forked from igorkis-scrts/A3-Antistasi-Plus
-
Notifications
You must be signed in to change notification settings - Fork 87
Expand file tree
/
Copy pathfn_initUtilityItems.sqf
More file actions
79 lines (65 loc) · 3.92 KB
/
fn_initUtilityItems.sqf
File metadata and controls
79 lines (65 loc) · 3.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/*
Initialize data for buyable items
Sets global vars A3A_utilityItemList and A3A_utilityItemHM
Arguments: none
Returns: none
Environment: Server, must be called after faction loading
*/
#include "..\..\script_component.hpp"
FIX_LINE_NUMBERS()
private _fuelDrum = FactionGet(reb,"vehicleFuelDrum");
private _fuelTank = FactionGet(reb,"vehicleFuelTank");
private _medCrate = FactionGet(reb,"vehicleMedicalBox");
private _medTent = FactionGet(reb,"vehicleHealthStation");
private _ammoStation = FactionGet(reb,"vehicleAmmoStation");
private _repairStation = FactionGet(reb,"vehicleRepairStation");
private _reviveKitBox = FactionGet(reb, "reviveKitBox");
private _lootCrate = [FactionGet(reb,"lootCrate"), lootCratePrice];
private _lightSource = [FactionGet(reb,"vehicleLightSource"), 100];
private _items = [];
if (lootCratesEnabled) then {
_items pushBack [_lootCrate#0, _lootCrate#1, localize "STR_A3AP_buyvehdialog_loot_crate", "lootbox", ["move", "place", "loot"]];
};
if (reviveKitsEnabled) then {
_items pushBack [_reviveKitBox#0, _reviveKitBox#1, localize "STR_A3AP_buyvehdialog_revive_kit_box", "revivebox", ["cmmdr", "move", "place", "revivekit"]];
};
_items append [
[_fuelDrum#0, _fuelDrum#1, localize "STR_A3AP_buyvehdialog_fuel_drum", "refuel", ["fuel", "move", "save", "rotate"]],
[_fuelTank#0, _fuelTank#1, localize "STR_A3AP_buyvehdialog_fuel_tank", "refuel", ["cmmdr", "fuel", "place", "move", "rotate", "save"]],
[_medTent#0, _medTent#1, localize "STR_A3AP_buyvehdialog_medical_tent", "heal", ["place", "move", "rotate", "pack"]],
[_ammoStation#0, _ammoStation#1, localize "STR_A3AP_buyvehdialog_ammo_station", "rearm", ["cmmdr", "ammo", "place", "move", "rotate", "save"]],
[_repairStation#0, _repairStation#1, localize "STR_A3AP_buyvehdialog_repair_station", "repair", ["cmmdr", "place", "move", "rotate", "pack", "save"]],
[_lightSource#0, _lightSource#1, localize "STR_A3AP_buyvehdialog_light", "light", ["move"]],
["Land_PlasticCase_01_small_black_F", 250, localize "STR_A3AP_buyvehdialog_BuildBoxExtraSmall", "build", ["place", "move", "build"]], //I guess those tags are not needed anymore?
["Land_PlasticCase_01_medium_black_F", 500, localize "STR_A3AP_buyvehdialog_BuildBoxSmall", "build", ["place", "move", "build"]],
["A3AU_Build_Box_Large_1", 2500, localize "STR_A3AP_buyvehdialog_BuildBoxMeduim", "build", ["place", "move", "build"]],
["Land_PlasticCase_01_large_black_F", 5000, localize "STR_A3AP_buyvehdialog_BuildBoxLarge", "build", ["place", "move", "build"]],
["A3AU_Build_Box_Humongous", 5000, localize "STR_A3AP_buyvehdialog_BuildBoxHumongous", "build", ["place", "move", "build"]]
// TODO: get larger box from somewhere
];
"getNumber (_x >> 'scope') > 0" configClasses(configFile >> QUOTE(PREFIX) >> "UtilityItems") apply {
private _displayName = getText(_x >> "displayName");
if (_displayName == "") then {
_displayName = getText(configFile >> "CfgVehicles" >> (configName _x) >> "displayName");
};
_items pushBack[
configName _x,
getNumber(_x >> "price"),
_displayName,
getText(_x >> "iconType"),
getArray(_x >> "flags")
];
};
if(A3A_hasACE) then {
_items pushBack [_medCrate#0, _medCrate#1, localize "STR_A3AP_buyvehdialog_medical_box", "heal", ["noclear", "move"]];
_items pushBack ["ACE_Wheel", 5, "", "", []];
_items pushBack ["ACE_Track", 5, "", "", []]; // check names
};
// Add packed variants so that they can be initialized properly
{
private _packClass = getText (configFile >> "A3A" >> "A3A_Logistics_Packable" >> _x#0 >> "packObject");
if (_packClass == "") then { Error_1("Packable item %1 has no packed object", _x#0); continue };
_items pushBack [_packClass, -1, "", "", ["move", "unpack"]];
} forEach (_items select { "pack" in _x#4 });
A3A_utilityItemList = _items select { _x#1 >= 0 } apply { _x#0 };
A3A_utilityItemHM = (_items apply { _x#0 }) createHashMapFromArray _items;