SHOW:
|
|
- or go back to the newest paste.
| 1 | scriptName "Functions\misc\fn_selfActions.sqf"; | |
| 2 | /*********************************************************** | |
| 3 | ADD ACTIONS FOR SELF | |
| 4 | - Function | |
| 5 | - [] call fnc_usec_selfActions; | |
| 6 | ************************************************************/ | |
| 7 | private ["_isWreckBuilding","_temp_keys","_magazinesPlayer","_isPZombie","_vehicle","_inVehicle","_hasFuelE","_hasRawMeat","_hasKnife","_hasToolbox","_onLadder","_nearLight","_canPickLight","_canDo","_text","_isHarvested","_isVehicle","_isVehicletype","_isMan","_traderType","_ownerID","_isAnimal","_isDog","_isZombie","_isDestructable","_isTent","_isFuel","_isAlive","_Unlock","_lock","_buy","_dogHandle","_lieDown","_warn","_hastinitem","_allowedDistance","_menu","_menu1","_humanity_logic","_low_high","_cancel","_metals_trader","_traderMenu","_isWreck","_isRemovable","_isDisallowRepair","_rawmeat","_humanity","_speed","_dog","_hasbottleitem","_isAir","_isShip","_playersNear","_findNearestGens","_findNearestGen","_IsNearRunningGen","_cursorTarget","_isnewstorage","_itemsPlayer","_ownerKeyId","_typeOfCursorTarget","_hasKey","_oldOwner","_combi","_key_colors","_player_deleteBuild","_player_flipveh","_player_lockUnlock_crtl","_player_butcher","_player_studybody","_player_cook","_player_boil","_hasFuelBarrelE","_hasHotwireKit","_player_SurrenderedGear","_isSurrendered","_isModular","_isModularDoor","_ownerKeyName","_temp_keys_names","_hasAttached","_allowTow","_liftHeli","_found","_posL","_posC","_height","_liftHelis","_attached","_playerUID","_characterID"]; | |
| 8 | _canDo = false; | |
| 9 | if (DZE_ActionInProgress) exitWith {}; // Do not allow if any script is running.
| |
| 10 | ||
| 11 | _vehicle = vehicle player; | |
| 12 | _isPZombie = player isKindOf "PZombie_VB"; | |
| 13 | _inVehicle = (_vehicle != player); | |
| 14 | ||
| 15 | if((speed player <= 1) && cursorTarget isKindOf "CSJ_GyroC" && _canDo) then {
| |
| 16 | if (s_player_deploybike6 < 0) then {
| |
| 17 | s_player_deploybike6 = player addaction[("<t color=""#007ab7"">" + ("Re-Pack GyroCopter") +"</t>"),"spawnbike\bike6.sqf","",5,false,true,"", ""];
| |
| 18 | }; | |
| 19 | } else {
| |
| 20 | player removeAction s_player_deploybike6; | |
| 21 | s_player_deploybike6 = -1; | |
| 22 | }; | |
| 23 | ||
| 24 | if((speed player <= 1) && cursorTarget isKindOf "TT650_Civ" && _canDo) then {
| |
| 25 | if (s_player_deploybike5 < 0) then {
| |
| 26 | s_player_deploybike5 = player addaction[("<t color=""#007ab7"">" + ("Upgrade to GyroCopter") +"</t>"),"spawnbike\bike5.sqf","",5,false,true,"", ""];
| |
| 27 | }; | |
| 28 | } else {
| |
| 29 | player removeAction s_player_deploybike5; | |
| 30 | s_player_deploybike5 = -1; | |
| 31 | }; | |
| 32 | ||
| 33 | if((speed player <= 1) && cursorTarget isKindOf "TT650_Civ" && _canDo) then {
| |
| 34 | if (s_player_deploybike4 < 0) then {
| |
| 35 | s_player_deploybike4 = player addaction[("<t color=""#007ab7"">" + ("Re-Pack Motorcycle") +"</t>"),"spawnbike\bike4.sqf","",5,false,true,"", ""];
| |
| 36 | }; | |
| 37 | } else {
| |
| 38 | player removeAction s_player_deploybike4; | |
| 39 | s_player_deploybike4 = -1; | |
| 40 | }; | |
| 41 | ||
| 42 | if((speed player <= 1) && cursorTarget isKindOf "Old_bike_TK_CIV_EP1" && _canDo) then {
| |
| 43 | if (s_player_deploybike3 < 0) then {
| |
| 44 | s_player_deploybike3 = player addaction[("<t color=""#007ab7"">" + ("Upgrade to Motorcycle") +"</t>"),"spawnbike\bike3.sqf","",5,false,true,"", ""];
| |
| 45 | }; | |
| 46 | } else {
| |
| 47 | player removeAction s_player_deploybike3; | |
| 48 | s_player_deploybike3 = -1; | |
| 49 | }; | |
| 50 | ||
| 51 | if((speed player <= 1) && cursorTarget isKindOf "Old_bike_TK_CIV_EP1" && _canDo) then {
| |
| 52 | if (s_player_deploybike2 < 0) then {
| |
| 53 | s_player_deploybike2 = player addaction[("<t color=""#007ab7"">" + ("Re-Pack Bike") +"</t>"),"spawnbike\bike2.sqf","",5,false,true,"", ""];
| |
| 54 | }; | |
| 55 | } else {
| |
| 56 | player removeAction s_player_deploybike2; | |
| 57 | s_player_deploybike2 = -1; | |
| 58 | }; | |
| 59 | ||
| 60 | if((speed player <= 1) && _hasToolbox && _canDo) then {
| |
| 61 | if (s_player_deploybike < 0) then {
| |
| 62 | s_player_deploybike = player addaction[("<t color=""#007ab7"">" + ("Deploy Bike (will loose Toolbox)") +"</t>"),"spawnbike\bike.sqf","",5,false,true,"", ""];
| |
| 63 | }; | |
| 64 | } else {
| |
| 65 | player removeAction s_player_deploybike; | |
| 66 | s_player_deploybike = -1; | |
| 67 | }; | |
| 68 | _onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1; | |
| 69 | _canDo = (!r_drag_sqf && !r_player_unconscious && !_onLadder); | |
| 70 | ||
| 71 | // ---------------------------------------Krixes Self Bloodbag Start------------------------------------ | |
| 72 | _mags = magazines player; | |
| 73 | ||
| 74 | // Krixes Self Bloodbag | |
| 75 | if ("ItemBloodbag" in _mags) then {
| |
| 76 | hasBagItem = true; | |
| 77 | } else { hasBagItem = false;};
| |
| 78 | if((speed player <= 1) && hasBagItem && _canDo) then {
| |
| 79 | if (s_player_selfBloodbag < 0) then {
| |
| 80 | s_player_selfBloodbag = player addaction[("<t color=""#c70000"">" + ("Self Bloodbag") +"</t>"),"scripts\player_selfbloodbag.sqf","",5,false,true,"", ""];
| |
| 81 | }; | |
| 82 | } else {
| |
| 83 | player removeAction s_player_selfBloodbag; | |
| 84 | s_player_selfBloodbag = -1; | |
| 85 | }; | |
| 86 | // ---------------------------------------Krixes Self Bloodbag End------------------------------------ | |
| 87 | ||
| 88 | _nearLight = nearestObject [player,"LitObject"]; | |
| 89 | _canPickLight = false; | |
| 90 | if (!isNull _nearLight) then {
| |
| 91 | if (_nearLight distance player < 4) then {
| |
| 92 | _canPickLight = isNull (_nearLight getVariable ["owner",objNull]); | |
| 93 | }; | |
| 94 | }; | |
| 95 | ||
| 96 | //Grab Flare | |
| 97 | if (_canPickLight && !dayz_hasLight && !_isPZombie) then {
| |
| 98 | if (s_player_grabflare < 0) then {
| |
| 99 | _text = getText (configFile >> "CfgAmmo" >> (typeOf _nearLight) >> "displayName"); | |
| 100 | s_player_grabflare = player addAction [format[localize "str_actions_medical_15",_text], "\z\addons\dayz_code\actions\flare_pickup.sqf",_nearLight, 1, false, true, "", ""]; | |
| 101 | s_player_removeflare = player addAction [format[localize "str_actions_medical_17",_text], "\z\addons\dayz_code\actions\flare_remove.sqf",_nearLight, 1, false, true, "", ""]; | |
| 102 | }; | |
| 103 | } else {
| |
| 104 | player removeAction s_player_grabflare; | |
| 105 | player removeAction s_player_removeflare; | |
| 106 | s_player_grabflare = -1; | |
| 107 | s_player_removeflare = -1; | |
| 108 | }; | |
| 109 | ||
| 110 | if (DZE_HeliLift) then {
| |
| 111 | _hasAttached = _vehicle getVariable["hasAttached",false]; | |
| 112 | if(_inVehicle && (_vehicle isKindOf "Air") && ((([_vehicle] call FNC_getPos) select 2) < 30) && (speed _vehicle < 5) && (typeName _hasAttached == "OBJECT")) then {
| |
| 113 | if (s_player_heli_detach < 0) then {
| |
| 114 | dayz_myLiftVehicle = _vehicle; | |
| 115 | s_player_heli_detach = dayz_myLiftVehicle addAction ["Detach Vehicle","\z\addons\dayz_code\actions\player_heliDetach.sqf",[dayz_myLiftVehicle,_hasAttached],2,false,true,"",""]; | |
| 116 | }; | |
| 117 | } else {
| |
| 118 | dayz_myLiftVehicle removeAction s_player_heli_detach; | |
| 119 | s_player_heli_detach = -1; | |
| 120 | }; | |
| 121 | }; | |
| 122 | ||
| 123 | if(DZE_HaloJump) then {
| |
| 124 | if(_inVehicle && (_vehicle isKindOf "Air") && ((([_vehicle] call FNC_getPos) select 2) > 400)) then {
| |
| 125 | if (s_halo_action < 0) then {
| |
| 126 | DZE_myHaloVehicle = _vehicle; | |
| 127 | s_halo_action = DZE_myHaloVehicle addAction [localize "STR_EPOCH_ACTIONS_HALO","\z\addons\dayz_code\actions\halo_jump.sqf",[],2,false,true,"",""]; | |
| 128 | }; | |
| 129 | } else {
| |
| 130 | DZE_myHaloVehicle removeAction s_halo_action; | |
| 131 | s_halo_action = -1; | |
| 132 | }; | |
| 133 | }; | |
| 134 | ||
| 135 | if (!DZE_ForceNameTagsOff) then {
| |
| 136 | if (s_player_showname < 0 && !_isPZombie) then {
| |
| 137 | if (DZE_ForceNameTags) then {
| |
| 138 | s_player_showname = 1; | |
| 139 | player setVariable["DZE_display_name",true,true]; | |
| 140 | } else {
| |
| 141 | s_player_showname = player addAction [localize "STR_EPOCH_ACTIONS_NAMEYES", "\z\addons\dayz_code\actions\display_name.sqf",true, 0, true, false, "",""]; | |
| 142 | s_player_showname1 = player addAction [localize "STR_EPOCH_ACTIONS_NAMENO", "\z\addons\dayz_code\actions\display_name.sqf",false, 0, true, false, "",""]; | |
| 143 | }; | |
| 144 | }; | |
| 145 | }; | |
| 146 | ||
| 147 | if(_isPZombie) then {
| |
| 148 | if (s_player_callzombies < 0) then {
| |
| 149 | s_player_callzombies = player addAction [localize "STR_EPOCH_ACTIONS_RAISEHORDE", "\z\addons\dayz_code\actions\call_zombies.sqf",player, 5, true, false, "",""]; | |
| 150 | }; | |
| 151 | if (DZE_PZATTACK) then {
| |
| 152 | call pz_attack; | |
| 153 | DZE_PZATTACK = false; | |
| 154 | }; | |
| 155 | if (s_player_pzombiesvision < 0) then {
| |
| 156 | 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"]; | |
| 157 | }; | |
| 158 | if (!isNull cursorTarget && (player distance cursorTarget < 3)) then { //Has some kind of target
| |
| 159 | _isAnimal = cursorTarget isKindOf "Animal"; | |
| 160 | _isZombie = cursorTarget isKindOf "zZombie_base"; | |
| 161 | _isHarvested = cursorTarget getVariable["meatHarvested",false]; | |
| 162 | _isMan = cursorTarget isKindOf "Man"; | |
| 163 | // Pzombie Gut human corpse || animal | |
| 164 | if (!alive cursorTarget && (_isAnimal || _isMan) && !_isZombie && !_isHarvested) then {
| |
| 165 | if (s_player_pzombiesfeed < 0) then {
| |
| 166 | s_player_pzombiesfeed = player addAction [localize "STR_EPOCH_ACTIONS_FEED", "\z\addons\dayz_code\actions\pzombie\pz_feed.sqf",cursorTarget, 3, true, false, "",""]; | |
| 167 | }; | |
| 168 | } else {
| |
| 169 | player removeAction s_player_pzombiesfeed; | |
| 170 | s_player_pzombiesfeed = -1; | |
| 171 | }; | |
| 172 | } else {
| |
| 173 | player removeAction s_player_pzombiesfeed; | |
| 174 | s_player_pzombiesfeed = -1; | |
| 175 | }; | |
| 176 | }; | |
| 177 | ||
| 178 | // Increase distance only if AIR || SHIP | |
| 179 | _allowedDistance = 4; | |
| 180 | _isAir = cursorTarget isKindOf "Air"; | |
| 181 | _isShip = cursorTarget isKindOf "Ship"; | |
| 182 | if(_isAir || _isShip) then {
| |
| 183 | _allowedDistance = 8; | |
| 184 | }; | |
| 185 | ||
| 186 | if (!isNull cursorTarget && !_inVehicle && !_isPZombie && (player distance cursorTarget < _allowedDistance) && _canDo) then { //Has some kind of target
| |
| 187 | ||
| 188 | // set cursortarget to variable | |
| 189 | _cursorTarget = cursorTarget; | |
| 190 | ||
| 191 | // get typeof cursortarget once | |
| 192 | _typeOfCursorTarget = typeOf _cursorTarget; | |
| 193 | ||
| 194 | // hintsilent _typeOfCursorTarget; | |
| 195 | ||
| 196 | _isVehicle = _cursorTarget isKindOf "AllVehicles"; | |
| 197 | _isVehicletype = _typeOfCursorTarget in ["ATV_US_EP1","ATV_CZ_EP1"]; | |
| 198 | _isnewstorage = _typeOfCursorTarget in DZE_isNewStorage; | |
| 199 | ||
| 200 | // get items && magazines only once | |
| 201 | _magazinesPlayer = magazines player; | |
| 202 | ||
| 203 | //boiled Water | |
| 204 | _hasbottleitem = "ItemWaterbottle" in _magazinesPlayer; | |
| 205 | _hastinitem = false; | |
| 206 | {
| |
| 207 | if (_x in _magazinesPlayer) then {
| |
| 208 | _hastinitem = true; | |
| 209 | }; | |
| 210 | } count boil_tin_cans; | |
| 211 | _hasFuelE = "ItemJerrycanEmpty" in _magazinesPlayer; | |
| 212 | _hasFuelBarrelE = "ItemFuelBarrelEmpty" in _magazinesPlayer; | |
| 213 | _hasHotwireKit = "ItemHotwireKit" in _magazinesPlayer; | |
| 214 | ||
| 215 | _itemsPlayer = items player; | |
| 216 | ||
| 217 | _temp_keys = []; | |
| 218 | _temp_keys_names = []; | |
| 219 | // find available keys | |
| 220 | _key_colors = ["ItemKeyYellow","ItemKeyBlue","ItemKeyRed","ItemKeyGreen","ItemKeyBlack"]; | |
| 221 | {
| |
| 222 | if (configName(inheritsFrom(configFile >> "CfgWeapons" >> _x)) in _key_colors) then {
| |
| 223 | _ownerKeyId = getNumber(configFile >> "CfgWeapons" >> _x >> "keyid"); | |
| 224 | _ownerKeyName = getText(configFile >> "CfgWeapons" >> _x >> "displayName"); | |
| 225 | _temp_keys_names set [_ownerKeyId,_ownerKeyName]; | |
| 226 | _temp_keys set [count _temp_keys,str(_ownerKeyId)]; | |
| 227 | }; | |
| 228 | } count _itemsPlayer; | |
| 229 | ||
| 230 | _hasKnife = "ItemKnife" in _itemsPlayer; | |
| 231 | _hasToolbox = "ItemToolbox" in _itemsPlayer; | |
| 232 | _playerUID = getPlayerUID player; | |
| 233 | _isMan = _cursorTarget isKindOf "Man"; | |
| 234 | _traderType = _typeOfCursorTarget; | |
| 235 | _ownerID = _cursorTarget getVariable ["ownerPUID","0"]; | |
| 236 | _characterID = _cursorTarget getVariable ["CharacterID","0"]; | |
| 237 | _isAnimal = _cursorTarget isKindOf "Animal"; | |
| 238 | _isDog = (_cursorTarget isKindOf "DZ_Pastor" || _cursorTarget isKindOf "DZ_Fin"); | |
| 239 | _isZombie = _cursorTarget isKindOf "zZombie_base"; | |
| 240 | _isDestructable = _cursorTarget isKindOf "BuiltItems"; | |
| 241 | _isWreck = _typeOfCursorTarget in DZE_isWreck; | |
| 242 | _isWreckBuilding = _typeOfCursorTarget in DZE_isWreckBuilding; | |
| 243 | _isModular = _cursorTarget isKindOf "ModularItems"; | |
| 244 | _isModularDoor = _typeOfCursorTarget in ["Land_DZE_WoodDoor","Land_DZE_LargeWoodDoor","Land_DZE_GarageWoodDoor","CinderWallDoor_DZ","CinderWallDoorSmall_DZ"]; | |
| 245 | ||
| 246 | _isRemovable = _typeOfCursorTarget in DZE_isRemovable; | |
| 247 | _isDisallowRepair = _typeOfCursorTarget in ["M240Nest_DZ"]; | |
| 248 | ||
| 249 | _isTent = _cursorTarget isKindOf "TentStorage"; | |
| 250 | ||
| 251 | _isAlive = alive _cursorTarget; | |
| 252 | ||
| 253 | _text = getText (configFile >> "CfgVehicles" >> _typeOfCursorTarget >> "displayName"); | |
| 254 | ||
| 255 | _rawmeat = meatraw; | |
| 256 | _hasRawMeat = false; | |
| 257 | {
| |
| 258 | if (_x in _magazinesPlayer) then {
| |
| 259 | _hasRawMeat = true; | |
| 260 | }; | |
| 261 | } count _rawmeat; | |
| 262 | ||
| 263 | _isFuel = false; | |
| 264 | if (_hasFuelE || _hasFuelBarrelE) then {
| |
| 265 | {
| |
| 266 | if(_cursorTarget isKindOf _x) exitWith {_isFuel = true;};
| |
| 267 | } count dayz_fuelsources; | |
| 268 | }; | |
| 269 | ||
| 270 | // diag_log ("OWNERID = " + _ownerID + " CHARID = " + dayz_characterID + " " + str(_ownerID == dayz_characterID));
| |
| 271 | ||
| 272 | // logic vars | |
| 273 | _player_flipveh = false; | |
| 274 | _player_deleteBuild = false; | |
| 275 | _player_lockUnlock_crtl = false; | |
| 276 | ||
| 277 | if (_canDo && (speed player <= 1) && (_cursorTarget isKindOf "Plastic_Pole_EP1_DZ")) then {
| |
| 278 | if (s_player_maintain_area < 0) then {
| |
| 279 | s_player_maintain_area = player addAction [format["<t color='#ff0000'>%1</t>",localize "STR_EPOCH_ACTIONS_MAINTAREA"], "\z\addons\dayz_code\actions\maintain_area.sqf", "maintain", 5, false]; | |
| 280 | s_player_maintain_area_preview = player addAction [format["<t color='#ff0000'>%1</t>",localize "STR_EPOCH_ACTIONS_MAINTPREV"], "\z\addons\dayz_code\actions\maintain_area.sqf", "preview", 5, false]; | |
| 281 | }; | |
| 282 | } else {
| |
| 283 | player removeAction s_player_maintain_area; | |
| 284 | s_player_maintain_area = -1; | |
| 285 | player removeAction s_player_maintain_area_preview; | |
| 286 | s_player_maintain_area_preview = -1; | |
| 287 | }; | |
| 288 | ||
| 289 | // CURSOR TARGET ALIVE | |
| 290 | if(_isAlive) then {
| |
| 291 | diag_log format["fn_actons: [PlayerUID: %1] [_ownerID: %2] [_isModularDoor: %3] [typeOfCursorTarget: %4]",_playerUID, _ownerID, _isModularDoor, _typeOfCursorTarget]; | |
| 292 | diag_log format["[_isDestructable:%1 ] [_isWreck: %2 ] [_isRemovable: %3 ] [_isWreckBuilding: %4 ]",_isDestructable, _isWreck, _isRemovable, _isWreckBuilding]; | |
| 293 | //Allow player to delete objects | |
| 294 | if(_isDestructable || _isWreck || _isRemovable || _isWreckBuilding) then {
| |
| 295 | if(_hasToolbox && "ItemCrowbar" in _itemsPlayer) then {
| |
| 296 | _player_deleteBuild = true; | |
| 297 | }; | |
| 298 | }; | |
| 299 | ||
| 300 | //Allow owners to delete modulars | |
| 301 | if(_isModular && (_playerUID == _ownerID)) then {
| |
| 302 | if(_hasToolbox && "ItemCrowbar" in _itemsPlayer) then {
| |
| 303 | _player_deleteBuild = true; | |
| 304 | }; | |
| 305 | }; | |
| 306 | //Allow owners to delete modular doors without locks | |
| 307 | if(_isModularDoor && (_playerUID == _ownerID)) then {
| |
| 308 | if(_hasToolbox && "ItemCrowbar" in _itemsPlayer) then {
| |
| 309 | _player_deleteBuild = true; | |
| 310 | }; | |
| 311 | }; | |
| 312 | // CURSOR TARGET VEHICLE | |
| 313 | if(_isVehicle) then {
| |
| 314 | ||
| 315 | //flip vehicle small vehicles by your self && all other vehicles with help nearby | |
| 316 | if (!(canmove _cursorTarget) && (player distance _cursorTarget >= 2) && (count (crew _cursorTarget))== 0 && ((vectorUp _cursorTarget) select 2) < 0.5) then {
| |
| 317 | _playersNear = {isPlayer _x} count (player nearEntities ["CAManBase", 6]);
| |
| 318 | if(_isVehicletype || (_playersNear >= 2)) then {
| |
| 319 | _player_flipveh = true; | |
| 320 | }; | |
| 321 | }; | |
| 322 | ||
| 323 | ||
| 324 | if(!_isMan && _characterID != "0" && !(_cursorTarget isKindOf "Bicycle")) then {
| |
| 325 | _player_lockUnlock_crtl = true; | |
| 326 | }; | |
| 327 | ||
| 328 | }; | |
| 329 | ||
| 330 | }; | |
| 331 | ||
| 332 | if(_player_deleteBuild) then {
| |
| 333 | if (s_player_deleteBuild < 0) then {
| |
| 334 | s_player_deleteBuild = player addAction [format[localize "str_actions_delete",_text], "scripts\remove.sqf",_cursorTarget, 1, true, true, "", ""]; | |
| 335 | }; | |
| 336 | } else {
| |
| 337 | player removeAction s_player_deleteBuild; | |
| 338 | s_player_deleteBuild = -1; | |
| 339 | }; | |
| 340 | ||
| 341 | if (DZE_HeliLift) then {
| |
| 342 | _liftHeli = objNull; | |
| 343 | _found = false; | |
| 344 | ||
| 345 | _allowTow = false; | |
| 346 | if ((count (crew _cursorTarget)) == 0) then {
| |
| 347 | {
| |
| 348 | if(!_allowTow) then {
| |
| 349 | _allowTow = _cursorTarget isKindOf _x; | |
| 350 | }; | |
| 351 | } count DZE_HeliAllowToTow; | |
| 352 | }; | |
| 353 | ||
| 354 | //diag_log format["CREW: %1 ALLOW: %2",(count (crew _cursorTarget)),_allowTow]; | |
| 355 | ||
| 356 | if (_allowTow) then {
| |
| 357 | _liftHelis = nearestObjects [player, DZE_HeliAllowTowFrom, 15]; | |
| 358 | {
| |
| 359 | if(!_found) then {
| |
| 360 | _posL = [_x] call FNC_getPos; | |
| 361 | _posC = [_cursorTarget] call FNC_getPos; | |
| 362 | _height = (_posL select 2) - (_posC select 2); | |
| 363 | _hasAttached = _x getVariable["hasAttached",false]; | |
| 364 | if(_height < 15 && _height > 5 && (typeName _hasAttached != "OBJECT")) then {
| |
| 365 | if(((abs((_posL select 0) - (_posC select 0))) < 10) && ((abs((_posL select 1) - (_posC select 1))) < 10)) then {
| |
| 366 | _liftHeli = _x; | |
| 367 | _found = true; | |
| 368 | }; | |
| 369 | }; | |
| 370 | }; | |
| 371 | } count _liftHelis; | |
| 372 | }; | |
| 373 | ||
| 374 | //diag_log format["HELI: %1 TARGET: %2",_found,_cursorTarget]; | |
| 375 | ||
| 376 | _attached = _cursorTarget getVariable["attached",false]; | |
| 377 | if(_found && _allowTow && _canDo && !locked _cursorTarget && !_isPZombie && (typeName _attached != "OBJECT")) then {
| |
| 378 | if (s_player_heli_lift < 0) then {
| |
| 379 | s_player_heli_lift = player addAction ["Attach to Heli", "\z\addons\dayz_code\actions\player_heliLift.sqf",[_liftHeli,_cursorTarget], -10, false, true, "",""]; | |
| 380 | }; | |
| 381 | } else {
| |
| 382 | player removeAction s_player_heli_lift; | |
| 383 | s_player_heli_lift = -1; | |
| 384 | }; | |
| 385 | }; | |
| 386 | ||
| 387 | // Allow Owner to lock && unlock vehicle | |
| 388 | if(_player_lockUnlock_crtl) then {
| |
| 389 | if (s_player_lockUnlock_crtl < 0) then {
| |
| 390 | _hasKey = _characterID in _temp_keys; | |
| 391 | _oldOwner = (_characterID == dayz_playerUID); | |
| 392 | if(locked _cursorTarget) then {
| |
| 393 | if(_hasKey || _oldOwner) then {
| |
| 394 | _Unlock = player addAction [format[localize "STR_EPOCH_ACTIONS_UNLOCK",_text], "\z\addons\dayz_code\actions\unlock_veh.sqf",[_cursorTarget,(_temp_keys_names select (parseNumber _characterID))], 2, true, true, "", ""]; | |
| 395 | s_player_lockunlock set [count s_player_lockunlock,_Unlock]; | |
| 396 | s_player_lockUnlock_crtl = 1; | |
| 397 | } else {
| |
| 398 | if(_hasHotwireKit) then {
| |
| 399 | _Unlock = player addAction [format[localize "STR_EPOCH_ACTIONS_HOTWIRE",_text], "\z\addons\dayz_code\actions\hotwire_veh.sqf",_cursorTarget, 2, true, true, "", ""]; | |
| 400 | } else {
| |
| 401 | _Unlock = player addAction [format["<t color='#ff0000'>%1</t>",localize "STR_EPOCH_ACTIONS_VEHLOCKED"], "",_cursorTarget, 2, true, true, "", ""]; | |
| 402 | }; | |
| 403 | s_player_lockunlock set [count s_player_lockunlock,_Unlock]; | |
| 404 | s_player_lockUnlock_crtl = 1; | |
| 405 | }; | |
| 406 | } else {
| |
| 407 | if(_hasKey || _oldOwner) then {
| |
| 408 | _lock = player addAction [format[localize "STR_EPOCH_ACTIONS_LOCK",_text], "\z\addons\dayz_code\actions\lock_veh.sqf",_cursorTarget, 1, true, true, "", ""]; | |
| 409 | s_player_lockunlock set [count s_player_lockunlock,_lock]; | |
| 410 | s_player_lockUnlock_crtl = 1; | |
| 411 | }; | |
| 412 | }; | |
| 413 | }; | |
| 414 | ||
| 415 | } else {
| |
| 416 | {player removeAction _x} count s_player_lockunlock;s_player_lockunlock = [];
| |
| 417 | s_player_lockUnlock_crtl = -1; | |
| 418 | }; | |
| 419 | ||
| 420 | if(DZE_AllowForceSave) then {
| |
| 421 | //Allow player to force save | |
| 422 | if((_isVehicle || _isTent) && !_isMan) then {
| |
| 423 | if (s_player_forceSave < 0) then {
| |
| 424 | s_player_forceSave = player addAction [format[localize "str_actions_save",_text], "\z\addons\dayz_code\actions\forcesave.sqf",_cursorTarget, 1, true, true, "", ""]; | |
| 425 | }; | |
| 426 | } else {
| |
| 427 | player removeAction s_player_forceSave; | |
| 428 | s_player_forceSave = -1; | |
| 429 | }; | |
| 430 | }; | |
| 431 | ||
| 432 | ||
| 433 | ||
| 434 | If(DZE_AllowCargoCheck) then {
| |
| 435 | if((_isVehicle || _isTent || _isnewstorage) && _isAlive && !_isMan && !locked _cursorTarget) then {
| |
| 436 | if (s_player_checkGear < 0) then {
| |
| 437 | s_player_checkGear = player addAction [localize "STR_EPOCH_PLAYER_CARGO", "\z\addons\dayz_code\actions\cargocheck.sqf",_cursorTarget, 1, true, true, "", ""]; | |
| 438 | }; | |
| 439 | } else {
| |
| 440 | player removeAction s_player_checkGear; | |
| 441 | s_player_checkGear = -1; | |
| 442 | }; | |
| 443 | }; | |
| 444 | ||
| 445 | ||
| 446 | //flip vehicle small vehicles by your self && all other vehicles with help nearby | |
| 447 | if(_player_flipveh) then {
| |
| 448 | if (s_player_flipveh < 0) then {
| |
| 449 | s_player_flipveh = player addAction [format[localize "str_actions_flipveh",_text], "\z\addons\dayz_code\actions\player_flipvehicle.sqf",_cursorTarget, 1, true, true, "", ""]; | |
| 450 | }; | |
| 451 | } else {
| |
| 452 | player removeAction s_player_flipveh; | |
| 453 | s_player_flipveh = -1; | |
| 454 | }; | |
| 455 | ||
| 456 | //Allow player to fill jerrycan | |
| 457 | if((_hasFuelE || _hasFuelBarrelE) && _isFuel) then {
| |
| 458 | if (s_player_fillfuel < 0) then {
| |
| 459 | s_player_fillfuel = player addAction [localize "str_actions_self_10", "\z\addons\dayz_code\actions\jerry_fill.sqf",[], 1, false, true, "", ""]; | |
| 460 | }; | |
| 461 | } else {
| |
| 462 | player removeAction s_player_fillfuel; | |
| 463 | s_player_fillfuel = -1; | |
| 464 | }; | |
| 465 | ||
| 466 | // logic vars for addactions | |
| 467 | _player_butcher = false; | |
| 468 | _player_studybody = false; | |
| 469 | _player_SurrenderedGear = false; | |
| 470 | ||
| 471 | // CURSOR TARGET NOT ALIVE | |
| 472 | if (!_isAlive) then {
| |
| 473 | ||
| 474 | // Gut animal/zed | |
| 475 | if((_isAnimal || _isZombie) && _hasKnife) then {
| |
| 476 | _isHarvested = _cursorTarget getVariable["meatHarvested",false]; | |
| 477 | if (!_isHarvested) then {
| |
| 478 | _player_butcher = true; | |
| 479 | }; | |
| 480 | }; | |
| 481 | ||
| 482 | // Study body | |
| 483 | if (_isMan && !_isZombie && !_isAnimal) then {
| |
| 484 | _player_studybody = true; | |
| 485 | } | |
| 486 | } else {
| |
| 487 | // unit alive | |
| 488 | ||
| 489 | // gear access on surrendered player | |
| 490 | if(_isMan && !_isZombie && !_isAnimal) then {
| |
| 491 | _isSurrendered = _cursorTarget getVariable ["DZE_Surrendered",false]; | |
| 492 | if (_isSurrendered) then {
| |
| 493 | _player_SurrenderedGear = true; | |
| 494 | }; | |
| 495 | }; | |
| 496 | }; | |
| 497 | ||
| 498 | ||
| 499 | // Human Gut animal || zombie | |
| 500 | if (_player_butcher) then {
| |
| 501 | if (s_player_butcher < 0) then {
| |
| 502 | if(_isZombie) then {
| |
| 503 | s_player_butcher = player addAction [localize "STR_EPOCH_ACTIONS_GUTZOM", "\z\addons\dayz_code\actions\gather_zparts.sqf",_cursorTarget, 0, true, true, "", ""]; | |
| 504 | } else {
| |
| 505 | s_player_butcher = player addAction [localize "str_actions_self_04", "\z\addons\dayz_code\actions\gather_meat.sqf",_cursorTarget, 3, true, true, "", ""]; | |
| 506 | }; | |
| 507 | }; | |
| 508 | } else {
| |
| 509 | player removeAction s_player_butcher; | |
| 510 | s_player_butcher = -1; | |
| 511 | }; | |
| 512 | ||
| 513 | // Study Body | |
| 514 | if (_player_studybody) then {
| |
| 515 | if (s_player_studybody < 0) then {
| |
| 516 | s_player_studybody = player addAction [localize "str_action_studybody", "\z\addons\dayz_code\actions\study_body.sqf",_cursorTarget, 0, false, true, "",""]; | |
| 517 | }; | |
| 518 | } else {
| |
| 519 | player removeAction s_player_studybody; | |
| 520 | s_player_studybody = -1; | |
| 521 | }; | |
| 522 | ||
| 523 | // logic vars | |
| 524 | _player_cook = false; | |
| 525 | _player_boil = false; | |
| 526 | ||
| 527 | // CURSOR TARGET IS FIRE | |
| 528 | if (inflamed _cursorTarget) then {
| |
| 529 | ||
| 530 | //Fireplace Actions check | |
| 531 | if (_hasRawMeat) then {
| |
| 532 | _player_cook = true; | |
| 533 | }; | |
| 534 | ||
| 535 | // Boil water | |
| 536 | if (_hasbottleitem && _hastinitem) then {
| |
| 537 | _player_boil = true; | |
| 538 | }; | |
| 539 | }; | |
| 540 | ||
| 541 | if (_player_SurrenderedGear) then {
| |
| 542 | if (s_player_SurrenderedGear < 0) then {
| |
| 543 | s_player_SurrenderedGear = player addAction [localize "STR_EPOCH_ACTIONS_GEAR", "\z\addons\dayz_code\actions\surrender_gear.sqf",_cursorTarget, 1, true, true, "", ""]; | |
| 544 | }; | |
| 545 | } else {
| |
| 546 | player removeAction s_player_SurrenderedGear; | |
| 547 | s_player_SurrenderedGear = -1; | |
| 548 | }; | |
| 549 | ||
| 550 | //Fireplace Actions check | |
| 551 | if (_player_cook) then {
| |
| 552 | if (s_player_cook < 0) then {
| |
| 553 | s_player_cook = player addAction [localize "str_actions_self_05", "\z\addons\dayz_code\actions\cook.sqf",_cursorTarget, 3, true, true, "", ""]; | |
| 554 | }; | |
| 555 | } else {
| |
| 556 | player removeAction s_player_cook; | |
| 557 | s_player_cook = -1; | |
| 558 | }; | |
| 559 | ||
| 560 | // Boil water | |
| 561 | if (_player_boil) then {
| |
| 562 | if (s_player_boil < 0) then {
| |
| 563 | s_player_boil = player addAction [localize "str_actions_boilwater", "\z\addons\dayz_code\actions\boil.sqf",_cursorTarget, 3, true, true, "", ""]; | |
| 564 | }; | |
| 565 | } else {
| |
| 566 | player removeAction s_player_boil; | |
| 567 | s_player_boil = -1; | |
| 568 | }; | |
| 569 | ||
| 570 | if(_cursorTarget == dayz_hasFire) then {
| |
| 571 | if ((s_player_fireout < 0) && !(inflamed _cursorTarget) && (player distance _cursorTarget < 3)) then {
| |
| 572 | s_player_fireout = player addAction [localize "str_actions_self_06", "\z\addons\dayz_code\actions\fire_pack.sqf",_cursorTarget, 0, false, true, "",""]; | |
| 573 | }; | |
| 574 | } else {
| |
| 575 | player removeAction s_player_fireout; | |
| 576 | s_player_fireout = -1; | |
| 577 | }; | |
| 578 | ||
| 579 | //Packing my tent | |
| 580 | if(_isTent && (player distance _cursorTarget < 3)) then {
| |
| 581 | if (_ownerID == _playerUID) then {
| |
| 582 | if (s_player_packtent < 0) then {
| |
| 583 | s_player_packtent = player addAction [localize "str_actions_self_07", "\z\addons\dayz_code\actions\tent_pack.sqf",_cursorTarget, 0, false, true, "",""]; | |
| 584 | }; | |
| 585 | } else {
| |
| 586 | if(("ItemJerrycan" in _magazinesPlayer) && ("ItemMatchbox_DZE" in weapons player)) then {
| |
| 587 | if (s_player_packtent < 0) then {
| |
| 588 | s_player_packtent = player addAction [localize "STR_EPOCH_ACTIONS_DESTROYTENT", "scripts\remove.sqf",_cursorTarget, 1, true, true, "", ""]; | |
| 589 | }; | |
| 590 | }; | |
| 591 | }; | |
| 592 | } else {
| |
| 593 | player removeAction s_player_packtent; | |
| 594 | s_player_packtent = -1; | |
| 595 | }; | |
| 596 | ||
| 597 | //Allow owner to unlock vault | |
| 598 | if((_typeOfCursorTarget in DZE_LockableStorage) && _ownerID != "0" && (player distance _cursorTarget < 3)) then {
| |
| 599 | if (s_player_unlockvault < 0) then {
| |
| 600 | if(_typeOfCursorTarget in DZE_LockedStorage) then {
| |
| 601 | if(_characterID == dayz_combination || _ownerID == dayz_playerUID) then {
| |
| 602 | _combi = player addAction [format[localize "STR_EPOCH_ACTIONS_OPEN",_text], "\z\addons\dayz_code\actions\vault_unlock.sqf",_cursorTarget, 0, false, true, "",""]; | |
| 603 | s_player_combi set [count s_player_combi,_combi]; | |
| 604 | } else {
| |
| 605 | _combi = player addAction [format[localize "STR_EPOCH_ACTIONS_UNLOCK",_text], "\z\addons\dayz_code\actions\vault_combination_1.sqf",_cursorTarget, 0, false, true, "",""]; | |
| 606 | s_player_combi set [count s_player_combi,_combi]; | |
| 607 | }; | |
| 608 | s_player_unlockvault = 1; | |
| 609 | } else {
| |
| 610 | if(_characterID != dayz_combination && _ownerID != _playerUID) then {
| |
| 611 | _combi = player addAction [localize "STR_EPOCH_ACTIONS_RECOMBO", "\z\addons\dayz_code\actions\vault_combination_1.sqf",_cursorTarget, 0, false, true, "",""]; | |
| 612 | s_player_combi set [count s_player_combi,_combi]; | |
| 613 | s_player_unlockvault = 1; | |
| 614 | }; | |
| 615 | }; | |
| 616 | }; | |
| 617 | } else {
| |
| 618 | {player removeAction _x} count s_player_combi;s_player_combi = [];
| |
| 619 | s_player_unlockvault = -1; | |
| 620 | }; | |
| 621 | ||
| 622 | //Allow owner to pack vault | |
| 623 | if(_typeOfCursorTarget in DZE_UnLockedStorage && _characterID != "0" && (player distance _cursorTarget < 3)) then {
| |
| 624 | ||
| 625 | if (s_player_lockvault < 0) then {
| |
| 626 | if(_characterID == dayz_combination || _ownerID == dayz_playerUID) then {
| |
| 627 | s_player_lockvault = player addAction [format[localize "STR_EPOCH_ACTIONS_LOCK",_text], "\z\addons\dayz_code\actions\vault_lock.sqf",_cursorTarget, 0, false, true, "",""]; | |
| 628 | }; | |
| 629 | }; | |
| 630 | if (s_player_packvault < 0 && (_characterID == dayz_combination || _ownerID == dayz_playerUID)) then {
| |
| 631 | s_player_packvault = player addAction [format["<t color='#ff0000'>%1</t>",(format[localize "STR_EPOCH_ACTIONS_PACK",_text])], "\z\addons\dayz_code\actions\vault_pack.sqf",_cursorTarget, 0, false, true, "",""]; | |
| 632 | }; | |
| 633 | } else {
| |
| 634 | player removeAction s_player_packvault; | |
| 635 | s_player_packvault = -1; | |
| 636 | player removeAction s_player_lockvault; | |
| 637 | s_player_lockvault = -1; | |
| 638 | }; | |
| 639 | ||
| 640 | ||
| 641 | ||
| 642 | //Player Deaths | |
| 643 | if(_typeOfCursorTarget == "Info_Board_EP1") then {
| |
| 644 | if (s_player_information < 0) then {
| |
| 645 | s_player_information = player addAction [localize "STR_EPOCH_ACTIONS_MURDERS", "\z\addons\dayz_code\actions\list_playerDeaths.sqf",[], 7, false, true, "",""]; | |
| 646 | }; | |
| 647 | } else {
| |
| 648 | player removeAction s_player_information; | |
| 649 | s_player_information = -1; | |
| 650 | }; | |
| 651 | ||
| 652 | //Fuel Pump | |
| 653 | if(_typeOfCursorTarget in dayz_fuelpumparray) then {
| |
| 654 | if (s_player_fuelauto < 0) then {
| |
| 655 | ||
| 656 | // check if Generator_DZ is running within 30 meters | |
| 657 | _findNearestGens = nearestObjects [player, ["Generator_DZ"], 30]; | |
| 658 | _findNearestGen = []; | |
| 659 | {
| |
| 660 | if (alive _x && (_x getVariable ["GeneratorRunning", false])) then {
| |
| 661 | _findNearestGen set [(count _findNearestGen),_x]; | |
| 662 | }; | |
| 663 | } count _findNearestGens; | |
| 664 | _IsNearRunningGen = count (_findNearestGen); | |
| 665 | ||
| 666 | // show that pump needs power if no generator nearby. | |
| 667 | if(_IsNearRunningGen > 0) then {
| |
| 668 | s_player_fuelauto = player addAction [localize "STR_EPOCH_ACTIONS_FILLVEH", "\z\addons\dayz_code\actions\fill_nearestVehicle.sqf",objNull, 0, false, true, "",""]; | |
| 669 | } else {
| |
| 670 | s_player_fuelauto = player addAction [format["<t color='#ff0000'>%1</t>",localize "STR_EPOCH_ACTIONS_NEEDPOWER"], "",[], 0, false, true, "",""]; | |
| 671 | }; | |
| 672 | }; | |
| 673 | } else {
| |
| 674 | player removeAction s_player_fuelauto; | |
| 675 | s_player_fuelauto = -1; | |
| 676 | }; | |
| 677 | ||
| 678 | //Fuel Pump on truck | |
| 679 | if(_typeOfCursorTarget in DZE_fueltruckarray && alive _cursorTarget) then {
| |
| 680 | if (s_player_fuelauto2 < 0) then {
| |
| 681 | // show that fuel truck pump needs power. | |
| 682 | if(isEngineOn _cursorTarget) then {
| |
| 683 | s_player_fuelauto2 = player addAction [localize "STR_EPOCH_ACTIONS_FILLVEH", "\z\addons\dayz_code\actions\fill_nearestVehicle.sqf",_cursorTarget, 0, false, true, "",""]; | |
| 684 | } else {
| |
| 685 | s_player_fuelauto2 = player addAction [format["<t color='#ff0000'>%1</t>",localize "STR_EPOCH_ACTIONS_NEEDPOWER"], "",[], 0, false, true, "",""]; | |
| 686 | }; | |
| 687 | }; | |
| 688 | } else {
| |
| 689 | player removeAction s_player_fuelauto2; | |
| 690 | s_player_fuelauto2 = -1; | |
| 691 | }; | |
| 692 | ||
| 693 | // inplace upgrade tool | |
| 694 | if ((_cursorTarget isKindOf "ModularItems") || (_cursorTarget isKindOf "Land_DZE_WoodDoor_Base") || (_cursorTarget isKindOf "CinderWallDoor_DZ_Base")) then {
| |
| 695 | if ((s_player_lastTarget select 0) != _cursorTarget) then {
| |
| 696 | if (s_player_upgrade_build > 0) then {
| |
| 697 | player removeAction s_player_upgrade_build; | |
| 698 | s_player_upgrade_build = -1; | |
| 699 | }; | |
| 700 | }; | |
| 701 | if (s_player_upgrade_build < 0) then {
| |
| 702 | // s_player_lastTarget = _cursorTarget; | |
| 703 | s_player_lastTarget set [0,_cursorTarget]; | |
| 704 | s_player_upgrade_build = player addAction [format[localize "STR_EPOCH_ACTIONS_UPGRADE",_text], "scripts\player_upgrade.sqf",_cursorTarget, -1, false, true, "",""]; | |
| 705 | }; | |
| 706 | } else {
| |
| 707 | player removeAction s_player_upgrade_build; | |
| 708 | s_player_upgrade_build = -1; | |
| 709 | }; | |
| 710 | diag_log text "============================================"; | |
| 711 | ||
| 712 | diag_log format["fn_actons: [PlayerUID: %1] [_ownerID: %2] [DZE_Lock_Door: %3] [_characterID: %4] [typeOfCursorTarget: %5]",_playerUID, _ownerID, DZE_Lock_Door, _characterID, _typeOfCursorTarget]; | |
| 713 | diag_log format["[s_player_downgrade_build:%1 ] [s_player_lastTarget: %2 ] [_isRemovable: %3 ] [_isWreckBuilding: %4 ]",s_player_downgrade_build, s_player_lastTarget, _isRemovable, _isWreckBuilding]; | |
| 714 | ||
| 715 | // downgrade system | |
| 716 | if((_isDestructable || _cursorTarget isKindOf "Land_DZE_WoodDoorLocked_Base" || _cursorTarget isKindOf "CinderWallDoorLocked_DZ_Base") && (DZE_Lock_Door == _characterID)) then {
| |
| 717 | if ((s_player_lastTarget select 1) != _cursorTarget) then {
| |
| 718 | if (s_player_downgrade_build > 0) then {
| |
| 719 | player removeAction s_player_downgrade_build; | |
| 720 | s_player_downgrade_build = -1; | |
| 721 | }; | |
| 722 | }; | |
| 723 | ||
| 724 | if (s_player_downgrade_build < 0) then {
| |
| 725 | s_player_lastTarget set [1,_cursorTarget]; | |
| 726 | s_player_downgrade_build = player addAction [format[localize "STR_EPOCH_ACTIONS_REMLOCK",_text], "scripts\player_buildingDowngrade.sqf",_cursorTarget, -2, false, true, "",""]; | |
| 727 | }; | |
| 728 | } else {
| |
| 729 | player removeAction s_player_downgrade_build; | |
| 730 | s_player_downgrade_build = -1; | |
| 731 | }; | |
| 732 | ||
| 733 | // inplace maintenance tool | |
| 734 | if((_cursorTarget isKindOf "ModularItems" || _cursorTarget isKindOf "DZE_Housebase" || _typeOfCursorTarget == "LightPole_DZ") && (damage _cursorTarget >= DZE_DamageBeforeMaint)) then {
| |
| 735 | if ((s_player_lastTarget select 2) != _cursorTarget) then {
| |
| 736 | if (s_player_maint_build > 0) then {
| |
| 737 | player removeAction s_player_maint_build; | |
| 738 | s_player_maint_build = -1; | |
| 739 | }; | |
| 740 | }; | |
| 741 | ||
| 742 | if (s_player_maint_build < 0) then {
| |
| 743 | s_player_lastTarget set [2,_cursorTarget]; | |
| 744 | s_player_maint_build = player addAction [format[localize "STR_EPOCH_ACTIONS_MAINTAIN",_text], "\z\addons\dayz_code\actions\player_buildingMaint.sqf",_cursorTarget, -2, false, true, "",""]; | |
| 745 | }; | |
| 746 | } else {
| |
| 747 | player removeAction s_player_maint_build; | |
| 748 | s_player_maint_build = -1; | |
| 749 | }; | |
| 750 | ||
| 751 | ||
| 752 | //Start Generator | |
| 753 | if(_cursorTarget isKindOf "Generator_DZ") then {
| |
| 754 | if (s_player_fillgen < 0) then {
| |
| 755 | ||
| 756 | // check if not running | |
| 757 | if((_cursorTarget getVariable ["GeneratorRunning", false])) then {
| |
| 758 | s_player_fillgen = player addAction [localize "STR_EPOCH_ACTIONS_GENERATOR1", "\z\addons\dayz_code\actions\stopGenerator.sqf",_cursorTarget, 0, false, true, "",""]; | |
| 759 | } else {
| |
| 760 | // check if not filled && player has jerry. | |
| 761 | if((_cursorTarget getVariable ["GeneratorFilled", false])) then {
| |
| 762 | s_player_fillgen = player addAction [localize "STR_EPOCH_ACTIONS_GENERATOR2", "\z\addons\dayz_code\actions\fill_startGenerator.sqf",_cursorTarget, 0, false, true, "",""]; | |
| 763 | } else {
| |
| 764 | if("ItemJerrycan" in _magazinesPlayer) then {
| |
| 765 | s_player_fillgen = player addAction [localize "STR_EPOCH_ACTIONS_GENERATOR3", "\z\addons\dayz_code\actions\fill_startGenerator.sqf",_cursorTarget, 0, false, true, "",""]; | |
| 766 | }; | |
| 767 | }; | |
| 768 | }; | |
| 769 | }; | |
| 770 | } else {
| |
| 771 | player removeAction s_player_fillgen; | |
| 772 | s_player_fillgen = -1; | |
| 773 | }; | |
| 774 | ||
| 775 | //Towing with tow truck | |
| 776 | /* | |
| 777 | if(_typeOfCursorTarget == "TOW_DZE") then {
| |
| 778 | if (s_player_towing < 0) then {
| |
| 779 | if(!(_cursorTarget getVariable ["DZEinTow", false])) then {
| |
| 780 | s_player_towing = player addAction [localize "STR_EPOCH_ACTIONS_ATTACH" "\z\addons\dayz_code\actions\tow_AttachStraps.sqf",_cursorTarget, 0, false, true, "",""]; | |
| 781 | } else {
| |
| 782 | s_player_towing = player addAction [localize "STR_EPOCH_ACTIONS_DETACH", "\z\addons\dayz_code\actions\tow_DetachStraps.sqf",_cursorTarget, 0, false, true, "",""]; | |
| 783 | }; | |
| 784 | }; | |
| 785 | } else {
| |
| 786 | player removeAction s_player_towing; | |
| 787 | s_player_towing = -1; | |
| 788 | }; | |
| 789 | */ | |
| 790 | ||
| 791 | ||
| 792 | //Sleep | |
| 793 | if(_isTent && _ownerID == _playerUID) then {
| |
| 794 | if ((s_player_sleep < 0) && (player distance _cursorTarget < 3)) then {
| |
| 795 | s_player_sleep = player addAction [localize "str_actions_self_sleep", "\z\addons\dayz_code\actions\player_sleep.sqf",_cursorTarget, 0, false, true, "",""]; | |
| 796 | }; | |
| 797 | } else {
| |
| 798 | player removeAction s_player_sleep; | |
| 799 | s_player_sleep = -1; | |
| 800 | }; | |
| 801 | ||
| 802 | _clothesTaken = _cursorTarget getVariable["clothesTaken",false]; | |
| 803 | ||
| 804 | // Take clothes by Zabn | |
| 805 | if (_isMan and !_isAlive and !_isZombie and !_clothesTaken) then {
| |
| 806 | if (s_player_clothes < 0) then {
| |
| 807 | s_player_clothes = player addAction [("<t color='#0096ff'>")+("Take Clothes")+("</t>"), "scripts\player_takeClothes_v2.sqf",[_cursorTarget], -10, false, true, "",""];
| |
| 808 | }; | |
| 809 | } else {
| |
| 810 | player removeAction s_player_clothes; | |
| 811 | s_player_clothes = -1; | |
| 812 | }; | |
| 813 | ||
| 814 | //Repairing Vehicles | |
| 815 | if ((dayz_myCursorTarget != _cursorTarget) && _isVehicle && !_isMan && _hasToolbox && (damage _cursorTarget < 1) && !_isDisallowRepair) then {
| |
| 816 | if (s_player_repair_crtl < 0) then {
| |
| 817 | dayz_myCursorTarget = _cursorTarget; | |
| 818 | _menu = dayz_myCursorTarget addAction [localize "STR_EPOCH_PLAYER_REPAIRV", "\z\addons\dayz_code\actions\repair_vehicle.sqf",_cursorTarget, 0, true, false, "",""]; | |
| 819 | _menu1 = dayz_myCursorTarget addAction [localize "STR_EPOCH_PLAYER_SALVAGEV", "\z\addons\dayz_code\actions\salvage_vehicle.sqf",_cursorTarget, 0, true, false, "",""]; | |
| 820 | s_player_repairActions set [count s_player_repairActions,_menu]; | |
| 821 | s_player_repairActions set [count s_player_repairActions,_menu1]; | |
| 822 | s_player_repair_crtl = 1; | |
| 823 | } else {
| |
| 824 | {dayz_myCursorTarget removeAction _x} count s_player_repairActions;s_player_repairActions = [];
| |
| 825 | s_player_repair_crtl = -1; | |
| 826 | }; | |
| 827 | }; | |
| 828 | //Pack Vehicles | |
| 829 | if (_typeOfCursorTarget in EVDVehicleArray and _hasToolbox and !(locked _cursorTarget) and (damage _cursorTarget < 1)) then {
| |
| 830 | if (s_player_packvehicle < 0) then {
| |
| 831 | s_player_packvehicle = player addAction ["Pack Vehicle", "scripts\EVD\EVD_pack.sqf",_cursorTarget, 0, false, true, "",""]; | |
| 832 | }; | |
| 833 | } else {
| |
| 834 | player removeAction s_player_packvehicle; | |
| 835 | s_player_packvehicle = -1; | |
| 836 | }; | |
| 837 | // All Traders | |
| 838 | if (_isMan && !_isPZombie && _traderType in serverTraders) then {
| |
| 839 | ||
| 840 | if (s_player_parts_crtl < 0) then {
| |
| 841 | ||
| 842 | // get humanity | |
| 843 | _humanity = player getVariable ["humanity",0]; | |
| 844 | _traderMenu = call compile format["menu_%1;",_traderType]; | |
| 845 | ||
| 846 | // diag_log ("TRADER = " + str(_traderMenu));
| |
| 847 | ||
| 848 | _low_high = "low"; | |
| 849 | _humanity_logic = false; | |
| 850 | if((_traderMenu select 2) == "friendly") then {
| |
| 851 | _humanity_logic = (_humanity < -5000); | |
| 852 | }; | |
| 853 | if((_traderMenu select 2) == "hostile") then {
| |
| 854 | _low_high = "high"; | |
| 855 | _humanity_logic = (_humanity > -5000); | |
| 856 | }; | |
| 857 | if((_traderMenu select 2) == "hero") then {
| |
| 858 | _humanity_logic = (_humanity < 5000); | |
| 859 | }; | |
| 860 | if(_humanity_logic) then {
| |
| 861 | _cancel = player addAction [format[localize "STR_EPOCH_ACTIONS_HUMANITY",_low_high], "\z\addons\dayz_code\actions\trade_cancel.sqf",["na"], 0, true, false, "",""]; | |
| 862 | s_player_parts set [count s_player_parts,_cancel]; | |
| 863 | } else {
| |
| 864 | ||
| 865 | // Static Menu | |
| 866 | {
| |
| 867 | //diag_log format["DEBUG TRADER: %1", _x]; | |
| 868 | _buy = player addAction [format["Trade %1 %2 for %3 %4",(_x select 3),(_x select 5),(_x select 2),(_x select 6)], "\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),(_x select 5),(_x select 6)], (_x select 7), true, true, "",""]; | |
| 869 | s_player_parts set [count s_player_parts,_buy]; | |
| 870 | ||
| 871 | } count (_traderMenu select 1); | |
| 872 | // Database menu | |
| 873 | _buy = player addAction [localize "STR_EPOCH_PLAYER_289", "\z\addons\dayz_code\actions\show_dialog.sqf",(_traderMenu select 0), 999, true, false, "",""]; | |
| 874 | s_player_parts set [count s_player_parts,_buy]; | |
| 875 | ||
| 876 | }; | |
| 877 | s_player_parts_crtl = 1; | |
| 878 | ||
| 879 | }; | |
| 880 | } else {
| |
| 881 | {player removeAction _x} count s_player_parts;s_player_parts = [];
| |
| 882 | s_player_parts_crtl = -1; | |
| 883 | }; | |
| 884 | ||
| 885 | ||
| 886 | if(dayz_tameDogs) then {
| |
| 887 | ||
| 888 | //Dog | |
| 889 | if (_isDog && _isAlive && (_hasRawMeat) && _characterID == "0" && player getVariable ["dogID", 0] == 0) then {
| |
| 890 | if (s_player_tamedog < 0) then {
| |
| 891 | s_player_tamedog = player addAction [localize "str_actions_tamedog", "\z\addons\dayz_code\actions\tame_dog.sqf", _cursorTarget, 1, false, true, "", ""]; | |
| 892 | }; | |
| 893 | } else {
| |
| 894 | player removeAction s_player_tamedog; | |
| 895 | s_player_tamedog = -1; | |
| 896 | }; | |
| 897 | if (_isDog && _characterID == dayz_characterID && _isAlive) then {
| |
| 898 | _dogHandle = player getVariable ["dogID", 0]; | |
| 899 | if (s_player_feeddog < 0 && _hasRawMeat) then {
| |
| 900 | s_player_feeddog = player addAction [localize "str_actions_feeddog","\z\addons\dayz_code\actions\dog\feed.sqf",[_dogHandle,0], 0, false, true,"",""]; | |
| 901 | }; | |
| 902 | if (s_player_waterdog < 0 && "ItemWaterbottle" in _magazinesPlayer) then {
| |
| 903 | s_player_waterdog = player addAction [localize "str_actions_waterdog","\z\addons\dayz_code\actions\dog\feed.sqf",[_dogHandle,1], 0, false, true,"",""]; | |
| 904 | }; | |
| 905 | if (s_player_staydog < 0) then {
| |
| 906 | _lieDown = _dogHandle getFSMVariable "_actionLieDown"; | |
| 907 | if (_lieDown) then { _text = "str_actions_liedog"; } else { _text = "str_actions_sitdog"; };
| |
| 908 | s_player_staydog = player addAction [localize _text,"\z\addons\dayz_code\actions\dog\stay.sqf", _dogHandle, 5, false, true,"",""]; | |
| 909 | }; | |
| 910 | if (s_player_trackdog < 0) then {
| |
| 911 | s_player_trackdog = player addAction [localize "str_actions_trackdog","\z\addons\dayz_code\actions\dog\track.sqf", _dogHandle, 4, false, true,"",""]; | |
| 912 | }; | |
| 913 | if (s_player_barkdog < 0) then {
| |
| 914 | s_player_barkdog = player addAction [localize "str_actions_barkdog","\z\addons\dayz_code\actions\dog\speak.sqf", _cursorTarget, 3, false, true,"",""]; | |
| 915 | }; | |
| 916 | if (s_player_warndog < 0) then {
| |
| 917 | _warn = _dogHandle getFSMVariable "_watchDog"; | |
| 918 | if (_warn) then { _text = (localize "str_epoch_player_247"); _warn = false; } else { _text = (localize "str_epoch_player_248"); _warn = true; };
| |
| 919 | s_player_warndog = player addAction [format[localize "str_actions_warndog",_text],"\z\addons\dayz_code\actions\dog\warn.sqf",[_dogHandle, _warn], 2, false, true,"",""]; | |
| 920 | }; | |
| 921 | if (s_player_followdog < 0) then {
| |
| 922 | s_player_followdog = player addAction [localize "str_actions_followdog","\z\addons\dayz_code\actions\dog\follow.sqf",[_dogHandle,true], 6, false, true,"",""]; | |
| 923 | }; | |
| 924 | } else {
| |
| 925 | player removeAction s_player_feeddog; | |
| 926 | s_player_feeddog = -1; | |
| 927 | player removeAction s_player_waterdog; | |
| 928 | s_player_waterdog = -1; | |
| 929 | player removeAction s_player_staydog; | |
| 930 | s_player_staydog = -1; | |
| 931 | player removeAction s_player_trackdog; | |
| 932 | s_player_trackdog = -1; | |
| 933 | player removeAction s_player_barkdog; | |
| 934 | s_player_barkdog = -1; | |
| 935 | player removeAction s_player_warndog; | |
| 936 | s_player_warndog = -1; | |
| 937 | player removeAction s_player_followdog; | |
| 938 | s_player_followdog = -1; | |
| 939 | }; | |
| 940 | }; | |
| 941 | ||
| 942 | } else {
| |
| 943 | //Engineering | |
| 944 | {dayz_myCursorTarget removeAction _x} count s_player_repairActions;s_player_repairActions = [];
| |
| 945 | s_player_repair_crtl = -1; | |
| 946 | ||
| 947 | {player removeAction _x} count s_player_combi;s_player_combi = [];
| |
| 948 | ||
| 949 | dayz_myCursorTarget = objNull; | |
| 950 | s_player_lastTarget = [objNull,objNull,objNull,objNull,objNull]; | |
| 951 | ||
| 952 | {player removeAction _x} count s_player_parts;s_player_parts = [];
| |
| 953 | s_player_parts_crtl = -1; | |
| 954 | ||
| 955 | {player removeAction _x} count s_player_lockunlock;s_player_lockunlock = [];
| |
| 956 | s_player_lockUnlock_crtl = -1; | |
| 957 | ||
| 958 | player removeAction s_player_checkGear; | |
| 959 | s_player_checkGear = -1; | |
| 960 | ||
| 961 | player removeAction s_player_SurrenderedGear; | |
| 962 | s_player_SurrenderedGear = -1; | |
| 963 | ||
| 964 | //Others | |
| 965 | player removeAction s_player_forceSave; | |
| 966 | s_player_forceSave = -1; | |
| 967 | player removeAction s_player_flipveh; | |
| 968 | s_player_flipveh = -1; | |
| 969 | player removeAction s_player_sleep; | |
| 970 | s_player_sleep = -1; | |
| 971 | player removeAction s_player_deleteBuild; | |
| 972 | s_player_deleteBuild = -1; | |
| 973 | player removeAction s_player_butcher; | |
| 974 | s_player_butcher = -1; | |
| 975 | player removeAction s_player_cook; | |
| 976 | s_player_cook = -1; | |
| 977 | player removeAction s_player_boil; | |
| 978 | s_player_boil = -1; | |
| 979 | player removeAction s_player_fireout; | |
| 980 | s_player_fireout = -1; | |
| 981 | player removeAction s_player_packtent; | |
| 982 | s_player_packtent = -1; | |
| 983 | player removeAction s_player_fillfuel; | |
| 984 | s_player_fillfuel = -1; | |
| 985 | player removeAction s_player_studybody; | |
| 986 | s_player_studybody = -1; | |
| 987 | // Take Clothes by Zabn | |
| 988 | player removeAction s_player_clothes; | |
| 989 | s_player_clothes = -1; | |
| 990 | //Dog | |
| 991 | player removeAction s_player_tamedog; | |
| 992 | s_player_tamedog = -1; | |
| 993 | player removeAction s_player_feeddog; | |
| 994 | s_player_feeddog = -1; | |
| 995 | player removeAction s_player_waterdog; | |
| 996 | s_player_waterdog = -1; | |
| 997 | player removeAction s_player_staydog; | |
| 998 | s_player_staydog = -1; | |
| 999 | player removeAction s_player_trackdog; | |
| 1000 | s_player_trackdog = -1; | |
| 1001 | player removeAction s_player_barkdog; | |
| 1002 | s_player_barkdog = -1; | |
| 1003 | player removeAction s_player_warndog; | |
| 1004 | s_player_warndog = -1; | |
| 1005 | player removeAction s_player_followdog; | |
| 1006 | s_player_followdog = -1; | |
| 1007 | ||
| 1008 | // vault | |
| 1009 | player removeAction s_player_unlockvault; | |
| 1010 | s_player_unlockvault = -1; | |
| 1011 | player removeAction s_player_packvault; | |
| 1012 | s_player_packvault = -1; | |
| 1013 | player removeAction s_player_lockvault; | |
| 1014 | s_player_lockvault = -1; | |
| 1015 | ||
| 1016 | player removeAction s_player_information; | |
| 1017 | s_player_information = -1; | |
| 1018 | player removeAction s_player_fillgen; | |
| 1019 | s_player_fillgen = -1; | |
| 1020 | player removeAction s_player_upgrade_build; | |
| 1021 | s_player_upgrade_build = -1; | |
| 1022 | player removeAction s_player_maint_build; | |
| 1023 | s_player_maint_build = -1; | |
| 1024 | player removeAction s_player_downgrade_build; | |
| 1025 | s_player_downgrade_build = -1; | |
| 1026 | player removeAction s_player_towing; | |
| 1027 | s_player_towing = -1; | |
| 1028 | player removeAction s_player_fuelauto; | |
| 1029 | s_player_fuelauto = -1; | |
| 1030 | player removeAction s_player_fuelauto2; | |
| 1031 | s_player_fuelauto2 = -1; | |
| 1032 | }; | |
| 1033 | ||
| 1034 | ||
| 1035 | ||
| 1036 | //Dog actions on player self | |
| 1037 | _dogHandle = player getVariable ["dogID", 0]; | |
| 1038 | if (_dogHandle > 0) then {
| |
| 1039 | _dog = _dogHandle getFSMVariable "_dog"; | |
| 1040 | _characterID = "0"; | |
| 1041 | if (!isNull cursorTarget) then { _characterID = cursorTarget getVariable ["CharacterID","0"]; };
| |
| 1042 | if (_canDo && !_inVehicle && alive _dog && _characterID != dayz_characterID) then {
| |
| 1043 | if (s_player_movedog < 0) then {
| |
| 1044 | s_player_movedog = player addAction [localize "str_actions_movedog", "\z\addons\dayz_code\actions\dog\move.sqf", player getVariable ["dogID", 0], 1, false, true, "", ""]; | |
| 1045 | }; | |
| 1046 | if (s_player_speeddog < 0) then {
| |
| 1047 | _text = (localize "str_epoch_player_249"); | |
| 1048 | _speed = 0; | |
| 1049 | if (_dog getVariable ["currentSpeed",1] == 0) then { _speed = 1; _text = (localize "str_epoch_player_250"); };
| |
| 1050 | 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, "", ""]; | |
| 1051 | }; | |
| 1052 | if (s_player_calldog < 0) then {
| |
| 1053 | s_player_calldog = player addAction [localize "str_actions_calldog", "\z\addons\dayz_code\actions\dog\follow.sqf", [player getVariable ["dogID", 0], true], 2, false, true, "", ""]; | |
| 1054 | }; | |
| 1055 | }; | |
| 1056 | } else {
| |
| 1057 | player removeAction s_player_movedog; | |
| 1058 | s_player_movedog = -1; | |
| 1059 | player removeAction s_player_speeddog; | |
| 1060 | s_player_speeddog = -1; | |
| 1061 | player removeAction s_player_calldog; | |
| 1062 | s_player_calldog = -1; | |
| 1063 | }; |