diff --git a/SQF/dayz_code/compile/fn_damageActions.sqf b/SQF/dayz_code/compile/fn_damageActions.sqf index 2c51d9593..f7923f62f 100644 --- a/SQF/dayz_code/compile/fn_damageActions.sqf +++ b/SQF/dayz_code/compile/fn_damageActions.sqf @@ -8,7 +8,7 @@ scriptName "Functions\misc\fn_damageActions.sqf"; - [] call fnc_usec_damageActions; ************************************************************/ -private ["_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","_hasEmptyBag","_hasTester","_hasAntibiotics","_hasBloodBag","_vehClose","_action1","_action2","_action3","_playerMagazines","_isFriendly"]; +private ["_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"]; _menClose = cursorTarget; _hasPatient = alive _menClose; @@ -29,9 +29,9 @@ if (_inVehicle) then { }; if (!r_player_unconscious && !r_action2) then { r_player_lastSeat = _assignedRole; - if (_vehicle isKindOf "helicopter" || (_inVehicle && ({(isPlayer _x) && (alive _x)} count (crew _vehicle) > 1))) then { + if (_vehicle isKindOf "helicopter" || {_inVehicle && {{(isPlayer _x) && (alive _x)} count (crew _vehicle) > 1}}) then { //allow switch to pilot - if (((_assignedRole select 0) != "driver") && ((!alive _driver) or ((_vehicle emptyPositions "Driver") > 0))) then { + if (((_assignedRole select 0) != "driver") && {(!alive _driver) || {(_vehicle emptyPositions "Driver") > 0}}) then { if (_vehicle isKindOf "helicopter") then { _action = _vehicle addAction [localize "str_actions_helipilotseat", "\z\addons\dayz_code\actions\veh_seatActions.sqf",["MoveToPilot",_driver], 0, false, true]; } else { @@ -41,25 +41,25 @@ if (_inVehicle) then { r_action2 = true; }; //allow switch to cargo - if (((_assignedRole select 0) != "cargo") && ((_vehicle emptyPositions "Cargo") > 0)) then { + if (((_assignedRole select 0) != "cargo") && {(_vehicle emptyPositions "Cargo") > 0}) then { _action = _vehicle addAction [localize "str_actions_helibackseat", "\z\addons\dayz_code\actions\veh_seatActions.sqf",["MoveToCargo",_driver], 0, false, true]; r_player_actions2 set [count r_player_actions2,_action]; r_action2 = true; }; //allow switch to gunner - if (((_assignedRole select 0) != "Turret") && ((_vehicle emptyPositions "Gunner") > 0)) then { + if (((_assignedRole select 0) != "Turret") && {(_vehicle emptyPositions "Gunner") > 0}) then { _action = _vehicle addAction [localize "str_actions_heligunnerseat", "\z\addons\dayz_code\actions\veh_seatActions.sqf",["MoveToTurret",_driver], 0, false, true]; r_player_actions2 set [count r_player_actions2,_action]; r_action2 = true; }; //allow switch to commander - if (((assignedCommander _vehicle) != player) && ((_vehicle emptyPositions "Commander") > 0)) then { + if (((assignedCommander _vehicle) != player) && {(_vehicle emptyPositions "Commander") > 0}) then { _action = _vehicle addAction[localize "STR_EPOCH_PLAYER_311", "\z\addons\dayz_code\actions\veh_seatActions.sqf", ["MoveToTurret", _driver], 0, false, true]; r_player_actions2 set [count r_player_actions2,_action]; r_action2 = true; }; }; - if ((count _assignedRole) > 1 || ((_assignedRole select 0) == "driver")) then { + if ((count _assignedRole) > 1 || {(_assignedRole select 0) == "driver"}) then { _turret = [-1]; if ((count _assignedRole) > 1) then { _turret = _assignedRole select 1; @@ -113,14 +113,14 @@ 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 { + if (!r_drag_sqf && {!r_action} && {!_inVehicle} && {!r_player_unconscious} && {player distance _menClose < 3}) then { _unit = cursorTarget; player reveal _unit; - + //Arrays _antibiotics =["ItemAntibiotic","ItemAntibiotic1","ItemAntibiotic2","ItemAntibiotic3","ItemAntibiotic4","ItemAntibiotic5","ItemAntibiotic6"]; _bloodBags = ["ItemBloodbag","bloodBagANEG","bloodBagAPOS","bloodBagBNEG","bloodBagBPOS","bloodBagABNEG","bloodBagABPOS","bloodBagONEG","bloodBagOPOS"]; - + //Var checks _unconscious = _unit getVariable ["NORRN_unconscious", false]; _lowBlood = _unit getVariable ["USEC_lowBlood", false]; @@ -130,7 +130,7 @@ if (isPlayer cursorTarget) then { _legsBroke = _unit getVariable ["hit_legs", 0] >= 1; _armsBroke = _unit getVariable ["hit_hands", 0] >= 1; _infected = _unit getVariable ["USEC_infected", false]; - + //Magazine checks _playerMagazines = magazines player; _hasBandage = "ItemBandage" in _playerMagazines; @@ -139,12 +139,9 @@ if (isPlayer cursorTarget) then { _hasMorphine = "ItemMorphine" in _playerMagazines; _hasSplint = "equip_woodensplint" in _playerMagazines; _hasPainkillers = "ItemPainkiller" in _playerMagazines; - //_hasEmptyBag = "emptyBloodBag" in _playerMagazines; - //_hasTester = "bloodTester" in _playerMagazines; - _hasAntibiotics = Array_Any(_playerMagazines, {_this in _antibiotics}); _hasBloodBag = Array_Any(_playerMagazines, {_this in _bloodBags}); - + _vehClose = (getPosATL player) nearEntities [["Car","Tank","Helicopter","Plane","StaticWeapon","Ship"],5]; if (_hasPatient) then { @@ -168,49 +165,49 @@ if (isPlayer cursorTarget) then { r_player_actions set [count r_player_actions,NORRN_loadWoundedAction]; }; //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, "", "'ItemBandage' in magazines player"]; r_player_actions set [count r_player_actions,_action]; }; //Sepsis - if(_hasSepsis && _hasSepsisBandage) then { + if(_hasSepsis && {_hasSepsisBandage}) then { r_action = true; _action = _unit addAction [localize "str_actions_medical_04", "\z\addons\dayz_code\medical\bandage.sqf",[_unit,"ItemSepsisBandage"], 0, true, true, "", "'ItemBandage' in magazines player"]; 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 or _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, "", "'ItemMorphine' in magazines player"]; r_player_actions set [count r_player_actions,_action]; }; //Allow player to give equip_woodensplint - if((_legsBroke or _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, "", "'equip_woodensplint' in magazines player"]; 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, "", "'ItemPainkiller' in magazines player"]; r_player_actions set [count r_player_actions,_action]; }; //Allow player to transfuse blood - if(_lowBlood && _hasBloodBag) then { + if(_lowBlood && {_hasBloodBag}) then { r_action = true; _action = _unit addAction [localize "str_actions_medical_08", "\z\addons\dayz_code\medical\transfusion.sqf",[_unit], 0, true, true]; r_player_actions set [count r_player_actions,_action]; }; //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]; @@ -233,7 +230,7 @@ if (isPlayer cursorTarget) then { }; //Remove Actions -if ((!_isClose or !_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 a9abaccb4..850f9eaac 100644 --- a/SQF/dayz_code/compile/fn_selfActions.sqf +++ b/SQF/dayz_code/compile/fn_selfActions.sqf @@ -40,7 +40,7 @@ if (!isNull _nearLight) then { }; //Grab Flare -if (_canPickLight && !dayz_hasLight && !_isPZombie) then { +if (_canPickLight && {!dayz_hasLight} && {!_isPZombie}) then { if (s_player_grabflare < 0) then { _text = getText (configFile >> "CfgAmmo" >> (typeOf _nearLight) >> "displayName"); s_player_grabflare = player addAction [format[localize "str_actions_medical_15",_text], "\z\addons\dayz_code\actions\flare_pickup.sqf",_nearLight, 1, false, true]; @@ -112,7 +112,7 @@ 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; @@ -178,7 +178,7 @@ if (DZE_HaloJump) then { }; if (DZE_NameTags > 0) then { - if (s_player_showname < 0 && !_isPZombie) then { + if (s_player_showname < 0 && {!_isPZombie}) then { if (DZE_NameTags < 2) then { s_player_showname = 1; player setVariable["DZE_display_name",true,true]; @@ -199,11 +199,11 @@ if (_isPZombie) then { if (s_player_pzombiesvision < 0) 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 { + if (!isNull _cursorTarget && {_isClose}) then { _isZombie = _cursorTarget isKindOf "zZombie_base"; _isHarvested = _cursorTarget getVariable["meatHarvested",false]; _isMan = _cursorTarget isKindOf "Man"; //includes animals and zombies - if (!alive _cursorTarget && _isMan && !_isZombie && !_isHarvested) then { + 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]; }; @@ -218,9 +218,9 @@ if (_isPZombie) then { }; // Increase distance only if AIR or SHIP -_allowedDistance = if ((_cursorTarget isKindOf "Air") or (_cursorTarget isKindOf "Ship")) then {8} else {4}; +_allowedDistance = [4, 8] select ((_cursorTarget isKindOf "Air") || (_cursorTarget isKindOf "Ship")); -if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cursorTarget < _allowedDistance) && _canDo) then { +if (!isNull _cursorTarget && {!_inVehicle} && {!_isPZombie} && {player distance _cursorTarget < _allowedDistance} && {_canDo}) then { //Has some kind of target _typeOfCursorTarget = typeOf _cursorTarget; _isVehicle = _cursorTarget isKindOf "AllVehicles"; @@ -239,7 +239,6 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur _weaponsPlayer = weapons player; _hasCrowbar = "ItemCrowbar" in _itemsPlayer or "MeleeCrowbar" in _weaponsPlayer or dayz_onBack == "MeleeCrowbar"; _hasToolbox = "ItemToolbox" in _itemsPlayer; - _hasbottleitem = ({_x in ["ItemWaterBottle","ItemWaterBottleInfected","ItemWaterBottleSafe","ItemWaterBottleBoiled","ItemPlasticWaterBottle","ItemPlasticWaterBottleInfected","ItemPlasticWaterBottleSafe","ItemPlasticWaterBottleBoiled"]} count _magazinesPlayer) > 0; _isAlive = alive _cursorTarget; _text = getText (configFile >> "CfgVehicles" >> _typeOfCursorTarget >> "displayName"); _isPlant = _typeOfCursorTarget in Dayz_plants; @@ -285,7 +284,7 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur }; //Allow player to fill Fuel can - if (_hasEmptyFuelCan && _isFuel && _isAlive) then { + if (_hasEmptyFuelCan && {_isFuel} && {_isAlive}) then { if (s_player_fillfuel < 0) then { s_player_fillfuel = player addAction [localize "str_actions_self_10", "\z\addons\dayz_code\actions\jerry_fill.sqf",_cursorTarget, 1, false, true]; }; @@ -357,13 +356,13 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur //Cook Meat - if (_hasRawMeat && !a_player_cooking) then { + if (_hasRawMeat && {!a_player_cooking}) then { if (s_player_cook < 0) then { s_player_cook = player addAction [localize "str_actions_self_05", "\z\addons\dayz_code\actions\cook.sqf",_cursorTarget, 3, true, true]; }; }; //Boil Water - if (_hasunboiledwater && !a_player_boil) then { + if (_hasunboiledwater && {!a_player_boil}) then { if (s_player_boil < 0) then { s_player_boil = player addAction [localize "str_actions_boilwater", "\z\addons\dayz_code\actions\boil.sqf",_cursorTarget, 3, true, true]; }; @@ -383,16 +382,16 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur _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 { - if (_hasToolbox && _hasCrowbar) then { + if (!_restrict && {_isDestructable || {_typeOfCursorTarget in DZE_isWreck} || {_typeOfCursorTarget in DZE_isWreckBuilding} || {_typeOfCursorTarget in DZE_isRemovable}}) then { + if (_hasToolbox && {_hasCrowbar}) then { _player_deleteBuild = true; }; }; //Allow player to remove objects only if they have proper ownership or access - if (_restrict || _isModular || _isModularDoor || _isGenerator || _typeOfCursorTarget in DZE_isDestroyableStorage) then { - if (_hasToolbox && _hasCrowbar) then { + if (_restrict || {_isModular} || {_isModularDoor} || {_isGenerator} || {_typeOfCursorTarget in DZE_isDestroyableStorage}) then { + if (_hasToolbox && {_hasCrowbar}) then { _hasAccess = [player, _cursorTarget] call FNC_check_access; - if ((_hasAccess select 0) or (_hasAccess select 2) or (_hasAccess select 3)) then { + if ((_hasAccess select 0) || {_hasAccess select 2} || {_hasAccess select 3}) then { _player_deleteBuild = true; }; }; @@ -443,7 +442,7 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur //other tents if (_istypeTent) then { _hasIgnitors = {_x in DayZ_Ignitors} count _itemsPlayer > 0; - if ((_hasFuel20 or _hasFuel5 or _hasBarrel) && _hasIgnitors) then { + 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]; }; @@ -607,11 +606,11 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur player removeAction s_player_breakinhouse; s_player_breakinhouse = -1; };*/ - if (_typeOfCursorTarget == "Plastic_Pole_EP1_DZ" && {speed player <= 1}) then { + if ((_typeOfCursorTarget == "Plastic_Pole_EP1_DZ") && {speed player <= 1}) then { _hasAccess = [player, _cursorTarget] call FNC_check_access; - _allowed = ((_hasAccess select 0) or (_hasAccess select 2) or (_hasAccess select 3) or (_hasAccess select 4)); + _allowed = ((_hasAccess select 0) || {_hasAccess select 2} || {_hasAccess select 3} || {_hasAccess select 4}); if (DZE_permanentPlot) then { - if (s_player_plotManagement < 0 && _allowed) 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]; }; } else { @@ -621,7 +620,7 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur s_player_maintain_area_preview = player addAction [format["%1",localize "STR_EPOCH_ACTIONS_MAINTPREV"], "\z\addons\dayz_code\actions\maintain_area.sqf", "preview", 5, false]; }; }; - if (s_player_plot_boundary < 0 && (_allowed or (_hasAccess select 1))) then { + if (s_player_plot_boundary < 0 && {_allowed || (_hasAccess select 1)}) then { s_player_plot_boundary = player addAction [localize "STR_EPOCH_PLOTMANAGEMENT_SHOW_BOUNDARY", "\z\addons\dayz_code\actions\plotManagement\plotToggleMarkers.sqf", "", 1, false]; }; } else { @@ -686,7 +685,7 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur _hasKey = _characterID in _temp_keys; _oldOwner = (_characterID == _uid); if (_isLocked) then { - if (_hasKey || _oldOwner) 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]; s_player_lockunlock set [count s_player_lockunlock,_unlock]; s_player_lockUnlock_crtl = 1; @@ -700,7 +699,7 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur s_player_lockUnlock_crtl = 1; }; } else { - if (_hasKey || _oldOwner) then { + if (_hasKey || {_oldOwner}) then { _lock = player addAction [format[localize "STR_EPOCH_ACTIONS_LOCK",_text], "\z\addons\dayz_code\actions\lock_veh.sqf",_cursorTarget, 1, true, true]; s_player_lockunlock set [count s_player_lockunlock,_lock]; s_player_lockUnlock_crtl = 1; @@ -732,10 +731,10 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur }; // Allow manage door - if (DZE_doorManagement && (_typeOfCursorTarget in DZE_DoorsLocked)) then { + if (DZE_doorManagement && {_typeOfCursorTarget in DZE_DoorsLocked}) then { // Check player access _hasAccess = [player, _cursorTarget] call FNC_check_access; - if (s_player_manageDoor < 0 && ((_hasAccess select 0) or (_hasAccess select 2) or (_hasAccess select 3) or (_hasAccess select 4) or (_hasAccess select 5) or (_hasAccess select 6))) then { + if (s_player_manageDoor < 0 && {(_hasAccess select 0) || {_hasAccess select 2} || {_hasAccess select 3} || {_hasAccess select 4} || {_hasAccess select 5} || {_hasAccess select 6}}) then { s_player_manageDoor = player addAction [format["%1", localize "STR_EPOCH_ACTIONS_MANAGEDOOR"], "\z\addons\dayz_code\actions\doorManagement\initDoorManagement.sqf", _cursorTarget, 5, false]; }; } else { @@ -747,7 +746,7 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur if ((_typeOfCursorTarget in DZE_LockableStorage) && {_characterID != "0"} && {_isClose} && {!keypadCancel}) then { if (s_player_unlockvault < 0) then { if (_typeOfCursorTarget in DZE_LockedStorage) then { - if (_characterID == dayz_combination || _ownerID == _uid) 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]; s_player_combi set [count s_player_combi,_combi]; } else { @@ -756,7 +755,7 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur }; s_player_unlockvault = 1; } else { - if (_characterID != dayz_combination && _ownerID != _uid) then { + if ((_characterID != dayz_combination) && {_ownerID != _uid}) then { _combi = player addAction [localize "STR_EPOCH_ACTIONS_RECOMBO", "\z\addons\dayz_code\actions\vault_combination_1.sqf",_cursorTarget, 0, false, true]; s_player_combi set [count s_player_combi,_combi]; s_player_unlockvault = 1; @@ -771,11 +770,11 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur //Allow owner to pack vault if ((_typeOfCursorTarget in DZE_UnLockedStorage) && {_characterID != "0"} && {_isClose} && {!keypadCancel}) then { if (s_player_lockvault < 0) then { - if (_characterID == dayz_combination || _ownerID == _uid) then { + if ((_characterID == dayz_combination) || {_ownerID == _uid}) then { s_player_lockvault = player addAction [format[localize "STR_EPOCH_ACTIONS_LOCK",_text], "\z\addons\dayz_code\actions\vault_lock.sqf",_cursorTarget, 0, false, true]; }; }; - if (s_player_packvault < 0 && (_characterID == dayz_combination || _ownerID == _uid)) then { + if (s_player_packvault < 0 && {(_characterID == dayz_combination) || (_ownerID == _uid)}) then { s_player_packvault = player addAction [format["%1",(format[localize "STR_EPOCH_ACTIONS_PACK",_text])], "\z\addons\dayz_code\actions\vault_pack.sqf",_cursorTarget, 0, false, true]; }; } else { @@ -814,7 +813,7 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur }; //Fuel Pump on truck - if (_typeOfCursorTarget in DZE_fueltruckarray && _isAlive) then { + if (_typeOfCursorTarget in DZE_fueltruckarray && {_isAlive}) then { if (s_player_fuelauto2 < 0) then { // show that fuel truck pump needs power. if (isEngineOn _cursorTarget) then { @@ -829,7 +828,7 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur }; // inplace upgrade tool - if ((_cursorTarget isKindOf "ModularItems") || (_cursorTarget isKindOf "Land_DZE_WoodDoor_Base") || (_cursorTarget isKindOf "CinderWallDoor_DZ_Base")) then { + if ((_cursorTarget isKindOf "ModularItems") || {_cursorTarget isKindOf "Land_DZE_WoodDoor_Base"} || {_cursorTarget isKindOf "CinderWallDoor_DZ_Base"}) then { if ((s_player_lastTarget select 0) != _cursorTarget) then { if (s_player_upgrade_build > 0) then { player removeAction s_player_upgrade_build; @@ -839,7 +838,7 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur if (s_player_upgrade_build < 0) then { _hasAccess = [player, _cursorTarget] call FNC_check_access; _upgrade = getArray (configFile >> "CfgVehicles" >> (typeOf _cursorTarget) >> "upgradeBuilding"); - if (((_hasAccess select 0) or (_hasAccess select 2) or (_hasAccess select 3)) && (count _upgrade) > 0) then { + if (((_hasAccess select 0) || {_hasAccess select 2} || {_hasAccess select 3}) && {(count _upgrade) > 0}) then { s_player_lastTarget set [0,_cursorTarget]; s_player_upgrade_build = player addAction [format[localize "STR_EPOCH_UPGRADE",_text], "\z\addons\dayz_code\actions\player_upgrade.sqf",_cursorTarget, -1, false, true]; }; @@ -859,7 +858,7 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur }; if (s_player_downgrade_build < 0) then { _hasAccess = [player, _cursorTarget] call FNC_check_access; - if ((_hasAccess select 0) or (_hasAccess select 2) or (_hasAccess select 3)) then { + if ((_hasAccess select 0) || {_hasAccess select 2} || {_hasAccess select 3}) then { s_player_lastTarget set [1,_cursorTarget]; s_player_downgrade_build = player addAction [format[localize "STR_EPOCH_ACTIONS_REMLOCK",_text], "\z\addons\dayz_code\actions\player_buildingDowngrade.sqf",_cursorTarget, -2, false, true]; }; @@ -870,7 +869,7 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur }; // inplace maintenance tool - if ((damage _cursorTarget >= DZE_DamageBeforeMaint) && {_cursorTarget isKindOf "ModularItems" || _cursorTarget isKindOf "DZE_Housebase" || _typeOfCursorTarget == "LightPole_DZ"}) then { + if ((damage _cursorTarget >= DZE_DamageBeforeMaint) && {_cursorTarget isKindOf "ModularItems" || {_cursorTarget isKindOf "DZE_Housebase"} || {_typeOfCursorTarget == "LightPole_DZ"}}) then { if ((s_player_lastTarget select 2) != _cursorTarget) then { if (s_player_maint_build > 0) then { player removeAction s_player_maint_build; @@ -879,7 +878,7 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur }; if (s_player_maint_build < 0) then { _hasAccess = [player, _cursorTarget] call FNC_check_access; - if ((_hasAccess select 0) or (_hasAccess select 2) or (_hasAccess select 3)) then { + if ((_hasAccess select 0) || {_hasAccess select 2} || {_hasAccess select 3}) then { _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]; @@ -901,7 +900,7 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur if (_cursorTarget getVariable ["GeneratorFilled", false]) then { s_player_fillgen = player addAction [localize "STR_EPOCH_ACTIONS_GENERATOR2", "\z\addons\dayz_code\actions\fill_startGenerator.sqf",_cursorTarget, 0, false, true]; } else { - if (_hasFuel20 or _hasFuel5 or _hasBarrel) then { + if (_hasFuel20 || {_hasFuel5} || {_hasBarrel}) then { s_player_fillgen = player addAction [localize "STR_EPOCH_ACTIONS_GENERATOR3", "\z\addons\dayz_code\actions\fill_startGenerator.sqf",_cursorTarget, 0, false, true]; }; }; @@ -970,9 +969,10 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur s_player_parts_crtl = -1; }; + //Dog if (dayz_tameDogs) then { - //Dog _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 { s_player_tamedog = player addAction [localize "str_actions_tamedog", "\z\addons\dayz_code\actions\dog\tame_dog.sqf", _cursorTarget, 1, false, true]; @@ -982,10 +982,12 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur s_player_tamedog = -1; }; if (_isDog && {_ownerID == _id} && {_isAlive}) then { - if (s_player_feeddog < 0 && _hasRawMeat) then { + _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]; }; - if (s_player_waterdog < 0 && _hasbottleitem) then { + if (s_player_waterdog < 0 && {_hasbottleitem}) then { s_player_waterdog = player addAction [localize "str_actions_waterdog","\z\addons\dayz_code\actions\dog\feed.sqf",[_dogHandle,1], 0, false, true]; }; if (s_player_staydog < 0) then { @@ -1150,7 +1152,7 @@ if (_dogHandle > 0) then { _dog = _dogHandle getFSMVariable "_dog"; if (isNil "_dog") exitWith {}; if (isNil "_ownerID") then {_ownerID = "0"}; - if (_canDo && !_inVehicle && alive _dog && !(_ownerID in [_myCharID,_uid])) then { + if (_canDo && {!_inVehicle} && {alive _dog} && {!(_ownerID in [_myCharID,_uid])}) then { if (s_player_movedog < 0) then { s_player_movedog = player addAction [localize "str_actions_movedog", "\z\addons\dayz_code\actions\dog\move.sqf", player getVariable ["dogID",0], 1, false, true]; }; diff --git a/SQF/dayz_code/system/player_monitor.fsm b/SQF/dayz_code/system/player_monitor.fsm index 593a66384..83eec62df 100644 --- a/SQF/dayz_code/system/player_monitor.fsm +++ b/SQF/dayz_code/system/player_monitor.fsm @@ -1144,7 +1144,7 @@ class FSM init = /*%FSM*/"if (_debug == 1) then {diag_log [diag_tickTime,'Initialize'];};" \n "" \n "//Medical" \n - "dayz_medicalH = [] execVM ""\z\addons\dayz_code\medical\init_medical.sqf""; //Medical Monitor Script (client only)" \n + "//dayz_medicalH = [] execVM ""\z\addons\dayz_code\medical\init_medical.sqf""; //Medical Monitor Script (client only)" \n "[player] call fnc_usec_damageHandle;" \n "" \n "if (r_player_unconscious) then {" \n diff --git a/SQF/dayz_code/system/scheduler/sched_medical.sqf b/SQF/dayz_code/system/scheduler/sched_medical.sqf index acf698a4c..e203fb1ba 100644 --- a/SQF/dayz_code/system/scheduler/sched_medical.sqf +++ b/SQF/dayz_code/system/scheduler/sched_medical.sqf @@ -7,7 +7,7 @@ sched_medical_slow = { // 10 seconds //Do not global send player setVariable["USEC_BloodQty", r_player_blood, false]; player setVariable["medForceUpdate", true, false]; - //Send only to server + //Send only to server PVDZ_serverStoreVar = [player, "USEC_BloodQty", r_player_blood]; publicVariableServer "PVDZ_serverStoreVar"; }; @@ -18,7 +18,9 @@ sched_medical_slow = { // 10 seconds sched_medical_init = { [ []spawn{} ] }; sched_medical = { // 1 second HIDE_FSM_VARS - private "_unconHdlr"; + + private ["_unconHdlr","_lowBlood"]; + _unconHdlr = _this select 0; if (r_player_blood == r_player_bloodTotal) then { @@ -26,7 +28,7 @@ sched_medical = { // 1 second }; //r_player_unconscious = getVariable ["NORRN_unconscious", true]; - + if (r_player_blood <= 0) then { [dayz_sourceBleeding,"find"] call player_death; }; @@ -38,14 +40,29 @@ sched_medical = { // 1 second }; }; - if ((r_player_blood <= 3000) and !r_player_unconscious) then { - if (random 100 > 99) then { + if (!r_player_unconscious && {(r_player_blood/r_player_bloodTotal) < 0.35}) then { + r_player_lowblood = true; + playSound "heartbeat_1"; + addCamShake [2, 0.5, 25]; + if (r_player_lowblood) then { + if (!dayz_soundMuted) then { + // muted is 0.25, so this is always higher + 0 fadeSound ((r_player_blood/r_player_bloodTotal) + 0.5); + }; + "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 { + player setVariable["USEC_lowBlood",true,true]; + }; + + if (r_player_blood <= 3000 && {random 100 > 99}) then { [player, ((random 0.1) + 0.2)] call fnc_usec_damageUnconscious; }; }; //Handle Unconscious player - if ((r_player_unconscious) and (!r_player_unconsciousInProgress) and (scriptDone _unconHdlr)) then { + if ((r_player_unconscious) and {!r_player_unconsciousInProgress} and {scriptDone _unconHdlr}) then { //localize "CLIENT: Start Unconscious Function"; _unconHdlr = [] spawn fnc_usec_unconscious; }; @@ -62,7 +79,7 @@ sched_medical = { // 1 second [_unconHdlr] }; -sched_medical_effects_init = { +sched_medical_effects_init = { private ["_hndCC", "_hndDB", "_hndRB"]; _hndCC = ppEffectCreate ["colorCorrections", 3]; @@ -72,17 +89,18 @@ sched_medical_effects_init = { _hndRB = ppEffectCreate ["radialBlur", 1]; _hndRB ppEffectEnable true; _hndRB ppEffectAdjust [0, 0, 0.5, 0.5]; - _hndRB ppEffectCommit 0; - + _hndRB ppEffectCommit 0; + [ _hndCC, _hndDB, _hndRB ] }; -sched_medical_effects = { +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"]; + + private ["_hndCC", "_hndDB", "_tmp1", "_tmp2", "_tmp3","_hndRB"]; + _hndCC = _this select 0; _hndDB = _this select 1; _hndRB = _this select 2; @@ -114,7 +132,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) and {(vehicle player == player and speed player < 5) or (vehicle player != player)}) then { addCamShake [0.6 * (dayz_temperaturmin / dayz_temperatur), 2, 30]; }; @@ -125,15 +143,15 @@ 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 or 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]; - + 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 or {vehicle player != player}}) then { [player,"cough",1,false] call dayz_zombieSpeak; }; };