mirror of
https://github.com/EpochModTeam/Epoch.git
synced 2024-08-30 18:22:13 +00:00
bdfee35a18
[FIXED] BurnBarrel and FirePlace02 UserActions requiring lighter_epoch did not need lighter when performed. [NEW] CfgActions event handler for "Action" ("PrevAction" and "NextAction" - not implemented yet) -Allows ability to override any of the CfgActions/UserActions in Arma 3 and other mods. [ADDED] usedItemRepack function to remove 1 use from the lighter. [ADDED] Require fire extinguisher to "Put Out Fire" on the Burn Barrel [CHANGED] ItemFireExtinguisher now has count = 5 for 5 uses to put out a small fire [ADDED] ItemFireExtinguisher to CfgItemSort and CfgPricing [ADDED] Arma Sling Loading requires ItemRope to sling and returns rope upon release.. [ADDED] Checks for R3F can_lift and Advanced Slingload InitVar. [ADDED] If above mod/script is present disable Arma SlingLoad Hook/Unhook action and key press. [CHANGED] While working with keyDown EH, debug logs show the DIKCodes are being pushed as whole numbers and not the 0x01 as the escape keyDown handler was setup to use and why my tests were failing using the 0x30 for the letter B(Hook/Unhook). [UPGRADED] Changed over the 0x01 and 0x30 to the actionKeys name in order to properly handle those with client using custom keys. [TEASED] Have a commented line in the Light Fire case showing future plans for a fire system(BURN BABY BURN!). [NEW] EPOCH_usedItemRepack Description: Allows adjusting of "ammo" counts in a magazine. Can be used locally and on the server for a remote unit. ``` [_player,_magazine,_change] call EPOCH_usedItemRepack;
66 lines
2.1 KiB
Plaintext
66 lines
2.1 KiB
Plaintext
/*
|
|
Author: DirtySanchez - ported from DonkeyPunch eXpoch http://DonkeyPunch.INFO
|
|
|
|
Contributors:
|
|
|
|
Licence:
|
|
Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike
|
|
|
|
Github:
|
|
https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/compile/inventory/EPOCH_usedItemRepack.sqf
|
|
|
|
Description:
|
|
Allows adjustments to mag with least ammo.
|
|
Can be used server and client side as addMagazine is a global command
|
|
|
|
Local Usage:
|
|
[player,'lighter_epoch',-1] call EPOCH_usedItemRepack;
|
|
|
|
Global Usage:
|
|
[_playerObj,'lighter_epoch',-1] call EPOCH_usedItemRepack;
|
|
*/
|
|
private["_msg","_itemMags","_displayName","_itemAmmoType","_mags","_ammoType","_total","_maxAmmo","_wholeMags","_remainder","_index","_usedItemArray"];
|
|
params[
|
|
["_player",objNull],
|
|
["_item",""],
|
|
["_chg",0]
|
|
];
|
|
|
|
if(isNull _player) exitWith {diag_log "[EPOCHDebug] EPOCH_usedItemRepack - player isNull"};
|
|
|
|
if(_item isEqualTo "") exitWith {diag_log "[EPOCHDebug] EPOCH_usedItemRepack - classname is empty string"};
|
|
|
|
if!(isClass(configFile >> "CfgMagazines" >> _item)) exitWith {diag_log format["[EPOCHDebug] EPOCH_usedItemRepack - Classname does not exist",_item]};
|
|
|
|
_msg = "";
|
|
_itemMags = [];
|
|
_displayName = getText(configFile >> "CfgMagazines" >> _item >> "displayName");
|
|
|
|
//get all mags of same classname and ammo type
|
|
_mags = magazinesAmmo _player;
|
|
{
|
|
_x params ["_className","_count"];
|
|
if(_className isEqualTo _item)then{
|
|
_itemMags pushBack _x;
|
|
};
|
|
}forEach _mags;
|
|
|
|
// if more than 1 sort them by ammo count
|
|
if(count _itemMags > 1)then{
|
|
_itemMags = [_itemMags,[],{_x select 1},"ASCEND"] call BIS_fnc_sortBy;
|
|
};
|
|
|
|
// adjust the item
|
|
if!(_chg isEqualTo 0)then{
|
|
_index = ((count _itemMags) - 1);
|
|
_usedItemArray = _itemMags select _index;
|
|
_usedItemArray params ["_mag","_count"];
|
|
_itemMags pushBack [_mag, (_count + _chg)];
|
|
_itemMags = _itemMags - [_usedItemArray];
|
|
_player removeMagazines _mag;
|
|
{
|
|
_player addMagazine _x;
|
|
[format["You have used your %1", _displayName],5,[[0,0,0,0.2],[1,1,1,1]]] call Epoch_message_stack;
|
|
}forEach _itemMags;
|
|
};
|