move to cfg, update createbox, create /defines

This commit is contained in:
2024-02-03 18:40:18 -08:00
parent 6764186794
commit 7ef48ecaa2
13 changed files with 339 additions and 291 deletions

View File

@@ -0,0 +1,22 @@
// Lists approved fixed-wing and rotary vehicle types that mission makers can use in their missions.
class ApprovedAssets {
// Fixed-wing aircraft
class USAF_A10 {callsign = "Ares";};
class RHSGREF_A29B_HIDF {callsign = "Odyssey";};
class USAF_C130J {callsign = "Hercules";};
// Rotary aircraft
class RHS_MELB_MH6M {callsign = "Apollo";};
class RHS_MELB_AH6M {callsign = "Artemis";};
class RHS_MELB_H6M {callsign = "Icarus";};
class RHS_CH_47F {callsign = "Achilles";};
class ej_MH60MDAP4 {callsign = "Hades";};
class RHS_UH60M {callsign = "Griffin";};
class RHS_UH60M_MEV2 {callsign = "Dustoff";};
class B_T_VTOL_01_INFANTRY_F {callsign = "Pegasus";};
class B_T_VTOL_01_ARMED_F {callsign = "Spartan";};
class RHS_AH64D {callsign = "Orion";};
class RHS_AH1Z {callsign = "Athena";};
class RHS_UH1Y {callsign = "Homer";};
class rhsusf_CH53E_USMC {callsign = "Atlas";};
};

180
defines/SupplyCrates.hpp Normal file
View File

