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