mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Field Rations - Add arsenal category (#9221)
* add field rations category * improve macro * second verse same as the first * account for empty items * switch to configClasses * documentation * add API variable * Update docs/wiki/framework/field-rations-framework.md
This commit is contained in:
parent
04e41a4d5a
commit
30a0e55843
@ -40,6 +40,7 @@ class CfgWeapons {
|
|||||||
XGVAR(replacementItem) = "ACE_WaterBottle_Half";
|
XGVAR(replacementItem) = "ACE_WaterBottle_Half";
|
||||||
XGVAR(consumeAnims)[] = {QGVAR(drinkStand), QGVAR(drinkCrouch), QGVAR(drinkProne)};
|
XGVAR(consumeAnims)[] = {QGVAR(drinkStand), QGVAR(drinkCrouch), QGVAR(drinkProne)};
|
||||||
XGVAR(consumeSounds)[] = {QGVAR(drink1), QGVAR(drink1), QGVAR(drink2)};
|
XGVAR(consumeSounds)[] = {QGVAR(drink1), QGVAR(drink1), QGVAR(drink2)};
|
||||||
|
ACE_isFieldRationItem = 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ACE_WaterBottle_Half: ACE_WaterBottle {
|
class ACE_WaterBottle_Half: ACE_WaterBottle {
|
||||||
@ -87,6 +88,7 @@ class CfgWeapons {
|
|||||||
XGVAR(replacementItem) = "ACE_Canteen_Half";
|
XGVAR(replacementItem) = "ACE_Canteen_Half";
|
||||||
XGVAR(consumeAnims)[] = {QGVAR(drinkStand), QGVAR(drinkCrouch), QGVAR(drinkProne)};
|
XGVAR(consumeAnims)[] = {QGVAR(drinkStand), QGVAR(drinkCrouch), QGVAR(drinkProne)};
|
||||||
XGVAR(consumeSounds)[] = {QGVAR(drink1), QGVAR(drink1), QGVAR(drink2)};
|
XGVAR(consumeSounds)[] = {QGVAR(drink1), QGVAR(drink1), QGVAR(drink2)};
|
||||||
|
ACE_isFieldRationItem = 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ACE_Canteen_Half: ACE_Canteen {
|
class ACE_Canteen_Half: ACE_Canteen {
|
||||||
@ -132,6 +134,7 @@ class CfgWeapons {
|
|||||||
XGVAR(consumeText) = CSTRING(DrinkingX);
|
XGVAR(consumeText) = CSTRING(DrinkingX);
|
||||||
XGVAR(consumeAnims)[] = {QGVAR(drinkStandCan), QGVAR(drinkCrouchCan), QGVAR(drinkProneCan)};
|
XGVAR(consumeAnims)[] = {QGVAR(drinkStandCan), QGVAR(drinkCrouchCan), QGVAR(drinkProneCan)};
|
||||||
XGVAR(consumeSounds)[] = {QGVAR(drinkCan1), QGVAR(drinkCan1), QGVAR(drinkCan2)};
|
XGVAR(consumeSounds)[] = {QGVAR(drinkCan1), QGVAR(drinkCan1), QGVAR(drinkCan2)};
|
||||||
|
ACE_isFieldRationItem = 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ACE_Can_Franta: ACE_Can_Spirit {
|
class ACE_Can_Franta: ACE_Can_Spirit {
|
||||||
@ -164,6 +167,7 @@ class CfgWeapons {
|
|||||||
XGVAR(consumeTime) = 10;
|
XGVAR(consumeTime) = 10;
|
||||||
XGVAR(hungerSatiated) = 20;
|
XGVAR(hungerSatiated) = 20;
|
||||||
XGVAR(consumeText) = CSTRING(EatingX);
|
XGVAR(consumeText) = CSTRING(EatingX);
|
||||||
|
ACE_isFieldRationItem = 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ACE_MRE_BeefStew: ACE_MRE_LambCurry {
|
class ACE_MRE_BeefStew: ACE_MRE_LambCurry {
|
||||||
@ -240,5 +244,6 @@ class CfgWeapons {
|
|||||||
XGVAR(consumeTime) = 10;
|
XGVAR(consumeTime) = 10;
|
||||||
XGVAR(hungerSatiated) = 10;
|
XGVAR(hungerSatiated) = 10;
|
||||||
XGVAR(consumeText) = CSTRING(EatingX);
|
XGVAR(consumeText) = CSTRING(EatingX);
|
||||||
|
ACE_isFieldRationItem = 1;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -14,5 +14,6 @@ ACEX_PREP(handleEffects);
|
|||||||
ACEX_PREP(handleHUD);
|
ACEX_PREP(handleHUD);
|
||||||
ACEX_PREP(handleRespawn);
|
ACEX_PREP(handleRespawn);
|
||||||
ACEX_PREP(refillItem);
|
ACEX_PREP(refillItem);
|
||||||
|
ACEX_PREP(scanFieldRations);
|
||||||
ACEX_PREP(setRemainingWater);
|
ACEX_PREP(setRemainingWater);
|
||||||
ACEX_PREP(update);
|
ACEX_PREP(update);
|
||||||
|
@ -8,6 +8,8 @@ PREP_RECOMPILE_END;
|
|||||||
|
|
||||||
#include "initSettings.sqf"
|
#include "initSettings.sqf"
|
||||||
|
|
||||||
|
#define ARSENAL_CATEGORY_ICON QPATHTOF(ui\icon_survival.paa)
|
||||||
|
|
||||||
// Init arrays of status modifiers
|
// Init arrays of status modifiers
|
||||||
GVAR(thirstModifiers) = [];
|
GVAR(thirstModifiers) = [];
|
||||||
GVAR(hungerModifiers) = [];
|
GVAR(hungerModifiers) = [];
|
||||||
@ -18,4 +20,9 @@ GVAR(waterSourceP3Ds) = _cache select 0;
|
|||||||
// List of refill action offsets corresponding to the p3ds in the array above
|
// List of refill action offsets corresponding to the p3ds in the array above
|
||||||
GVAR(waterSourceOffsets) = _cache select 1;
|
GVAR(waterSourceOffsets) = _cache select 1;
|
||||||
|
|
||||||
|
// Custom Arsenal Tab
|
||||||
|
if (["ace_arsenal"] call EFUNC(common,isModLoaded)) then {
|
||||||
|
[keys FIELD_RATIONS_ITEMS, LLSTRING(DisplayName), ARSENAL_CATEGORY_ICON] call EFUNC(arsenal,addRightPanelButton);
|
||||||
|
};
|
||||||
|
|
||||||
ADDON = true;
|
ADDON = true;
|
||||||
|
@ -30,3 +30,5 @@ private _waterSourceOffsets = [
|
|||||||
|
|
||||||
uiNamespace setVariable [QGVAR(cacheP3Ds), compileFinal str [_waterSourceP3Ds, _waterSourceOffsets]];
|
uiNamespace setVariable [QGVAR(cacheP3Ds), compileFinal str [_waterSourceP3Ds, _waterSourceOffsets]];
|
||||||
TRACE_1("compiled",count _waterSourceP3Ds);
|
TRACE_1("compiled",count _waterSourceP3Ds);
|
||||||
|
|
||||||
|
call FUNC(scanFieldRations);
|
||||||
|
34
addons/field_rations/functions/fnc_scanFieldRations.sqf
Normal file
34
addons/field_rations/functions/fnc_scanFieldRations.sqf
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
#include "script_component.hpp"
|
||||||
|
/*
|
||||||
|
* Author: Salluci
|
||||||
|
* Caches all item classnames used as field rations, their thirst/hunger values, and whether they are treated as magazines
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* call acex_field_rations_fnc_scanFieldRations
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
|
*/
|
||||||
|
|
||||||
|
private _list = createHashMap;
|
||||||
|
private _cfgWeapons = configFile >> "CfgWeapons";
|
||||||
|
private _cfgMagazines = configFile >> "CfgMagazines";
|
||||||
|
|
||||||
|
private _fnc_isFieldRationItem = toString {
|
||||||
|
(getNumber (_x >> "ACE_isFieldRationItem") isEqualTo 1) || {(getNumber (_x >> QXGVAR(thirstQuenched))) > 0} || {(getNumber (_x >> QXGVAR(hungerSatiated))) > 0} || {(getText (_x >> QXGVAR(refillItem))) isNotEqualTo ""}
|
||||||
|
};
|
||||||
|
|
||||||
|
{
|
||||||
|
_list set [configName _x, ""];
|
||||||
|
} forEach (_fnc_isFieldRationItem configClasses _cfgWeapons);
|
||||||
|
|
||||||
|
{
|
||||||
|
_list set [configName _x, ""];
|
||||||
|
} forEach (_fnc_isFieldRationItem configClasses _cfgMagazines);
|
||||||
|
|
||||||
|
uiNamespace setVariable [QXGVAR(fieldRationItems), compileFinal str _list];
|
@ -33,3 +33,5 @@
|
|||||||
#define IDC_DRAINING_HUD_THIRST_ICON 7750
|
#define IDC_DRAINING_HUD_THIRST_ICON 7750
|
||||||
#define IDC_DRAINING_HUD_HUNGER_GROUP 7840
|
#define IDC_DRAINING_HUD_HUNGER_GROUP 7840
|
||||||
#define IDC_DRAINING_HUD_HUNGER_ICON 7850
|
#define IDC_DRAINING_HUD_HUNGER_ICON 7850
|
||||||
|
|
||||||
|
#define FIELD_RATIONS_ITEMS (createHashMapFromArray (call (uiNamespace getVariable [QXGVAR(fieldRationItems), {createHashMap}])))
|
||||||
|
@ -28,6 +28,7 @@ Config Name | Type | Description
|
|||||||
`acex_field_rations_refillItem` | String | Makes an item refillable, class name of item added when refilled (OPTIONAL)
|
`acex_field_rations_refillItem` | String | Makes an item refillable, class name of item added when refilled (OPTIONAL)
|
||||||
`acex_field_rations_refillAmount` | Number | Amount of water required to refill item (OPTIONAL)
|
`acex_field_rations_refillAmount` | Number | Amount of water required to refill item (OPTIONAL)
|
||||||
`acex_field_rations_refillTime` | Number | Time required to refill item (in seconds) (OPTIONAL)
|
`acex_field_rations_refillTime` | Number | Time required to refill item (in seconds) (OPTIONAL)
|
||||||
|
`ACE_isFieldRationItem` | Number | Force adds the item to the ACE Field Rations category in ACE Arsenal (OPTIONAL)
|
||||||
|
|
||||||
|
|
||||||
_* Value range is 0 to 100 and can be modified by the corresponding coefficient setting._
|
_* Value range is 0 to 100 and can be modified by the corresponding coefficient setting._
|
||||||
|
Loading…
Reference in New Issue
Block a user