summaryrefslogtreecommitdiffstats
path: root/Client/Module/ZetaCargo
diff options
context:
space:
mode:
authorhybrid <hybrid@hybridlabs.pro>2026-06-11 19:38:09 +0300
committerhybrid <hybrid@hybridlabs.pro>2026-06-11 19:38:09 +0300
commita3a91d4f45b22fd487ecbc954ad979be5d03efdd (patch)
treea554ab159a347dcd6c00ca1c7c26c1ec3ac0a6bd /Client/Module/ZetaCargo
downloada2wf_chernarus-main.tar.gz
a2wf_chernarus-main.tar.bz2
a2wf_chernarus-main.zip
Diffstat (limited to 'Client/Module/ZetaCargo')
-rw-r--r--Client/Module/ZetaCargo/Zeta_Hook.sqf40
-rw-r--r--Client/Module/ZetaCargo/Zeta_Init.sqf12
-rw-r--r--Client/Module/ZetaCargo/Zeta_Unhook.sqf21
3 files changed, 73 insertions, 0 deletions
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