Skip to content

Commit

Permalink
Add Supply Cargo Attributes (#753)
Browse files Browse the repository at this point in the history
* Add Supply Cargo Attributes with Settings: Ammo, Fuel, Repair
  • Loading branch information
ampersand38 authored Nov 17, 2023
1 parent 88c193d commit 07031ba
Show file tree
Hide file tree
Showing 4 changed files with 93 additions and 0 deletions.
42 changes: 42 additions & 0 deletions addons/attributes/initAttributes.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,48 @@
{GVAR(enableAmmo) && {alive _entity} && {_entity call EFUNC(common,getVehicleAmmo) != -1}}
] call FUNC(addAttribute);

[
"Object",
LSTRING(AmmoCargo),
QGVAR(slider),
[0, 1, 0.1, true],
{
{
[QEGVAR(common,setAmmoCargo), [_x, _value], _x] call CBA_fnc_targetEvent;
} forEach call EFUNC(common,getSelectedVehicles);
},
{getAmmoCargo _entity},
{GVAR(enableAmmoCargo) && {getAmmoCargo _entity >= 0}}
] call FUNC(addAttribute);

[
"Object",
LSTRING(FuelCargo),
QGVAR(slider),
[0, 1, 0.1, true],
{
{
[QEGVAR(common,setFuelCargo), [_x, _value], _x] call CBA_fnc_targetEvent;
} forEach call EFUNC(common,getSelectedVehicles);
},
{getFuelCargo _entity},
{GVAR(enableFuelCargo) && {getFuelCargo _entity >= 0}}
] call FUNC(addAttribute);

[
"Object",
LSTRING(RepairCargo),
QGVAR(slider),
[0, 1, 0.1, true],
{
{
[QEGVAR(common,setRepairCargo), [_x, _value], _x] call CBA_fnc_targetEvent;
} forEach call EFUNC(common,getSelectedVehicles);
},
{getRepairCargo _entity},
{GVAR(enableRepairCargo) && {getRepairCargo _entity >= 0}}
] call FUNC(addAttribute);

[
"Object",
"STR_3DEN_Object_Attribute_Rank_displayName",
Expand Down
27 changes: 27 additions & 0 deletions addons/attributes/initSettings.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,33 @@
false
] call CBA_fnc_addSetting;

[
QGVAR(enableAmmoCargo),
"CHECKBOX",
LSTRING(AmmoCargo),
[LSTRING(DisplayName), "STR_3DEN_Object_textPlural"],
true,
false
] call CBA_fnc_addSetting;

[
QGVAR(enableFuelCargo),
"CHECKBOX",
LSTRING(FuelCargo),
[LSTRING(DisplayName), "STR_3DEN_Object_textPlural"],
true,
false
] call CBA_fnc_addSetting;

[
QGVAR(enableRepairCargo),
"CHECKBOX",
LSTRING(RepairCargo),
[LSTRING(DisplayName), "STR_3DEN_Object_textPlural"],
true,
false
] call CBA_fnc_addSetting;

[
QGVAR(enableRank),
"CHECKBOX",
Expand Down
9 changes: 9 additions & 0 deletions addons/attributes/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@
<Chinesesimp>Zeus Enhanced - 属性</Chinesesimp>
<Turkish>Zeus Enhanced - Özellikler</Turkish>
</Key>
<Key ID="STR_ZEN_Attributes_AmmoCargo">
<English>Ammo Cargo</English>
</Key>
<Key ID="STR_ZEN_Attributes_FuelCargo">
<English>Fuel Cargo</English>
</Key>
<Key ID="STR_ZEN_Attributes_RepairCargo">
<English>Repair Cargo</English>
</Key>
<Key ID="STR_ZEN_Attributes_Engine">
<English>Engine</English>
<French>Moteur</French>
Expand Down
15 changes: 15 additions & 0 deletions addons/common/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,21 @@
_vehicle setFuel _fuel;
}] call CBA_fnc_addEventHandler;

[QGVAR(setAmmoCargo), {
params ["_vehicle", "_ammoCargo"];
_vehicle setAmmoCargo _ammoCargo;
}] call CBA_fnc_addEventHandler;

[QGVAR(setFuelCargo), {
params ["_vehicle", "_fuelCargo"];
_vehicle setFuelCargo _fuelCargo;
}] call CBA_fnc_addEventHandler;

[QGVAR(setRepairCargo), {
params ["_vehicle", "_repairCargo"];
_vehicle setRepairCargo _repairCargo;
}] call CBA_fnc_addEventHandler;

[QGVAR(allowDamage), {
params ["_object", "_allow"];
_object allowDamage _allow;
Expand Down

0 comments on commit 07031ba

Please sign in to comment.