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.
This commit is contained in:
ebayShopper
2017-10-29 15:39:05 -04:00
parent a229057fc6
commit f74e065de1
2 changed files with 13 additions and 21 deletions

View File

@@ -82,12 +82,12 @@ if (count _medical > 0) then {
}; };
//General Stats //General Stats
player setVariable ["humanity",_humanity,true]; //player setVariable ["humanity",_humanity,true]; //Moved to player_switchModel
player setVariable ["zombieKills",_zombieKills,true]; player setVariable ["zombieKills",_zombieKills,true];
player setVariable ["headShots",_headShots,true]; player setVariable ["headShots",_headShots,true];
player setVariable ["humanKills",_humanKills,true]; player setVariable ["humanKills",_humanKills,true];
player setVariable ["banditKills",_banditKills,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 ["worldspace",_worldspace];
//player setVariable ["Achievements",_achievements]; //player setVariable ["Achievements",_achievements];
player setVariable ["combattimeout",_combattimeout,false]; 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. 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. 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;}]; eh_player_killed = player addeventhandler ["FiredNear",{_this call player_weaponFiredNear;}];
[player] call fnc_usec_damageHandle; [player] call fnc_usec_damageHandle;
player allowDamage true; player allowDamage true;

View File

@@ -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"]; 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"; _isArray = typeName _this == "ARRAY";
if (_isArray) then { _class = if (_isArray) then {_this select 0} else {_this};
_class = _this select 0;
} else {
_class = _this;
};
if (gear_done) then {disableUserInput true;disableUserInput true;}; if (gear_done) then {disableUserInput true;disableUserInput true;};
disableSerialization; disableSerialization;
//Old location system causes issues with players getting damaged during movement. //Old location system causes issues with players getting damaged during movement.
//_position = getPosATL player; //_position = getPosATL player;
//New system testing needed. //New system testing needed.
@@ -53,13 +50,6 @@ _currentWpn = currentWeapon player;
_muzzles = getArray(configFile >> "cfgWeapons" >> _currentWpn >> "muzzles"); _muzzles = getArray(configFile >> "cfgWeapons" >> _currentWpn >> "muzzles");
if (count _muzzles > 1) then {_currentWpn = currentMuzzle player;}; 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 //Secure Player for Transformation
//player setPosATL dayz_spawnPos; //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;}; if (gear_done) then {disableUserInput false;disableUserInput false;disableUserInput false;disableUserInput false;};
//Debug Message //Debug Message
//diag_log "Swichtable Unit Created. Equipment:"; /*
//diag_log format["Weapons: %1",weapons _newUnit]; diag_log "Swichtable Unit Created. Equipment:";
//diag_log format["Magazines: %1",magazines _newUnit]; diag_log format["Weapons: %1",weapons _newUnit];
//diag_log format["Backpack weapons: %1",getWeaponCargo unitBackpack _newUnit]; diag_log format["Magazines: %1",magazines _newUnit];
//diag_log format["Backpack magazines: %1",getMagazineCargo unitBackpack _newUnit]; diag_log format["Backpack weapons: %1",getWeaponCargo unitBackpack _newUnit];
diag_log format["Backpack magazines: %1",getMagazineCargo unitBackpack _newUnit];
*/
player switchCamera _currentCamera; player switchCamera _currentCamera;
if (_currentWpn != "") then {_newUnit selectWeapon _currentWpn;}; if (_currentWpn != "") then {_newUnit selectWeapon _currentWpn;};
[objNull, player, rSwitchMove, _currentAnim] call RE; [objNull, player, rSwitchMove, _currentAnim] call RE;