Skip to content

Commit

Permalink
[Feature] - Added ZEN module for creating loadout lockers mid-mission. (
Browse files Browse the repository at this point in the history
#155)

* Added ZEN module for creating loadout lockers mid-mission.
Changed calculations for loadout locker add-on prop to allow for different objects.

* Forgot about ZEN Module ASL pos.

* Ok any object can be lockernatored mid mission now
  • Loading branch information
Bubbus authored Mar 14, 2023
1 parent 4f15136 commit b0624f0
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 14 deletions.
27 changes: 14 additions & 13 deletions components/gearScript/fn_createLoadoutLocker.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -53,19 +53,20 @@ if (IS_PLAYER) then

_locker setVariable ["f_var_isLoadoutLocker", true];

if (isServer) then

_bagType = switch (_gearVariant) do
{
_bagType = switch (_gearVariant) do
{
case ("blufor"): {"Land_TentSolar_01_folded_bluewhite_F"};
case ("opfor"): {"Land_TentSolar_01_folded_redwhite_F"};
case ("indfor"): {"Land_TentSolar_01_folded_olive_F"};
case ("guerrilla"): {"Land_TentSolar_01_folded_olive_F"};
case ("civilian"): {"Land_TentSolar_01_folded_sand_F"};
default {"RoadCone_L_F"};
};
case ("blufor"): {"Land_TentSolar_01_folded_bluewhite_F"};
case ("opfor"): {"Land_TentSolar_01_folded_redwhite_F"};
case ("indfor"): {"Land_TentSolar_01_folded_olive_F"};
case ("guerrilla"): {"Land_TentSolar_01_folded_olive_F"};
case ("civilian"): {"Land_TentSolar_01_folded_sand_F"};
default {"RoadCone_L_F"};
};

_lockerBag = _bagType createVehicle [0,0,0];
_lockerBag attachTo [_locker, [0,0,1]];
_lockerBag = _bagType createVehicleLocal [0,0,0];

};
private _lockerHeightTop = (0 boundingBoxReal _locker) # 1 # 2;
private _bagHeightBottom = (0 boundingBoxReal _lockerBag) # 0 # 2;

_lockerBag attachTo [_locker, [0,0,_lockerHeightTop - _bagHeightBottom]];
1 change: 1 addition & 0 deletions components/gearScript/functions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class gearScriptRadios
class gearScript_zen
{
file = "components\gearScript\zen";
class zen_createLoadoutLocker{};
class zen_createSupplyCrate{};
class zen_createSupplyCrate_followUpDialog{};
class zen_createSupplyCrate_performAction{};
Expand Down
55 changes: 55 additions & 0 deletions components/gearScript/zen/fn_zen_createLoadoutLocker.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#include "../macros.hpp"

CLIENT_ONLY;

params ["_position", "_unit"];

if ((!isNull _unit) and {_unit getVariable ["f_var_isLoadoutLocker", false]}) exitWith
{
["This object is already a loadout locker and cannot be reassigned."] call zen_common_fnc_showMessage;
};


private _createLocker =
{
params ["_dialogValues", "_args"];
_dialogValues params ["_chosenFaction"];
_args params ["_position", "_locker"];

if (isNull _locker) then
{
private _lockerModel = ["Metal_Locker_F", "Land_OfficeCabinet_02_F"] select (isNull (configFile >> "CfgVehicles" >> "Metal_Locker_F"));
_locker = _lockerModel createVehicle [0,0,0];
_locker setPosASL _position;
};

// In case picked object becomes a locker while zeus is in the side selection menu.
if (_locker getVariable ["f_var_isLoadoutLocker", false]) exitWith
{
["This object is already a loadout locker and cannot be reassigned."] call zen_common_fnc_showMessage;
};

[_locker, _chosenFaction] remoteExec ["f_fnc_createLoadoutLocker", 0, _locker];
};

private _potentialSides =
[
["BLUFOR", "blu_f"],
["OPFOR", "opf_f"],
["INDFOR", "ind_f"],
["Civilian", "civ_f"],
["Guerrilla", "blu_g_f"]
];

private _sidesInUse = _potentialSides select { CRATE_REGISTRY_DYNAMIC(toLower (_x # 0)) isNotEqualTo [] };

[
"Choose Gearscript Side",
[
["LIST", "Choose gearscript side", [_sidesInUse apply {_x#1}, _sidesInUse apply {_x#0}, 0, (count _sidesInUse)]]
],
_createLocker,
{},
_this

] call zen_dialog_fnc_create;
10 changes: 9 additions & 1 deletion components/gearScript/zen_modules.sqf
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
call
{
private _category = "[CAFE3] Logistics";

[
"[CAFE3] Logistics",
_category,
"Create / refill supply crate",
f_fnc_zen_createSupplyCrate

] call zen_custom_modules_fnc_register;

[
_category,
"Create Loadout Locker",
f_fnc_zen_createLoadoutLocker

] call zen_custom_modules_fnc_register;
};

0 comments on commit b0624f0

Please sign in to comment.