@@ -0,0 +1,180 @@
class SupplyCrates {
class AmmoSquad {
boxClass = "Box_Syndicate_Ammo_F";
displayName = "Squad Ammo";
tooltip = "A crate containing general ammunition and equipment for an infantry squad.";
icon = "\A3\ui_f\data\map\vehicleicons\iconCrateAmmo_ca.paa";
backpacks[] = {};
weapons[] = {
{"rhs_weap_M136",4},
{"rhs_weap_M136_hp",4},
{"rhs_weap_m72a7",2}
};
magazines[] = {
{"1Rnd_SmokePurple_Grenade_shell",12},
{"1Rnd_SmokeBlue_Grenade_shell",24},
{"1Rnd_SmokeOrange_Grenade_shell",12},
{"rhs_mag_M441_HE",25},
{"rhs_mag_M433_HEDP",15},
{"ACE_40mm_Flare_ir",12},
{"rhsusf_200Rnd_556x45_mixed_soft_pouch_coyote",25},
{"rhsusf_20Rnd_762x51_m993_Mag",25},
{"SmokeShell",12},
{"rhs_mag_m67",12},
{"1Rnd_Smoke_Grenade_shell",24},
{"1Rnd_SmokeRed_Grenade_shell",24},
{"1Rnd_SmokeGreen_Grenade_shell",24},
{"1Rnd_SmokeYellow_Grenade_shell",12},
{"Tier1_30Rnd_556x45_M856A1_EMag",25},
{"Tier1_30Rnd_556x45_Mk318Mod0_EMag",75},
{"ACE_30Rnd_65_Creedmor_mag",25},
{"SMA_30Rnd_762x35_BLK_EPR",25},
{"Tier1_30Rnd_762x35_300BLK_SMK_PMAG",25},
{"SMA_30Rnd_68x43_SPC_FMJ",25},
{"SMA_30Rnd_68x43_SPC_FMJ_Tracer",25},
{"SMA_20Rnd_762x51mm_M80A1_EPR",25},
{"SMA_20Rnd_762x51mm_M80A1_EPR_Tracer",25},
{"SMA_20Rnd_762x51mm_Mk316_Mod_0_Special_Long_Range",25},
{"SMA_20Rnd_762x51mm_Mk316_Mod_0_Special_Long_Range_Tracer",25},
{"Tier1_250Rnd_762x51_Belt_M993_AP",15},
{"ACE_20Rnd_762x51_Mag_Tracer",25},
{"ACE_20Rnd_762x51_M993_AP_Mag",25},
{"rhsusf_20Rnd_762x51_SR25_m993_Mag",25},
{"Tier1_20Rnd_762x51_M993_SR25_Mag",25},
{"Tier1_20Rnd_65x48_Creedmoor_SR25_Mag",25},
{"rhssaf_30rnd_556x45_EPR_G36", 25},
{"DemoCharge_Remote_Mag",16}
};
items[] = {};
};
class AmmoHeavy {
boxClass = "Box_NATO_Wps_F";
displayName = "Heavy Ammo";
tooltip = "A crate containing mixed ammo for rifles, ARs, MAT, and HAT.";
icon = "\A3\ui_f\data\map\vehicleicons\iconCrateWpns_ca.paa";
backpacks[] = {};
weapons[] = {};
magazines[] = {
{"MRAWS_HEAT_F",35},
{"MRAWS_HE_F",15},
{"Tier1_250Rnd_762x51_Belt_M993_AP",50},
{"Tier1_30Rnd_556x45_M856A1_EMag",25},
{"Tier1_30Rnd_556x45_Mk318Mod0_EMag",50},
{"Titan_AA",10},
{"Titan_AT",10},
{"200Rnd_65x39_cased_Box_Tracer_Red",50}
};
items[] = {};
};
class MedicalSupplies {
boxClass = "ACE_medicalSupplyCrate_advanced";
displayName = "Medical Crate";
tooltip = "A crate containing medical supplies.";
icon = "\A3\ui_f\data\map\vehicleicons\pictureHeal_ca.paa";
backpacks[] = {};
weapons[] = {};
magazines[] = {};
items[] = {
{"ACE_packingBandage",100},
{"ACE_elasticBandage",100},
{"ACE_tourniquet",48},
{"ACE_splint",48},
{"ACE_morphine",50},
{"ACE_epinephrine",50},
{"ACE_bloodIV",75},
{"ACE_bloodIV_500",50},
{"ACE_bloodIV_250",25},
{"ACE_quikclot",75},
{"ACE_personalAidKit", 5},
{"ACE_surgicalKit", 5}
};
};
class Launchers {
boxClass = "Box_NATO_WpsLaunch_F";
displayName = "Launcher Crate";
tooltip = "A crate containing missile launchers and ammunition.";
icon = "\A3\ui_f\data\map\vehicleicons\iconCrateLong_ca.paa";
backpacks[] = {};
weapons[] = {
{"launch_B_Titan_short_F",2},
{"launch_NLAW_F",2},
{"rhs_weap_fim92",2}
};
magazines[] = {
{"Titan_AA",6},
{"Titan_AT",6}
};
items[] = {};
};
class CrewServedWeapons {
boxClass = "Box_NATO_Equip_F";
displayName = "CSW Crate";
tooltip = "A crate containing backpacks that assemble into static weapons.";
icon = "\A3\ui_f\data\igui\cfg\simpleTasks\types\defend_ca.paa";
backpacks[] = {
{"RHS_M2_Gun_Bag",2},
{"RHS_M2_Tripod_Bag",2},
{"RHS_M2_MiniTripod_Bag",2},
{"rhs_Tow_Gun_Bag",2},
{"rhs_TOW_Tripod_Bag",2},
{"UK3CB_Static_M240_Elcan_Gun_Bag",2},
{"UK3CB_B_Static_M240_Elcan_Tripod_Low_Bag_US_D",2},
{"RHS_Mk19_Gun_Bag",2},
{"RHS_Mk19_Tripod_Bag",2}
};
weapons[] = {};
magazines[] = {};
items[] = {};
};
class MortarMk6Resupply {
boxClass = "Box_NATO_WpsSpecial_F";
displayName = "Mortar MK6 Supply Crate";
tooltip = "A crate containing Mk6 mortar resupply (tubes) and tools.";
icon = "\A3\ui_f\data\map\vehicleicons\iconStaticMortar_ca.paa";
backpacks[] = {
{"B_Mortar_01_support_F",3},
{"B_Mortar_01_weapon_F",6},
{"UK3CB_LSM_B_B_CARRYALL_RADIO_TIG_STRIPE_01",1}
};
weapons[] = {
{"ACE_Vector",2}
};
magazines[] = {
{"acex_intelitems_notepad",2}
};
items[] = {
{"ACE_artilleryTable",2},
{"ACE_RangeTable_82mm",2},
{"ACE_microDAGR",2},
{"ACE_MapTools",2}
};
};
class Mortar60mmCommandoResupply {
boxClass = "Box_NATO_WpsSpecial_F";
displayName = "Mortar 60mm Commando Supply Crate";
tooltip = "A crate containing COMMANDO 60mm mortar shells and some STANAGs.";
icon = "\A3\ui_f\data\igui\cfg\simpleTasks\types\scout_ca.paa";
backpacks[] = {};
weapons[] = {};
magazines[] = {
{"twc_2inch_he_1rnd",70},
{"twc_2inch_smoke_1rnd",15},
{"twc_2inch_illum_1rnd",15},
{"Tier1_30Rnd_556x45_Mk318Mod0_EMag",20}
};
items[] = {};
};
};

