Towing
This commit is contained in:
Binary file not shown.
BIN
.hemtt/missions/~test.stratis/mission.sqm
Normal file
BIN
.hemtt/missions/~test.stratis/mission.sqm
Normal file
Binary file not shown.
@@ -24,6 +24,7 @@ workshop = [
|
|||||||
"463939057", # ACE
|
"463939057", # ACE
|
||||||
"2369477168", # Advanced Developer Tools
|
"2369477168", # Advanced Developer Tools
|
||||||
"3058335345", # TBD Mortars
|
"3058335345", # TBD Mortars
|
||||||
|
"843577117", # RHSUSAF
|
||||||
]
|
]
|
||||||
|
|
||||||
mission = "test.Stratis"
|
mission = "test.Stratis"
|
||||||
|
|||||||
@@ -13,3 +13,6 @@ PREP(canLoad);
|
|||||||
PREP(canUnload);
|
PREP(canUnload);
|
||||||
PREP(load);
|
PREP(load);
|
||||||
PREP(unload);
|
PREP(unload);
|
||||||
|
PREP(canBeTowed);
|
||||||
|
PREP(tow);
|
||||||
|
PREP(detach);
|
||||||
|
|||||||
@@ -1 +1,45 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
// Array of all towable vehicles and the offsets
|
||||||
|
GVAR(towingList) = [
|
||||||
|
["B_Truck_01.*", [0.025, -4.7, -0.8], -0.21],
|
||||||
|
["B_MRAP_01.*", [0.01, -4.33, -0.8], -0.14],
|
||||||
|
["rhsusf_M977A4.*", [-0.05, -4.8, -0.8], -0.14],
|
||||||
|
["rhsusf_M1117.*", [0.03, -2.72, -0.9], -0.14],
|
||||||
|
["rhsusf_M1078.*", [-0.03, -2.77, -0.98], -0.16],
|
||||||
|
["rhsusf_M1083.*", [-0.01, -3.32, -0.98], -0.16],
|
||||||
|
["rhsusf_M1084.*", [-0.03, -3.82, -0.88], -0.155],
|
||||||
|
["rhsusf_M1220.*", [-0.04, -3.4, -1.44], -0.195],
|
||||||
|
["rhsusf_M1230.*", [-0.04, -3.6, -2.02], -0.195],
|
||||||
|
["rhsusf_M1232.*", [-0.04, -3.52, -0.37], -0.335],
|
||||||
|
["rhsusf_M1237.*", [-0.04, -4.37, -0.44], -0.334],
|
||||||
|
["rhsusf_m1240a1_usarmy_.*", [0.01, -3.1, -1.78], -0.25],
|
||||||
|
["rhsusf_m1240a1.*", [0.01, -3.76, -1.78], -0.25],
|
||||||
|
["rhsusf_m1025.*", [-0.065, -2.48, -1.17], -0.12],
|
||||||
|
["rhsusf_m1043.*", [-0.065, -2.48, -1.17], -0.12],
|
||||||
|
["rhsusf_m1045.*", [-0.065, -2.48, -0.98], -0.12],
|
||||||
|
["rhsusf_m998.*", [0, -2.4, -0.88], -0.115],
|
||||||
|
["rhsusf_m1151.*", [-0.05, -2.53, -0.7], -0.1],
|
||||||
|
["rhsusf_m1152.*", [-0.05, -2.52, -0.7], -0.105],
|
||||||
|
["rhsusf_m113d.*", [0.37, -1.93, -1.69], -0.035]
|
||||||
|
];
|
||||||
|
|
||||||
|
[QGVAR(detached), {
|
||||||
|
private _arty = _this#0;
|
||||||
|
[_arty, true, [0, 1.2, 0], 0, true] call ace_dragging_fnc_setDraggable;
|
||||||
|
}] call CBA_fnc_addEventHandler;
|
||||||
|
|
||||||
|
[QGVAR(towed), {
|
||||||
|
private _arty = _this#0;
|
||||||
|
[_arty, false] call ace_dragging_fnc_setDraggable;
|
||||||
|
}] call CBA_fnc_addEventHandler;
|
||||||
|
|
||||||
|
[QGVAR(tow), {
|
||||||
|
params ["_arty", "_veh", "_offX", "_offY", "_offZ", "_offRot"];
|
||||||
|
private _offset = _arty selectionPosition "towing_point";
|
||||||
|
private _offset = [_offset#0 + _offX, _offset#1 + _offY, _offZ];
|
||||||
|
_arty attachTo [_veh, _offset];
|
||||||
|
_arty setDir -180;
|
||||||
|
_arty animateSource ["rest_rotation_source", _offRot];
|
||||||
|
_arty setPosWorld getPosWorld _arty;
|
||||||
|
}] call CBA_fnc_addEventHandler;
|
||||||
|
|||||||
54
addons/m119/functions/fnc_canBeTowed.sqf
Normal file
54
addons/m119/functions/fnc_canBeTowed.sqf
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
/*
|
||||||
|
FILE: fnc_canBeTowed.sqf
|
||||||
|
|
||||||
|
Name: tbd_m119_m119_fnc_canBeTowed
|
||||||
|
|
||||||
|
Author(s):
|
||||||
|
ilbinek
|
||||||
|
|
||||||
|
Description:
|
||||||
|
Check if the M119 can be towed
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
_arty - object - M119 to be checked
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
bool - true if the M119 can be towed
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
> [_arty] call tbd_m119_m119_fnc_canBeTowed;
|
||||||
|
|
||||||
|
Public:
|
||||||
|
No
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
|
params ["_arty"];
|
||||||
|
|
||||||
|
// check if being towed
|
||||||
|
if (_arty getVariable [QGVAR(towed), false]) exitWith {false};
|
||||||
|
|
||||||
|
// Check if folded
|
||||||
|
if !(_arty getVariable [QGVAR(folded), false]) exitWith {false};
|
||||||
|
|
||||||
|
// Get pos of the towing point
|
||||||
|
private _pos = _arty modelToWorld (_arty selectionPosition ["towing_point", "Memory"]);
|
||||||
|
private _radius = TOW_RADIUS;
|
||||||
|
private _vehicles = _pos nearEntities _radius;
|
||||||
|
|
||||||
|
|
||||||
|
private _canBeTowed = false;
|
||||||
|
{
|
||||||
|
private _veh = _x;
|
||||||
|
private _class = typeOf _veh;
|
||||||
|
{
|
||||||
|
if (_class regexMatch _x#0) then {
|
||||||
|
private _p = _veh modelToWorldVisual [_x#1#0, _x#1#1, _x#1#2];
|
||||||
|
if (_p distance _pos < ATTACH_RADIUS) exitWith { _canBeTowed = true;};
|
||||||
|
};
|
||||||
|
} forEach GVAR(towingList);
|
||||||
|
if (_canBeTowed) exitWith {};
|
||||||
|
} forEach _vehicles;
|
||||||
|
|
||||||
|
_canBeTowed
|
||||||
38
addons/m119/functions/fnc_detach.sqf
Normal file
38
addons/m119/functions/fnc_detach.sqf
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
FILE: fnc_detach.sqf
|
||||||
|
|
||||||
|
Name: tbd_m119_m119_fnc_detach
|
||||||
|
|
||||||
|
Author(s):
|
||||||
|
ilbinek
|
||||||
|
|
||||||
|
Description:
|
||||||
|
Detach the M119 from the object
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
_arty - object - M119 to detach
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Nothing
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
> [_arty] call tbd_m119_m119_fnc_detach;
|
||||||
|
|
||||||
|
Public:
|
||||||
|
No
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
|
params ["_arty"];
|
||||||
|
|
||||||
|
_arty setVariable [QGVAR(towed), false, false];
|
||||||
|
|
||||||
|
[QGVAR(detached), [_arty], QGVAR(towJIP)] call CBA_fnc_globalEventJIP;
|
||||||
|
_arty animateSource ["rest_rotation_source", 0, 10];
|
||||||
|
|
||||||
|
detach _arty;
|
||||||
|
|
||||||
|
_pos = getPos _arty;
|
||||||
|
_pos set [2, 0];
|
||||||
|
_arty setPos _pos
|
||||||
54
addons/m119/functions/fnc_tow.sqf
Normal file
54
addons/m119/functions/fnc_tow.sqf
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
/*
|
||||||
|
FILE: fnc_tow.sqf
|
||||||
|
|
||||||
|
Name: tbd_m119_m119_fnc_tow
|
||||||
|
|
||||||
|
Author(s):
|
||||||
|
ilbinek
|
||||||
|
|
||||||
|
Description:
|
||||||
|
Start towing the M119 howitzer
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
_arty - object - M119 to be towed
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Nothing
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
> [_arty] call tbd_m119_m119_fnc_tow;
|
||||||
|
|
||||||
|
Public:
|
||||||
|
No
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
|
params ["_arty"];
|
||||||
|
|
||||||
|
if (!([_arty] call FUNC(canBeTowed))) exitWith {};
|
||||||
|
|
||||||
|
// Find the vehicle I need to attach to
|
||||||
|
// Get pos of the towing point
|
||||||
|
private _pos = _arty modelToWorld (_arty selectionPosition ["towing_point", "Memory"]);
|
||||||
|
private _radius = TOW_RADIUS;
|
||||||
|
private _vehicles = _pos nearEntities _radius;
|
||||||
|
|
||||||
|
private _canBeTowed = false;
|
||||||
|
{
|
||||||
|
private _veh = _x;
|
||||||
|
private _class = typeOf _veh;
|
||||||
|
{
|
||||||
|
if (_class regexMatch _x#0) then {
|
||||||
|
private _p = _veh modelToWorldVisual [_x#1#0, _x#1#1, _x#1#2];
|
||||||
|
if (_p distance _pos < ATTACH_RADIUS) exitWith {
|
||||||
|
_canBeTowed = true;
|
||||||
|
[QGVAR(tow), [_arty, _veh, _x#1#0, _x#1#1, _x#1#2, _x#2]] call CBA_fnc_serverEvent;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
} forEach GVAR(towingList);
|
||||||
|
if (_canBeTowed) exitWith {};
|
||||||
|
} forEach _vehicles;
|
||||||
|
|
||||||
|
_arty setVariable [QGVAR(towed), true, true];
|
||||||
|
[QGVAR(towed), [_vasil], QGVAR(towJIP)] call CBA_fnc_globalEventJIP;
|
||||||
@@ -38,3 +38,6 @@
|
|||||||
#define TBD_MORTARS_105mm_ROUND_HE_CHARGE_MAG_5 tbd_mortars_105mm_round_he_charge_mag_5
|
#define TBD_MORTARS_105mm_ROUND_HE_CHARGE_MAG_5 tbd_mortars_105mm_round_he_charge_mag_5
|
||||||
#define TBD_MORTARS_105mm_ROUND_HE_CHARGE_MAG_6 tbd_mortars_105mm_round_he_charge_mag_6
|
#define TBD_MORTARS_105mm_ROUND_HE_CHARGE_MAG_6 tbd_mortars_105mm_round_he_charge_mag_6
|
||||||
#define TBD_MORTARS_105mm_ROUND_HE_CHARGE_MAG_7 tbd_mortars_105mm_round_he_charge_mag_7
|
#define TBD_MORTARS_105mm_ROUND_HE_CHARGE_MAG_7 tbd_mortars_105mm_round_he_charge_mag_7
|
||||||
|
|
||||||
|
#define TOW_RADIUS 10
|
||||||
|
#define ATTACH_RADIUS 2
|
||||||
@@ -36,5 +36,15 @@
|
|||||||
<Czech>Vybít</Czech>
|
<Czech>Vybít</Czech>
|
||||||
<Russian>Разрядить</Russian>
|
<Russian>Разрядить</Russian>
|
||||||
</Key>
|
</Key>
|
||||||
|
<Key ID="STR_TBD_M119_M119_TOW">
|
||||||
|
<English>Tow</English>
|
||||||
|
<Czech>Zaháknout</Czech>
|
||||||
|
<Russian>Прицепить</Russian>
|
||||||
|
</Key>
|
||||||
|
<Key ID="STR_TBD_M119_M119_DETACH">
|
||||||
|
<English>Detach</English>
|
||||||
|
<Czech>Odpojit</Czech>
|
||||||
|
<Russian>Отсоединить</Russian>
|
||||||
|
</Key>
|
||||||
</Package>
|
</Package>
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -229,6 +229,8 @@ class CfgVehicles {
|
|||||||
|
|
||||||
class ACE_Actions: ACE_Actions {
|
class ACE_Actions: ACE_Actions {
|
||||||
class ACE_MainActions: ACE_MainActions {
|
class ACE_MainActions: ACE_MainActions {
|
||||||
|
selection = "interact";
|
||||||
|
|
||||||
class TBD_Fold {
|
class TBD_Fold {
|
||||||
distance = 2.5;
|
distance = 2.5;
|
||||||
condition = QUOTE([ARR_1(_target)] call FUNC(canFold));
|
condition = QUOTE([ARR_1(_target)] call FUNC(canFold));
|
||||||
@@ -337,6 +339,24 @@ class CfgVehicles {
|
|||||||
statement = QUOTE([ARR_2(_target,0)] call FUNC(unload));
|
statement = QUOTE([ARR_2(_target,0)] call FUNC(unload));
|
||||||
icon = "x\tbd_mortars\addons\main\data\unload.paa";
|
icon = "x\tbd_mortars\addons\main\data\unload.paa";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class TBD_Tow {
|
||||||
|
selection = "towing_point";
|
||||||
|
distance = 2.5;
|
||||||
|
condition = QUOTE([ARR_1(_target)] call FUNC(canBeTowed));
|
||||||
|
showDisabled = 0;
|
||||||
|
displayName = CSTRING(TOW);
|
||||||
|
statement = QUOTE([ARR_1(_target)] call FUNC(tow));
|
||||||
|
};
|
||||||
|
|
||||||
|
class TBD_Detach {
|
||||||
|
selection = "towing_point";
|
||||||
|
distance = 2.5;
|
||||||
|
condition = QUOTE(_target getVariable [ARR_2(QUOTE(QGVAR(towed)),false)]);
|
||||||
|
showDisabled = 0;
|
||||||
|
displayName = CSTRING(DETACH);
|
||||||
|
statement = QUOTE([ARR_1(_target)] call FUNC(detach));
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user