mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-17 17:20:26 +03:00
Add medic anim function with proper interrupt
Closes #1386 Vanilla commits applied:f99a3deced731b957e8eRemoved two unused files and a few variables made redundant by actionInProgress
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
#define MAINTENANCE_NUTRITION_VALUES [20,40,15,0]
|
||||
|
||||
|
||||
private ["_isMedic","_cursorTarget","_item","_classname","_displayname","_requiredTools","_requiredParts","_onLadder","_isWater","_upgradeParts","_startMaintenance","_dis","_sfx","_started","_finished","_animState","_isRefuel"];
|
||||
private ["_cursorTarget","_item","_classname","_displayname","_requiredTools","_requiredParts","_onLadder","_isWater","_startMaintenance","_dis","_sfx","_finished"];
|
||||
|
||||
_cursorTarget = _this;
|
||||
|
||||
@@ -19,10 +19,6 @@ if(isNull _cursorTarget) exitWith {
|
||||
localize "str_maintenanceNoOption" call dayz_rollingMessages;
|
||||
};
|
||||
|
||||
if (player getVariable["alreadyBuilding",0] == 1) exitWith {
|
||||
localize "str_upgradeInProgress" call dayz_rollingMessages;
|
||||
};
|
||||
|
||||
//Item
|
||||
_item = typeof _cursorTarget;
|
||||
//diag_log (str(_item));
|
||||
@@ -42,13 +38,15 @@ _requiredParts = getArray (_classname >> "Maintenance" >> "requiredParts");
|
||||
_onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
|
||||
_isWater = (surfaceIsWater (getPosATL player)) or dayz_isSwimming;
|
||||
|
||||
_upgradeParts = [];
|
||||
_startMaintenance = true;
|
||||
|
||||
if(_isWater or _onLadder) exitWith {
|
||||
localize "str_water_ladder_cant_do" call dayz_rollingMessages;
|
||||
};
|
||||
|
||||
if (dayz_actionInProgress) exitWith {localize "str_player_actionslimit" call dayz_rollingMessages;};
|
||||
dayz_actionInProgress = true;
|
||||
|
||||
// lets check player has requiredTools for upgrade
|
||||
{
|
||||
if (!(_x IN items player)) exitWith {
|
||||
@@ -67,36 +65,27 @@ if(_isWater or _onLadder) exitWith {
|
||||
|
||||
|
||||
if (_startMaintenance) then {
|
||||
//play animation
|
||||
player playActionNow "Medic";
|
||||
_dis=20;
|
||||
_sfx = "tentpack";
|
||||
[player,_sfx,0,false,_dis] call dayz_zombieSpeak;
|
||||
[player,_dis,true,(getPosATL player)] call player_alertZombies;
|
||||
["Working",0,MAINTENANCE_NUTRITION_VALUES] call dayz_NutritionSystem; // Added Nutrition-Factor for work
|
||||
|
||||
{ player removeMagazine _x; } count _requiredParts;
|
||||
|
||||
//Animation Loop
|
||||
r_doLoop = true;
|
||||
_started = false;
|
||||
_finished = false;
|
||||
while {r_doLoop} do {
|
||||
_animState = animationState player;
|
||||
_isRefuel = ["medic",_animState] call fnc_inString;
|
||||
if (_isRefuel) then {
|
||||
_started = true;
|
||||
};
|
||||
if (_started and !_isRefuel) then {
|
||||
r_doLoop = false;
|
||||
_finished = true;
|
||||
};
|
||||
uiSleep 0.1;
|
||||
};
|
||||
|
||||
r_doLoop = false;
|
||||
_finished = ["Medic",1] call fn_loopAction;
|
||||
|
||||
if (_finished) then {
|
||||
//Double check player did not drop any items
|
||||
{
|
||||
if !(_x in magazines player) exitWith {
|
||||
format[localize "str_maintenanceMissingPart",_x,_displayname] call dayz_rollingMessages; //"Missing %1 to maintenance %2."
|
||||
_startMaintenance = false;
|
||||
};
|
||||
} count _requiredParts;
|
||||
|
||||
if (!_startMaintenance) exitWith {};
|
||||
{ player removeMagazine _x } count _requiredParts;
|
||||
|
||||
["Working",0,MAINTENANCE_NUTRITION_VALUES] call dayz_NutritionSystem; // Added Nutrition-Factor for work
|
||||
|
||||
PVDZ_veh_Save = [_cursorTarget,"maintenance"];
|
||||
if (isServer) then {
|
||||
PVDZ_veh_Save call server_updateObject;
|
||||
@@ -106,10 +95,9 @@ if (_startMaintenance) then {
|
||||
|
||||
//PVDZ_object_replace = _cursorTarget;
|
||||
//publicVariableServer "PVDZ_object_replace";
|
||||
_cursorTarget setVariable["Maintenance",false,true];
|
||||
localize "str_maintenanceDone" call dayz_rollingMessages;
|
||||
};
|
||||
|
||||
_cursorTarget setVariable["Maintenance",false,true];
|
||||
|
||||
localize "str_maintenanceDone" call dayz_rollingMessages;
|
||||
};
|
||||
|
||||
dayz_actionInProgress = false;
|
||||
Reference in New Issue
Block a user