View File

@@ -17,9 +17,10 @@
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#include "mission_settings.hpp" #include "mission_settings.hpp"
#include "functions\definitions\DisallowedEquipment.hpp" #include "defines\ApprovedAssets.hpp"
#include "functions\definitions\BattalionInfo.hpp" #include "defines\BattalionInfo.hpp"
#include "functions\definitions\ApprovedAssets.hpp" #include "defines\DisallowedEquipment.hpp"
#include "defines\SupplyCrates.hpp"
//-------------------------------------------MISSION INFO-------------------------------------------------------------------- //-------------------------------------------MISSION INFO--------------------------------------------------------------------
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

View File

@@ -49,17 +49,6 @@ class milsim
class logPlayerInventory {}; class logPlayerInventory {};
}; };
class resupply {
class crateDefinitions {};
class createAmmoBox {};
class createBox {};
class createCSWBox {};
class createLaunchersBox {};
class createMedicalBox {};
class createMortarBox {};
class createWeaponsBox {};
}
class ambience { class ambience {
class flakInitVehicle {}; class flakInitVehicle {};
class flakEH {}; class flakEH {};
@@ -88,6 +77,20 @@ class milsim
}; };
}; };
class milsim_resupply {
class functions {
file = "functions\resupply";
class createAmmoBox {};
class createBox {};
class createCSWBox {};
class createLaunchersBox {};
class createMedicalBox {};
class createMortarBox {};
class createWeaponsBox {};
class getSupplyCratesCfg {};
};
};
class milsim_fbcb2_assets { class milsim_fbcb2_assets {
class functions { class functions {
file = "functions\fbcb2\assets"; file = "functions\fbcb2\assets";

View File

@@ -5,24 +5,28 @@ if ( !hasInterface ) exitWith {};
"Create Resupply Box", "Create Resupply Box",
{ {
params [["_pos", [0,0,0], [[]], 3], ["_target", objNull, [objNull]]]; params [["_pos", [0,0,0], [[]], 3], ["_target", objNull, [objNull]]];
_keysSorted = keys milsim_resupply_crateDefinitions; // get parent definition
_keysSorted sort true; private _supplyCratesCfg = call milsim_resupply_fnc_getSupplyCratesCfg;
_comboOptions = []; // get the subclass names
_comboOptions resize (count _keysSorted); private _boxTypesAvailable = _supplyCratesCfg call BIS_fnc_getCfgSubClasses;
for "_i" from 0 to (count _keysSorted) - 1 do {
private _definition = milsim_resupply_crateDefinitions get (_keysSorted select _i); _boxTypesAvailable sort true;
_comboOptions set [_i, [ _comboOptions = _boxTypesAvailable apply {
_definition getOrDefault ["displayName", "ERROR"], // display name [
_definition getOrDefault ["description", "No description"], // tooltip // display name
_definition getOrDefault ["icon", "No icon"] // icon [_supplyCratesCfg >> _x >> "displayName", "STRING", "ERROR"] call CBA_fnc_getConfigEntry,
]]; // tooltip
[_supplyCratesCfg >> _x >> "tooltip", "STRING", "ERROR"] call CBA_fnc_getConfigEntry,
// icon
[_supplyCratesCfg >> _x >> "icon", "STRING", "ERROR"] call CBA_fnc_getConfigEntry
]
}; };
[ [
"Resupply Box Options", "Resupply Box Options",
[ [
// [ "COMBO", "Box Type", [[1,2,3], [["Ammo"],["Weapons"],["Medical"]],0] ] // [ "COMBO", "Box Type", [[1,2,3], [["Ammo"],["Weapons"],["Medical"]],0] ]
["COMBO", "Box Type", [_keysSorted, _comboOptions, 0]] ["COMBO", "Box Type", [_boxTypesAvailable, _comboOptions, 0]]
], ],
{ {
@@ -32,14 +36,14 @@ if ( !hasInterface ) exitWith {};
_args params ["_pos", "_target", "_keysSorted"]; _args params ["_pos", "_target", "_keysSorted"];
private _box = [_target, _typeOptionSelected, _pos] call milsim_fnc_createBox; private _box = [_target, _typeOptionSelected, _pos] call milsim_resupply_fnc_createBox;
if (isNull _box) exitWith { if (isNull _box) exitWith {
["Resupply Box", "WARNING: Failed to locate or create box!"] call BIS_fnc_curatorHint; ["Resupply Box", "WARNING: Failed to locate or create box!"] call BIS_fnc_curatorHint;
}; };
["Resupply Box", format["Created a %1 box", _typeOptionSelected]] call BIS_fnc_curatorHint; ["Resupply Box", format["Created box from class %1", _typeOptionSelected]] call BIS_fnc_curatorHint;
}, },
{}, {},
[_pos, _target, _options] [_pos, _target]
] call zen_dialog_fnc_create; ] call zen_dialog_fnc_create;
} }
] call zen_custom_modules_fnc_register; ] call zen_custom_modules_fnc_register;

View File

@@ -1,22 +0,0 @@
// Lists approved fixed-wing and rotary vehicle types that mission makers can use in their missions.
class ApprovedAssets {
// Fixed-wing aircraft
class USAF_A10 {callsign = "Ares";assetType = "FixedWing";};
class RHSGREF_A29B_HIDF {callsign = "Odyssey";assetType = "FixedWing";};
class USAF_C130J {callsign = "Hercules";assetType = "FixedWing";};
// Rotary aircraft
class RHS_MELB_MH6M {callsign = "Apollo";assetType = "Rotary";};
class RHS_MELB_AH6M {callsign = "Artemis";assetType = "Rotary";};
class RHS_MELB_H6M {callsign = "Icarus";assetType = "Rotary";};
class RHS_CH_47F {callsign = "Achilles";assetType = "Rotary";};
class ej_MH60MDAP4 {callsign = "Hades";assetType = "Rotary";};
class RHS_UH60M {callsign = "Griffin";assetType = "Rotary";};
class RHS_UH60M_MEV2 {callsign = "Dustoff";assetType = "Rotary";};
class B_T_VTOL_01_INFANTRY_F {callsign = "Pegasus";assetType = "Rotary";};
class B_T_VTOL_01_ARMED_F {callsign = "Spartan";assetType = "Rotary";};
class RHS_AH64D {callsign = "Orion";assetType = "Rotary";};
class RHS_AH1Z {callsign = "Athena";assetType = "Rotary";};
class RHS_UH1Y {callsign = "Homer";assetType = "Rotary";};
class rhsusf_CH53E_USMC {callsign = "Atlas";assetType = "Rotary";};
};

View File

@@ -9,9 +9,6 @@ if (!isServer) then {
}] call CBA_fnc_addEventHandler; }] call CBA_fnc_addEventHandler;
}; };
// define milsim_resupply_crateDefinitions
call milsim_fnc_crateDefinitions;
["InitializePlayer", [player, true]] call BIS_fnc_dynamicGroups; ["InitializePlayer", [player, true]] call BIS_fnc_dynamicGroups;
nil; nil;

