diff --git a/SQF/dayz_code/actions/flare_pickup.sqf b/SQF/dayz_code/actions/flare_pickup.sqf index 70e89b662..7b329803d 100644 --- a/SQF/dayz_code/actions/flare_pickup.sqf +++ b/SQF/dayz_code/actions/flare_pickup.sqf @@ -1,21 +1,37 @@ -private["_flare","_text"]; - -_flare = _this select 3; +local _flare = _this select 3; player playActionNow "PutDown"; uiSleep 2; -_flare attachTo [player,[0,0,0],"granat2"]; + +_flare attachTo [player, [0,0,0], "granat2"]; [_flare, -90, -10] call object_setpitchbank; -[_flare] call FNC_GetSetPos; -_flare setVariable ["owner",player,true]; +//[_flare] call FNC_GetSetPos; +_flare setVariable ["owner", player, true]; player removeAction s_player_grabflare; player removeAction s_player_removeflare; dayz_hasLight = true; //Add Drop Action -_text = getText (configFile >> "CfgAmmo" >> (typeOf _flare) >> "displayName"); -s_player_dropflare = player addAction [format[localize "str_actions_medical_16",_text], "\z\addons\dayz_code\actions\flare_drop.sqf",_flare, 1, false, true, "", ""]; +local _text = getText (configFile >> "CfgAmmo" >> (typeOf _flare) >> "displayName"); +s_player_dropflare = player addAction [format [localize "str_actions_medical_16", _text], "\z\addons\dayz_code\actions\flare_drop.sqf", _flare, 1, false, true, "", ""]; + +local _vehicle = false; while {(alive _flare) and dayz_hasLight} do { + local _player = true; + if (player != vehicle player) then { + _player = false; + }; + if (!_player && !_vehicle) then { // player got into a vehicle + detach _flare; + _flare attachTo [vehicle player, [0,0,0]]; + _vehicle = true; + }; + if (_player && _vehicle) then { // player exited a vehicle + detach _flare; + _flare attachTo [player, [0,0,0], "granat2"]; + [_flare, -90, -10] call object_setpitchbank; + _vehicle = false; + }; uiSleep 0.1; }; if (dayz_hasLight) then { diff --git a/SQF/dayz_code/compile/fn_getPos.sqf b/SQF/dayz_code/compile/fn_getPos.sqf index 1e087bcad..68dfe131c 100644 --- a/SQF/dayz_code/compile/fn_getPos.sqf +++ b/SQF/dayz_code/compile/fn_getPos.sqf @@ -1,9 +1,3 @@ -private "_pos"; - -_pos = getPosASL (_this select 0); - -if !(surfaceIsWater _pos) then { - _pos = ASLToATL _pos; -}; - -_pos \ No newline at end of file +local _pos = getPosATL (_this select 0); +if (surfaceIsWater _pos) then {_pos = ATLToASL _pos;}; +_pos diff --git a/SQF/dayz_code/init/compiles.sqf b/SQF/dayz_code/init/compiles.sqf index 63a979978..e9d7abb4b 100644 --- a/SQF/dayz_code/init/compiles.sqf +++ b/SQF/dayz_code/init/compiles.sqf @@ -840,7 +840,6 @@ if (dayz_townGenerator) then { BIS_fnc_numberDigits = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_numberDigits.sqf"; BIS_fnc_numberText = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_numberText.sqf"; local_lockUnlock = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\local_lockUnlock.sqf"; //When vehicle is local to unit perform locking vehicle -FNC_GetSetPos = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fnc_getSetPos.sqf"; dayz_groupInvite = compile preprocessFileLineNumbers "\z\addons\dayz_code\groups\handleInvite.sqf"; player_sumMedical = { diff --git a/SQF/dayz_code/compile/fnc_getSetPos.sqf b/SQF/dayz_code/old/fnc_getSetPos.sqf similarity index 100% rename from SQF/dayz_code/compile/fnc_getSetPos.sqf rename to SQF/dayz_code/old/fnc_getSetPos.sqf