diff --git a/SQF/dayz_code/compile/fn_damageActions.sqf b/SQF/dayz_code/compile/fn_damageActions.sqf
index 15613da16..4df140990 100644
--- a/SQF/dayz_code/compile/fn_damageActions.sqf
+++ b/SQF/dayz_code/compile/fn_damageActions.sqf
@@ -8,18 +8,16 @@ scriptName "Functions\misc\fn_damageActions.sqf";
- [] call fnc_usec_damageActions;
************************************************************/
-private ["_hasABWipes","_dragged","_menClose","_hasPatient","_vehicle","_inVehicle","_isClose","_assignedRole","_driver","_action","_turret","_weapons","_weaponName","_crew","_unconscious_crew","_patients","_vehType","_unit","_antibiotics","_bloodBags","_unconscious","_lowBlood","_injured","_hasSepsis","_inPain","_legsBroke","_armsBroke","_infected","_hasBandage","_hasSepsisBandage","_hasEpi","_hasMorphine","_hasSplint","_hasPainkillers","_hasAntibiotics","_hasBloodBag","_vehClose","_action1","_action2","_action3","_playerMagazines","_isFriendly","_action4","_painkillers"];
-
-_menClose = cursorTarget;
-_hasPatient = alive _menClose;
-_vehicle = vehicle player;
-_inVehicle = (_vehicle != player);
-_isClose = ((player distance _menClose) < ((sizeOf typeOf _menClose) / 2));
+local _menClose = cursorTarget;
+local _hasPatient = alive _menClose;
+local _vehicle = vehicle player;
+local _inVehicle = (_vehicle != player);
+local _isClose = ((player distance _menClose) < ((sizeOf typeOf _menClose) / 2));
if (_inVehicle) then {
r_player_lastVehicle = _vehicle;
- _assignedRole = assignedVehicleRole player;
- _driver = driver (vehicle player);
+ local _assignedRole = assignedVehicleRole player;
+ local _driver = driver (vehicle player);
if (str (_assignedRole) != str (r_player_lastSeat)) then {
call r_player_removeActions2;
if (_vehicle isKindOf "ArmoredSUV_Base_PMC" && {_vehicle animationPhase "HideGun_01" != 0} && {_vehicle emptyPositions "Gunner" == 0}) then {
@@ -30,6 +28,7 @@ if (_inVehicle) then {
if (!r_player_unconscious && !r_action2) then {
r_player_lastSeat = _assignedRole;
+ local _action = [];
if (_vehicle isKindOf "helicopter" || {_inVehicle && {{(isPlayer _x) && (alive _x)} count (crew _vehicle) > 1}}) then {
//allow switch to pilot
@@ -62,14 +61,14 @@ if (_inVehicle) then {
};
};
if ((count _assignedRole) > 1 || {(_assignedRole select 0) == "driver"}) then {
- _turret = [-1];
+ local _turret = [-1];
if ((count _assignedRole) > 1) then {
_turret = _assignedRole select 1;
};
- _weapons = _vehicle weaponsTurret _turret;
+ local _weapons = _vehicle weaponsTurret _turret;
_weapons = _weapons - ["CarHorn","MiniCarHorn","SportCarHorn","BikeHorn","TruckHorn","TruckHorn2"];
{
- _weaponName = getText (configFile >> "cfgWeapons" >> _x >> "displayName");
+ local _weaponName = getText (configFile >> "cfgWeapons" >> _x >> "displayName");
_action = _vehicle addAction [format[localize "str_actions_addammo",_weaponName], "\z\addons\dayz_code\actions\ammo.sqf",[_vehicle,_x,_turret], 0, false, true];
r_player_actions2 set [count r_player_actions2,_action];
r_action2 = true;
@@ -77,19 +76,19 @@ if (_inVehicle) then {
};
};
//Check if patients
- _crew = crew _vehicle;
- if (count _crew > 0 && {!r_player_unconscious}) then {
- _unconscious_crew = [];
+ local _crew = crew _vehicle;
+ if (count _crew > 0 && !r_player_unconscious) then {
+ local _unconscious_crew = [];
{
if (_x getVariable "NORRN_unconscious") then {
_unconscious_crew set [(count _unconscious_crew), _x]
};
} forEach _crew;
- _patients = count _unconscious_crew;
+ local _patients = count _unconscious_crew;
if (_patients > 0) then {
if (!r_action_unload) then {
r_action_unload = true;
- _vehType = typeOf _vehicle;
+ local _vehType = typeOf _vehicle;
_action = _vehicle addAction [format[localize "str_actions_medical_14",_vehType], "\z\addons\dayz_code\medical\load\unLoad_act.sqf",[player,_unconscious_crew,_vehicle], 0, false, true];
r_player_actions2 set [count r_player_actions2,_action];
};
@@ -115,52 +114,53 @@ if (r_player_unconscious) then {
//Lets make sure the player is looking at the target
if (isPlayer cursorTarget) then {
- if (!r_drag_sqf && {!r_action} && {!_inVehicle} && {!r_player_unconscious} && {player distance _menClose < 3}) then {
- _unit = cursorTarget;
+ if (!r_player_unconscious && !_inVehicle && {!r_drag_sqf && !r_action && player distance _menClose < 3}) then {
+ local _unit = cursorTarget;
player reveal _unit;
//Arrays
- _antibiotics = ["ItemAntibiotic","ItemAntibiotic1","ItemAntibiotic2","ItemAntibiotic3","ItemAntibiotic4","ItemAntibiotic5","ItemAntibiotic6"];
- _painkillers = ["ItemPainkiller","ItemPainkiller1","ItemPainkiller2","ItemPainkiller3","ItemPainkiller4","ItemPainkiller5","ItemPainkiller6"];
- _bloodBags = ["bloodBagANEG","bloodBagAPOS","bloodBagBNEG","bloodBagBPOS","bloodBagABNEG","bloodBagABPOS","bloodBagONEG","bloodBagOPOS","wholeBloodBagANEG","wholeBloodBagAPOS","wholeBloodBagBNEG","wholeBloodBagBPOS","wholeBloodBagABNEG","wholeBloodBagABPOS","wholeBloodBagONEG","wholeBloodBagOPOS"];
+ local _antibiotics = ["ItemAntibiotic","ItemAntibiotic1","ItemAntibiotic2","ItemAntibiotic3","ItemAntibiotic4","ItemAntibiotic5","ItemAntibiotic6"];
+ local _painkillers = ["ItemPainkiller","ItemPainkiller1","ItemPainkiller2","ItemPainkiller3","ItemPainkiller4","ItemPainkiller5","ItemPainkiller6"];
+ local _bloodBags = ["bloodBagANEG","bloodBagAPOS","bloodBagBNEG","bloodBagBPOS","bloodBagABNEG","bloodBagABPOS","bloodBagONEG","bloodBagOPOS","wholeBloodBagANEG","wholeBloodBagAPOS","wholeBloodBagBNEG","wholeBloodBagBPOS","wholeBloodBagABNEG","wholeBloodBagABPOS","wholeBloodBagONEG","wholeBloodBagOPOS"];
//Var checks
- _unconscious = _unit getVariable ["NORRN_unconscious", false];
- _dragged = _unit getVariable ["NORRN_unit_dragged", false];
- _lowBlood = _unit getVariable ["USEC_lowBlood", false];
- _injured = _unit getVariable ["USEC_injured", false];
- _hasSepsis = _unit getVariable ["USEC_Sepsis", false];
- _inPain = _unit getVariable ["USEC_inPain", false];
- _legsBroke = _unit getVariable ["hit_legs", 0] >= 1;
- _armsBroke = _unit getVariable ["hit_hands", 0] >= 1;
- _infected = _unit getVariable ["USEC_infected", false];
+ local _unconscious = _unit getVariable ["NORRN_unconscious", false];
+ local _dragged = _unit getVariable ["NORRN_unit_dragged", false];
+ local _lowBlood = _unit getVariable ["USEC_lowBlood", false];
+ local _injured = _unit getVariable ["USEC_injured", false];
+ local _hasSepsis = _unit getVariable ["USEC_Sepsis", false];
+ local _inPain = _unit getVariable ["USEC_inPain", false];
+ local _legsBroke = _unit getVariable ["hit_legs", 0] >= 1;
+ local _armsBroke = _unit getVariable ["hit_hands", 0] >= 1;
+ local _infected = _unit getVariable ["USEC_infected", false];
//Magazine checks
- _playerMagazines = magazines player;
- _hasBandage = "ItemBandage" in _playerMagazines;
- _hasSepsisBandage = "ItemSepsisBandage" in _playerMagazines;
- _hasEpi = "ItemEpinephrine" in _playerMagazines;
- _hasMorphine = "ItemMorphine" in _playerMagazines;
- _hasSplint = "equip_woodensplint" in _playerMagazines;
- _hasPainkillers = Array_Any(_playerMagazines, {_this in _painkillers});
- _hasAntibiotics = Array_Any(_playerMagazines, {_this in _antibiotics});
- _hasABWipes = "ItemAntibacterialWipe" in _playerMagazines;
- if (dayz_classicBloodBagSystem) then {
- _hasBloodBag = "ItemBloodbag" in _playerMagazines;
- } else {
+ local _playerMagazines = magazines player;
+ local _hasBandage = "ItemBandage" in _playerMagazines;
+ local _hasSepsisBandage = "ItemSepsisBandage" in _playerMagazines;
+ local _hasEpi = "ItemEpinephrine" in _playerMagazines;
+ local _hasMorphine = "ItemMorphine" in _playerMagazines;
+ local _hasSplint = "equip_woodensplint" in _playerMagazines;
+ local _hasPainkillers = Array_Any(_playerMagazines, {_this in _painkillers});
+ local _hasAntibiotics = Array_Any(_playerMagazines, {_this in _antibiotics});
+ local _hasABWipes = "ItemAntibacterialWipe" in _playerMagazines;
+ local _hasBloodBag = "ItemBloodbag" in _playerMagazines;
+
+ if !(dayz_classicBloodBagSystem) then {
_hasBloodBag = Array_Any(_playerMagazines, {_this in _bloodBags});
};
- _vehClose = (getPosATL player) nearEntities [["Car","Tank","Helicopter","Plane","StaticWeapon","Ship"],5];
+ local _vehClose = (getPosATL player) nearEntities [["Car","Tank","Helicopter","Plane","StaticWeapon","Ship"],5];
if (_hasPatient) then {
+ local _action = [];
//Allow player to drag
- if(_unconscious && {!_dragged}) then {
+ if(_unconscious && !_dragged) then {
r_action = true;
- _action1 = _unit addAction [localize "STR_UI_GEAR", "\z\addons\dayz_code\actions\openGear.sqf",_unit, 0, true, true];
- _action2 = _unit addAction [localize "str_actions_medical_01", "\z\addons\dayz_code\medical\drag.sqf",_unit, 0, true, true];
- _action3 = _unit addAction [localize "str_actions_medical_02", "\z\addons\dayz_code\medical\pulse.sqf",_unit, 0, true, true];
- _action4 = _unit addAction [localize "str_actions_medical_drag", "\z\addons\dayz_code\medical\carry.sqf",_unit, 0, true, true];
+ local _action1 = _unit addAction [localize "STR_UI_GEAR", "\z\addons\dayz_code\actions\openGear.sqf",_unit, 0, true, true];
+ local _action2 = _unit addAction [localize "str_actions_medical_01", "\z\addons\dayz_code\medical\drag.sqf",_unit, 0, true, true];
+ local _action3 = _unit addAction [localize "str_actions_medical_02", "\z\addons\dayz_code\medical\pulse.sqf",_unit, 0, true, true];
+ local _action4 = _unit addAction [localize "str_actions_medical_drag", "\z\addons\dayz_code\medical\carry.sqf",_unit, 0, true, true];
r_player_actions set [count r_player_actions, _action1];
r_player_actions set [count r_player_actions, _action2];
@@ -168,67 +168,66 @@ if (isPlayer cursorTarget) then {
r_player_actions set [count r_player_actions, _action4];
};
//Load Vehicle
- if (count _vehClose > 0 && {!locked (_vehClose select 0)} && {_unconscious}) then {
+ if (_unconscious && {(count _vehClose > 0) && !locked (_vehClose select 0)}) then {
r_action = true;
- _vehicle = _vehClose select 0;
- _vehType = getText (configFile >> "CfgVehicles" >> typeOf _vehicle >> "displayName");
+ local _vehicle = _vehClose select 0;
+ local _vehType = getText (configFile >> "CfgVehicles" >> typeOf _vehicle >> "displayName");
_action = _unit addAction [format[localize "str_actions_medical_03",_vehType], "\z\addons\dayz_code\medical\load\load_act.sqf",[player,_vehicle,_unit], 0, true, true];
r_player_actions set [count r_player_actions,_action];
};
//Allow player to bandage
- if(_injured && {_hasBandage}) then {
+ if(_injured && _hasBandage) then {
r_action = true;
_action = _unit addAction [localize "str_actions_medical_04", "\z\addons\dayz_code\medical\bandage.sqf",[_unit,"ItemBandage"], 0, true, true];
r_player_actions set [count r_player_actions,_action];
};
//Allow player to give sepsis bandage
- if((_injured || {_hasSepsis}) && {_hasSepsisBandage}) then {
+ if((_injured || _hasSepsis) && _hasSepsisBandage) then {
r_action = true;
_action = _unit addAction [localize "str_actions_medical_04_sepsis", "\z\addons\dayz_code\medical\bandage.sqf",[_unit,"ItemSepsisBandage"], 0, true, true];
r_player_actions set [count r_player_actions,_action];
};
//Allow player to give antibacterial wipe
- if(_hasSepsis && {_hasABWipes}) then {
+ if(_hasSepsis && _hasABWipes) then {
r_action = true;
_action = _unit addAction [localize "str_actions_medical_04_wipes", "\z\addons\dayz_code\medical\wipes.sqf",[_unit], 0, true, true];
r_player_actions set [count r_player_actions,_action];
};
//Allow player to give Epinephrine
- if(_unconscious && {_hasEpi}) then {
+ if(_unconscious && _hasEpi) then {
r_action = true;
_action = _unit addAction [localize "str_actions_medical_05", "\z\addons\dayz_code\medical\epinephrine.sqf",[_unit], 0, true, true];
r_player_actions set [count r_player_actions,_action];
};
//Allow player to give Morphine
- if((_legsBroke || {_armsBroke}) && {_hasMorphine}) then {
+ if((_legsBroke || _armsBroke) && _hasMorphine) then {
r_action = true;
_action = _unit addAction [localize "str_actions_medical_06", "\z\addons\dayz_code\medical\brokeBones.sqf",[_unit,"ItemMorphine"], 0, true, true];
r_player_actions set [count r_player_actions,_action];
};
//Allow player to give equip_woodensplint
- if((_legsBroke || {_armsBroke}) && {_hasSplint}) then {
+ if((_legsBroke || _armsBroke) && _hasSplint) then {
r_action = true;
_action = _unit addAction [localize "str_actions_medical_06_splint", "\z\addons\dayz_code\medical\brokeBones.sqf",[_unit,"equip_woodensplint"], 0, true, true];
r_player_actions set [count r_player_actions,_action];
};
//Allow player to give Painkillers
- if(_inPain && {_hasPainkillers}) then {
+ if(_inPain && _hasPainkillers) then {
r_action = true;
_action = _unit addAction [localize "str_actions_medical_07", "\z\addons\dayz_code\medical\painkiller.sqf",[_unit], 0, true, true];
r_player_actions set [count r_player_actions,_action];
};
//Allow player to transfuse blood
- if(_lowBlood && {_hasBloodBag}) then {
- private ["_tempArray","_displayName"];
+ if(_lowBlood && _hasBloodBag) then {
r_action = true;
if (dayz_classicBloodBagSystem) then {
_action = _unit addAction [localize "str_actions_medical_08", "\z\addons\dayz_code\medical\transfusion.sqf",[_unit,"ItemBloodbag"], 0, true, true];
r_player_actions set [count r_player_actions,_action];
} else {
- _tempArray = [];
+ local _tempArray = [];
{ // This was a TODO by the Vanilla Mod devs.
if (_x in _playerMagazines && {!(_x in _tempArray)}) then {
- _displayName = getText(configFile >> "cfgMagazines" >> _x >> "displayName");
+ local _displayName = getText(configFile >> "cfgMagazines" >> _x >> "displayName");
_action = _unit addAction [format[localize "str_actions_medical_08a",_displayName], "\z\addons\dayz_code\medical\transfusion.sqf",[_unit,_x], 0, true, true];
r_player_actions set [count r_player_actions,_action];
_tempArray set [count _tempArray, _x];
@@ -237,7 +236,7 @@ if (isPlayer cursorTarget) then {
};
};
//Allow player to give antibiotics
- if (_infected && {_hasAntibiotics}) then {
+ if (_infected && _hasAntibiotics) then {
r_action = true;
_action = _unit addAction [localize "str_actions_medical_give_antibiotics", "\z\addons\dayz_code\medical\antibiotics.sqf",[_unit], 0, true, true];
r_player_actions set [count r_player_actions, _action];
@@ -260,7 +259,7 @@ if (isPlayer cursorTarget) then {
};
//Remove Actions
-if ((!_isClose || {!_hasPatient}) && {r_action}) then {
+if ((!_isClose || !_hasPatient) && r_action) then {
call fnc_usec_medic_removeActions;
r_action = false;
};
diff --git a/SQF/dayz_code/compile/fn_selfActions.sqf b/SQF/dayz_code/compile/fn_selfActions.sqf
index 414a348aa..43de6709b 100644
--- a/SQF/dayz_code/compile/fn_selfActions.sqf
+++ b/SQF/dayz_code/compile/fn_selfActions.sqf
@@ -4,34 +4,27 @@ scriptName "Functions\misc\fn_selfActions.sqf";
- Function
- [] call fnc_usec_selfActions;
************************************************************/
-private ["_canPickLight","_text","_unlock","_lock","_totalKeys","_temp_keys","_temp_keys_names","_restrict",
-"_hasKey","_oldOwner","_hasAttached","_isZombie","_isHarvested","_isMan","_isFuel","_hasRawMeat","_player_deleteBuild",
-"_player_lockUnlock_crtl","_hasIgnitors","_menu","_menu1","_allowTow","_liftHeli","_found","_posL","_posC","_height","_attached",
-"_combi","_findNearestGen","_humanity_logic","_low_high","_cancel","_buy","_buyV","_humanity","_traderMenu","_warn","_typeOfCursorTarget",
-"_isVehicle","_isBicycle","_isDestructable","_isGenerator","_ownerID","_hasBarrel","_hasFuel20","_hasFuel5","_hasEmptyFuelCan",
-"_itemsPlayer","_hasToolbox","_hasbottleitem","_isAlive","_isPlant","_istypeTent","_isDisallowRefuel","_isDog",
-"_isModular","_isModularDoor","_speed","_dog","_vehicle","_inVehicle","_cursorTarget","_primaryWeapon","_currentWeapon","_magazinesPlayer","_onLadder","_canDo",
-"_nearLight","_vehicleOwnerID","_hasHotwireKit","_isPZombie","_dogHandle","_allowedDistance","_id","_upgrade","_weaponsPlayer","_hasCrowbar",
-"_allowed","_hasAccess","_uid","_myCharID","_isLocked","_isClose","_hasunboiledwater","_characterID","_text2"];
-_vehicle = vehicle player;
-_inVehicle = (_vehicle != player);
-_cursorTarget = cursorTarget;
-_primaryWeapon = primaryWeapon player;
-_currentWeapon = currentWeapon player;
-_magazinesPlayer = magazines player;
-_onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
-_canDo = (!r_drag_sqf && !r_player_unconscious && !_onLadder);
-_uid = getPlayerUID player;
-_nearLight = nearestObject [player,"LitObject"];
-_canPickLight = false;
-_myCharID = player getVariable ["CharacterID","0"];
-_vehicleOwnerID = _vehicle getVariable ["CharacterID","0"];
-_hasHotwireKit = "ItemHotwireKit" in _magazinesPlayer;
-_isZombie = _cursorTarget isKindOf "zZombie_base";
-_isPZombie = player isKindOf "PZombie_VB";
-_isClose = (player distance _cursorTarget < 3);
-_dogHandle = player getVariable ["dogID",0];
+local _vehicle = vehicle player;
+local _inVehicle = (_vehicle != player);
+local _cursorTarget = cursorTarget;
+local _primaryWeapon = primaryWeapon player;
+local _currentWeapon = currentWeapon player;
+local _magazinesPlayer = magazines player;
+local _onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
+local _canDo = (!r_drag_sqf && !r_player_unconscious && !_onLadder);
+local _uid = getPlayerUID player;
+local _nearLight = nearestObject [player,"LitObject"];
+local _canPickLight = false;
+local _myCharID = player getVariable ["CharacterID","0"];
+local _vehicleOwnerID = _vehicle getVariable ["CharacterID","0"];
+local _hasHotwireKit = "ItemHotwireKit" in _magazinesPlayer;
+local _isMan = _cursorTarget isKindOf "Man"; //includes animals and zombies
+local _isZombie = _cursorTarget isKindOf "zZombie_base";
+local _isPZombie = player isKindOf "PZombie_VB";
+local _isClose = (player distance _cursorTarget < 3);
+local _dogHandle = player getVariable ["dogID",0];
+local _text = "";
if (!isNull _nearLight) then {
if (_nearLight distance player < 4) then {
@@ -99,13 +92,14 @@ if (_canDo && !_inVehicle && !dayz_isSwimming && ((call fn_nearWaterHole) select
if (_inVehicle) then {
DZE_myVehicle = _vehicle;
- if ((_vehicleOwnerID != "0") && {_canDo}) then {
+ if ((_vehicleOwnerID != "0") && _canDo) then {
if (s_player_lockUnlockInside_ctrl < 0) then {
- _totalKeys = call epoch_tempKeys;
- _temp_keys = _totalKeys select 0;
- _temp_keys_names = _totalKeys select 1;
- _hasKey = _vehicleOwnerID in _temp_keys;
- _oldOwner = (_vehicleOwnerID == _uid);
+ local _totalKeys = call epoch_tempKeys;
+ local _temp_keys = _totalKeys select 0;
+ local _temp_keys_names = _totalKeys select 1;
+ local _hasKey = _vehicleOwnerID in _temp_keys;
+ local _oldOwner = (_vehicleOwnerID == _uid);
+ local _unlock = [];
_text = getText (configFile >> "CfgVehicles" >> (typeOf DZE_myVehicle) >> "displayName");
if (locked DZE_myVehicle) then {
@@ -140,7 +134,7 @@ if (_inVehicle) then {
};
if (DZE_HeliLift) then {
- _hasAttached = _vehicle getVariable["hasAttached",false];
+ local _hasAttached = _vehicle getVariable["hasAttached",false];
if (_inVehicle && {_vehicle isKindOf "Air"} && {(([_vehicle] call FNC_getPos) select 2) < 30} && {speed _vehicle < 5} && {typeName _hasAttached == "OBJECT"}) then {
if (s_player_heli_detach < 0) then {
dayz_myLiftVehicle = _vehicle;
@@ -187,8 +181,7 @@ if (_isPZombie) then {
s_player_pzombiesvision = player addAction [localize "STR_EPOCH_ACTIONS_NIGHTVIS", "\z\addons\dayz_code\actions\pzombie\pz_vision.sqf", [], 4, false, true, "nightVision", "_this == _target"];
};
if (!isNull _cursorTarget && _isClose) then {
- _isHarvested = _cursorTarget getVariable["meatHarvested",false];
- _isMan = _cursorTarget isKindOf "Man"; //includes animals and zombies
+ local _isHarvested = _cursorTarget getVariable["meatHarvested",false];
if (!alive _cursorTarget && _isMan && !_isZombie && !_isHarvested) then {
if (s_player_pzombiesfeed < 0) then {
s_player_pzombiesfeed = player addAction [localize "STR_EPOCH_ACTIONS_FEED", "\z\addons\dayz_code\actions\pzombie\pz_feed.sqf",_cursorTarget, 3, true, false];
@@ -204,30 +197,32 @@ if (_isPZombie) then {
};
// Increase distance only if AIR, SHIP or TANK
-_allowedDistance = [4, 8] select ((_cursorTarget isKindOf "Air") || {_cursorTarget isKindOf "Ship"} || {_cursorTarget isKindOf "Tank"});
+local _allowedDistance = [4, 8] select ((_cursorTarget isKindOf "Air") || {_cursorTarget isKindOf "Ship"} || {_cursorTarget isKindOf "Tank"});
if (!isNull _cursorTarget && {!_inVehicle && !_isPZombie && _canDo && player distance _cursorTarget < _allowedDistance}) then {
- _typeOfCursorTarget = typeOf _cursorTarget;
- _isVehicle = _cursorTarget isKindOf "AllVehicles";
- _isBicycle = _cursorTarget isKindOf "Bicycle";
- _isMan = _cursorTarget isKindOf "Man"; //includes animals and zombies
- _isDestructable = _cursorTarget isKindOf "BuiltItems";
- _isGenerator = _typeOfCursorTarget == "Generator_DZ";
- _isLocked = locked _cursorTarget;
- _isFuel = false;
- _hasBarrel = "ItemFuelBarrel" in _magazinesPlayer;
- _hasFuel20 = "ItemJerrycan" in _magazinesPlayer;
- _hasFuel5 = "ItemFuelcan" in _magazinesPlayer;
- _hasEmptyFuelCan = (("ItemJerrycanEmpty" in _magazinesPlayer) || ("ItemFuelcanEmpty" in _magazinesPlayer) || ("ItemFuelBarrelEmpty" in _magazinesPlayer));
- _itemsPlayer = items player;
- _weaponsPlayer = weapons player;
- _hasCrowbar = "ItemCrowbar" in _itemsPlayer or "MeleeCrowbar" in _weaponsPlayer or dayz_onBack == "MeleeCrowbar";
- _hasToolbox = "ItemToolbox" in _itemsPlayer;
- _isAlive = alive _cursorTarget;
- _text = getText (configFile >> "CfgVehicles" >> _typeOfCursorTarget >> "displayName");
- _isPlant = _typeOfCursorTarget in Dayz_plants;
- _istypeTent = (_cursorTarget isKindOf "TentStorage_base") or (_cursorTarget isKindOf "IC_Tent");
- _characterID = _cursorTarget getVariable ["CharacterID","0"];
+ local _typeOfCursorTarget = typeOf _cursorTarget;
+ local _isVehicle = _cursorTarget isKindOf "AllVehicles";
+ local _isBicycle = _cursorTarget isKindOf "Bicycle";
+ local _isDestructable = _cursorTarget isKindOf "BuiltItems";
+ local _isGenerator = _typeOfCursorTarget == "Generator_DZ";
+ local _isLocked = locked _cursorTarget;
+ local _isFuel = false;
+ local _hasBarrel = "ItemFuelBarrel" in _magazinesPlayer;
+ local _hasFuel20 = "ItemJerrycan" in _magazinesPlayer;
+ local _hasFuel5 = "ItemFuelcan" in _magazinesPlayer;
+ local _hasEmptyFuelCan = (("ItemJerrycanEmpty" in _magazinesPlayer) || ("ItemFuelcanEmpty" in _magazinesPlayer) || ("ItemFuelBarrelEmpty" in _magazinesPlayer));
+ local _itemsPlayer = items player;
+ local _weaponsPlayer = weapons player;
+ local _hasCrowbar = "ItemCrowbar" in _itemsPlayer || "MeleeCrowbar" in _weaponsPlayer || dayz_onBack == "MeleeCrowbar";
+ local _hasToolbox = "ItemToolbox" in _itemsPlayer;
+ local _isAlive = alive _cursorTarget;
+ local _text = getText (configFile >> "CfgVehicles" >> _typeOfCursorTarget >> "displayName");
+ local _isPlant = _typeOfCursorTarget in Dayz_plants;
+ local _istypeTent = (_cursorTarget isKindOf "TentStorage_base") or (_cursorTarget isKindOf "IC_Tent");
+ local _characterID = _cursorTarget getVariable ["CharacterID","0"];
+ local _id = "";
+ local _ownerID = "";
+ local _hasAccess = [];
if (DZE_permanentPlot) then {
_id = _uid;
@@ -237,11 +232,11 @@ if (!isNull _cursorTarget && {!_inVehicle && !_isPZombie && _canDo && player dis
_ownerID = _characterID;
};
- _isDog = (_cursorTarget isKindOf "Pastor" || _cursorTarget isKindOf "Fin");
- _isModular = _cursorTarget isKindOf "ModularItems";
- _isModularDoor = _typeOfCursorTarget in ["Land_DZE_WoodDoor","Land_DZE_LargeWoodDoor","Land_DZE_GarageWoodDoor","CinderWallDoor_DZ","CinderWallDoorSmall_DZ","WoodenGate_foundation_DZ","WoodenGate_1_DZ","WoodenGate_2_DZ","WoodenGate_3_DZ","WoodenGate_4_DZ"];
- _player_deleteBuild = false;
- _player_lockUnlock_crtl = false;
+ local _isDog = (_cursorTarget isKindOf "Pastor" || _cursorTarget isKindOf "Fin");
+ local _isModular = _cursorTarget isKindOf "ModularItems";
+ local _isModularDoor = _typeOfCursorTarget in ["Land_DZE_WoodDoor","Land_DZE_LargeWoodDoor","Land_DZE_GarageWoodDoor","CinderWallDoor_DZ","CinderWallDoorSmall_DZ","WoodenGate_foundation_DZ","WoodenGate_1_DZ","WoodenGate_2_DZ","WoodenGate_3_DZ","WoodenGate_4_DZ","Land_DZE_WoodGate","Land_DZE_WoodOpenTopGarageDoor","CinderGate_DZ","CinderGarageOpenTop_DZ","CinderDoorHatch_DZ","Door_DZ","Concrete_Bunker_DZ","Metal_Drawbridge_DZ"];
+ local _player_deleteBuild = false;
+ local _player_lockUnlock_crtl = false;
//fuel tanks
if (_hasEmptyFuelCan) then {
@@ -277,7 +272,7 @@ if (!isNull _cursorTarget && {!_inVehicle && !_isPZombie && _canDo && player dis
if (_isVehicle && {!_isMan && damage _cursorTarget < 1}) then {
- _isDisallowRefuel = _typeOfCursorTarget in ["M240Nest_DZ","MMT_Civ","MMT_USMC","Old_bike_TK_CIV_EP1","Old_bike_TK_INS_EP1"];
+ local _isDisallowRefuel = _typeOfCursorTarget in ["M240Nest_DZ","MMT_Civ","MMT_USMC","Old_bike_TK_CIV_EP1","Old_bike_TK_INS_EP1"];
//Allow player to fill vehicle 210L
if (_hasBarrel && {fuel _cursorTarget < 1 && !_isDisallowRefuel}) then {
if (s_player_fillfuel210 < 0) then {
@@ -330,8 +325,8 @@ if (!isNull _cursorTarget && {!_inVehicle && !_isPZombie && _canDo && player dis
//Fireplace Actions check
if ((_cursorTarget call isInflamed) or (inflamed _cursorTarget)) then {
- _hasRawMeat = {_x in Dayz_meatraw} count _magazinesPlayer > 0;
- _hasunboiledwater = {_x in ["ItemWaterBottleInfected","ItemWaterBottle","ItemWaterBottleSafe","ItemWaterbottle1oz","ItemWaterbottle2oz","ItemWaterbottle3oz","ItemWaterbottle4oz","ItemWaterbottle5oz","ItemWaterbottle6oz","ItemWaterbottle7oz","ItemWaterbottle8oz","ItemWaterbottle9oz","ItemPlasticWaterBottle","ItemPlasticWaterBottleInfected","ItemPlasticWaterBottleSafe","ItemPlasticWaterbottle1oz","ItemPlasticWaterbottle2oz","ItemPlasticWaterbottle3oz","ItemPlasticWaterbottle4oz","ItemPlasticWaterbottle5oz","ItemPlasticWaterbottle6oz","ItemPlasticWaterbottle7oz","ItemPlasticWaterbottle8oz","ItemPlasticWaterbottle9oz"]} count _magazinesPlayer > 0;
+ local _hasRawMeat = {_x in Dayz_meatraw} count _magazinesPlayer > 0;
+ local _hasunboiledwater = {_x in ["ItemWaterBottleInfected","ItemWaterBottle","ItemWaterBottleSafe","ItemWaterbottle1oz","ItemWaterbottle2oz","ItemWaterbottle3oz","ItemWaterbottle4oz","ItemWaterbottle5oz","ItemWaterbottle6oz","ItemWaterbottle7oz","ItemWaterbottle8oz","ItemWaterbottle9oz","ItemPlasticWaterBottle","ItemPlasticWaterBottleInfected","ItemPlasticWaterBottleSafe","ItemPlasticWaterbottle1oz","ItemPlasticWaterbottle2oz","ItemPlasticWaterbottle3oz","ItemPlasticWaterbottle4oz","ItemPlasticWaterbottle5oz","ItemPlasticWaterbottle6oz","ItemPlasticWaterbottle7oz","ItemPlasticWaterbottle8oz","ItemPlasticWaterbottle9oz"]} count _magazinesPlayer > 0;
//Cook Meat
@@ -358,7 +353,7 @@ if (!isNull _cursorTarget && {!_inVehicle && !_isPZombie && _canDo && player dis
};
if (_isAlive) then {
- _restrict = _typeOfCursorTarget in DZE_restrictRemoval;
+ local _restrict = _typeOfCursorTarget in DZE_restrictRemoval;
//Allow player to remove objects with no ownership or access required
if (!_restrict && {_isDestructable || {_typeOfCursorTarget in DZE_isWreck} || {_typeOfCursorTarget in DZE_isWreckBuilding} || {_typeOfCursorTarget in DZE_isRemovable}}) then {
@@ -376,7 +371,7 @@ if (!isNull _cursorTarget && {!_inVehicle && !_isPZombie && _canDo && player dis
};
};
if (_isVehicle) then {
- if ((_characterID != "0") && {!_isMan}) then {
+ if ((_characterID != "0") && !_isMan) then {
_player_lockUnlock_crtl = true;
};
};
@@ -409,7 +404,7 @@ if (!isNull _cursorTarget && {!_inVehicle && !_isPZombie && _canDo && player dis
//other tents
if (_istypeTent) then {
- _hasIgnitors = {_x in DayZ_Ignitors} count _itemsPlayer > 0;
+ local _hasIgnitors = {_x in DayZ_Ignitors} count _itemsPlayer > 0;
if ((_hasFuel20 || _hasFuel5 || _hasBarrel) && _hasIgnitors) then {
if (s_player_destroytent < 0) then {
s_player_destroytent = player addAction [localize "str_actions_self_destroytent", "\z\addons\dayz_code\actions\player_destroyTent.sqf",_cursorTarget, 0, false, true];
@@ -446,7 +441,7 @@ if (!isNull _cursorTarget && {!_inVehicle && !_isPZombie && _canDo && player dis
};
/*
//Carbomb
- _hasCarBomb = "ItemCarBomb" in _magazinesPlayer;
+ local _hasCarBomb = "ItemCarBomb" in _magazinesPlayer;
if (((_cursorTarget isKindOf "Car") || (_cursorTarget isKindOf "Air") || (_cursorTarget isKindOf "Motorcycle")) && _hasCarBomb) then {
if (s_player_attach_bomb < 0) then {
s_player_attach_bomb = player addAction [localize "str_bombAttach", "\z\addons\dayz_code\actions\player_attach_bomb.sqf",_cursorTarget, 3, true, true];
@@ -460,8 +455,9 @@ if (!isNull _cursorTarget && {!_inVehicle && !_isPZombie && _canDo && player dis
if (_isVehicle && {!_isMan && _hasToolbox && {dayz_myCursorTarget != _cursorTarget} && {damage _cursorTarget < 1} && {_typeOfCursorTarget != "M240Nest_DZ"}}) then {
if (s_player_repair_crtl < 0) then {
dayz_myCursorTarget = _cursorTarget;
- _menu = dayz_myCursorTarget addAction [localize "str_actions_repairveh", "\z\addons\dayz_code\actions\repair_vehicle.sqf",_cursorTarget, 0, true, false];
+ local _menu = dayz_myCursorTarget addAction [localize "str_actions_repairveh", "\z\addons\dayz_code\actions\repair_vehicle.sqf",_cursorTarget, 0, true, false];
if (!_isBicycle) then { //Bike wheels should not give full size tires. Also model does not update to show removed wheels.
+ local _menu1 = [];
if (!DZE_salvageLocked) then {
if (!_isLocked) then {
_menu1 = dayz_myCursorTarget addAction [localize "str_actions_salvageveh", "\z\addons\dayz_code\actions\salvage_vehicle.sqf",_cursorTarget, 0, true, false];
@@ -483,7 +479,7 @@ if (!isNull _cursorTarget && {!_inVehicle && !_isPZombie && _canDo && player dis
if ((_typeOfCursorTarget == "Plastic_Pole_EP1_DZ") && {speed player <= 1}) then {
_hasAccess = [player, _cursorTarget] call FNC_check_access;
- _allowed = ((_hasAccess select 0) || _hasAccess select 2 || _hasAccess select 3 || _hasAccess select 4);
+ local _allowed = ((_hasAccess select 0) || _hasAccess select 2 || _hasAccess select 3 || _hasAccess select 4);
if (DZE_permanentPlot) then {
if (s_player_plotManagement < 0 && _allowed) then {
s_player_plotManagement = player addAction [format["%1",localize "STR_EPOCH_ACTIONS_MANAGEPLOT"], "\z\addons\dayz_code\actions\plotManagement\initPlotManagement.sqf", [], 5, false];
@@ -512,9 +508,9 @@ if (!isNull _cursorTarget && {!_inVehicle && !_isPZombie && _canDo && player dis
};
if (DZE_HeliLift) then {
- _liftHeli = objNull;
- _found = false;
- _allowTow = false;
+ local _liftHeli = objNull;
+ local _found = false;
+ local _allowTow = false;
if ((count (crew _cursorTarget)) == 0) then {
{
if (!_allowTow) then {
@@ -526,10 +522,10 @@ if (!isNull _cursorTarget && {!_inVehicle && !_isPZombie && _canDo && player dis
if (_allowTow) then {
{
if (!_found) then {
- _posL = [_x] call FNC_getPos;
- _posC = [_cursorTarget] call FNC_getPos;
- _height = (_posL select 2) - (_posC select 2);
- _hasAttached = _x getVariable["hasAttached",false];
+ local _posL = [_x] call FNC_getPos;
+ local _posC = [_cursorTarget] call FNC_getPos;
+ local _height = (_posL select 2) - (_posC select 2);
+ local _hasAttached = _x getVariable["hasAttached",false];
if ((_height < 15) && {_height > 5} && {typeName _hasAttached != "OBJECT"}) then {
if (((abs((_posL select 0) - (_posC select 0))) < 10) && {(abs((_posL select 1) - (_posC select 1))) < 10}) then {
_liftHeli = _x;
@@ -540,7 +536,7 @@ if (!isNull _cursorTarget && {!_inVehicle && !_isPZombie && _canDo && player dis
} count (player nearEntities [DZE_HeliAllowTowFrom,15]);
};
- _attached = _cursorTarget getVariable["attached",false];
+ local _attached = _cursorTarget getVariable["attached",false];
if (_found && _allowTow && !_isLocked && {typeName _attached != "OBJECT"}) then {
if (s_player_heli_lift < 0) then {
s_player_heli_lift = player addAction [localize "STR_EPOCH_ACTIONS_ATTACHTOHELI", "\z\addons\dayz_code\actions\player_heliLift.sqf",[_liftHeli,_cursorTarget], -10, false, true];
@@ -554,11 +550,13 @@ if (!isNull _cursorTarget && {!_inVehicle && !_isPZombie && _canDo && player dis
// Allow Owner to lock and unlock vehicle
if (_player_lockUnlock_crtl) then {
if (s_player_lockUnlock_crtl < 0) then {
- _totalKeys = call epoch_tempKeys;
- _temp_keys = _totalKeys select 0;
- _temp_keys_names = _totalKeys select 1;
- _hasKey = _characterID in _temp_keys;
- _oldOwner = (_characterID == _uid);
+ local _totalKeys = call epoch_tempKeys;
+ local _temp_keys = _totalKeys select 0;
+ local _temp_keys_names = _totalKeys select 1;
+ local _hasKey = _characterID in _temp_keys;
+ local _oldOwner = (_characterID == _uid);
+ local _unlock = [];
+
if (_isLocked) then {
if (_hasKey || _oldOwner) then {
_unlock = player addAction [format[localize "STR_EPOCH_ACTIONS_UNLOCK",_text], "\z\addons\dayz_code\actions\unlock_veh.sqf",[_cursorTarget,(_temp_keys_names select (_temp_keys find _characterID))], 2, true, true];
@@ -586,7 +584,7 @@ if (!isNull _cursorTarget && {!_inVehicle && !_isPZombie && _canDo && player dis
s_player_lockUnlock_crtl = -1;
};
- if (DZE_Hide_Body && _isMan && !_isAlive) then {
+ if (DZE_Hide_Body && {_isMan && !_isAlive}) then {
if (s_player_hide_body < 0) then {
s_player_hide_body = player addAction [localize "str_action_hide_body", "\z\addons\dayz_code\actions\hide_body.sqf",_cursorTarget, 1, true, true];
};
@@ -620,6 +618,7 @@ if (!isNull _cursorTarget && {!_inVehicle && !_isPZombie && _canDo && player dis
//Allow owner to unlock vault
if (_isClose && !keypadCancel && {(_typeOfCursorTarget in DZE_LockedStorage) && {_characterID != "0"}}) then {
if (s_player_unlockvault < 0) then {
+ local _combi = [];
if (_typeOfCursorTarget in DZE_LockedStorage) then {
if ((_characterID == dayz_combination) || {_ownerID == _uid}) then {
_combi = player addAction [format[localize "STR_EPOCH_ACTIONS_OPEN",_text], "\z\addons\dayz_code\actions\vault_unlock.sqf",_cursorTarget, 0, false, true];
@@ -675,7 +674,7 @@ if (!isNull _cursorTarget && {!_inVehicle && !_isPZombie && _canDo && player dis
//Fuel Pump
if (_typeOfCursorTarget in dayz_fuelpumparray) then {
if (s_player_fuelauto < 0) then {
- _findNearestGen = {((alive _x) && (_x getVariable ["GeneratorRunning",false]))} count (([player] call FNC_getPos) nearObjects ["Generator_DZ",30]);
+ local _findNearestGen = {((alive _x) && (_x getVariable ["GeneratorRunning",false]))} count (([player] call FNC_getPos) nearObjects ["Generator_DZ",30]);
if (_findNearestGen > 0) then {
s_player_fuelauto = player addAction [localize "STR_EPOCH_ACTIONS_FILLVEH", "\z\addons\dayz_code\actions\fill_nearestVehicle.sqf",objNull, 0, false, true];
} else {
@@ -709,7 +708,7 @@ if (!isNull _cursorTarget && {!_inVehicle && !_isPZombie && _canDo && player dis
s_player_upgrade_build = -1;
};
};
- _upgrade = getArray (configFile >> "CfgVehicles" >> (typeOf _cursorTarget) >> "upgradeBuilding");
+ local _upgrade = getArray (configFile >> "CfgVehicles" >> (typeOf _cursorTarget) >> "upgradeBuilding");
if ((s_player_upgrade_build < 0) && {(count _upgrade) > 0}) then {
_hasAccess = [player, _cursorTarget] call FNC_check_access;
if ((_hasAccess select 0) || (_hasAccess select 2) || (_hasAccess select 3) || (_typeOfCursorTarget in DZE_UpgradableStorage) || (_typeOfCursorTarget isKindOf "DZ_storage_base")) then {
@@ -760,7 +759,7 @@ if (!isNull _cursorTarget && {!_inVehicle && !_isPZombie && _canDo && player dis
if (s_player_maint_build < 0) then {
_hasAccess = [player, _cursorTarget] call FNC_check_access;
if ((_hasAccess select 0) || {_hasAccess select 2} || {_hasAccess select 3}) then {
- _text2 = _text + " (" + str(round ((damage _cursorTarget) * 100)) + "% damaged)";
+ local _text2 = _text + " (" + str(round ((damage _cursorTarget) * 100)) + "% damaged)";
s_player_lastTarget set [2,_cursorTarget];
s_player_maint_build = player addAction [format["%1 %2",localize "STR_EPOCH_ACTIONS_MAINTAIN",_text2], "\z\addons\dayz_code\actions\player_buildingMaint.sqf",_cursorTarget, -2, false, true];
};
@@ -868,10 +867,10 @@ if (!isNull _cursorTarget && {!_inVehicle && !_isPZombie && _canDo && player dis
// All Traders
if (_isMan && {!(isPlayer _cursorTarget)} && {_typeOfCursorTarget in serverTraders}) then {
if (s_player_parts_crtl < 0) then {
- _humanity = player getVariable ["humanity",0];
- _traderMenu = call compile format["menu_%1;",_typeOfCursorTarget];
- _low_high = localize "STR_EPOCH_ACTIONS_HUMANITY_LOW";
- _humanity_logic = false;
+ local _humanity = player getVariable ["humanity",0];
+ local _traderMenu = call compile format["menu_%1;",_typeOfCursorTarget];
+ local _low_high = localize "STR_EPOCH_ACTIONS_HUMANITY_LOW";
+ local _humanity_logic = false;
if ((_traderMenu select 2) == "friendly") then {
_humanity_logic = (_humanity < DZE_Bandit);
};
@@ -883,21 +882,21 @@ if (!isNull _cursorTarget && {!_inVehicle && !_isPZombie && _canDo && player dis
_humanity_logic = (_humanity < DZE_Hero);
};
if (_humanity_logic) then {
- _cancel = player addAction [format[localize "STR_EPOCH_ACTIONS_HUMANITY",_low_high], "","", 0, true, false];
+ local _cancel = player addAction [format[localize "STR_EPOCH_ACTIONS_HUMANITY",_low_high], "","", 0, true, false];
s_player_parts set [count s_player_parts,_cancel];
} else {
- private ["_itemName1","_itemName2"];
+ local _buy = [];
{
- _itemName2 = getText (configFile >> "CfgMagazines" >> (_x select 1) >> "displayName");
+ local _itemName2 = getText (configFile >> "CfgMagazines" >> (_x select 1) >> "displayName");
if (_x select 1 in ["ItemDogTagBandit","ItemDogTagHero"]) then {
_buy = player addAction [format[localize "STR_EPOCH_TRADER_CATEGORY_TRADE_ITEMS",(_x select 3),_itemName2,(_x select 4),localize "str_actions_stats_hm"], "\z\addons\dayz_code\actions\trade_items_wo_db.sqf",[(_x select 0),(_x select 1),(_x select 2),(_x select 3),(_x select 4)],1, true, true];
} else {
- _itemName1 = getText (configFile >> "CfgMagazines" >> (_x select 0) >> "displayName");
+ local _itemName1 = getText (configFile >> "CfgMagazines" >> (_x select 0) >> "displayName");
_buy = player addAction [format[localize "STR_EPOCH_TRADER_CATEGORY_TRADE_ITEMS",(_x select 3),_itemName2,(_x select 2),_itemName1], "\z\addons\dayz_code\actions\trade_items_wo_db.sqf",[(_x select 0),(_x select 1),(_x select 2),(_x select 3),(_x select 4)],1, true, true];
};
s_player_parts set [count s_player_parts,_buy];
} count (_traderMenu select 1);
- _buyV = player addAction [localize "STR_EPOCH_PLAYER_289", "\z\addons\dayz_code\actions\AdvancedTrading\init.sqf",(_traderMenu select 0), 999, true, false];
+ local _buyV = player addAction [localize "STR_EPOCH_PLAYER_289", "\z\addons\dayz_code\actions\AdvancedTrading\init.sqf",(_traderMenu select 0), 999, true, false];
s_player_parts set [count s_player_parts,_buyV];
};
s_player_parts_crtl = 1;
@@ -909,7 +908,7 @@ if (!isNull _cursorTarget && {!_inVehicle && !_isPZombie && _canDo && player dis
//Dog
if (dayz_tameDogs) then {
- _hasRawMeat = {_x in Dayz_meatraw} count _magazinesPlayer > 0;
+ local _hasRawMeat = {_x in Dayz_meatraw} count _magazinesPlayer > 0;
if (_isDog && {_hasRawMeat && _isAlive && {_ownerID == "0"} && {player getVariable ["dogID",0] == 0}}) then {
if (s_player_tamedog < 0) then {
@@ -920,7 +919,7 @@ if (!isNull _cursorTarget && {!_inVehicle && !_isPZombie && _canDo && player dis
s_player_tamedog = -1;
};
if (_isDog && _isAlive && {_ownerID == _id}) then {
- _hasbottleitem = ({_x in ["ItemWaterBottle","ItemWaterBottleInfected","ItemWaterBottleSafe","ItemWaterBottleBoiled","ItemPlasticWaterBottle","ItemPlasticWaterBottleInfected","ItemPlasticWaterBottleSafe","ItemPlasticWaterBottleBoiled"]} count _magazinesPlayer) > 0;
+ local _hasbottleitem = ({_x in ["ItemWaterBottle","ItemWaterBottleInfected","ItemWaterBottleSafe","ItemWaterBottleBoiled","ItemPlasticWaterBottle","ItemPlasticWaterBottleInfected","ItemPlasticWaterBottleSafe","ItemPlasticWaterBottleBoiled"]} count _magazinesPlayer) > 0;
if (s_player_feeddog < 0 && _hasRawMeat) then {
s_player_feeddog = player addAction [localize "str_actions_feeddog","\z\addons\dayz_code\actions\dog\feed.sqf",[_dogHandle,0], 0, false, true];
@@ -939,7 +938,7 @@ if (!isNull _cursorTarget && {!_inVehicle && !_isPZombie && _canDo && player dis
s_player_barkdog = player addAction [localize "str_actions_barkdog","\z\addons\dayz_code\actions\dog\speak.sqf", _cursorTarget, 3, false, true];
};
if (s_player_warndog < 0) then {
- _warn = _dogHandle getFSMVariable "_watchDog";
+ local _warn = _dogHandle getFSMVariable "_watchDog";
if (_warn) then { _text = localize "str_epoch_player_247"; _warn = false; } else { _text = localize "str_epoch_player_248"; _warn = true; };
s_player_warndog = player addAction [format[localize "str_actions_warndog",_text],"\z\addons\dayz_code\actions\dog\warn.sqf",[_dogHandle, _warn], 2, false, true];
};
@@ -1084,7 +1083,7 @@ if (!isNull _cursorTarget && {!_inVehicle && !_isPZombie && _canDo && player dis
//Dog actions on player self
if (_dogHandle > 0) then {
- _dog = _dogHandle getFSMVariable "_dog";
+ local _dog = _dogHandle getFSMVariable "_dog";
if (isNil "_dog") exitWith {};
if (isNil "_ownerID") then {_ownerID = "0"};
if (_canDo && !_inVehicle && {alive _dog} && {!(_ownerID in [_myCharID,_uid])}) then {
@@ -1093,7 +1092,7 @@ if (_dogHandle > 0) then {
};
if (s_player_speeddog < 0) then {
_text = localize "str_epoch_player_249";
- _speed = 0;
+ local _speed = 0;
if (_dog getVariable ["currentSpeed",1] == 0) then { _speed = 1; _text = localize "str_epoch_player_250"; };
s_player_speeddog = player addAction [format[localize "str_actions_speeddog", _text], "\z\addons\dayz_code\actions\dog\speed.sqf",[player getVariable ["dogID",0],_speed], 0, false, true];
};
@@ -1111,4 +1110,4 @@ if (_dogHandle > 0) then {
};
//Monitor
-player setVariable ["selfActions", diag_ticktime, false];
+player setVariable ["selfActions", diag_ticktime, false];
\ No newline at end of file
diff --git a/SQF/dayz_code/compile/player_spawnCheck.sqf b/SQF/dayz_code/compile/player_spawnCheck.sqf
index 5a0180448..7cff6dea9 100644
--- a/SQF/dayz_code/compile/player_spawnCheck.sqf
+++ b/SQF/dayz_code/compile/player_spawnCheck.sqf
@@ -1,11 +1,10 @@
-private ["_zeds","_isWreck","_looted","_zombied","_doNothing","_spawnZedRadius","_serverTime","_age","_position","_radius","_inVehicle","_Controlledzeddivided","_nearby","_type","_config","_canSpawn","_dis","_checkLoot","_islocal","_bPos","_zombiesNum","_vehicle"];
-_age = -1;
-_position = [player] call fnc_getPos;
-_radius = 200; // distance from player to perform checks.
-_spawnZedRadius = 20;
+local _age = -1;
+local _position = [player] call fnc_getPos;
+local _radius = 200; // distance from player to perform checks.
+local _spawnZedRadius = 20;
// Current zombies
-_zeds = entities "zZombie_Base";
+local _zeds = entities "zZombie_Base";
dayz_currentGlobalZombies = count _zeds;
dayz_spawnZombies = 0;
dayz_CurrentNearByZombies = 0;
@@ -23,12 +22,12 @@ dayz_maxControlledZombies = dayz_maxLocalZombies; // This variable is also used
dayz_currentWeaponHolders = count (_position nearObjects ["ReammoBox",_radius]);
// In vehicle check
-_vehicle = vehicle player;
-_inVehicle = (_vehicle != player);
+local _vehicle = vehicle player;
+local _inVehicle = (_vehicle != player);
+local _doNothing = false;
-_doNothing = false;
if (_inVehicle) then {
- _Controlledzeddivided = 0;
+ local _Controlledzeddivided = 0;
//exit if too fast
if ((speed _vehicle) > 25) exitwith {_doNothing = true;};
@@ -96,27 +95,28 @@ if (_doNothing) exitWith {};
// nearObjects is faster than nearestObjects when sorting by distance isn't needed
// "Building" includes House and all of its child classes (Crashsite, IC_Fireplace1, IC_Tent, etc.)
-_nearby = _position nearObjects ["Building",_radius];
+local _nearby = _position nearObjects ["Building",_radius];
dayz_spawnZombies = dayz_spawnZombies max floor(dayz_maxControlledZombies*.8);
if (dayz_spawnZombies > 0) then { _spawnZedRadius = _spawnZedRadius * 3;};
//Spawn Zeds & loot in buildings
-_serverTime = serverTime; // Get the current time once per cycle.
+local _serverTime = serverTime; // Get the current time once per cycle.
{
- _type = typeOf _x;
- _config = missionConfigFile >> "CfgLoot" >> "Buildings" >> _type;
- _canSpawn = isClass (_config);
+ local _type = typeOf _x;
+ local _config = missionConfigFile >> "CfgLoot" >> "Buildings" >> _type;
+ local _canSpawn = isClass (_config);
if (_canSpawn) then {
- _dis = _x distance player;
- _islocal = _x getVariable ["", false]; // object created locally via TownGenerator.
+ local _dis = _x distance player;
+ local _islocal = _x getVariable ["", false]; // object created locally via TownGenerator.
//Loot
if (dayz_currentWeaponHolders < dayz_maxMaxWeaponHolders) then { // Check this first
- _checkLoot = (count (getArray (_config >> "lootPos"))) > 0;
- if ((_dis < 125) && {_dis > 15} && {!_inVehicle} && {_checkLoot}) then {
- _looted = (_x getVariable ["looted",_serverTime]);
- _age = _serverTime - _looted; // if age is zero then the building hasn't been looted before.
+ local _checkLoot = (count (getArray (_config >> "lootPos"))) > 0;
+ if (!_inVehicle && {(_dis < 125) && (_dis > 15) && _checkLoot}) then {
+ local _looted = (_x getVariable ["looted",_serverTime]);
+ local _age = _serverTime - _looted; // if age is zero then the building hasn't been looted before.
+
if ((_age == 0) || {_age > getNumber(_config >> "lootRefreshTimer")}) then {
_x setVariable ["looted",_serverTime,!_islocal];
[_x,_type,_config] call building_spawnLoot;
@@ -127,12 +127,14 @@ _serverTime = serverTime; // Get the current time once per cycle.
//Zeds
if (getNumber(_config >> "zombieChance") > 0) then {
if (_dis > _spawnZedRadius) then {
- _zombied = (_x getVariable ["zombieSpawn",_serverTime]);
- _age = _serverTime - _zombied;
+ local _zombied = (_x getVariable ["zombieSpawn",_serverTime]);
+ local _age = _serverTime - _zombied;
if ((_age == 0) || {_age > 300}) then {
//Make sure crash sites always spawn Zeds
- _isWreck = _x isKindOf "CrashSite";
- _bPos = getPosATL _x;
+ local _isWreck = _x isKindOf "CrashSite";
+ local _bPos = getPosATL _x;
+ local _zombiesNum = 0;
+
if (!_isWreck) then {
if ((dayz_spawnZombies < dayz_maxControlledZombies) && {dayz_CurrentNearByZombies < dayz_maxNearByZombies} && {dayz_currentGlobalZombies < dayz_maxGlobalZeds}) then {
_zombiesNum = count (_bPos nearEntities ["zZombie_Base",(((sizeOf _type) * 2) + 10)]);
diff --git a/SQF/dayz_code/compile/player_updateGui.sqf b/SQF/dayz_code/compile/player_updateGui.sqf
index dfaf9d3bc..9474b099e 100644
--- a/SQF/dayz_code/compile/player_updateGui.sqf
+++ b/SQF/dayz_code/compile/player_updateGui.sqf
@@ -1,10 +1,9 @@
-private ["_combatVal","_ctrlCombatBorder","_ctrlCombat","_uiNumber","_bloodText","_blood","_bloodType","_rhFactor","_thirstLvl","_foodLvl","_tempImg","_tempText","_visual","_audible","_id","_rID","_color","_string","_humanity","_size","_friendlies","_rfriendlies","_rfriendlyTo","_distance","_targetControl","_flash","_foodVal","_thirstVal","_tempVal","_display","_ctrlBloodOuter","_ctrlFoodBorder","_ctrlThirstBorder","_ctrlTempBorder","_ctrlBlood","_ctrlBloodType","_ctrlBleed","_bloodVal","_ctrlFood","_ctrlThirst","_ctrlTemp","_ctrlEar","_ctrlEye","_ctrlFracture","_ctrlMuteBackground","_ctrlMuteIcon","_thirst","_food","_temp","_bloodLvl","_tempLvl","_bloodTestdone","_humanityTarget"];
disableSerialization;
-_display = uiNamespace getVariable 'DAYZ_GUI_display';
+local _display = uiNamespace getVariable 'DAYZ_GUI_display';
if (isNil "_display") exitWith {}; // not ready
-_flash = {
+local _flash = {
if (ctrlShown _this) then {
_this ctrlShow false;
} else {
@@ -12,11 +11,20 @@ _flash = {
};
};
-_foodVal = 1 - (dayz_hunger / SleepFood);
-_thirstVal = 1 - (dayz_thirst / SleepWater);
-_tempVal = 1 - ((dayz_temperatur - dayz_temperaturmin)/(dayz_temperaturmax - dayz_temperaturmin)); // Normalise to [0,1]
-_bloodVal = r_player_blood / r_player_bloodTotal;
-_combatVal = if (player getVariable["combattimeout",0] >= diag_tickTime) then {0} else {1};
+local _foodVal = 1 - (dayz_hunger / SleepFood);
+local _thirstVal = 1 - (dayz_thirst / SleepWater);
+local _tempVal = 1 - ((dayz_temperatur - dayz_temperaturmin)/(dayz_temperaturmax - dayz_temperaturmin)); // Normalise to [0,1]
+local _bloodVal = r_player_blood / r_player_bloodTotal;
+local _combatVal = if (player getVariable["combattimeout",0] >= diag_tickTime) then {0} else {1};
+local _ctrlBloodOuter = 0;
+local _ctrlFoodBorder = 0;
+local _ctrlThirstBorder = 0;
+local _ctrlTempBorder = 0;
+local _ctrlCombatBorder = 0;
+local _ctrlCombatBG = 0;
+local _ctrlCombat = 0;
+local _ctrlEar = 0;
+local _ctrlEye = 0;
if (DZE_UI in [1,3,4]) then { // White borders
_ctrlBloodOuter = _display displayCtrl 1200;
@@ -57,14 +65,14 @@ if (DZE_UI in [1,3]) then {
_ctrlEye = _display displayCtrl 1309;
};
-_ctrlBlood = _display displayCtrl 1300;
-_ctrlBleed = _display displayCtrl 1303;
-_ctrlFood = _display displayCtrl 1301;
-_ctrlThirst = _display displayCtrl 1302;
-_ctrlTemp = _display displayCtrl 1306;
-_ctrlFracture = _display displayCtrl 1203;
-_ctrlMuteBackground = _display displayCtrl 1904;
-_ctrlMuteIcon = _display displayCtrl 1204;
+local _ctrlBlood = _display displayCtrl 1300;
+local _ctrlBleed = _display displayCtrl 1303;
+local _ctrlFood = _display displayCtrl 1301;
+local _ctrlThirst = _display displayCtrl 1302;
+local _ctrlTemp = _display displayCtrl 1306;
+local _ctrlFracture = _display displayCtrl 1203;
+local _ctrlMuteBackground = _display displayCtrl 1904;
+local _ctrlMuteIcon = _display displayCtrl 1204;
if (dayz_soundMuted) then {
_ctrlMuteBackground ctrlShow true;
@@ -88,16 +96,16 @@ if (DZE_UI == 3) then { // Dark
_ctrlThirst ctrlSetTextColor [(Dayz_GUI_R + (0.3 * (1-_thirstVal))),(Dayz_GUI_G * _thirstVal),(Dayz_GUI_B * _thirstVal), 1];
};
-_blood = "";
-_thirst = "";
-_food = "";
-_temp = "";
-_visualtext = "";
-_audibletext = "";
-_bloodLvl = 6 min (0 max (round((r_player_blood / 2) / 1000 + 0.49)));
-_thirstLvl = round(_thirstVal / 0.25);
-_foodLvl = round(_foodVal / 0.25);
-_tempLvl = round(dayz_temperatur);
+local _blood = "";
+local _thirst = "";
+local _food = "";
+local _temp = "";
+local _visualtext = "";
+local _audibletext = "";
+local _bloodLvl = 6 min (0 max (round((r_player_blood / 2) / 1000 + 0.49)));
+local _thirstLvl = round(_thirstVal / 0.25);
+local _foodLvl = round(_foodVal / 0.25);
+local _tempLvl = round(dayz_temperatur);
/* //Debugging Stuff would be usefull
diag_log format["DEBUG: bloodlvl: %1 r_player_blood: %2 bloodval: %3",_bloodLvl, r_player_blood, _bloodVal];
@@ -108,7 +116,7 @@ diag_log format["DEBUG: templvl: %1 dayz_temperatur: %2 tempval: %3",_tempLvl, d
if (DZE_UI == 1) then { // Vanilla
// Blood Regen & BloodLoss:
- _uiNumber = call {
+ local _uiNumber = call {
if (r_player_bloodpersec <= -50) exitWith {-3};
if ((r_player_bloodpersec <= -25) && {r_player_bloodpersec > -50}) exitWith {-2};
if ((r_player_bloodpersec < 0) && {r_player_bloodpersec > -25}) exitWith {-1};
@@ -118,7 +126,7 @@ if (DZE_UI == 1) then { // Vanilla
0;
};
- _bloodText = "\z\addons\dayz_code\gui\status\status_blood_border";
+ local _bloodText = "\z\addons\dayz_code\gui\status\status_blood_border";
if (r_player_infected) then {
_bloodText = call {
@@ -136,7 +144,7 @@ if (DZE_UI == 1) then { // Vanilla
_ctrlBloodOuter ctrlSetText _bloodText;
- _tempText = "\z\addons\dayz_code\gui\status\status_temp_border";
+ local _tempText = "\z\addons\dayz_code\gui\status\status_temp_border";
_tempText = call {
if (r_player_temp_factor <= r_player_temp_min_factor) exitWith {_tempText + "_down3_ca.paa"};
@@ -150,16 +158,16 @@ if (DZE_UI == 1) then { // Vanilla
_ctrlTempBorder ctrlSetText _tempText;
- _bloodTestdone = player getVariable ["blood_testdone", false];
+ local _bloodTestdone = player getVariable ["blood_testdone", false];
if (_bloodTestdone) then {
- _bloodType = player getVariable ["blood_type", "O"];
- _rhFactor = if (player getVariable ["rh_factor", false]) then { "pos" } else { "neg" };
+ local _bloodType = player getVariable ["blood_type", "O"];
+ local _rhFactor = if (player getVariable ["rh_factor", false]) then { "pos" } else { "neg" };
_ctrlBloodType = _display displayCtrl 1310;
_ctrlBloodType ctrlSetText ("\z\addons\dayz_code\gui\status\status_blood_type_"+_bloodType+"_"+_rhFactor+"_ca.paa");
};
};
-_path = if (DZE_UI == 1) then {"\z\addons\dayz_code\gui\status\"} else {"\z\addons\dayz_code\gui\status_epoch\"};
+local _path = if (DZE_UI == 1) then {"\z\addons\dayz_code\gui\status\"} else {"\z\addons\dayz_code\gui\status_epoch\"};
if (_bloodLvl <= 0) then {
_blood = _path + "status_blood_inside_1_ca.paa";
@@ -176,7 +184,7 @@ if (_foodLvl < 0) then { _foodLvl = 0 };
_food = _path + "status_food_inside_" + str(_foodLvl) + "_ca.paa";
_ctrlFood ctrlSetText _food;
-_tempImg = call {
+local _tempImg = call {
if (_tempLvl >= 36) exitWith {4};
if (_tempLvl > 33 && {_tempLvl < 36}) exitWith {3};
if (_tempLvl >= 30 && {_tempLvl <= 33}) exitWith {2};
@@ -185,6 +193,8 @@ _tempImg = call {
};
_temp = _path + "status_temp_" + str(_tempImg) + "_ca.paa";
_ctrlTemp ctrlSetText _temp;
+local _visual = 0;
+local _audible = 0;
if (DZE_UI in [1,3]) then {
_visual = (dayz_disVisual / 185) min 1;
@@ -205,7 +215,7 @@ if (DZE_UI in [1,3]) then {
};
// Fracture/Broken Legs
-if !(canStand player) then { //&& !(ctrlShown _ctrlFracture) makes icon flash non-stop until leg is fixed
+if !(canStand player) then {
_ctrlFracture ctrlShow true;
} else {
_ctrlFracture ctrlShow false;
@@ -263,18 +273,21 @@ if (r_player_injured) then {
/*
Opt-in tag system with friend tagging
*/
-_string = "";
-_humanityTarget = cursorTarget;
+local _string = "";
+local _humanityTarget = cursorTarget;
if (!isNull _humanityTarget && {isPlayer _humanityTarget} && {alive _humanityTarget}) then {
- _distance = player distance _humanityTarget;
+ local _distance = player distance _humanityTarget;
if (_distance < DZE_HumanityTargetDistance) then {
- _size = (1-(floor(_distance/5)*0.1)) max 0.1;
+ local _size = (1-(floor(_distance/5)*0.1)) max 0.1;
// Display name if player opt-in or if friend
- _friendlies = player getVariable ["friendlies", []];
+ local _friendlies = player getVariable ["friendlies", []];
+ local _id = "";
+ local _rID = "";
+
if (DZE_permanentPlot) then {
_id = dayz_playerUID;
_rID = getPlayerUID _humanityTarget;
@@ -282,8 +295,9 @@ if (!isNull _humanityTarget && {isPlayer _humanityTarget} && {alive _humanityTar
_id = dayz_characterID;
_rID = _humanityTarget getVariable ["CharacterID","0"];
};
- _rfriendlies = _humanityTarget getVariable ["friendlies", []];
- _rfriendlyTo = _humanityTarget getVariable ["friendlyTo", []];
+ local _rfriendlies = _humanityTarget getVariable ["friendlies", []];
+ local _rfriendlyTo = _humanityTarget getVariable ["friendlyTo", []];
+ local _color = "";
if ((_rID in _friendlies) && {_id in _rfriendlies}) then {
@@ -301,7 +315,7 @@ if (!isNull _humanityTarget && {isPlayer _humanityTarget} && {alive _humanityTar
} else {
// Humanity checks
- _humanity = _humanityTarget getVariable ["humanity",0];
+ local _humanity = _humanityTarget getVariable ["humanity",0];
_color = "color='#ffffff'";
if(_humanity < -5000) then {
@@ -320,7 +334,7 @@ if (!isNull _humanityTarget && {isPlayer _humanityTarget} && {alive _humanityTar
// update gui if changed
if (dayz_humanitytarget != _string) then {
- _targetControl = _display displayCtrl 1199;
+ local _targetControl = _display displayCtrl 1199;
_targetControl ctrlSetStructuredText (parseText _string);
dayz_humanitytarget = _string;
};
@@ -329,14 +343,14 @@ if (dayz_humanitytarget != _string) then {
if (Z_singleCurrency) then {
_display = uiNameSpace getVariable "ZSC_Money_Display";
if (isNil "_display") exitWith {}; // not ready
- _ctrlZSC = _display displayCtrl 4900;
+ local _ctrlZSC = _display displayCtrl 4900;
_string = "";
if (Z_showCurrencyUI) then {
- _cashAmt = player getVariable[(["cashMoney","globalMoney"] select Z_persistentMoney),0];
+ local _cashAmt = player getVariable[(["cashMoney","globalMoney"] select Z_persistentMoney),0];
_string = format ["%1 ![]()
",[_cashAmt] call BIS_fnc_numberText];
};
if (Z_globalBanking && Z_showBankUI) then {
- _bankAmt = player getVariable ["bankMoney",0];
+ local _bankAmt = player getVariable ["bankMoney",0];
_string = _string + format ["%1 ![]()
",[_bankAmt] call BIS_fnc_numberText];
};
_ctrlZSC ctrlSetStructuredText parseText _string;
diff --git a/SQF/dayz_code/system/scheduler/sched_antiTeleport.sqf b/SQF/dayz_code/system/scheduler/sched_antiTeleport.sqf
index c01a5c900..c5ddba27b 100644
--- a/SQF/dayz_code/system/scheduler/sched_antiTeleport.sqf
+++ b/SQF/dayz_code/system/scheduler/sched_antiTeleport.sqf
@@ -11,14 +11,11 @@ sched_antiTP_init = {
};
sched_antiTP = {
- private ["_lastpos","_lastheight","_lasttime","_lastVehicle","_debug","_curpos","_distance","_curtime","_difftime",
- "_curheight","_speed","_topSpeed","_terrainHeight","_safetyVehicle","_curPos"];
-
- _lastpos = _this select 1;
- _lastheight = _this select 2;
- _lasttime = _this select 3;
- _lastVehicle = _this select 4;
- _debug = _this select 5;
+ local _lastpos = _this select 1;
+ local _lastheight = _this select 2;
+ local _lasttime = _this select 3;
+ local _lastVehicle = _this select 4;
+ local _debug = _this select 5;
if (typeName player == "OBJECT" && {(player in playableUnits) && (alive player)}) then {
if (count _lastpos != 3) then {
@@ -27,22 +24,22 @@ sched_antiTP = {
_lasttime = diag_ticktime;
_lastVehicle = vehicle player;
};
- _curpos = getPosATL (vehicle player);
- _distance = _lastpos distance _curpos;
- _curtime = diag_ticktime;
- _difftime = _curtime - _lasttime;
+ local _curpos = getPosATL (vehicle player);
+ local _distance = _lastpos distance _curpos;
+ local _curtime = diag_ticktime;
+ local _difftime = _curtime - _lasttime;
if ((_distance > 10) OR {(_difftime > 1)}) then {
- _curheight = (ATLtoASL _curpos) select 2;
- _speed = _distance / _difftime;
- _topSpeed = 10;
+ local _curheight = (ATLtoASL _curpos) select 2;
+ local _speed = _distance / _difftime;
+ local _topSpeed = 10;
if (vehicle player != player) then {
_topSpeed = (getNumber (configFile >> "CfgVehicles" >> typeOf (vehicle player) >> "maxSpeed")) min 500;
};
- _terrainHeight = getTerrainHeightASL [_curpos select 0, _curpos select 1];
- _safetyVehicle = vehicle player;
+ local _terrainHeight = getTerrainHeightASL [_curpos select 0, _curpos select 1];
+ local _safetyVehicle = vehicle player;
if (_lastVehicle == vehicle player) then {
if ((_speed > _topSpeed) && (alive player) && ((driver (vehicle player) == player) or (isNull (driver (vehicle player)))) && (_debug distance _lastpos > 3000) && !((vehicle player == player) && (_curheight < _lastheight) && ((_curheight - _terrainHeight) > 1))) then {
diff --git a/SQF/dayz_code/system/scheduler/sched_gravity.sqf b/SQF/dayz_code/system/scheduler/sched_gravity.sqf
index d2e6e1226..e650658d0 100644
--- a/SQF/dayz_code/system/scheduler/sched_gravity.sqf
+++ b/SQF/dayz_code/system/scheduler/sched_gravity.sqf
@@ -6,26 +6,24 @@ sched_gravity_init = {
};
sched_gravity = {
- private ["_otime","_opos","_offtime","_offpos","_oid","_idTrickCount","_timeTrickCount","_time","_ppos","_fftime","_ffpos","_pid","_netid","_initDone"];
-
if ((!(_this select 5) and !isNil 'Dayz_loginCompleted') and {(Dayz_loginCompleted)}) then {
_this = [ time, VisiblePositionASL player, time, VisiblePositionASL player, false, true];
//diag_log [ diag_tickTime, __FILE__, "freefall inited" ];
};
- _otime = _this select 0;
- _opos = _this select 1;
- _offtime = _this select 2;
- _offpos = _this select 3;
- _inprogress = _this select 4;
- _initDone = _this select 5;
+ local _otime = _this select 0;
+ local _opos = _this select 1;
+ local _offtime = _this select 2;
+ local _offpos = _this select 3;
+ local _inprogress = _this select 4;
+ local _initDone = _this select 5;
if (_initDone) then {
// detect and save freefall start
- _time = time;
- _ppos = VisiblePositionASL player;
- _fftime = _time;
- _ffpos = +(_ppos);
+ local _time = time;
+ local _ppos = VisiblePositionASL player;
+ local _fftime = _time;
+ local _ffpos = +(_ppos);
if ((_opos select 2) - (_ppos select 2) >= if (_inprogress) then {0.1} else {0.39} ) then {
_fftime = _offtime;
_ffpos = +(_offpos);
diff --git a/SQF/dayz_code/system/scheduler/sched_gui.sqf b/SQF/dayz_code/system/scheduler/sched_gui.sqf
index deafe3ee5..c5e372610 100644
--- a/SQF/dayz_code/system/scheduler/sched_gui.sqf
+++ b/SQF/dayz_code/system/scheduler/sched_gui.sqf
@@ -4,13 +4,11 @@ sched_gui_init = { [false] };
sched_gui = {
HIDE_FSM_VARS
- private [ "_array", "_initDone", "_ui"];
+ local _initDone = _this select 0;
- _initDone = _this select 0;
-
- if ((!_initDone and !isNil 'Dayz_loginCompleted') and {(Dayz_loginCompleted)}) then {
+ if (!_initDone && !isNil 'Dayz_loginCompleted' && {Dayz_loginCompleted}) then {
if !(DZE_UI == 0) then {
- _ui = call {
+ local _ui = call {
if (DZE_UI == 1) exitWith {"playerStatusGUI"};
if (DZE_UI == 2) exitWith {"playerStatusGUI_epoch"};
"playerStatusGUI_legacy";
@@ -28,7 +26,7 @@ sched_gui = {
// diag_log [ diag_Ticktime, __FILE__, "waiting", _initDone,Dayz_loginCompleted];
//};
if (_initDone) then {
- _array = player call world_surfaceNoise;
+ local _array = player call world_surfaceNoise;
dayz_surfaceNoise = _array select 1;
dayz_surfaceType = _array select 0;
call player_checkStealth;
diff --git a/SQF/dayz_code/system/scheduler/sched_medical.sqf b/SQF/dayz_code/system/scheduler/sched_medical.sqf
index c1416a146..56be9f3f0 100644
--- a/SQF/dayz_code/system/scheduler/sched_medical.sqf
+++ b/SQF/dayz_code/system/scheduler/sched_medical.sqf
@@ -17,10 +17,8 @@ sched_medical_slow = { // 10 seconds
sched_medical_init = { [ []spawn{} ] };
sched_medical = { // 1 second
HIDE_FSM_VARS
-
- private ["_unconHdlr","_lowBlood"];
- _unconHdlr = _this select 0;
+ local _unconHdlr = _this select 0;
if (r_player_blood == r_player_bloodTotal) then {
r_player_foodstack = 0;
@@ -33,7 +31,7 @@ sched_medical = { // 1 second
};
if (!canStand player) then { // be consistant with player_updateGui.sqf
- if ((player getVariable ["hit_legs", 0] < 1) OR !r_fracture_legs) then {
+ if ((player getVariable ["hit_legs", 0] < 1) || !r_fracture_legs) then {
player setVariable ["hit_legs",1,true];
r_fracture_legs = true;
};
@@ -50,8 +48,8 @@ sched_medical = { // 1 second
};
"dynamicBlur" ppEffectEnable true;"dynamicBlur" ppEffectAdjust [random 4]; "dynamicBlur" ppEffectCommit 0.2;
};
- _lowBlood = player getVariable ["USEC_lowBlood", false];
- if ((r_player_blood < r_player_bloodTotal) and {!_lowBlood}) then {
+ local _lowBlood = player getVariable ["USEC_lowBlood", false];
+ if ((r_player_blood < r_player_bloodTotal) && !_lowBlood) then {
player setVariable["USEC_lowBlood",true,true];
};
@@ -61,7 +59,7 @@ sched_medical = { // 1 second
};
//Handle Unconscious player
- if ((r_player_unconscious) and {!r_player_unconsciousInProgress} and {scriptDone _unconHdlr}) then {
+ if ((r_player_unconscious) && !r_player_unconsciousInProgress && (scriptDone _unconHdlr)) then {
//localize "CLIENT: Start Unconscious Function";
_unconHdlr = [] spawn fnc_usec_unconscious;
};
@@ -79,13 +77,11 @@ sched_medical = { // 1 second
};
sched_medical_effects_init = {
- private ["_hndCC", "_hndDB", "_hndRB"];
-
- _hndCC = ppEffectCreate ["colorCorrections", 3];
+ local _hndCC = ppEffectCreate ["colorCorrections", 3];
_hndCC ppEffectEnable true;
- _hndDB = ppEffectCreate ["dynamicBlur", 2];
+ local _hndDB = ppEffectCreate ["dynamicBlur", 2];
_hndDB ppEffectEnable true;
- _hndRB = ppEffectCreate ["radialBlur", 1];
+ local _hndRB = ppEffectCreate ["radialBlur", 1];
_hndRB ppEffectEnable true;
_hndRB ppEffectAdjust [0, 0, 0.5, 0.5];
_hndRB ppEffectCommit 0;
@@ -97,12 +93,12 @@ sched_medical_effects = {
// every 2 seconds:
// change saturation, blur and vignetting according to blood level
// Shivering if character temperature is near the minimum
-
- private ["_hndCC", "_hndDB", "_tmp1", "_tmp2", "_tmp3","_hndRB"];
-
- _hndCC = _this select 0;
- _hndDB = _this select 1;
- _hndRB = _this select 2;
+ local _hndCC = _this select 0;
+ local _hndDB = _this select 1;
+ local _hndRB = _this select 2;
+ local _tmp1 = 0;
+ local _tmp2 = 0;
+ local _tmp3 = 0;
if (r_player_infected) then {
_tmp1 = 0.4 + 0.06 * cos(diag_tickTime * 360 / 12);
@@ -131,7 +127,7 @@ sched_medical_effects = {
[_hndCC, _hndDB, _hndRB] ppEffectCommit 1.5;
//Add Shivering
- if (dayz_temperatur <= (0.125 * (dayz_temperaturmax - dayz_temperaturmin) + dayz_temperaturmin) and {(vehicle player == player and speed player < 5) or (vehicle player != player)}) then {
+ if (dayz_temperatur <= (0.125 * (dayz_temperaturmax - dayz_temperaturmin) + dayz_temperaturmin) && {((vehicle player == player) && (speed player < 5)) || (vehicle player != player)}) then {
addCamShake [0.6 * (dayz_temperaturmin / dayz_temperatur), 2, 30];
};
@@ -142,7 +138,7 @@ sched_medical_effectsSlow = {
// every 10 seconds
HIDE_FSM_VARS
- if (!r_player_unconscious && {r_player_infected or r_player_inpain}) then {
+ if (!r_player_unconscious && {r_player_infected || r_player_inpain}) then {
//Original pain shake was stronger [2, 1, 25]
//Low blood still uses strong shake in init_medical.sqf
addCamShake [1, 1, 20];
@@ -150,7 +146,7 @@ sched_medical_effectsSlow = {
if (!r_player_infected) then {
playSound "breath_1"; //In pain
} else {
- if ((1 > random 2) && {speed player < 5 or {vehicle player != player}}) then {
+ if ((1 > random 2) && {speed player < 5 || {vehicle player != player}}) then {
[player,"cough",1,false] call dayz_zombieSpeak;
};
};
diff --git a/SQF/dayz_code/system/scheduler/sched_oneachframe.sqf b/SQF/dayz_code/system/scheduler/sched_oneachframe.sqf
index e6889913f..0265b02bc 100644
--- a/SQF/dayz_code/system/scheduler/sched_oneachframe.sqf
+++ b/SQF/dayz_code/system/scheduler/sched_oneachframe.sqf
@@ -10,8 +10,7 @@ sched_onEachFrame_init = {
};
sched_onEachFrame = {
- private ["_ret"];
- _ret = (1==0);
+ local _ret = (1==0);
if (diag_fpsmin < 10) then {
sched_ef_lowFPSctr = sched_ef_lowFPSctr +1;
diff --git a/SQF/dayz_code/system/scheduler/sched_security.sqf b/SQF/dayz_code/system/scheduler/sched_security.sqf
index 129d1e89e..16f328393 100644
--- a/SQF/dayz_code/system/scheduler/sched_security.sqf
+++ b/SQF/dayz_code/system/scheduler/sched_security.sqf
@@ -6,14 +6,12 @@ sched_security_init = {
};
sched_security = {
- private ["_netid","_timeTrickCount","_idTrickCount","_time","_otime","_pid", "_quit", "_list"];
-
- _netid = _this select 0;
- _otime = _this select 1;
- _idTrickCount = _this select 2;
- _timeTrickCount = _this select 3;
- _grp = _this select 4;
- _time = time;
+ local _netid = _this select 0;
+ local _otime = _this select 1;
+ local _idTrickCount = _this select 2;
+ local _timeTrickCount = _this select 3;
+ local _grp = _this select 4;
+ local _time = time;
if (typeName player != "OBJECT") then {
PVDZ_sec_atp = format["WARNING typename error for play3r UID#%1", getPlayerUID player];
@@ -38,7 +36,7 @@ sched_security = {
};
};
- _pid = netid player;
+ local _pid = netid player;
_idTrickCount = _idTrickCount * 0.8;
if (_pid != _netid) then {
_idTrickCount = _idTrickCount +1;
@@ -50,13 +48,13 @@ sched_security = {
if (isNull _grp) then { _grp = group ((entities 'FunctionsManager') select 0); };
if (!isNull _grp) then {
- _list = units _grp;
+ local _list = units _grp;
if (count _list > 1) then {
- _quit = false;
+ local _quit = false;
for "_i" from 2 to (count _list)-1 do {
- _u = (_list select _i);
+ local _u = (_list select _i);
if (!isNull _u) then {
- _pos = getPosATL _u;
+ local _pos = getPosATL _u;
PVDZ_sec_atp = format ["From play3r UID#%1: illegal gr0up m3mber %2 at %3,%4... Server may be compromised!", getPlayerUID player, typeOf _u, _pos select 0, _pos select 1];
publicVariableServer "PVDZ_sec_atp";
deleteVehicle _u;
diff --git a/SQF/dayz_code/system/scheduler/sched_throwable.sqf b/SQF/dayz_code/system/scheduler/sched_throwable.sqf
index a2c65f722..350fe5287 100644
--- a/SQF/dayz_code/system/scheduler/sched_throwable.sqf
+++ b/SQF/dayz_code/system/scheduler/sched_throwable.sqf
@@ -12,10 +12,8 @@ sched_throwable_init = {
};
sched_throwable = {
- private ["_stance","_cur_muzz","_type", "_x"];
-
if ((!isNil "player") and {(!isNull player)}) then {
- _cur_muzz = currentMuzzle player;
+ local _cur_muzz = currentMuzzle player;
if (((!isNil "_cur_muzz") and {(_cur_muzz != "")}) AND {(0 == getNumber(configFile >> "CfgWeapons" >> _cur_muzz >> "type"))}) then {
if (sched_throwable_prevmuzz != _cur_muzz) then {
sched_throwable_prevmuzz = currentMuzzle player;
@@ -26,9 +24,9 @@ sched_throwable = {
};
};
if (abs(sched_throwable_time-diag_tickTime)<2) then {
- _stance = toArray (animationState player);
+ local _stance = toArray (animationState player);
_stance = if ((!isNil "_stance") and {(count _stance>17)}) then {toString [_stance select 17]} else {""};
- _type = 4096;
+ local _type = 4096;
switch _stance do {
case "p": { _type = 2; };
case "r": { _type = 1; };
diff --git a/SQF/dayz_server/compile/server_playerSync.sqf b/SQF/dayz_server/compile/server_playerSync.sqf
index c85032263..3ae756a3d 100644
--- a/SQF/dayz_server/compile/server_playerSync.sqf
+++ b/SQF/dayz_server/compile/server_playerSync.sqf
@@ -1,25 +1,18 @@
#include "\z\addons\dayz_server\compile\server_toggle_debug.hpp"
-private ["_distanceFoot","_playerPos","_lastPos","_playerGear","_medical","_currentModel","_currentAnim",
-"_currentWpn","_muzzles","_array","_coins","_key","_globalCoins","_bankCoins","_playerBackp","_exitReason",
-"_backpack","_kills","_killsB","_killsH","_headShots","_humanity","_lastTime","_timeGross","_timeSince",
-"_timeLeft","_config","_onLadder","_isTerminal","_modelChk","_temp","_currentState","_character",
-"_magazines","_characterID","_charPos","_isInVehicle","_name","_inDebug","_newPos","_count","_maxDist","_relocate","_playerUID","_statsDiff"];
-//[player,array]
-
-_character = _this select 0;
-_magazines = _this select 1;
+local _character = _this select 0;
+local _magazines = _this select 1;
local _dayz_onBack = _this select 2;
-_characterID = _character getVariable ["characterID","0"];
-_playerUID = getPlayerUID _character;
-_charPos = getPosATL _character;
-_isInVehicle = vehicle _character != _character;
-_timeSince = 0;
-_humanity = 0;
-_name = if (alive _character) then {name _character} else {"Dead Player"};
-_inDebug = (respawn_west_original distance _charPos) < 1500;
+local _characterID = _character getVariable ["characterID","0"];
+local _playerUID = getPlayerUID _character;
+local _charPos = getPosATL _character;
+local _isInVehicle = vehicle _character != _character;
+local _timeSince = 0;
+local _humanity = 0;
+local _name = if (alive _character) then {name _character} else {"Dead Player"};
+local _inDebug = (respawn_west_original distance _charPos) < 1500;
-_exitReason = call {
+local _exitReason = call {
if (isNil "_characterID") exitwith {("ERROR: Cannot Sync Character " + _name + " has nil characterID")}; //Unit is null
if (_inDebug) exitwith {format["INFO: Cannot Sync Character %1 near respawn_west %2. This is normal when relogging or changing clothes.",_name,_charPos]};
if (_characterID == "0") exitwith {("ERROR: Cannot Sync Character " + _name + " has no characterID")};
@@ -32,31 +25,32 @@ if (_exitReason != "none") exitWith {
};
//Check for player initiated updates
-_playerPos = [];
-_playerGear = [];
-_playerBackp = [];
-_medical = [];
-_distanceFoot = 0;
+local _playerPos = [];
+local _playerGear = [];
+local _playerBackp = [];
+local _medical = [];
+local _distanceFoot = 0;
//all getVariable immediately
-_globalCoins = _character getVariable ["globalMoney", -1];
-_bankCoins = _character getVariable ["bankMoney", -1];
-_coins = _character getVariable ["cashMoney", -1]; //should getting coins fail set the variable to an invalid value to prevent overwritting the in the DB
-_lastPos = _character getVariable ["lastPos",_charPos];
-_usec_Dead = _character getVariable ["USEC_isDead",false];
-_lastTime = _character getVariable ["lastTime",-1];
-_modelChk = _character getVariable ["model_CHK",""];
-_temp = round (_character getVariable ["temperature",100]);
-_lastMagazines = _character getVariable ["ServerMagArray",[[],""]];
+local _globalCoins = _character getVariable ["globalMoney", -1];
+local _bankCoins = _character getVariable ["bankMoney", -1];
+local _coins = _character getVariable ["cashMoney", -1]; //should getting coins fail set the variable to an invalid value to prevent overwritting the in the DB
+local _lastPos = _character getVariable ["lastPos",_charPos];
+local _usec_Dead = _character getVariable ["USEC_isDead",false];
+local _lastTime = _character getVariable ["lastTime",-1];
+local _modelChk = _character getVariable ["model_CHK",""];
+local _temp = round (_character getVariable ["temperature",100]);
+local _lastMagazines = _character getVariable ["ServerMagArray",[[],""]];
//Get difference between current stats and stats at last sync
-_statsDiff = [_character,_playerUID] call server_getStatsDiff;
+local _statsDiff = [_character,_playerUID] call server_getStatsDiff;
_humanity = _statsDiff select 0;
-_kills = _statsDiff select 1;
-_headShots = _statsDiff select 2;
-_killsH = _statsDiff select 3;
-_killsB = _statsDiff select 4;
+local _kills = _statsDiff select 1;
+local _headShots = _statsDiff select 2;
+local _killsH = _statsDiff select 3;
+local _killsB = _statsDiff select 4;
-_charPosLen = count _charPos;
+local _charPosLen = count _charPos;
+local _magTemp = [];
if (!isNil "_magazines") then {
_playerGear = [weapons _character,_magazines,_dayz_onBack];
@@ -67,13 +61,13 @@ if (!isNil "_magazines") then {
if (count _magTemp > 0) then {
_magazines = [(magazines _character),20] call array_reduceSize;
{
- _class = _x;
+ local _class = _x;
if (typeName _x == "ARRAY") then {
_class = _x select 0;
};
if (_class in _magazines) then {
- _MatchedCount = {_compare = if (typeName _x == "ARRAY") then {_x select 0;} else {_x}; _compare == _class} count _magTemp;
- _CountedActual = {_x == _class} count _magazines;
+ local _MatchedCount = {_compare = if (typeName _x == "ARRAY") then {_x select 0;} else {_x}; _compare == _class} count _magTemp;
+ local _CountedActual = {_x == _class} count _magazines;
if (_MatchedCount > _CountedActual) then {
_magTemp set [_forEachIndex, "0"];
};
@@ -100,7 +94,7 @@ if !((_charPos select 0 == 0) && (_charPos select 1 == 0)) then {
};
//Check player backpack each time sync runs
-_backpack = unitBackpack _character;
+local _backpack = unitBackpack _character;
_playerBackp = [typeOf _backpack,getWeaponCargo _backpack,getMagazineCargo _backpack];
if (!_usec_Dead) then {
@@ -112,23 +106,24 @@ _character addScore _kills;
Assess how much time has passed, for recording total time on server
Note "lastTime" is -1 after clothes change
*/
+local _timeLeft = 0;
if (_lastTime == -1) then {
_character setVariable ["lastTime",diag_tickTime,false];
} else {
- _timeGross = (diag_tickTime - _lastTime);
+ local _timeGross = (diag_tickTime - _lastTime);
_timeSince = floor (_timeGross / 60);
_timeLeft = (_timeGross - (_timeSince * 60));
};
/*
Get character state details
*/
-_currentWpn = currentMuzzle _character;
-_currentAnim = animationState _character;
-_config = configFile >> "CfgMovesMaleSdr" >> "States" >> _currentAnim;
-_onLadder = (getNumber (_config >> "onLadder")) == 1;
-_isTerminal = (getNumber (_config >> "terminal")) == 1;
+local _currentWpn = currentMuzzle _character;
+local _currentAnim = animationState _character;
+local _config = configFile >> "CfgMovesMaleSdr" >> "States" >> _currentAnim;
+local _onLadder = (getNumber (_config >> "onLadder")) == 1;
+local _isTerminal = (getNumber (_config >> "terminal")) == 1;
//_wpnDisabled = (getNumber (_config >> "disableWeapons")) == 1;
-_currentModel = typeOf _character;
+local _currentModel = typeOf _character;
if (_currentModel == _modelChk) then {
_currentModel = "";
} else {
@@ -152,14 +147,14 @@ if (count _this > 4) then { //calling from player_onDisconnect
};
if (_isInVehicle) then {
//if the player object is inside a vehicle lets eject the player
- _relocate = ((vehicle _character isKindOf "Air") && (_charPos select 2 > 1.5));
+ local _relocate = ((vehicle _character isKindOf "Air") && (_charPos select 2 > 1.5));
_character action ["eject", vehicle _character];
// Prevent relog in parachute, heli or plane above base exploit to get inside
if (_relocate) then {
- _count = 0;
- _maxDist = 800;
- _newPos = [_charPos, 80, _maxDist, 10, 1, 0, 0, [], [_charPos,_charPos]] call BIS_fnc_findSafePos;
+ local _count = 0;
+ local _maxDist = 800;
+ local _newPos = [_charPos, 80, _maxDist, 10, 1, 0, 0, [], [_charPos,_charPos]] call BIS_fnc_findSafePos;
while {_newPos distance _charPos == 0} do {
_count = _count + 1;
@@ -168,7 +163,7 @@ if (count _this > 4) then { //calling from player_onDisconnect
};
_newPos set [2,0]; //findSafePos only returns two elements
_charPos = _newPos;
- diag_log format["%1(%2) logged out in air vehicle. Relocated to safePos.",_name,_playerUID];
+ diag_log format["%1(%2) logged out in air vehicle. Relocated to safePos %3 - %4.",_name,_playerUID,mapGridPosition _charPos,_charPos];
};
};
};
@@ -184,14 +179,14 @@ if (_isInVehicle) then {
_currentWpn = "";
} else {
if (typeName _currentWpn == "STRING") then {
- _muzzles = getArray (configFile >> "cfgWeapons" >> _currentWpn >> "muzzles");
+ local _muzzles = getArray (configFile >> "cfgWeapons" >> _currentWpn >> "muzzles");
if (count _muzzles > 1) then {_currentWpn = currentMuzzle _character;};
} else {
//diag_log ("DW_DEBUG: _currentWpn: " + str(_currentWpn));
_currentWpn = "";
};
};
-_currentState = [[_currentWpn,_currentAnim,_temp],[]];
+local _currentState = [[_currentWpn,_currentAnim,_temp],[]];
//Reset timer
if (_timeSince > 0) then {
@@ -203,7 +198,7 @@ if (_timeSince > 0) then {
Low priority code below this point where _character object is no longer needed and may be Null.
*/
if (count _playerPos > 0) then {
- _array = [];
+ local _array = [];
{
if (_x > dayz_minpos && _x < dayz_maxpos) then {_array set [count _array,_x];};
} forEach (_playerPos select 1);
@@ -211,7 +206,7 @@ if (count _playerPos > 0) then {
};
//Wait for HIVE to be free and send request
-_key = if (Z_SingleCurrency) then {
+local _key = if (Z_SingleCurrency) then {
str formatText["CHILD:201:%1:%2:%3:%4:%5:%6:%7:%8:%9:%10:%11:%12:%13:%14:%15:%16:%17:",_characterID,_playerPos,_playerGear,_playerBackp,_medical,false,false,_kills,_headShots,_distanceFoot,_timeSince,_currentState,_killsH,_killsB,_currentModel,_humanity,_coins]
} else {
str formatText["CHILD:201:%1:%2:%3:%4:%5:%6:%7:%8:%9:%10:%11:%12:%13:%14:%15:%16:",_characterID,_playerPos,_playerGear,_playerBackp,_medical,false,false,_kills,_headShots,_distanceFoot,_timeSince,_currentState,_killsH,_killsB,_currentModel,_humanity]