mirror of
https://github.com/EpochModTeam/Epoch.git
synced 2024-08-30 18:22:13 +00:00
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;
This commit is contained in:
parent
755bef4284
commit
bdfee35a18
@ -72,7 +72,7 @@ if (_ctrl && _dikCode == EPOCH_keysVolumeDown) then {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// ESC default to cancel
|
// ESC default to cancel
|
||||||
if (_dikCode == 0x01) then {
|
if (_dikCode in (actionKeys "ingamePause")) then {
|
||||||
if !(isNull EPOCH_Target) then {
|
if !(isNull EPOCH_Target) then {
|
||||||
if !(EPOCH_Target isKindOf "ThingX") then {
|
if !(EPOCH_Target isKindOf "ThingX") then {
|
||||||
deleteVehicle EPOCH_Target;
|
deleteVehicle EPOCH_Target;
|
||||||
@ -264,4 +264,29 @@ if (_dikCode in (actionKeys "NightVision")) then {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if(!_ctrl && (_dikCode in (actionKeys "HeliRopeAction")))then{
|
||||||
|
_msg = "";
|
||||||
|
if(EPOCH_ArmaSlingLoad)then{
|
||||||
|
if(driver vehicle player isEqualTo player)then{
|
||||||
|
_slung = ropeAttachedObjects vehicle player;
|
||||||
|
if(_slung isEqualTo [])then{
|
||||||
|
if!('ItemRope' in magazines player) then {
|
||||||
|
_msg = "You need rope to hook";
|
||||||
|
_handled = true;
|
||||||
|
}else{
|
||||||
|
player removeItem 'ItemRope';
|
||||||
|
};
|
||||||
|
}else{
|
||||||
|
player addItem 'ItemRope';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}else{
|
||||||
|
_msg = "Hook/Unhook Malfunction, overrode by R3F or AdvSlingLoad";
|
||||||
|
_handled = true;
|
||||||
|
};
|
||||||
|
if!(_msg isEqualTo "")then{
|
||||||
|
[_msg,5,[[0,0,0,0.2],[1,1,1,1]]] call Epoch_message_stack;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
_handled
|
_handled
|
||||||
|
@ -0,0 +1,81 @@
|
|||||||
|
/*
|
||||||
|
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/interface_event_handlers/EPOCH_handleUIActions.sqf
|
||||||
|
*/
|
||||||
|
private['_msg', '_type', '_disableSlingLoad', '_slung'];
|
||||||
|
params [
|
||||||
|
['_actionObj',objNull],
|
||||||
|
['_player',objNull],
|
||||||
|
['_index',0],
|
||||||
|
['_actionName',''],
|
||||||
|
['_actionDisplayName',''],
|
||||||
|
['_priority',1],
|
||||||
|
['_showWindow',false],
|
||||||
|
['_hideOnUse',true],
|
||||||
|
['_shortCut',''],
|
||||||
|
['_visibility',false],
|
||||||
|
['_eventName','']
|
||||||
|
];
|
||||||
|
_blocked = false;
|
||||||
|
_msg = '';
|
||||||
|
_type = typeOf _actionObj;
|
||||||
|
switch(true)do{
|
||||||
|
case (_actionName isEqualTo 'FireInflame'): {
|
||||||
|
if!('lighter_epoch' in magazines player) then {
|
||||||
|
_msg = 'You need a lighter';
|
||||||
|
_blocked = true;
|
||||||
|
}else{
|
||||||
|
[player,'lighter_epoch',-1] call EPOCH_usedItemRepack;
|
||||||
|
//[_actionObj] remoteExec ['EPOCH_server_addToFireSystem',2];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
case (_actionName isEqualTo 'FirePutDown'): {
|
||||||
|
if(_type isEqualTo 'BurnBarrel_EPOCH')then{
|
||||||
|
if!('ItemFireExtinguisher' in magazines player) then {
|
||||||
|
_msg = 'You need an extinguisher';
|
||||||
|
_blocked = true;
|
||||||
|
}else{
|
||||||
|
[player,'ItemFireExtinguisher',-1] call EPOCH_usedItemRepack;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
case (_actionName isEqualTo 'HookCargo'): {
|
||||||
|
if(EPOCH_ArmaSlingLoad)then{
|
||||||
|
if(driver vehicle player isEqualTo player)then{
|
||||||
|
_slung = ropeAttachedObjects vehicle player;
|
||||||
|
if(_slung isEqualTo [])then{
|
||||||
|
if!('ItemRope' in magazines player) then {
|
||||||
|
_msg = 'You need rope to hook';
|
||||||
|
_blocked = true;
|
||||||
|
}else{
|
||||||
|
player removeItem 'ItemRope';
|
||||||
|
};
|
||||||
|
}else{
|
||||||
|
player addItem 'ItemRope';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}else{
|
||||||
|
_msg = 'Hook Malfunction, overrode by R3F or AdvSlingLoad';
|
||||||
|
_blocked = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
case (_actionName isEqualTo 'UnhookCargo'): {
|
||||||
|
if(EPOCH_ArmaSlingLoad)then{
|
||||||
|
player addItem 'ItemRope';
|
||||||
|
}else{
|
||||||
|
_msg = 'Unhook Malfunction, overrode by R3F or AdvSlingLoad';
|
||||||
|
_blocked = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
if!(_msg isEqualTo '')then{
|
||||||
|
[_msg,5,[[0,0,0,0.2],[1,1,1,1]]] call Epoch_message_stack;
|
||||||
|
};
|
||||||
|
_blocked
|
@ -0,0 +1,65 @@
|
|||||||
|
/*
|
||||||
|
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;
|
||||||
|
};
|
@ -53,3 +53,15 @@ EPOCH_playerStaminaMax = 100;
|
|||||||
enableSentences false;
|
enableSentences false;
|
||||||
enableRadio false;
|
enableRadio false;
|
||||||
player setVariable["BIS_noCoreConversations", true];
|
player setVariable["BIS_noCoreConversations", true];
|
||||||
|
|
||||||
|
EPOCH_ArmaSlingLoad = true;
|
||||||
|
_r3fON = if(!isNil "R3F_LOG_CFG_can_lift")then{if!(R3F_LOG_CFG_can_lift isEqualTo [])then{true}else{false}}else{false};
|
||||||
|
_advSling = if(!isNil "ASL_ROPE_INIT")then{if(ASL_ROPE_INIT)then{true}else{false}}else{false};
|
||||||
|
if (_r3fON || _advSling)then{
|
||||||
|
EPOCH_ArmaSlingLoad = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
// handle actions, prevactions, nextactions
|
||||||
|
inGameUISetEventHandler ["Action", "if(!(_this isEqualTo []) && !(_this select 10 in ['PrevAction','NextAction']))then{_this call EPOCH_handleUIActions}"];
|
||||||
|
//inGameUISetEventHandler ["NextAction", "_this call EPOCH_handleUIActions"];
|
||||||
|
//inGameUISetEventHandler ["PrevAction", "_this call EPOCH_handleUIActions"];
|
||||||
|
@ -91,6 +91,7 @@ class CfgClientFunctions
|
|||||||
};
|
};
|
||||||
class KeyUp {};
|
class KeyUp {};
|
||||||
class onChar {};
|
class onChar {};
|
||||||
|
class handleUIActions {};
|
||||||
};
|
};
|
||||||
class event_handlers
|
class event_handlers
|
||||||
{
|
{
|
||||||
@ -207,6 +208,7 @@ class CfgClientFunctions
|
|||||||
class refeshUI {};
|
class refeshUI {};
|
||||||
class equip {};
|
class equip {};
|
||||||
class itemTypeSlot {};
|
class itemTypeSlot {};
|
||||||
|
class usedItemRepack {};
|
||||||
};
|
};
|
||||||
class servicepoint
|
class servicepoint
|
||||||
{
|
{
|
||||||
|
@ -1128,7 +1128,8 @@ class CfgItemSort
|
|||||||
"SeedPacket_Hemp",
|
"SeedPacket_Hemp",
|
||||||
"SeedPacket_Poppy",
|
"SeedPacket_Poppy",
|
||||||
"SeedPacket_Pumpkin",
|
"SeedPacket_Pumpkin",
|
||||||
"SeedPacket_Sunflower"
|
"SeedPacket_Sunflower",
|
||||||
|
"ItemFireExtinguisher"
|
||||||
};
|
};
|
||||||
Vehicles_Land[] = {
|
Vehicles_Land[] = {
|
||||||
"ebike_epoch", // Motorrad
|
"ebike_epoch", // Motorrad
|
||||||
|
@ -1824,6 +1824,10 @@ class CfgPricing
|
|||||||
{
|
{
|
||||||
price = 50;
|
price = 50;
|
||||||
};
|
};
|
||||||
|
class ItemFireExtinguisher
|
||||||
|
{
|
||||||
|
price = 50;
|
||||||
|
}
|
||||||
class WoodLog_EPOCH
|
class WoodLog_EPOCH
|
||||||
{
|
{
|
||||||
price = 2;
|
price = 2;
|
||||||
|
Loading…
Reference in New Issue
Block a user