mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-17 09:10:27 +03:00
Change inCombat to bool instead of number
When a variable is only going to be 0 or 1 it makes more sense to use a
bool.
Also avoided unnecessary network broadcasts of inCombat from e446603
This commit is contained in:
@@ -3,6 +3,8 @@ _amm=_this select 4;
|
||||
_this call (call compile GetText (configFile >> "CfgAmmo" >> _amm >> "muzzleEffect"));
|
||||
//Handle combat in vehicle
|
||||
if (player in (crew (_this select 0))) then {
|
||||
player setVariable ["inCombat", 1, true];
|
||||
if (player getVariable ["inCombat",false]) then {
|
||||
player setVariable ["inCombat",true,true];
|
||||
};
|
||||
player setVariable["combattimeout", diag_tickTime + 30, false];
|
||||
};
|
||||
@@ -344,7 +344,7 @@ while {1 == 1} do {
|
||||
_startcombattimer = player getVariable["startcombattimer", 0];
|
||||
if (_startcombattimer == 1) then { //Do not use _PlayerNearby it makes building impossible, this is handled in player_onPause.sqf just fine
|
||||
player setVariable["combattimeout", diag_tickTime + 30, false];
|
||||
player setVariable["inCombat", 1, true];
|
||||
if (player getVariable["inCombat",false]) then {player setVariable["inCombat",true,true];};
|
||||
player setVariable["startcombattimer", 0, false];
|
||||
}; /* else {
|
||||
if (_ZedsNearby && !_isPZombie) then { //this makes building a nightmare, this is handled in player_onPause.sqf just fine
|
||||
|
||||
@@ -7,8 +7,8 @@ sched_playerActions = {
|
||||
call fnc_usec_upgradeActions;
|
||||
|
||||
//combat check
|
||||
if ((player getVariable ["combattimeout",0] < diag_tickTime) && {player getVariable ["inCombat", 0] > 0}) then {
|
||||
player setVariable ["inCombat", 0, true];
|
||||
if ((player getVariable ["combattimeout",0] < diag_tickTime) && {player getVariable ["inCombat",false]}) then {
|
||||
player setVariable ["inCombat", false, true];
|
||||
};
|
||||
|
||||
objNull
|
||||
|
||||
Reference in New Issue
Block a user