mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
6ca9d59443
* Merge ACEX - first attempt Backwards compatibility with XGVAR set of macros used on all settings and config entries Public API functions not taken into account yet, many other things probably still missed * Resolve issues * Switch to addSetting, backward compatible CfgPatches, missed XGVAR. * Remove unnecessary backwards compat * Convert ACEX Categorised settings to initSettings / Fix Intel items magazine * Apply suggestions from code review Co-authored-by: PabstMirror <pabstmirror@gmail.com> * Remove maintainers from merged ACEX components * Cleanup unused module and faction classes * Sitting - Add more object configs by @Dystopian https://github.com/acemod/ACEX/pull/255 * Translations - Add Japanese by @classicarma https://github.com/acemod/ACEX/pull/259 * Kill Tracker - Add killtracker.inc public include file by @Freddo3000" https://github.com/acemod/ACEX/pull/251 * Add ACEX authors and sort authors file * acex - final tweaks (#8513) * acex - handle old funcs * replace thirst/hunger setvars to acex naming fix macro Revert "fix macro" This reverts commit d807e5e804c43916eaa42d34a89af94c6d9a48ad. Revert "replace thirst/hunger setvars to acex naming" This reverts commit bafc607884932d6e339daedc7c22e25dddbdd868. x Co-authored-by: TyroneMF <TyroneMF@hotmail.com> Co-authored-by: PabstMirror <pabstmirror@gmail.com>
76 lines
2.0 KiB
Plaintext
76 lines
2.0 KiB
Plaintext
#include "script_component.hpp"
|
|
/*
|
|
* Author: mharis001, Glowbal, PabstMirror
|
|
* Refills an item from given water source.
|
|
*
|
|
* Arguments:
|
|
* 0: Water source <OBJECT>
|
|
* 1: Player <OBJECT>
|
|
* 2: Item classname <STRING>
|
|
*
|
|
* Return Value:
|
|
* None
|
|
*
|
|
* Example:
|
|
* [_source, _player, "ACE_WaterBottle_Empty"] call ace_field_rations_fnc_refillItem
|
|
*
|
|
* Public: No
|
|
*/
|
|
|
|
params ["_source", "_player", "_item"];
|
|
TRACE_3("Item refill started",_source,_player,_item);
|
|
|
|
private _config = configFile >> "CfgWeapons" >> _item;
|
|
|
|
// Get config values for refill
|
|
private _refillItem = getText (_config >> QXGVAR(refillItem));
|
|
private _refillAmount = getNumber (_config >> QXGVAR(refillAmount));
|
|
private _refillTime = getNumber (_config >> QXGVAR(refillTime));
|
|
|
|
private _fnc_onSuccess = {
|
|
params ["_args"];
|
|
_args params ["_source", "_player", "_item", "_refillItem", "_refillAmount"];
|
|
TRACE_1("Refill item successful",_args);
|
|
|
|
// Replace item with refilled one
|
|
_player removeItem _item;
|
|
[_player, _refillItem] call EFUNC(common,addToInventory);
|
|
|
|
// Update remaining water in source
|
|
private _waterInSource = _source call FUNC(getRemainingWater);
|
|
if (_waterInSource != REFILL_WATER_INFINITE) then {
|
|
_waterInSource = (_waterInSource - _refillAmount) max 0;
|
|
[_source, _waterInSource] call FUNC(setRemainingWater);
|
|
};
|
|
|
|
["acex_rationRefilled", [_source, _player, _item, _refillItem, _refillAmount]] call CBA_fnc_localEvent;
|
|
|
|
// Show refilled item hint
|
|
private _picture = getText (configFile >> "CfgWeapons" >> _refillItem >> "picture");
|
|
[LSTRING(ItemRefilled), _picture] call EFUNC(common,displayTextPicture);
|
|
};
|
|
|
|
private _fnc_onFailure = {
|
|
TRACE_1("Refill item failed",_this);
|
|
};
|
|
|
|
private _fnc_condition = {
|
|
params ["_args"];
|
|
_args call FUNC(canRefillItem);
|
|
};
|
|
|
|
[
|
|
_refillTime,
|
|
[
|
|
_source,
|
|
_player,
|
|
_item,
|
|
_refillItem,
|
|
_refillAmount
|
|
],
|
|
_fnc_onSuccess,
|
|
_fnc_onFailure,
|
|
LLSTRING(Refilling),
|
|
_fnc_condition
|
|
] call EFUNC(common,progressBar);
|