mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Towing - Add rope to vehicle inventory (#8963)
* Add rope to vehicle inventory * Use LINKFUNC * Make setting not need restart Co-authored-by: PabstMirror <pabstmirror@gmail.com> Co-authored-by: PabstMirror <pabstmirror@gmail.com>
This commit is contained in:
parent
e677021e5a
commit
20fb895b31
@ -1,3 +1,4 @@
|
||||
PREP(addRopeToVehicle);
|
||||
PREP(attachRopePFH);
|
||||
PREP(canStartTow);
|
||||
PREP(detach);
|
||||
|
@ -6,4 +6,6 @@ PREP_RECOMPILE_START;
|
||||
#include "XEH_PREP.hpp"
|
||||
PREP_RECOMPILE_END;
|
||||
|
||||
#include "initSettings.sqf"
|
||||
|
||||
ADDON = true;
|
||||
|
27
addons/towing/functions/fnc_addRopeToVehicle.sqf
Normal file
27
addons/towing/functions/fnc_addRopeToVehicle.sqf
Normal file
@ -0,0 +1,27 @@
|
||||
#include "script_component.hpp"
|
||||
/*
|
||||
* Author: Dystopian
|
||||
* Adds rope to vehicle inventory.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Vehicle <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* cursorObject call ace_towing_fnc_addRopeToVehicle
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
if (!GVAR(addRopeToVehicleInventory)) exitWith {};
|
||||
params ["_vehicle"];
|
||||
|
||||
if (0 == getNumber (configOf _vehicle >> QEGVAR(cargo,hasCargo))) exitWith {};
|
||||
|
||||
private _ropeType = if (
|
||||
-1 < ["Tank", "Wheeled_APC_F", "Truck_F"] findIf {_vehicle isKindOf _x}
|
||||
) then {"ACE_rope12"} else {"ACE_rope6"};
|
||||
|
||||
_vehicle addItemCargoGlobal [_ropeType, 1];
|
13
addons/towing/initSettings.sqf
Normal file
13
addons/towing/initSettings.sqf
Normal file
@ -0,0 +1,13 @@
|
||||
[
|
||||
QGVAR(addRopeToVehicleInventory), "CHECKBOX",
|
||||
LSTRING(Setting_addRopeToVehicleInventory_DisplayName),
|
||||
LELSTRING(OptionsMenu,CategoryLogistics),
|
||||
true,
|
||||
true,
|
||||
{
|
||||
if !(_this && {isServer} && {isNil QGVAR(addRopeToVehicleInventory_initialized)}) exitWith {};
|
||||
GVAR(addRopeToVehicleInventory_initialized) = true;
|
||||
["Tank", "initPost", LINKFUNC(addRopeToVehicle), true, [], true] call CBA_fnc_addClassEventHandler;
|
||||
["Car", "initPost", LINKFUNC(addRopeToVehicle), true, [], true] call CBA_fnc_addClassEventHandler;
|
||||
}
|
||||
] call CBA_fnc_addSetting;
|
@ -111,5 +111,9 @@
|
||||
<Chinesesimp>解开牵引绳</Chinesesimp>
|
||||
<Korean>견인줄 분리</Korean>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Towing_Setting_addRopeToVehicleInventory_DisplayName">
|
||||
<English>Add Tow Rope to Vehicle Inventory</English>
|
||||
<Russian>Добавить буксировочный трос в инвентарь машин</Russian>
|
||||
</Key>
|
||||
</Package>
|
||||
</Project>
|
||||
|
Loading…
Reference in New Issue
Block a user