Animations for Consumeitems

This commit is contained in:
He-Man 2017-10-17 00:24:38 +02:00
parent ae1f874dc8
commit 0935cb3f08

View File

@ -62,7 +62,14 @@ switch _interactOption do {
_magazineSizeMax = getNumber (configfile >> "CfgMagazines" >> _item >> "count"); _magazineSizeMax = getNumber (configfile >> "CfgMagazines" >> _item >> "count");
// allow repack for all magazines with greater than 1 bullet // allow repack for all magazines with greater than 1 bullet
if (_magazineSizeMax > 1) then { if (_magazineSizeMax > 1) then {
[_item,_magazineSizeMax] spawn {
params ["_item","_magazineSizeMax"];
if (player == vehicle player) then {
closeDialog 0;
player playMove 'AinvPknlMstpSnonWrflDnon_medic0';
player playMove 'AinvPknlMstpSnonWrflDnon_medicEnd';
uisleep 5;
};
_magazineSize = 0; _magazineSize = 0;
_magazinesAmmoFull = magazinesAmmoFull player; _magazinesAmmoFull = magazinesAmmoFull player;
{ {
@ -72,22 +79,18 @@ switch _interactOption do {
}; };
}; };
} forEach _magazinesAmmoFull; } forEach _magazinesAmmoFull;
// remove all
player removeMagazines _item; player removeMagazines _item;
// Add full magazines back to player
for "_i" from 1 to floor (_magazineSize / _magazineSizeMax) do for "_i" from 1 to floor (_magazineSize / _magazineSizeMax) do
{ {
player addMagazine [_item, _magazineSizeMax]; player addMagazine [_item, _magazineSizeMax];
}; };
// Add last non full magazine
if ((_magazineSize % _magazineSizeMax) > 0) then { if ((_magazineSize % _magazineSizeMax) > 0) then {
player addMagazine [_item, floor (_magazineSize % _magazineSizeMax)]; player addMagazine [_item, floor (_magazineSize % _magazineSizeMax)];
}; };
["Ammo Repacked", 5] call Epoch_message; ["Ammo Repacked", 5] call Epoch_message;
}; };
}; };
};
case 1: _unifiedInteract; // Eat 1 case 1: _unifiedInteract; // Eat 1
case 2: _unifiedInteract; //Drink 2 case 2: _unifiedInteract; //Drink 2
case 3: { // Build 3 case 3: { // Build 3
@ -170,15 +173,23 @@ switch _interactOption do {
_newFuel = _newFuel / _fuelCapacity; _newFuel = _newFuel / _fuelCapacity;
if (_item call _removeItem) then { if (_item call _removeItem) then {
[_interactReturnOnUse,_vehicle,_newFuel] spawn {
params ["_interactReturnOnUse","_vehicle","_newFuel"];
closeDialog 0;
player playMove 'AinvPknlMstpSnonWrflDnon_medic0';
player playMove 'AinvPknlMstpSnonWrflDnon_medicEnd';
uisleep 5;
_interactReturnOnUse call EPOCH_fnc_addItemOverflow; _interactReturnOnUse call EPOCH_fnc_addItemOverflow;
// send
[_vehicle,_newFuel,player,Epoch_personalToken] remoteExec ["EPOCH_server_fillVehicle",2]; [_vehicle,_newFuel,player,Epoch_personalToken] remoteExec ["EPOCH_server_fillVehicle",2];
["Fuel Added", 5] call Epoch_message; ["Fuel Added", 5] call Epoch_message;
}; };
}; };
}; };
};
case 5: { case 5: {
if !(player == vehicle player) exitwith {
["Siphon from outside!", 5] call Epoch_message;
};
_vehicles = player nearEntities [["LandVehicle","Ship","Air","Tank"], 30]; _vehicles = player nearEntities [["LandVehicle","Ship","Air","Tank"], 30];
_canCapacity = _interactAttributes param [0,10]; _canCapacity = _interactAttributes param [0,10];
if (cursorTarget in _vehicles) then { if (cursorTarget in _vehicles) then {
@ -187,10 +198,17 @@ switch _interactOption do {
_newFuel = (((fuel _vehicle) * _fuelCapacity) - _canCapacity) / _fuelCapacity; _newFuel = (((fuel _vehicle) * _fuelCapacity) - _canCapacity) / _fuelCapacity;
if (_newFuel > 0) then { if (_newFuel > 0) then {
if (_item call _removeItem) then { if (_item call _removeItem) then {
[_interactReturnOnUse,_vehicle,_newFuel] spawn {
params ["_interactReturnOnUse","_vehicle","_newFuel"];
closeDialog 0;
player playMove 'AinvPknlMstpSnonWrflDnon_medic0';
player playMove 'AinvPknlMstpSnonWrflDnon_medicEnd';
uisleep 5;
_interactReturnOnUse call EPOCH_fnc_addItemOverflow; _interactReturnOnUse call EPOCH_fnc_addItemOverflow;
[_vehicle,_newFuel,player,Epoch_personalToken] remoteExec ["EPOCH_server_fillVehicle",2]; [_vehicle,_newFuel,player,Epoch_personalToken] remoteExec ["EPOCH_server_fillVehicle",2];
["Fuel Siphoned", 5] call Epoch_message; ["Fuel Siphoned", 5] call Epoch_message;
}; };
};
} else { } else {
["Not Enough Fuel", 5] call Epoch_message; ["Not Enough Fuel", 5] call Epoch_message;
}; };
@ -204,9 +222,16 @@ switch _interactOption do {
if (_transportFuel > _canCapacity) then { if (_transportFuel > _canCapacity) then {
if (_item call _removeItem) then { if (_item call _removeItem) then {
[_interactReturnOnUse] spawn {
params ["_interactReturnOnUse"];
closeDialog 0;
player playMove 'AinvPknlMstpSnonWrflDnon_medic0';
player playMove 'AinvPknlMstpSnonWrflDnon_medicEnd';
uisleep 5;
_interactReturnOnUse call EPOCH_fnc_addItemOverflow; _interactReturnOnUse call EPOCH_fnc_addItemOverflow;
["Fuel Siphoned", 5] call Epoch_message; ["Fuel Siphoned", 5] call Epoch_message;
}; };
};
} else { } else {
["Not Enough Fuel", 5] call Epoch_message; ["Not Enough Fuel", 5] call Epoch_message;
}; };
@ -217,12 +242,21 @@ switch _interactOption do {
case 8: _unifiedInteract; //Cold -1 case 8: _unifiedInteract; //Cold -1
case 9: _unifiedInteract; //Energy 100 case 9: _unifiedInteract; //Energy 100
case 10: { // Repair 10 - Lite case 10: { // Repair 10 - Lite
if !(player == vehicle player) exitwith {
["Repair from outside!", 5] call Epoch_message;
};
_vehicles = player nearEntities [["LandVehicle","Ship","Air","Tank"], 30]; _vehicles = player nearEntities [["LandVehicle","Ship","Air","Tank"], 30];
_vehicle = cursorTarget; _vehicle = cursorTarget;
if (_vehicle in _vehicles) then { if (_vehicle in _vehicles) then {
if (_item call _removeItem) then { if (_item call _removeItem) then {
[_vehicle] spawn {
params ["_vehicle"];
closeDialog 0;
player playMove 'AinvPknlMstpSnonWrflDnon_medic0';
player playMove 'AinvPknlMstpSnonWrflDnon_medicEnd';
_vehicle say3d 'vehicle_repair';
uisleep 5;
_highestDMG = 0; _highestDMG = 0;
_currentHIT = -1; _currentHIT = -1;
_currentDMG = 0; _currentDMG = 0;
@ -233,17 +267,13 @@ switch _interactOption do {
_currentHIT = _forEachIndex; _currentHIT = _forEachIndex;
}; };
}forEach ((getAllHitPointsDamage _vehicle) param [2,[]]); }forEach ((getAllHitPointsDamage _vehicle) param [2,[]]);
if (_highestDMG > 0) then { if (_highestDMG > 0) then {
_newDMG = ((_highestDMG - 0.5) max 0); _newDMG = ((_highestDMG - 0.5) max 0);
if (local _vehicle) then { if (local _vehicle) then {
[_vehicle, [[_currentHIT, _newDMG]] ] call EPOCH_client_repairVehicle; [_vehicle, [[_currentHIT, _newDMG]] ] call EPOCH_client_repairVehicle;
} else { } else {
[_vehicle,[[_currentHIT,_newDMG]],player,Epoch_personalToken] remoteExec ["EPOCH_server_repairVehicle",2]; [_vehicle,[[_currentHIT,_newDMG]],player,Epoch_personalToken] remoteExec ["EPOCH_server_repairVehicle",2];
}; };
} else { } else {
if ((damage _vehicle) > 0) then { if ((damage _vehicle) > 0) then {
[_vehicle,["ALL",0],player,Epoch_personalToken] remoteExec ["EPOCH_server_repairVehicle",2]; [_vehicle,["ALL",0],player,Epoch_personalToken] remoteExec ["EPOCH_server_repairVehicle",2];
@ -253,16 +283,28 @@ switch _interactOption do {
}; };
}; };
}; };
};
case 11: { // Repair 11 - Heavy case 11: { // Repair 11 - Heavy
if !(player == vehicle player) exitwith {
["Repair from outside!", 5] call Epoch_message;
};
_vehicles = player nearEntities [["LandVehicle","Ship","Air","Tank"], 30]; _vehicles = player nearEntities [["LandVehicle","Ship","Air","Tank"], 30];
_vehicle = cursorTarget; _vehicle = cursorTarget;
if (_vehicle in _vehicles) then { if (_vehicle in _vehicles) then {
if (_item call _removeItem) then { if (_item call _removeItem) then {
[_vehicle] spawn {
params ["_vehicle"];
closeDialog 0;
player playMove 'AinvPknlMstpSnonWrflDnon_medic0';
player playMove 'AinvPknlMstpSnonWrflDnon_medicEnd';
uisleep 5;
_vehicle say3d 'vehicle_repair';
[_vehicle,["ALL",0],player,Epoch_personalToken] remoteExec ["EPOCH_server_repairVehicle",2]; [_vehicle,["ALL",0],player,Epoch_personalToken] remoteExec ["EPOCH_server_repairVehicle",2];
["Vehicle Fully Repaired", 5] call Epoch_message; ["Vehicle Fully Repaired", 5] call Epoch_message;
}; };
}; };
}; };
};
// case 12 consume paincan and set texture on base object (only if has slot and is static) // case 12 consume paincan and set texture on base object (only if has slot and is static)
case 12: { case 12: {
@ -300,6 +342,14 @@ switch _interactOption do {
}; };
if (damage _vehicle != 0 || {_x > 0} count ((getallhitpointsdamage _vehicle) select 2) > 0) then { if (damage _vehicle != 0 || {_x > 0} count ((getallhitpointsdamage _vehicle) select 2) > 0) then {
if (_item call _removeItem) then { if (_item call _removeItem) then {
[_vehicle] spawn {
params ["_vehicle"];
if (player == vehicle player) then {
closeDialog 0;
player playMove 'AinvPknlMstpSnonWrflDnon_medic0';
player playMove 'AinvPknlMstpSnonWrflDnon_medicEnd';
uisleep 5;
};
[_vehicle,["ALL",0],player,Epoch_personalToken] remoteExec ["EPOCH_server_repairVehicle",2]; [_vehicle,["ALL",0],player,Epoch_personalToken] remoteExec ["EPOCH_server_repairVehicle",2];
if (_vehicle isEqualTo player) then { if (_vehicle isEqualTo player) then {
["Healed yourself", 5] call Epoch_message; ["Healed yourself", 5] call Epoch_message;
@ -309,6 +359,7 @@ switch _interactOption do {
}; };
}; };
}; };
};
case 14: { // Unpack Backpack case 14: { // Unpack Backpack
if (_item call _removeItem) then { if (_item call _removeItem) then {
@ -332,6 +383,14 @@ switch _interactOption do {
_vehicle = player; _vehicle = player;
if (damage _vehicle != 0 || {_x > 0} count ((getallhitpointsdamage _vehicle) select 2) > 0) then { if (damage _vehicle != 0 || {_x > 0} count ((getallhitpointsdamage _vehicle) select 2) > 0) then {
if (call _unifiedInteract) then { if (call _unifiedInteract) then {
[_vehicle,_item] spawn {
params ["_vehicle","_item"];
if (player == vehicle player) then {
closeDialog 0;
player playMove 'AinvPknlMstpSnonWrflDnon_medic0';
player playMove 'AinvPknlMstpSnonWrflDnon_medicEnd';
uisleep 5;
};
private _out = []; private _out = [];
{ {
if (_x > 0) then { if (_x > 0) then {
@ -350,6 +409,7 @@ switch _interactOption do {
}; };
}; };
}; };
};
default { default {
["Found nothing", 5] call Epoch_message; ["Found nothing", 5] call Epoch_message;