View File

@@ -1,8 +1,5 @@
if (!isServer) exitWith {}; if (!isServer) exitWith {};
// define milsim_resupply_crateDefinitions
call milsim_fnc_crateDefinitions;
milsim_baseObjects = allMissionObjects "ModuleRespawnPosition_F"; milsim_baseObjects = allMissionObjects "ModuleRespawnPosition_F";
publicVariable "milsim_baseObjects"; publicVariable "milsim_baseObjects";

View File

@@ -1,201 +0,0 @@
milsim_resupply_crateDefinitions = createHashMapFromArray [
["AMMO LIGHT", createHashMapFromArray [
["className", "Box_Syndicate_Ammo_F"],
["displayName", "Ammo Crate"],
["description", "A crate containing general ammunition and equipment for an infantry squad."],
["icon", "\A3\ui_f\data\igui\cfg\simpleTasks\types\rifle_ca.paa"],
["items", createHashMapFromArray [
["backpacks", []],
["weapons", [
["rhs_weap_M136",4],
["rhs_weap_M136_hp",4],
["rhs_weap_m72a7",2]
]],
["magazines", [
["1Rnd_SmokePurple_Grenade_shell",12],
["1Rnd_SmokeBlue_Grenade_shell",24],
["1Rnd_SmokeOrange_Grenade_shell",12],
["rhs_mag_M441_HE",25],
["rhs_mag_M433_HEDP",15],
["ACE_40mm_Flare_ir",12],
["rhsusf_200Rnd_556x45_mixed_soft_pouch_coyote",25],
["rhsusf_20Rnd_762x51_m993_Mag",25],
["SmokeShell",12],
["rhs_mag_m67",12],
["1Rnd_Smoke_Grenade_shell",24],
["1Rnd_SmokeRed_Grenade_shell",24],
["1Rnd_SmokeGreen_Grenade_shell",24],
["1Rnd_SmokeYellow_Grenade_shell",12],
["Tier1_30Rnd_556x45_M856A1_EMag",25],
["Tier1_30Rnd_556x45_Mk318Mod0_EMag",75],
["ACE_30Rnd_65_Creedmor_mag",25],
["SMA_30Rnd_762x35_BLK_EPR",25],
["Tier1_30Rnd_762x35_300BLK_SMK_PMAG",25],
["SMA_30Rnd_68x43_SPC_FMJ",25],
["SMA_30Rnd_68x43_SPC_FMJ_Tracer",25],
["SMA_20Rnd_762x51mm_M80A1_EPR",25],
["SMA_20Rnd_762x51mm_M80A1_EPR_Tracer",25],
["SMA_20Rnd_762x51mm_Mk316_Mod_0_Special_Long_Range",25],
["SMA_20Rnd_762x51mm_Mk316_Mod_0_Special_Long_Range_Tracer",25],
["Tier1_250Rnd_762x51_Belt_M993_AP",15],
["ACE_20Rnd_762x51_Mag_Tracer",25],
["ACE_20Rnd_762x51_M993_AP_Mag",25],
["rhsusf_20Rnd_762x51_SR25_m993_Mag",25],
["Tier1_20Rnd_762x51_M993_SR25_Mag",25],
["Tier1_20Rnd_65x48_Creedmoor_SR25_Mag",25],
["rhssaf_30rnd_556x45_EPR_G36", 25],
["DemoCharge_Remote_Mag",16]
]],
["items", []]
]
]]],
["AMMO HEAVY", createHashMapFromArray [
["className", "Box_NATO_Wps_F"],
["displayName", "Heavy Ammo Crate"],
["description", "A crate containing mixed ammo for rifles, ARs, MAT, and HAT."],
["icon", "\A3\ui_f\data\igui\cfg\simpleTasks\types\heli_ca.paa"],
["items", createHashMapFromArray [
["backpacks", []],
["weapons", []],
["magazines", [
["MRAWS_HEAT_F",35],
["MRAWS_HE_F",15],
["Tier1_250Rnd_762x51_Belt_M993_AP",50],
["Tier1_30Rnd_556x45_M856A1_EMag",25],
["Tier1_30Rnd_556x45_Mk318Mod0_EMag",50],
["Titan_AA",10],
["Titan_AT",10],
["200Rnd_65x39_cased_Box_Tracer_Red",50]
]],
["items", []]
]
]]],
["AMMO MORTAR", createHashMapFromArray [
["className", "Box_Syndicate_Wps_F"],
["displayName", "Mortar Ammo Crate"],
["description", "A crate containing mortar ammunition."],
["icon", "\A3\ui_f\data\igui\cfg\simpleTasks\types\scout_ca.paa"],
["items", createHashMapFromArray [
["backpacks", []],
["weapons", []],
["magazines", [
["ACE_1Rnd_82mm_Mo_HE",24],
["ACE_1Rnd_82mm_Mo_Smoke",12],
["ACE_1Rnd_82mm_Mo_Illum",12]
]],
["items", []]
]
]]],
["MEDICAL", createHashMapFromArray [
["className", "ACE_medicalSupplyCrate_advanced"],
["displayName", "Medical Crate"],
["description", "A crate containing medical supplies."],
["icon", "\A3\ui_f\data\igui\cfg\simpleTasks\types\heal_ca.paa"],
["items", createHashMapFromArray [
["backpacks", []],
["weapons", []],
["magazines", []],
["items", [
["ACE_packingBandage",100],
["ACE_elasticBandage",100],
["ACE_tourniquet",48],
["ACE_splint",48],
["ACE_morphine",50],
["ACE_epinephrine",50],
["ACE_bloodIV",75],
["ACE_bloodIV_500",50],
["ACE_bloodIV_250",25],
["ACE_quikclot",75],
["ACE_personalAidKit", 5],
["ACE_surgicalKit", 5]
]]
]
]]],
["LAUNCHERS", createHashMapFromArray [
["className", "Box_NATO_WpsLaunch_F"],
["displayName", "Launcher Crate"],
["description", "A crate containing missile launchers and ammunition."],
["icon", "\A3\ui_f\data\igui\cfg\simpleTasks\types\heli_ca.paa"],
["items", createHashMapFromArray [
["backpacks", [
]],
["weapons", [
["launch_B_Titan_short_F",2],
["launch_NLAW_F",2],
["rhs_weap_fim92",2]
]],
["magazines", [
["Titan_AA",6],
["Titan_AT",6]
]],
["items", [
]]
]
]]],
["CSW", createHashMapFromArray [
["className", "Box_NATO_Equip_F"],
["displayName", "CSW Crate"],
["description", "A crate containing backpacks that assemble into static weapons."],
["icon", "\A3\ui_f\data\igui\cfg\simpleTasks\types\defend_ca.paa"],
["items", createHashMapFromArray [
["backpacks", [
["RHS_M2_Gun_Bag",2],
["RHS_M2_Tripod_Bag",2],
["RHS_M2_MiniTripod_Bag",2],
["rhs_Tow_Gun_Bag",2],
["rhs_TOW_Tripod_Bag",2],
["UK3CB_Static_M240_Elcan_Gun_Bag",2],
["UK3CB_B_Static_M240_Elcan_Tripod_Low_Bag_US_D",2],
["RHS_Mk19_Gun_Bag",2],
["RHS_Mk19_Tripod_Bag",2]
]],
["weapons", []],
["magazines", []],
["items", []]
]
]]],
["MORTAR MK6", createHashMapFromArray [
["className", "Box_NATO_WpsSpecial_F"],
["displayName", "Mortar MK6 Supply Crate"],
["description", "A crate containing Mk6 mortar resupply (tubes) and tools."],
["icon", "\A3\ui_f\data\igui\cfg\simpleTasks\types\scout_ca.paa"],
["items", createHashMapFromArray [
["backpacks", [
["B_Mortar_01_support_F",3],
["B_Mortar_01_weapon_F",6],
["UK3CB_LSM_B_B_CARRYALL_RADIO_TIG_STRIPE_01",1]
]],
["weapons", [
["ACE_Vector",2]
]],
["magazines", [
["acex_intelitems_notepad",2]
]],
["items", [
["ACE_artilleryTable",2],
["ACE_RangeTable_82mm",2],
["ACE_microDAGR",2],
["ACE_MapTools",2]
]]
]
]]],
["MORTAR 60MM COMMANDO", createHashMapFromArray [
["className", "Box_NATO_WpsSpecial_F"],
["displayName", "Mortar 60mm Commando Supply Crate"],
["description", "A crate containing COMMANDO 60mm mortar shells and some STANAGs."],
["icon", "\A3\ui_f\data\igui\cfg\simpleTasks\types\scout_ca.paa"],
["items", createHashMapFromArray [
["backpacks", []],
["weapons", []],
["magazines", [
["twc_2inch_he_1rnd",70],
["twc_2inch_smoke_1rnd",15],
["twc_2inch_illum_1rnd",15],
["Tier1_30Rnd_556x45_Mk318Mod0_EMag",20]
]],
["items", []]
]
]]]
];

