Epoch/Sources/epoch_code/compile/inventory/EPOCH_usedItemRepack.sqf

67 lines
2.2 KiB
Plaintext
Raw Normal View History

CfgActions overriding - fire on/off req - a3 hooking ++ [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;
2017-12-06 00:20:08 +00:00
/*
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 deleteat _index;
CfgActions overriding - fire on/off req - a3 hooking ++ [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;
2017-12-06 00:20:08 +00:00
_usedItemArray params ["_mag","_count"];
_itemMags pushBack [_mag, (_count + _chg)];
_player removeMagazines _mag;
{
2018-01-10 20:16:29 +00:00
if ((_x select 1) > 0) then { // Do not add back an empty mag, as it can not be handled by any scripts and is useless
2018-01-15 17:48:36 +00:00
_x call EPOCH_fnc_addMagazineOverflow;
};
CfgActions overriding - fire on/off req - a3 hooking ++ [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;
2017-12-06 00:20:08 +00:00
}forEach _itemMags;
[format["You have used your %1", _displayName],5,[[0,0,0,0.2],[1,1,1,1]]] call Epoch_message_stack;
CfgActions overriding - fire on/off req - a3 hooking ++ [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;
2017-12-06 00:20:08 +00:00
};