From f74e065de1670d53eee1c69817c61ffef18aec31 Mon Sep 17 00:00:00 2001 From: ebayShopper Date: Sun, 29 Oct 2017 15:39:05 -0400 Subject: [PATCH] Remove redundant setVariable in humanityMorph Setvariables made redundant by 9cc3c82 Also changed removeEventHandler to remove all, so if switchModel exits at one of the exitWiths the player will not be left invincible. --- .../compile/player_humanityMorph.sqf | 7 ++--- SQF/dayz_code/compile/player_switchModel.sqf | 27 +++++++------------ 2 files changed, 13 insertions(+), 21 deletions(-) diff --git a/SQF/dayz_code/compile/player_humanityMorph.sqf b/SQF/dayz_code/compile/player_humanityMorph.sqf index cf31efe35..789f5ed52 100644 --- a/SQF/dayz_code/compile/player_humanityMorph.sqf +++ b/SQF/dayz_code/compile/player_humanityMorph.sqf @@ -82,12 +82,12 @@ if (count _medical > 0) then { }; //General Stats -player setVariable ["humanity",_humanity,true]; +//player setVariable ["humanity",_humanity,true]; //Moved to player_switchModel player setVariable ["zombieKills",_zombieKills,true]; player setVariable ["headShots",_headShots,true]; player setVariable ["humanKills",_humanKills,true]; player setVariable ["banditKills",_banditKills,true]; -player setVariable ["characterID",_charID,true]; +//player setVariable ["characterID",_charID,true]; //Moved to player_switchModel player setVariable ["worldspace",_worldspace]; //player setVariable ["Achievements",_achievements]; player setVariable ["combattimeout",_combattimeout,false]; @@ -109,7 +109,8 @@ if (Z_SingleCurrency) then { call dayz_resetSelfActions; //New unit has no self actions yet. Reset variables so actions can be added back. dayz_actionInProgress = false; //Allow self actions to run now. -player removeEventHandler ["HandleDamage",mydamage_eh1]; + +player removeAllEventHandlers "HandleDamage"; eh_player_killed = player addeventhandler ["FiredNear",{_this call player_weaponFiredNear;}]; [player] call fnc_usec_damageHandle; player allowDamage true; diff --git a/SQF/dayz_code/compile/player_switchModel.sqf b/SQF/dayz_code/compile/player_switchModel.sqf index cb07663f2..aca2dc7d6 100644 --- a/SQF/dayz_code/compile/player_switchModel.sqf +++ b/SQF/dayz_code/compile/player_switchModel.sqf @@ -1,13 +1,10 @@ private ["_weapons","_isArray","_backpackWpn","_backpackMag","_currentWpn","_isWeapon","_isMagazine","_backpackWpnTypes","_backpackWpnQtys","_countr","_class","_position","_dir","_currentAnim","_playerUID","_countMags","_magazines","_primweapon","_secweapon","_newBackpackType","_muzzles","_oldUnit","_group","_newUnit","_oldGroup","_idc","_display","_switchUnit","_leader","_currentCamera"]; _isArray = typeName _this == "ARRAY"; -if (_isArray) then { - _class = _this select 0; -} else { - _class = _this; -}; +_class = if (_isArray) then {_this select 0} else {_this}; if (gear_done) then {disableUserInput true;disableUserInput true;}; disableSerialization; + //Old location system causes issues with players getting damaged during movement. //_position = getPosATL player; //New system testing needed. @@ -53,13 +50,6 @@ _currentWpn = currentWeapon player; _muzzles = getArray(configFile >> "cfgWeapons" >> _currentWpn >> "muzzles"); if (count _muzzles > 1) then {_currentWpn = currentMuzzle player;}; -//Debug Message -// diag_log "Attempting to switch model"; -// diag_log str(_weapons); -// diag_log str(_magazines); -// diag_log (str(_backpackWpn)); -// diag_log (str(_backpackMag)); - //Secure Player for Transformation //player setPosATL dayz_spawnPos; @@ -193,12 +183,13 @@ if (!isNil "_newBackpackType" && {_newBackpackType != ""}) then { if (gear_done) then {disableUserInput false;disableUserInput false;disableUserInput false;disableUserInput false;}; //Debug Message -//diag_log "Swichtable Unit Created. Equipment:"; -//diag_log format["Weapons: %1",weapons _newUnit]; -//diag_log format["Magazines: %1",magazines _newUnit]; -//diag_log format["Backpack weapons: %1",getWeaponCargo unitBackpack _newUnit]; -//diag_log format["Backpack magazines: %1",getMagazineCargo unitBackpack _newUnit]; - +/* +diag_log "Swichtable Unit Created. Equipment:"; +diag_log format["Weapons: %1",weapons _newUnit]; +diag_log format["Magazines: %1",magazines _newUnit]; +diag_log format["Backpack weapons: %1",getWeaponCargo unitBackpack _newUnit]; +diag_log format["Backpack magazines: %1",getMagazineCargo unitBackpack _newUnit]; +*/ player switchCamera _currentCamera; if (_currentWpn != "") then {_newUnit selectWeapon _currentWpn;}; [objNull, player, rSwitchMove, _currentAnim] call RE;