From b2a2e25a2ce8ffb5d1c73a0c444d781647795554 Mon Sep 17 00:00:00 2001 From: He-Man Date: Wed, 10 Jan 2018 21:16:29 +0100 Subject: [PATCH] Make Lighter Refillable --- Sources/epoch_code/compile/EPOCH_consumeItem.sqf | 14 +++++++------- .../compile/inventory/EPOCH_usedItemRepack.sqf | 2 +- .../epoch_config/Configs/CfgItemInteractions.hpp | 8 +++++++- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/Sources/epoch_code/compile/EPOCH_consumeItem.sqf b/Sources/epoch_code/compile/EPOCH_consumeItem.sqf index abfe3205..fa18bf93 100644 --- a/Sources/epoch_code/compile/EPOCH_consumeItem.sqf +++ b/Sources/epoch_code/compile/EPOCH_consumeItem.sqf @@ -188,7 +188,7 @@ switch _interactOption do { }; case 5: { if !(player == vehicle player) exitwith { - ["Siphon from outside!", 5] call Epoch_message; + ["Fill from outside!", 5] call Epoch_message; }; _vehicles = player nearEntities [["LandVehicle","Ship","Air","Tank"], 30]; _canCapacity = _interactAttributes param [0,10]; @@ -198,15 +198,15 @@ switch _interactOption do { _newFuel = (((fuel _vehicle) * _fuelCapacity) - _canCapacity) / _fuelCapacity; if (_newFuel > 0) then { if (_item call _removeItem) then { - [_interactReturnOnUse,_vehicle,_newFuel] spawn { - params ["_interactReturnOnUse","_vehicle","_newFuel"]; + [_interactReturnOnUse,_vehicle,_newFuel,_item] spawn { + params ["_interactReturnOnUse","_vehicle","_newFuel","_item"]; closeDialog 0; player playMove 'AinvPknlMstpSnonWrflDnon_medic0'; player playMove 'AinvPknlMstpSnonWrflDnon_medicEnd'; uisleep 5; _interactReturnOnUse call EPOCH_fnc_addItemOverflow; [_vehicle,_newFuel,player,Epoch_personalToken] remoteExec ["EPOCH_server_fillVehicle",2]; - ["Fuel Siphoned", 5] call Epoch_message; + [format["%1 Filled",_item call EPOCH_itemDisplayName], 5] call Epoch_message; }; }; } else { @@ -222,14 +222,14 @@ switch _interactOption do { if (_transportFuel > _canCapacity) then { if (_item call _removeItem) then { - [_interactReturnOnUse] spawn { - params ["_interactReturnOnUse"]; + [_interactReturnOnUse,_item] spawn { + params ["_interactReturnOnUse","_item"]; closeDialog 0; player playMove 'AinvPknlMstpSnonWrflDnon_medic0'; player playMove 'AinvPknlMstpSnonWrflDnon_medicEnd'; uisleep 5; _interactReturnOnUse call EPOCH_fnc_addItemOverflow; - ["Fuel Siphoned", 5] call Epoch_message; + [format["%1 Filled",_item call EPOCH_itemDisplayName], 5] call Epoch_message; }; }; } else { diff --git a/Sources/epoch_code/compile/inventory/EPOCH_usedItemRepack.sqf b/Sources/epoch_code/compile/inventory/EPOCH_usedItemRepack.sqf index 80189bbb..b77f9396 100644 --- a/Sources/epoch_code/compile/inventory/EPOCH_usedItemRepack.sqf +++ b/Sources/epoch_code/compile/inventory/EPOCH_usedItemRepack.sqf @@ -58,7 +58,7 @@ if!(_chg isEqualTo 0)then{ _itemMags pushBack [_mag, (_count + _chg)]; _player removeMagazines _mag; { - if ((_x select 1) > 0) then { + 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 _player addMagazine _x; }; }forEach _itemMags; diff --git a/Sources/epoch_config/Configs/CfgItemInteractions.hpp b/Sources/epoch_config/Configs/CfgItemInteractions.hpp index fa6422cd..8526defd 100644 --- a/Sources/epoch_config/Configs/CfgItemInteractions.hpp +++ b/Sources/epoch_config/Configs/CfgItemInteractions.hpp @@ -229,6 +229,13 @@ class CfgItemInteractions interactReturnOnUse = "jerrycan_epoch"; interactAttributes[] = {10}; }; + class lighter_epoch : Default + { + interactAction = 5; + interactText = "Fill"; + interactReturnOnUse = "lighter_epoch"; + interactAttributes[] = {2}; + }; class FAK : Default { interactAction = 13; @@ -793,7 +800,6 @@ class CfgItemInteractions class hatchet_swing : Default {}; class WoodLog_EPOCH : Default {}; class ItemCoolerE : Default {}; - class lighter_epoch : Default {}; class Item_AssaultPack_cbr : Item_Packed_base { interactReturnOnUse = "B_AssaultPack_cbr";