mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-14 20:13:13 +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:
@@ -15,7 +15,7 @@
|
|||||||
- dayz_allowedObjects --> DayZ_SafeObjects
|
- dayz_allowedObjects --> DayZ_SafeObjects
|
||||||
- dayz_CLBase --> dz_loot_groups (similar not identical)
|
- dayz_CLBase --> dz_loot_groups (similar not identical)
|
||||||
- dayz_CLChances --> dz_loot_weighted (similar not identical)
|
- dayz_CLChances --> dz_loot_weighted (similar not identical)
|
||||||
- dayz_combat --> no longer exists use (player getVariable["combattimeout",0] >= diag_tickTime)
|
- dayz_combat --> no longer exists use (player getVariable["inCombat",false])
|
||||||
- dayz_fullMoonNights --> dayz_ForcefullmoonNights
|
- dayz_fullMoonNights --> dayz_ForcefullmoonNights
|
||||||
- dayz_MapArea --> no longer exists (was only used for DynamicVehicleArea and HeliCrashArea)
|
- dayz_MapArea --> no longer exists (was only used for DynamicVehicleArea and HeliCrashArea)
|
||||||
- dayz_sellDistance_vehicle, dayz_sellDistance_boat, dayz_sellDistance_air --> Z_VehicleDistance
|
- dayz_sellDistance_vehicle, dayz_sellDistance_boat, dayz_sellDistance_air --> Z_VehicleDistance
|
||||||
|
|||||||
@@ -68,7 +68,9 @@ dayz_lastDamageSourceNull = false;
|
|||||||
if (_unit == player) then {
|
if (_unit == player) then {
|
||||||
//Set player in combat
|
//Set player in combat
|
||||||
_unit setVariable["startcombattimer", 1];
|
_unit setVariable["startcombattimer", 1];
|
||||||
_unit setVariable["inCombat", 1, true];
|
if (_unit getVariable["inCombat",false]) then {
|
||||||
|
_unit setVariable["inCombat",true,true];
|
||||||
|
};
|
||||||
|
|
||||||
if (_hit == "") exitWith //Ignore none part dmg. Exit after processing humanity hit
|
if (_hit == "") exitWith //Ignore none part dmg. Exit after processing humanity hit
|
||||||
{
|
{
|
||||||
@@ -152,14 +154,13 @@ if (_unit == player) then {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//Overkill logging. PVS network send every two seconds = lag. Not worth it just for extra anticheat logs.
|
||||||
//Log to server :-( OverProcessing really not needed.
|
//Log to server :-( OverProcessing really not needed.
|
||||||
if (((!(isNil {_source})) AND {(!(isNull _source))}) AND {((_source isKindOf "CAManBase") AND {(!local _source )})}) then {
|
/*if (((!(isNil {_source})) AND {(!(isNull _source))}) AND {((_source isKindOf "CAManBase") AND {(!local _source )})}) then {
|
||||||
_wpst = weaponState _source;
|
_wpst = weaponState _source;
|
||||||
if (diag_ticktime-(_source getVariable ["lastloghit",0])>2) then {
|
if (diag_ticktime-(_source getVariable ["lastloghit",0])>2) then {
|
||||||
//private ["_sourceWeap"];
|
private ["_sourceWeap"];
|
||||||
_source setVariable ["lastloghit",diag_ticktime];
|
_source setVariable ["lastloghit",diag_ticktime];
|
||||||
/* // Excessively intensive logging (Network send on every hit)
|
|
||||||
_sourceDist = round(_unit distance _source);
|
_sourceDist = round(_unit distance _source);
|
||||||
_sourceWeap = switch (true) do {
|
_sourceWeap = switch (true) do {
|
||||||
case ((vehicle _source) != _source) : { format ["in %1",getText(configFile >> "CfgVehicles" >> _sourceVehicleType >> "displayName")] };
|
case ((vehicle _source) != _source) : { format ["in %1",getText(configFile >> "CfgVehicles" >> _sourceVehicleType >> "displayName")] };
|
||||||
@@ -175,9 +176,8 @@ if (_unit == player) then {
|
|||||||
PVDZ_sec_atp = [_unit, _source, toArray _sourceWeap, _sourceDist]; //Send arbitrary string as array to allow stricter publicVariableVal.txt filter
|
PVDZ_sec_atp = [_unit, _source, toArray _sourceWeap, _sourceDist]; //Send arbitrary string as array to allow stricter publicVariableVal.txt filter
|
||||||
publicVariableServer "PVDZ_sec_atp";
|
publicVariableServer "PVDZ_sec_atp";
|
||||||
};
|
};
|
||||||
*/
|
|
||||||
};
|
};
|
||||||
};
|
};*/
|
||||||
|
|
||||||
dayz_lastDamageSource = switch (true) do {
|
dayz_lastDamageSource = switch (true) do {
|
||||||
case (_falling): {"fall"};
|
case (_falling): {"fall"};
|
||||||
@@ -185,8 +185,9 @@ if (_unit == player) then {
|
|||||||
case (_ammo == "RunOver"): {"runover"};
|
case (_ammo == "RunOver"): {"runover"};
|
||||||
case (_ammo == "Dragged"): {"eject"};
|
case (_ammo == "Dragged"): {"eject"};
|
||||||
case (_ammo in MeleeAmmo): {"melee"};
|
case (_ammo in MeleeAmmo): {"melee"};
|
||||||
case (!isNil "_wpst" && {!(_wpst select 0 in ["","Throw"])}): {"shot"};
|
case (_source isKindOf "CAManBase" && !local _source && !(currentWeapon _source in ["","Throw"])): {"shot"};
|
||||||
case (_sourceVehicleType isKindOf "LandVehicle" or {_sourceVehicleType isKindOf "Air"} or {_sourceVehicleType isKindOf "Ship"}): {"shot"};
|
//(vehicle _source != _source) does not work to detect if source unit is in a vehicle in HandleDamage EH
|
||||||
|
case (_sourceVehicleType isKindOf "LandVehicle" or _sourceVehicleType isKindOf "Air" or _sourceVehicleType isKindOf "Ship"): {"shot"};
|
||||||
default {"none"};
|
default {"none"};
|
||||||
};
|
};
|
||||||
if (dayz_lastDamageSource != "none") then {dayz_lastDamageTime = diag_tickTime;};
|
if (dayz_lastDamageSource != "none") then {dayz_lastDamageTime = diag_tickTime;};
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ player setVariable ["USEC_isCardiac",false,true];
|
|||||||
player setVariable ["medForceUpdate",true,true];
|
player setVariable ["medForceUpdate",true,true];
|
||||||
player setVariable ["bloodTaken", false, true];
|
player setVariable ["bloodTaken", false, true];
|
||||||
player setVariable ["startcombattimer", 0]; //remove combat timer on death
|
player setVariable ["startcombattimer", 0]; //remove combat timer on death
|
||||||
player setVariable ["inCombat", 0, true];
|
player setVariable ["inCombat", false, true];
|
||||||
r_player_unconscious = false;
|
r_player_unconscious = false;
|
||||||
r_player_cardiac = false;
|
r_player_cardiac = false;
|
||||||
_model = typeOf player;
|
_model = typeOf player;
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ _humanKills = player getVariable ["humanKills",0];
|
|||||||
_banditKills = player getVariable ["banditKills",0];
|
_banditKills = player getVariable ["banditKills",0];
|
||||||
_achievements = player getVariable ["Achievements",[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];
|
_achievements = player getVariable ["Achievements",[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];
|
||||||
_combattimeout = player getVariable["combattimeout",0];
|
_combattimeout = player getVariable["combattimeout",0];
|
||||||
_inCombat = player getVariable["inCombat",0];
|
_inCombat = player getVariable ["inCombat",false];
|
||||||
_ConfirmedHumanKills = player getVariable ["ConfirmedHumanKills",0];
|
_ConfirmedHumanKills = player getVariable ["ConfirmedHumanKills",0];
|
||||||
_ConfirmedBanditKills = player getVariable ["ConfirmedBanditKills",0];
|
_ConfirmedBanditKills = player getVariable ["ConfirmedBanditKills",0];
|
||||||
_friendlies = player getVariable ["friendlies",[]];
|
_friendlies = player getVariable ["friendlies",[]];
|
||||||
@@ -83,7 +83,7 @@ player setVariable ["characterID",_charID,true];
|
|||||||
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];
|
||||||
player setVariable ["inCombat", _inCombat, true];
|
player setVariable ["inCombat",_inCombat,true];
|
||||||
|
|
||||||
player setVariable ["ConfirmedHumanKills",_ConfirmedHumanKills,true];
|
player setVariable ["ConfirmedHumanKills",_ConfirmedHumanKills,true];
|
||||||
player setVariable ["ConfirmedBanditKills",_ConfirmedBanditKills,true];
|
player setVariable ["ConfirmedBanditKills",_ConfirmedBanditKills,true];
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ while {(alive _projectile) && !(isNull _projectile) && (_callCount < 85)} do {
|
|||||||
_isInCombat = _nearVehicle getVariable["startcombattimer",0];
|
_isInCombat = _nearVehicle getVariable["startcombattimer",0];
|
||||||
if ((alive _nearVehicle) and _isInCombat == 0) then {
|
if ((alive _nearVehicle) and _isInCombat == 0) then {
|
||||||
_nearVehicle setVariable["startcombattimer", 1];
|
_nearVehicle setVariable["startcombattimer", 1];
|
||||||
_nearVehicle setVariable["inCombat", 1, true];
|
_nearVehicle setVariable["inCombat", true, true];
|
||||||
diag_log("Now in Combat (Player): " + name _unit);
|
diag_log("Now in Combat (Player): " + name _unit);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@@ -44,7 +44,7 @@ while {(alive _projectile) && !(isNull _projectile) && (_callCount < 85)} do {
|
|||||||
_isInCombat = _x getVariable["startcombattimer",0];
|
_isInCombat = _x getVariable["startcombattimer",0];
|
||||||
if (isPlayer _x and _isInCombat == 0 and alive _x) then {
|
if (isPlayer _x and _isInCombat == 0 and alive _x) then {
|
||||||
_x setVariable["startcombattimer", 1];
|
_x setVariable["startcombattimer", 1];
|
||||||
_x setVariable["inCombat", 1, true];
|
_x setVariable["inCombat", true, true];
|
||||||
diag_log("Now in Combat (Crew): " + name _x);
|
diag_log("Now in Combat (Crew): " + name _x);
|
||||||
};
|
};
|
||||||
} forEach (crew _nearVehicle);
|
} forEach (crew _nearVehicle);
|
||||||
|
|||||||
@@ -22,10 +22,14 @@ private ["_handled"];
|
|||||||
// Both the firer and those nearby (<=8m) go into "combat" to prevent ALT-F4
|
// Both the firer and those nearby (<=8m) go into "combat" to prevent ALT-F4
|
||||||
//diag_log ("DEBUG: AMMO TYPE: " +str(_ammo));
|
//diag_log ("DEBUG: AMMO TYPE: " +str(_ammo));
|
||||||
_firer setVariable["startcombattimer", 1];
|
_firer setVariable["startcombattimer", 1];
|
||||||
_firer setVariable["inCombat", 1, true];
|
if (_firer getVariable["inCombat",false]) then {
|
||||||
|
_firer setVariable["inCombat",true,true];
|
||||||
|
};
|
||||||
if (_distance <= 8) then {
|
if (_distance <= 8) then {
|
||||||
_unit setVariable["startcombattimer", 1];
|
_unit setVariable["startcombattimer", 1];
|
||||||
_unit setVariable["inCombat", 1, true];
|
if (_unit getVariable["inCombat",false]) then {
|
||||||
|
_unit setVariable["inCombat",true,true];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
if (_inVehicle) exitWith {};
|
if (_inVehicle) exitWith {};
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ _amm=_this select 4;
|
|||||||
_this call (call compile GetText (configFile >> "CfgAmmo" >> _amm >> "muzzleEffect"));
|
_this call (call compile GetText (configFile >> "CfgAmmo" >> _amm >> "muzzleEffect"));
|
||||||
//Handle combat in vehicle
|
//Handle combat in vehicle
|
||||||
if (player in (crew (_this select 0))) then {
|
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];
|
player setVariable["combattimeout", diag_tickTime + 30, false];
|
||||||
};
|
};
|
||||||
@@ -344,7 +344,7 @@ while {1 == 1} do {
|
|||||||
_startcombattimer = player getVariable["startcombattimer", 0];
|
_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
|
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["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];
|
player setVariable["startcombattimer", 0, false];
|
||||||
}; /* else {
|
}; /* else {
|
||||||
if (_ZedsNearby && !_isPZombie) then { //this makes building a nightmare, this is handled in player_onPause.sqf just fine
|
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;
|
call fnc_usec_upgradeActions;
|
||||||
|
|
||||||
//combat check
|
//combat check
|
||||||
if ((player getVariable ["combattimeout",0] < diag_tickTime) && {player getVariable ["inCombat", 0] > 0}) then {
|
if ((player getVariable ["combattimeout",0] < diag_tickTime) && {player getVariable ["inCombat",false]}) then {
|
||||||
player setVariable ["inCombat", 0, true];
|
player setVariable ["inCombat", false, true];
|
||||||
};
|
};
|
||||||
|
|
||||||
objNull
|
objNull
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ if (isNil "_playerObj") exitWith {
|
|||||||
//If the the playerObj exists lets run all sync systems
|
//If the the playerObj exists lets run all sync systems
|
||||||
|
|
||||||
_characterID = _playerObj getVariable["characterID", "?"];
|
_characterID = _playerObj getVariable["characterID", "?"];
|
||||||
_inCombat = _playerObj getVariable ["inCombat",0];
|
_inCombat = _playerObj getVariable ["inCombat",false];
|
||||||
_Sepsis = _playerObj getVariable["USEC_Sepsis",false];
|
_Sepsis = _playerObj getVariable["USEC_Sepsis",false];
|
||||||
|
|
||||||
//Login processing do not sync
|
//Login processing do not sync
|
||||||
@@ -58,7 +58,7 @@ if (_characterID != "?") exitwith {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
//Punish combat log
|
//Punish combat log
|
||||||
if (_inCombat > 0 && _playerPos distance (getMarkerPos "respawn_west") > 1500) then {
|
if (_inCombat && _playerPos distance (getMarkerPos "respawn_west") > 1500) then {
|
||||||
// Moved setVariables to server_playerSync since they are high priority
|
// Moved setVariables to server_playerSync since they are high priority
|
||||||
// Messages are low priority. Player object not needed
|
// Messages are low priority. Player object not needed
|
||||||
diag_log format["PLAYER COMBAT LOGGED: %1(%3) at location %2",_playerName,_playerPos,_playerUID];
|
diag_log format["PLAYER COMBAT LOGGED: %1(%3) at location %2",_playerName,_playerPos,_playerUID];
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ if (_currentModel == _modelChk) then {
|
|||||||
_character setVariable ["model_CHK",typeOf _character];
|
_character setVariable ["model_CHK",typeOf _character];
|
||||||
};
|
};
|
||||||
if (count _this > 4) then { //calling from player_onDisconnect
|
if (count _this > 4) then { //calling from player_onDisconnect
|
||||||
if (_this select 4 > 0) then { //combat logged
|
if (_this select 4) then { //combat logged
|
||||||
_medical set [1, true]; //set unconcious to true
|
_medical set [1, true]; //set unconcious to true
|
||||||
_medical set [10, 150]; //combat timeout
|
_medical set [10, 150]; //combat timeout
|
||||||
//_character setVariable ["NORRN_unconscious",true,true]; // Set status to unconscious
|
//_character setVariable ["NORRN_unconscious",true,true]; // Set status to unconscious
|
||||||
|
|||||||
Reference in New Issue
Block a user