From 7a4775beea210dbfa1a5273bbf52af6490ef4ce2 Mon Sep 17 00:00:00 2001 From: ebaydayz Date: Fri, 5 Aug 2016 14:38:12 -0400 Subject: [PATCH] Fix needing to click lock/unlock twice from inside vehicle to take effect No reason to use spawn here. Spawn can have a delay. Since fn_selfActions runs faster it can register the vehicle as still locked or unlocked after you clicked the action. --- SQF/dayz_code/actions/hotwire_veh.sqf | 4 ++-- SQF/dayz_code/actions/lock_veh.sqf | 4 ++-- SQF/dayz_code/actions/unlock_veh.sqf | 4 ++-- SQF/dayz_code/compile/fn_selfActions.sqf | 7 ++----- SQF/dayz_code/init/publicEH.sqf | 2 +- SQF/dayz_code/init/variables.sqf | 1 + 6 files changed, 10 insertions(+), 12 deletions(-) diff --git a/SQF/dayz_code/actions/hotwire_veh.sqf b/SQF/dayz_code/actions/hotwire_veh.sqf index e386ea25f..21ea1dfb5 100644 --- a/SQF/dayz_code/actions/hotwire_veh.sqf +++ b/SQF/dayz_code/actions/hotwire_veh.sqf @@ -7,7 +7,7 @@ DZE_ActionInProgress = true; {player removeAction _x} count s_player_lockunlock;s_player_lockunlock = []; s_player_lockUnlock_crtl = 1; {DZE_myVehicle removeAction _x} count s_player_lockUnlockInside;s_player_lockUnlockInside = []; -s_player_lockUnlockInside_ctrl = -1; +s_player_lockUnlockInside_ctrl = 1; _removed = ([player,"ItemHotwireKit",1] call BIS_fnc_invRemove); @@ -19,7 +19,7 @@ if (_removed == 1) then { if(player distance _vehicle < 10) then { if (local _vehicle) then { - PVDZE_veh_Lock spawn local_lockUnlock + PVDZE_veh_Lock call local_lockUnlock } else { publicVariable "PVDZE_veh_Lock"; }; diff --git a/SQF/dayz_code/actions/lock_veh.sqf b/SQF/dayz_code/actions/lock_veh.sqf index f3fd7bafe..60fdaf357 100644 --- a/SQF/dayz_code/actions/lock_veh.sqf +++ b/SQF/dayz_code/actions/lock_veh.sqf @@ -7,12 +7,12 @@ DZE_ActionInProgress = true; {player removeAction _x} count s_player_lockunlock;s_player_lockunlock = []; s_player_lockUnlock_crtl = 1; {DZE_myVehicle removeAction _x} count s_player_lockUnlockInside;s_player_lockUnlockInside = []; -s_player_lockUnlockInside_ctrl = -1; +s_player_lockUnlockInside_ctrl = 1; PVDZE_veh_Lock = [_vehicle,true]; if(player distance _vehicle < 10) then { if (local _vehicle) then { - PVDZE_veh_Lock spawn local_lockUnlock + PVDZE_veh_Lock call local_lockUnlock } else { publicVariable "PVDZE_veh_Lock"; }; diff --git a/SQF/dayz_code/actions/unlock_veh.sqf b/SQF/dayz_code/actions/unlock_veh.sqf index 495a8c66a..5d49c3964 100644 --- a/SQF/dayz_code/actions/unlock_veh.sqf +++ b/SQF/dayz_code/actions/unlock_veh.sqf @@ -8,12 +8,12 @@ DZE_ActionInProgress = true; {player removeAction _x} count s_player_lockunlock;s_player_lockunlock = []; s_player_lockUnlock_crtl = 1; {DZE_myVehicle removeAction _x} count s_player_lockUnlockInside;s_player_lockUnlockInside = []; -s_player_lockUnlockInside_ctrl = -1; +s_player_lockUnlockInside_ctrl = 1; PVDZE_veh_Lock = [_vehicle,false]; if(player distance _vehicle < 10) then { if (local _vehicle) then { - PVDZE_veh_Lock spawn local_lockUnlock + PVDZE_veh_Lock call local_lockUnlock } else { publicVariable "PVDZE_veh_Lock"; }; diff --git a/SQF/dayz_code/compile/fn_selfActions.sqf b/SQF/dayz_code/compile/fn_selfActions.sqf index ad382a357..08682209b 100644 --- a/SQF/dayz_code/compile/fn_selfActions.sqf +++ b/SQF/dayz_code/compile/fn_selfActions.sqf @@ -150,13 +150,10 @@ if (_inVehicle) then { s_player_lockUnlockInside_ctrl = -1; }; } else { - if (!isNil "DZE_myVehicle") then { - {DZE_myVehicle removeAction _x} count s_player_lockUnlockInside;s_player_lockUnlockInside = []; - s_player_lockUnlockInside_ctrl = -1; - }; + {DZE_myVehicle removeAction _x} count s_player_lockUnlockInside;s_player_lockUnlockInside = []; + s_player_lockUnlockInside_ctrl = -1; }; - if (DZE_HeliLift) then { _hasAttached = _vehicle getVariable["hasAttached",false]; if (_inVehicle && {_vehicle isKindOf "Air"} && {(([_vehicle] call FNC_getPos) select 2) < 30} && {speed _vehicle < 5} && {typeName _hasAttached == "OBJECT"}) then { diff --git a/SQF/dayz_code/init/publicEH.sqf b/SQF/dayz_code/init/publicEH.sqf index ada956f28..8d684c957 100644 --- a/SQF/dayz_code/init/publicEH.sqf +++ b/SQF/dayz_code/init/publicEH.sqf @@ -12,7 +12,7 @@ //"dayzInfectedCamps" addPublicVariableEventHandler {(_this select 1) call infectedcamps}; // EPOCH ADDITIONS -"PVDZE_veh_Lock" addPublicVariableEventHandler {(_this select 1) spawn local_lockUnlock}; +"PVDZE_veh_Lock" addPublicVariableEventHandler {(_this select 1) call local_lockUnlock}; "PVDZE_plr_GutBodyZ" addPublicVariableEventHandler {(_this select 1) spawn local_gutObjectZ}; "PVDZE_veh_Init" addPublicVariableEventHandler {(_this select 1) call fnc_veh_ResetEH}; diff --git a/SQF/dayz_code/init/variables.sqf b/SQF/dayz_code/init/variables.sqf index 8eb380b2c..8a5b1cced 100644 --- a/SQF/dayz_code/init/variables.sqf +++ b/SQF/dayz_code/init/variables.sqf @@ -687,4 +687,5 @@ if (!isDedicated) then { DZE_Surrender = false; DZE_Quarantine = false; DZE_InRadiationZone = false; + DZE_myVehicle = objNull; };