View File

@@ -1,18 +1,19 @@
/* /*
* Author: Hizumi & IndigoFox * Author: Hizumi & IndigoFox
* *
* Create Mortar resupply box for the 17th Battalion * Create Mortar resupply box for the 17th Battalion. Primarily called from milsim_fnc_addZenModules
* *
* Arguments: * Arguments:
* 0: Vehicle - <OBJECT> * 0: Vehicle - <OBJECT>
* 1: Position - <ARRAY> * 1: Type - <STRING>
* 2: Position - <ARRAY>
* *
* Return Value: * Return Value:
* Function executed <BOOL> * Function executed <BOOL>
* *
* Example: * Example:
* [box] call milsim_fnc_createBox; // create mortar ammo box via init line of editor object * [box, "AmmoSquad"] call milsim_fnc_createBox; // create mortar ammo box via init line of editor object
* [objNull, pos] call milsim_fnc_createBox; // create mortar ammo box via zeus module * [objNull, "AmmoHeavy", pos] call milsim_fnc_createBox; // create mortar ammo box via zeus module
* *
* Public: Yes * Public: Yes
* *
@@ -34,68 +35,133 @@ params [
["_pos", [0,0,0], [[]], 3] ["_pos", [0,0,0], [[]], 3]
]; ];
if (isNil "milsim_resupply_crateDefinitions") exitWith { // get defs class
format["Resupply Boxes: milsim_resupply_crateDefinitions is not defined, possibly a bad edit?"] remoteExec ["systemChat", 0]; private _supplyCratesCfg = call milsim_resupply_fnc_getSupplyCratesCfg;
false; if (!isClass _supplyCratesCfg) exitWith {
["Resupply Boxes: Failed to load crate definitions, possibly a bad edit?"] call BIS_fnc_error;
objNull;
}; };
// get the subclass names
private _boxTypesAvailable = _supplyCratesCfg call BIS_fnc_getCfgSubClasses;
// if no type is provided, show the available types
if (_type isEqualTo "") exitWith { if (_type isEqualTo "") exitWith {
format["Resupply Boxes: [_boxObject, _type, _pos] call milsim_fnc_createBox"] remoteExec ["systemChat", 0]; [
format["Please use one of the following types for _type:"] remoteExec ["systemChat", 0]; "%1 | %2 %3",
format["%1", (keys milsim_resupply_crateDefinitions)] remoteExec ["systemChat", 0]; "Resupply Boxes: [_boxObject, _type, _pos] call milsim_fnc_createBox",
false; "No type provided. Please use one of the following types for _type:",
_boxTypesAvailable joinString ", "
] call BIS_fnc_error;
objNull;
}; };
private _boxData = milsim_resupply_crateDefinitions getOrDefault [_type, createHashMap];
if (count _boxData isEqualTo 0) exitWith { //////////////////////////////////////////////////////////////////////////
format["Resupply Boxes: [_boxObject, _type, _pos] call milsim_fnc_createBox"] remoteExec ["systemChat", 0]; // get the box definition class
format["%1 is not a valid type for _type", _type] remoteExec ["systemChat", 0]; //////////////////////////////////////////////////////////////////////////
format["Please use one of the following types for _type:"] remoteExec ["systemChat", 0]; private _boxDef = (_supplyCratesCfg >> _type);
format["%1", (keys milsim_resupply_crateDefinitions)] remoteExec ["systemChat", 0]; // validate it exists
false; if (!isClass _boxDef) exitWith {
[
"%1 | %2 %3",
"Resupply Boxes: [_boxObject, _type, _pos] call milsim_fnc_createBox",
"Invalid type provided. Please use one of the following types for _type:",
_boxTypesAvailable joinString ", "
] call BIS_fnc_error;
objNull;
}; };
private _boxItems = _boxData getOrDefault ["items", createHashMap]; //////////////////////////////////////////////////////////////////////////
// Create box if one wasn't provided in parameters
//////////////////////////////////////////////////////////////////////////
if (isNull _box) then { if (isNull _box) then {
_box = (_boxData get "className") createVehicle _pos; private _neededBoxType = getText(_boxDef >> "boxClass");
if (_neededBoxType isEqualTo "") exitWith {
[
"Resupply Boxes: Failed to create box. No boxClass defined in the box definition."
] call BIS_fnc_error;
objNull;
};
_box = _neededBoxType createVehicle _pos;
}; };
//////////////////////////////////////////////////////////////////////////
// Clear box
//////////////////////////////////////////////////////////////////////////
clearBackpackCargoGlobal _box; clearBackpackCargoGlobal _box;
clearItemCargoGlobal _box; clearItemCargoGlobal _box;
clearMagazineCargoGlobal _box; clearMagazineCargoGlobal _box;
clearWeaponCargoGlobal _box; clearWeaponCargoGlobal _box;
//////////////////////////////////////////////////////////////////////////
// Get [item, quantity] arrays from definition
//////////////////////////////////////////////////////////////////////////
private _backpacks = ([_boxDef >> "backpacks"] call BIS_fnc_getCfgDataArray);
if (isNil "_backpacks") exitWith {
[
"Resupply Boxes: Failed to create box. No backpacks defined in the box definition."
] call BIS_fnc_error;
objNull;
};
private _weapons = ([_boxDef >> "weapons"] call BIS_fnc_getCfgDataArray);
if (isNil "_weapons") exitWith {
[
"Resupply Boxes: Failed to create box. No weapons defined in the box definition."
] call BIS_fnc_error;
objNull;
};
private _magazines = ([_boxDef >> "magazines"] call BIS_fnc_getCfgDataArray);
if (isNil "_magazines") exitWith {
[
"Resupply Boxes: Failed to create box. No magazines defined in the box definition."
] call BIS_fnc_error;
objNull;
};
private _items = ([_boxDef >> "items"] call BIS_fnc_getCfgDataArray);
if (isNil "_items") exitWith {
[
"Resupply Boxes: Failed to create box. No items defined in the box definition."
] call BIS_fnc_error;
objNull;
};
//////////////////////////////////////////////////////////////////////////
// Add stuff to box
//////////////////////////////////////////////////////////////////////////
{ {
_x params ["_class", "_qty"]; _x params ["_class", "_qty"];
_box addBackpackCargoGlobal [_class, _qty] _box addBackpackCargoGlobal [_class, _qty]
} foreach _backpacks;
} foreach (_boxItems getOrDefault ["backpacks", []]);
{ {
_x params ["_class", "_qty"]; _x params ["_class", "_qty"];
_box addItemCargoGlobal [_class, _qty] _box addItemCargoGlobal [_class, _qty]
} foreach _items;
} foreach (_boxItems getOrDefault ["items", []]);
{ {
_x params ["_class", "_qty"]; _x params ["_class", "_qty"];
_box addMagazineCargoGlobal [_class, _qty] _box addMagazineCargoGlobal [_class, _qty]
} foreach _magazines;
} foreach (_boxItems getOrDefault ["magazines", []]);
{ {
_x params ["_class", "_qty"]; _x params ["_class", "_qty"];
_box addWeaponCargoGlobal [_class, _qty] _box addWeaponCargoGlobal [_class, _qty]
} foreach _weapons;
} foreach (_boxItems getOrDefault ["weapons", []]);
//////////////////////////////////////////////////////////////////////////
// Adjust ACE settings
//////////////////////////////////////////////////////////////////////////
// set box size
[_box,1] call ace_cargo_fnc_setSize; [_box,1] call ace_cargo_fnc_setSize;
// ignore weight restrictions for carry/drag // ignore weight restrictions for carry/drag
_box setVariable ["ace_ignoreWeightCarry", true, true]; _box setVariable ["ace_ignoreWeightCarry", true, true];
// Return the box
_box; _box;

View File

@@ -0,0 +1 @@
(missionConfigFile >> "SupplyCrates");