From 628d33984d9228f1781d13a65fbb80f35facc899 Mon Sep 17 00:00:00 2001 From: hybrid Date: Thu, 11 Jun 2026 19:55:24 +0300 Subject: init --- Client/Module/ZetaCargo/Zeta_Hook.sqf | 40 +++++++++++++++++++++++++++++++++ Client/Module/ZetaCargo/Zeta_Init.sqf | 12 ++++++++++ Client/Module/ZetaCargo/Zeta_Unhook.sqf | 21 +++++++++++++++++ 3 files changed, 73 insertions(+) create mode 100644 Client/Module/ZetaCargo/Zeta_Hook.sqf create mode 100644 Client/Module/ZetaCargo/Zeta_Init.sqf create mode 100644 Client/Module/ZetaCargo/Zeta_Unhook.sqf (limited to 'Client/Module/ZetaCargo') diff --git a/Client/Module/ZetaCargo/Zeta_Hook.sqf b/Client/Module/ZetaCargo/Zeta_Hook.sqf new file mode 100644 index 0000000..653ecaa --- /dev/null +++ b/Client/Module/ZetaCargo/Zeta_Hook.sqf @@ -0,0 +1,40 @@ +Private ["_action","_actionID","_caller","_index","_isAttached","_lifter","_position","_sorted","_type","_vehicle","_vehicles"]; + +_lifter = _this select 0; +_caller = _this select 1; +_actionID = _this select 2; + +if (_caller != driver _lifter) exitWith {}; +if ((typeOf _lifter) in Zeta_Special) then { + if (speed _lifter > 20) exitWith {}; +} else { + if ((speed _lifter > 20)||((getpos _lifter select 2)<2)) exitWith {}; +}; +//--- nearEntities handle living units. +_vehicles = _lifter nearEntities [Zeta_Types, 10]; +if (count _vehicles < 1) exitWith {}; + +_sorted = [_lifter,_vehicles] Call SortByDistance; +_vehicle = _sorted select 0; +_type = typeOf _lifter; +_position = Zeta_DefaultPos; +_index = Zeta_Special find _type; +if (_index != -1) then {_position = Zeta_SpecialPosition select _index}; + +if (count crew(_vehicle) > 0) exitWith {hint (localize 'STR_WF_INFO_Hook_Manned')}; + +_vehicle attachTo [_lifter,_position]; +_lifter setVariable ["Attached",true,false]; +_lifter removeAction _actionID; + +_action = _lifter addAction [localize "STR_WF_Lift_Detach","Client\Module\ZetaCargo\Zeta_Unhook.sqf"]; + +while {!gameOver} do { + sleep 2; + _isAttached = _lifter getVariable "Attached"; + if ((getDammage _lifter > 0.3)||!_isAttached||isNull (driver _lifter)) exitWith { + detach _vehicle; + _lifter removeAction _action; + if (alive _lifter) then {_lifter addAction [localize "STR_WF_Lift","Client\Module\ZetaCargo\Zeta_Hook.sqf"]}; + }; +}; \ No newline at end of file diff --git a/Client/Module/ZetaCargo/Zeta_Init.sqf b/Client/Module/ZetaCargo/Zeta_Init.sqf new file mode 100644 index 0000000..29dcac0 --- /dev/null +++ b/Client/Module/ZetaCargo/Zeta_Init.sqf @@ -0,0 +1,12 @@ +//--- Zeta Cargo by Benny. + +//--- Unit allowed to hook. +Zeta_Lifter = ["MH60S","MV22","C130J","Mi17_Ins","Mi17_medevac_RU","UH60M_EP1","UH60M_MEV_EP1","CH_47F_EP1","C130J_US_EP1","Mi17_TK_EP1","BAF_Merlin_HC3_D","CH_47F_BAF"]; +//--- Zeta Cargo can lift these types. +Zeta_Types = ["Car","Motorcycle","Tank","Ship"]; +//--- Zeta Cargo default Position. +Zeta_DefaultPos = [0,0,-4]; + +//--- Special vehicle with special position. +Zeta_Special = ["C130J","C130J_US_EP1"]; +Zeta_SpecialPosition = [[0,0,-2]]; \ No newline at end of file diff --git a/Client/Module/ZetaCargo/Zeta_Unhook.sqf b/Client/Module/ZetaCargo/Zeta_Unhook.sqf new file mode 100644 index 0000000..3e06b0f --- /dev/null +++ b/Client/Module/ZetaCargo/Zeta_Unhook.sqf @@ -0,0 +1,21 @@ +private ["_actionID","_caller","_lifter","_param","_vehicle"]; + +_lifter = _this select 0; +_caller = _this select 1; +_actionID = _this select 2; +_param = _this select 3; +_vehicle = _param select 0; + +_lifter setVariable ["Attached",false]; +detach _vehicle; +if ((typeOf _lifter) in Zeta_Special) then { + _vehicle setPos [(getPos _lifter select 0) - (15 * sin (getDir _vehicle)), (getPos _lifter select 1) - (15 * cos (getDir _vehicle)), getPos _lifter select 2]; +}; + +_vehicle setVelocity (velocity _lifter); + +_lifter removeAction _actionID; + +sleep 1; + +if ((getPos _vehicle) select 2 < 0) then {_vehicle setPos [(getPos _vehicle) select 0,(getPos _vehicle) select 1,0];_vehicle setVelocity [0,0,-0.1]}; \ No newline at end of file -- cgit v1.3.1