mirror of
https://github.com/EpochModTeam/Epoch.git
synced 2024-08-30 18:22:13 +00:00
Animations for Consumeitems
This commit is contained in:
parent
ae1f874dc8
commit
0935cb3f08
@ -62,30 +62,33 @@ 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 {
|
||||||
_magazineSize = 0;
|
params ["_item","_magazineSizeMax"];
|
||||||
_magazinesAmmoFull = magazinesAmmoFull player;
|
if (player == vehicle player) then {
|
||||||
{
|
closeDialog 0;
|
||||||
if (_item isEqualTo (_x select 0)) then {
|
player playMove 'AinvPknlMstpSnonWrflDnon_medic0';
|
||||||
if (!(_x select 2)) then {
|
player playMove 'AinvPknlMstpSnonWrflDnon_medicEnd';
|
||||||
_magazineSize = _magazineSize + (_x select 1);
|
uisleep 5;
|
||||||
};
|
|
||||||
};
|
};
|
||||||
} forEach _magazinesAmmoFull;
|
_magazineSize = 0;
|
||||||
|
_magazinesAmmoFull = magazinesAmmoFull player;
|
||||||
// remove all
|
{
|
||||||
player removeMagazines _item;
|
if (_item isEqualTo (_x select 0)) then {
|
||||||
|
if (!(_x select 2)) then {
|
||||||
// Add full magazines back to player
|
_magazineSize = _magazineSize + (_x select 1);
|
||||||
for "_i" from 1 to floor (_magazineSize / _magazineSizeMax) do
|
};
|
||||||
{
|
};
|
||||||
player addMagazine [_item, _magazineSizeMax];
|
} forEach _magazinesAmmoFull;
|
||||||
|
player removeMagazines _item;
|
||||||
|
for "_i" from 1 to floor (_magazineSize / _magazineSizeMax) do
|
||||||
|
{
|
||||||
|
player addMagazine [_item, _magazineSizeMax];
|
||||||
|
};
|
||||||
|
if ((_magazineSize % _magazineSizeMax) > 0) then {
|
||||||
|
player addMagazine [_item, floor (_magazineSize % _magazineSizeMax)];
|
||||||
|
};
|
||||||
|
["Ammo Repacked", 5] call Epoch_message;
|
||||||
};
|
};
|
||||||
// Add last non full magazine
|
|
||||||
if ((_magazineSize % _magazineSizeMax) > 0) then {
|
|
||||||
player addMagazine [_item, floor (_magazineSize % _magazineSizeMax)];
|
|
||||||
};
|
|
||||||
["Ammo Repacked", 5] call Epoch_message;
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
case 1: _unifiedInteract; // Eat 1
|
case 1: _unifiedInteract; // Eat 1
|
||||||
@ -170,15 +173,23 @@ switch _interactOption do {
|
|||||||
_newFuel = _newFuel / _fuelCapacity;
|
_newFuel = _newFuel / _fuelCapacity;
|
||||||
|
|
||||||
if (_item call _removeItem) then {
|
if (_item call _removeItem) then {
|
||||||
_interactReturnOnUse call EPOCH_fnc_addItemOverflow;
|
[_interactReturnOnUse,_vehicle,_newFuel] spawn {
|
||||||
// send
|
params ["_interactReturnOnUse","_vehicle","_newFuel"];
|
||||||
[_vehicle,_newFuel,player,Epoch_personalToken] remoteExec ["EPOCH_server_fillVehicle",2];
|
closeDialog 0;
|
||||||
|
player playMove 'AinvPknlMstpSnonWrflDnon_medic0';
|
||||||
["Fuel Added", 5] call Epoch_message;
|
player playMove 'AinvPknlMstpSnonWrflDnon_medicEnd';
|
||||||
|
uisleep 5;
|
||||||
|
_interactReturnOnUse call EPOCH_fnc_addItemOverflow;
|
||||||
|
[_vehicle,_newFuel,player,Epoch_personalToken] remoteExec ["EPOCH_server_fillVehicle",2];
|
||||||
|
["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,9 +198,16 @@ 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 call EPOCH_fnc_addItemOverflow;
|
[_interactReturnOnUse,_vehicle,_newFuel] spawn {
|
||||||
[_vehicle,_newFuel,player,Epoch_personalToken] remoteExec ["EPOCH_server_fillVehicle",2];
|
params ["_interactReturnOnUse","_vehicle","_newFuel"];
|
||||||
["Fuel Siphoned", 5] call Epoch_message;
|
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;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
["Not Enough Fuel", 5] call Epoch_message;
|
["Not Enough Fuel", 5] call Epoch_message;
|
||||||
@ -204,8 +222,15 @@ switch _interactOption do {
|
|||||||
|
|
||||||
if (_transportFuel > _canCapacity) then {
|
if (_transportFuel > _canCapacity) then {
|
||||||
if (_item call _removeItem) then {
|
if (_item call _removeItem) then {
|
||||||
_interactReturnOnUse call EPOCH_fnc_addItemOverflow;
|
[_interactReturnOnUse] spawn {
|
||||||
["Fuel Siphoned", 5] call Epoch_message;
|
params ["_interactReturnOnUse"];
|
||||||
|
closeDialog 0;
|
||||||
|
player playMove 'AinvPknlMstpSnonWrflDnon_medic0';
|
||||||
|
player playMove 'AinvPknlMstpSnonWrflDnon_medicEnd';
|
||||||
|
uisleep 5;
|
||||||
|
_interactReturnOnUse call EPOCH_fnc_addItemOverflow;
|
||||||
|
["Fuel Siphoned", 5] call Epoch_message;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
["Not Enough Fuel", 5] call Epoch_message;
|
["Not Enough Fuel", 5] call Epoch_message;
|
||||||
@ -217,49 +242,66 @@ 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 {
|
||||||
_highestDMG = 0;
|
params ["_vehicle"];
|
||||||
_currentHIT = -1;
|
closeDialog 0;
|
||||||
_currentDMG = 0;
|
player playMove 'AinvPknlMstpSnonWrflDnon_medic0';
|
||||||
{
|
player playMove 'AinvPknlMstpSnonWrflDnon_medicEnd';
|
||||||
_currentDMG = _x;
|
_vehicle say3d 'vehicle_repair';
|
||||||
if (_currentDMG > _highestDMG) then {
|
uisleep 5;
|
||||||
_highestDMG = _currentDMG;
|
_highestDMG = 0;
|
||||||
_currentHIT = _forEachIndex;
|
_currentHIT = -1;
|
||||||
};
|
_currentDMG = 0;
|
||||||
}forEach ((getAllHitPointsDamage _vehicle) param [2,[]]);
|
{
|
||||||
|
_currentDMG = _x;
|
||||||
if (_highestDMG > 0) then {
|
if (_currentDMG > _highestDMG) then {
|
||||||
|
_highestDMG = _currentDMG;
|
||||||
_newDMG = ((_highestDMG - 0.5) max 0);
|
_currentHIT = _forEachIndex;
|
||||||
|
};
|
||||||
if (local _vehicle) then {
|
}forEach ((getAllHitPointsDamage _vehicle) param [2,[]]);
|
||||||
[_vehicle, [[_currentHIT, _newDMG]] ] call EPOCH_client_repairVehicle;
|
if (_highestDMG > 0) then {
|
||||||
|
_newDMG = ((_highestDMG - 0.5) max 0);
|
||||||
|
if (local _vehicle) then {
|
||||||
|
[_vehicle, [[_currentHIT, _newDMG]] ] call EPOCH_client_repairVehicle;
|
||||||
|
} else {
|
||||||
|
[_vehicle,[[_currentHIT,_newDMG]],player,Epoch_personalToken] remoteExec ["EPOCH_server_repairVehicle",2];
|
||||||
|
};
|
||||||
} else {
|
} else {
|
||||||
[_vehicle,[[_currentHIT,_newDMG]],player,Epoch_personalToken] remoteExec ["EPOCH_server_repairVehicle",2];
|
if ((damage _vehicle) > 0) then {
|
||||||
};
|
[_vehicle,["ALL",0],player,Epoch_personalToken] remoteExec ["EPOCH_server_repairVehicle",2];
|
||||||
|
};
|
||||||
} else {
|
|
||||||
if ((damage _vehicle) > 0) then {
|
|
||||||
[_vehicle,["ALL",0],player,Epoch_personalToken] remoteExec ["EPOCH_server_repairVehicle",2];
|
|
||||||
};
|
};
|
||||||
|
["Vehicle Partially Repaired", 5] call Epoch_message;
|
||||||
};
|
};
|
||||||
["Vehicle Partially Repaired", 5] call Epoch_message;
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
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,["ALL",0],player,Epoch_personalToken] remoteExec ["EPOCH_server_repairVehicle",2];
|
[_vehicle] spawn {
|
||||||
["Vehicle Fully Repaired", 5] call Epoch_message;
|
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 Fully Repaired", 5] call Epoch_message;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -300,11 +342,20 @@ 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,["ALL",0],player,Epoch_personalToken] remoteExec ["EPOCH_server_repairVehicle",2];
|
[_vehicle] spawn {
|
||||||
if (_vehicle isEqualTo player) then {
|
params ["_vehicle"];
|
||||||
["Healed yourself", 5] call Epoch_message;
|
if (player == vehicle player) then {
|
||||||
} else {
|
closeDialog 0;
|
||||||
["Healed other player", 5] call Epoch_message;
|
player playMove 'AinvPknlMstpSnonWrflDnon_medic0';
|
||||||
|
player playMove 'AinvPknlMstpSnonWrflDnon_medicEnd';
|
||||||
|
uisleep 5;
|
||||||
|
};
|
||||||
|
[_vehicle,["ALL",0],player,Epoch_personalToken] remoteExec ["EPOCH_server_repairVehicle",2];
|
||||||
|
if (_vehicle isEqualTo player) then {
|
||||||
|
["Healed yourself", 5] call Epoch_message;
|
||||||
|
} else {
|
||||||
|
["Healed other player", 5] call Epoch_message;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -332,21 +383,30 @@ 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 {
|
||||||
private _out = [];
|
[_vehicle,_item] spawn {
|
||||||
{
|
params ["_vehicle","_item"];
|
||||||
if (_x > 0) then {
|
if (player == vehicle player) then {
|
||||||
_out pushback [_foreachindex,((_x - 0.2) min 0.45) max 0];
|
closeDialog 0;
|
||||||
|
player playMove 'AinvPknlMstpSnonWrflDnon_medic0';
|
||||||
|
player playMove 'AinvPknlMstpSnonWrflDnon_medicEnd';
|
||||||
|
uisleep 5;
|
||||||
};
|
};
|
||||||
}forEach ((getAllHitPointsDamage _vehicle) param [2,0]);
|
private _out = [];
|
||||||
if (_out isequalto []) then {
|
{
|
||||||
if ((damage _vehicle) > 0) then {
|
if (_x > 0) then {
|
||||||
_out = ["ALL",0];
|
_out pushback [_foreachindex,((_x - 0.2) min 0.45) max 0];
|
||||||
|
};
|
||||||
|
}forEach ((getAllHitPointsDamage _vehicle) param [2,0]);
|
||||||
|
if (_out isequalto []) then {
|
||||||
|
if ((damage _vehicle) > 0) then {
|
||||||
|
_out = ["ALL",0];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
if !(_out isequalto []) then {
|
||||||
|
[_vehicle,_out,player,Epoch_personalToken] remoteExec ["EPOCH_server_repairVehicle",2];
|
||||||
|
};
|
||||||
|
[format["Used %1 on yourself",_item call EPOCH_itemDisplayName], 5] call Epoch_message;
|
||||||
};
|
};
|
||||||
if !(_out isequalto []) then {
|
|
||||||
[_vehicle,_out,player,Epoch_personalToken] remoteExec ["EPOCH_server_repairVehicle",2];
|
|
||||||
};
|
|
||||||
[format["Used %1 on yourself",_item call EPOCH_itemDisplayName], 5] call Epoch_message;
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user