From bbdaf0cffe2faae9883245b59b1e3ed73be116f1 Mon Sep 17 00:00:00 2001 From: worldwidesorrow Date: Wed, 11 Dec 2019 18:34:41 -0600 Subject: [PATCH] Uploading new files for load functions The files are heavily edited. --- SQF/dayz_code/medical/load/load_act.sqf | 30 +++----- SQF/dayz_code/medical/load/load_wounded.sqf | 68 ++++++++----------- SQF/dayz_code/medical/load/unLoad_act.sqf | 52 ++++++-------- SQF/dayz_code/medical/load/unload_wounded.sqf | 18 +++++ 4 files changed, 78 insertions(+), 90 deletions(-) create mode 100644 SQF/dayz_code/medical/load/unload_wounded.sqf diff --git a/SQF/dayz_code/medical/load/load_act.sqf b/SQF/dayz_code/medical/load/load_act.sqf index 4fb128492..557825ba4 100644 --- a/SQF/dayz_code/medical/load/load_act.sqf +++ b/SQF/dayz_code/medical/load/load_act.sqf @@ -1,31 +1,23 @@ // Load_act.sqf // JULY 2010 - norrin +// Updated December 2019 - JasonTM -private ["_args","_dragger","_vcl","_wounded"]; +private ["_args","_medic","_vcl","_wounded"]; _args = _this select 3; -_dragger = _args select 0; +_medic = _args select 0; _vcl = _args select 1; _wounded = _args select 2; -r_drag_sqf = false; + r_action = false; -r_action_load = false; call fnc_usec_medic_removeActions; -_wounded removeAction NORRN_loadWoundedAction; - -if ((_vcl emptyPositions "cargo") > 0) then -{ - detach _wounded; - _dragger switchMove ""; - _wounded setVariable ["NORRN_LoadVcl", _vcl, true]; - uiSleep 1; - //["PVDZ_drg_RLact",_wounded] call broadcastRpcCallAll; - [_wounded] execVM "\z\addons\dayz_code\medical\load\load_wounded.sqf"; - PVDZ_drg_RLact = _wounded; - publicVariable "PVDZ_drg_RLact"; - player removeAction NORRN_dropAction; +if ((_vcl emptyPositions "cargo") > 0) then { + + // Send information to start the load process + PVDZ_send = [_wounded,"LoadWounded",[_wounded,_medic,_vcl],[_wounded,dayz_authKey,_medic]]; + publicVariableServer "PVDZ_send"; } else { - localize "str_dragnospace" call dayz_rollingMessages;//hint "No space left in vehicle"; + localize "str_dragnospace" call dayz_rollingMessages; // "No space left in vehicle" }; -NORRN_load_wounded_action = true; + diff --git a/SQF/dayz_code/medical/load/load_wounded.sqf b/SQF/dayz_code/medical/load/load_wounded.sqf index 381f42611..d01a6d704 100644 --- a/SQF/dayz_code/medical/load/load_wounded.sqf +++ b/SQF/dayz_code/medical/load/load_wounded.sqf @@ -1,52 +1,40 @@ // Load_wounded.sqf // OCTOBER 2010 - norrin +// Updated December 2019 - JasonTM -private ["_wounded","_vcl","_group"]; +private ["_wounded","_vehicle","_group","_medic"]; _wounded = _this select 0; +_medic = _this select 1; +_vehicle = _this select 2; -if (!local _wounded) exitWith {}; +// Check to see that the first passed object matches local player object +if (player != _wounded) exitWith {}; +if !(r_player_unconscious) exitWith {}; -uiSleep 1; -_vcl = _wounded getVariable "NORRN_loadVcl"; -_wounded setVariable ["NORRN_unit_dragged", true, true]; +_wounded assignAsCargo _vehicle; +_wounded moveInCargo _vehicle; -_wounded assignAsCargo _vcl; -_wounded moveInCargo _vcl; -uiSleep 1; -//["PVDZ_drg_RaLW",_wounded] call broadcastRpcCallAll; - PVDZ_drg_RaLW = _wounded; - publicVariable "PVDZ_drg_RaLW"; - _wounded switchMove "kia_hmmwv_driver"; +// Animation needs to be synced on all clients. +[nil, _wounded, rSWITCHMOVE, "KIA_HMMWV_Cargo01"] call RE; +_wounded switchMove "KIA_HMMWV_Cargo01"; -if (local _wounded) then -{ - waitUntil {!(_wounded getVariable "NORRN_unconscious")|| !alive _wounded || vehicle _wounded == _wounded || (assignedVehicleRole _wounded) select 0 != "Cargo"}; +r_drag_sqf = true; - if ((vehicle _wounded == _wounded) || (assignedVehicleRole _wounded) select 0 != "Cargo") exitWith - { - if (_wounded getVariable "NORRN_AIunconscious") then - { - if (vehicle _wounded != _wounded) then - { - unassignVehicle _wounded; - uiSleep 0.05; - _wounded action ["EJECT", _vcl]; - uiSleep 1; - }; -// PVDZ_drg_RAlie = _wounded; // not used -// publicVariable "PVDZ_drg_RAlie"; // not used - _wounded switchMove "ainjppnemstpsnonwrfldnon"; - _wounded setVariable ["NORRN_unit_dragged", false, true]; - uiSleep 1; +while {r_drag_sqf} do { + + // If the player wakes up, end the loop. + if (!(_wounded getVariable ["NORRN_unconscious", false])) then { + + uiSleep 2; // Give fn_unconsious time to finish + + if (vehicle _wounded != _wounded) then { + // fn_unconscious does not perform an animation if the player is in a vehicle. + [nil, _wounded, rSWITCHMOVE, "HMMWV_Cargo01"] call RE; + _wounded switchMove "HMMWV_Cargo01"; }; + + r_drag_sqf = false; }; - - if (vehicle _wounded != _wounded && alive _wounded) then - { - _wounded playMove "BasicDriver"; - }; -}; -uiSleep 0.01; - -if (true) exitWith {}; \ No newline at end of file + uiSleep 1; +}; \ No newline at end of file diff --git a/SQF/dayz_code/medical/load/unLoad_act.sqf b/SQF/dayz_code/medical/load/unLoad_act.sqf index 868ea0e61..9ec173726 100644 --- a/SQF/dayz_code/medical/load/unLoad_act.sqf +++ b/SQF/dayz_code/medical/load/unLoad_act.sqf @@ -1,40 +1,30 @@ // unLoad_act.sqf // AUGUST 2010 - norrin +// Updated December 2019 - JasonTM -private ["_args","_dragger","_vcl","_wounded"]; +private ["_args","_unconscious_crew","_vehicle","_pos","_wounded","_medic"]; _args = _this select 3; -_name = _args select 0; -_vcl = _args select 1; -_crewVcl = crew _vcl; -LHA_Deck = []; -LHA_height = 0; +_medic = _args select 0; +_unconscious_crew = _args select 1; +_vehicle = _args select 2; +_pos = [_vehicle] call FNC_GetPos; -//_name removeAction NORRN_pullOutAction; // NORRN_pullOutAction is defined anywhere +r_action = false; +call fnc_usec_medic_removeActions; -for [{ _loop = 0 },{ _loop < count _crewVcl },{ _loop = _loop + 1}] do -{ - _unit = _crewVcl select _loop; - - if (_unit getVariable "NORRN_unconscious") then +// Prevent trolling unconscious players by checking that the position is not over water. +if !(surfaceIsWater _pos) then { { - unassignVehicle _unit; - uiSleep 0.05; - _unit action ["EJECT", _vcl]; - uiSleep 1; - _position = getPosATL _unit; - _isOnDeck = getPosASL _unit in LHA_Deck; - if (_isOnDeck) then { - _unit setPosAsl [(_position select 0), (_position select 1), (LHA_height+1)]; - }; - _unit switchMove ""; - _unit switchMove "ainjppnemstpsnonwrfldnon"; - uiSleep 0.2; - //Needed or else patient user input is not fully disabled after eject - PVDZ_drg_RaDrag = [_unit]; - publicVariable "PVDZ_drg_RaDrag"; - }; - uiSleep 0.1; -}; + _wounded = _x; + unassignVehicle _wounded; + _wounded action ["EJECT", _vehicle]; + + // Send information to reestablish the "lie on back" animation + PVDZ_send = [_wounded,"UnloadWounded",_wounded,[_pos,dayz_authKey,_medic]]; + publicVariableServer "PVDZ_send"; -if (true) exitWith {}; + } count _unconscious_crew; +} else { + localize "str_actions_unload_fail" call dayz_rollingMessages; +}; diff --git a/SQF/dayz_code/medical/load/unload_wounded.sqf b/SQF/dayz_code/medical/load/unload_wounded.sqf new file mode 100644 index 000000000..7159c1485 --- /dev/null +++ b/SQF/dayz_code/medical/load/unload_wounded.sqf @@ -0,0 +1,18 @@ +// unload_wounded.sqf +// December 2019 - JasonTM + +private "_wounded"; + +_wounded = _this; + +// Check to see that the passed object matches local player object +if (player != _wounded) exitWith {}; + +// Check if the player is still unconscious +if (r_player_unconscious) then { + // Reestablish the "lie on back" animation + [nil, _wounded, rSWITCHMOVE, "ainjppnemstpsnonwrfldnon"] call RE; + _wounded switchmove "ainjppnemstpsnonwrfldnon"; +}; + +r_drag_sqf = false; \ No newline at end of file