Make Lighter Refillable

This commit is contained in:
He-Man 2018-01-10 21:16:29 +01:00
parent a2172aaef5
commit b2a2e25a2c
3 changed files with 15 additions and 9 deletions

View File

@ -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 {

View File

@ -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;

View File

@ -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";