mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-14 12:12:34 +03:00
Actions Done
This commit is contained in:
@@ -1,128 +1,58 @@
|
||||
private ["_vehicle","_part","_hitpoint","_type","_selection","_array","_started","_finished","_animState","_isMedic","_num_removed","_damage","_dis","_sfx","_allFixed","_id","_hasToolbox","_section","_nameType","_namePart","_hitpoints"];
|
||||
|
||||
private["_id","_array","_vehicle","_part","_hitpoint","_type","_hasToolbox","_section","_nameType","_namePart","_damage","_selection","_dis","_sfx","_hitpoints","_allFixed"];
|
||||
if(DZE_ActionInProgress) exitWith { cutText [(localize "str_epoch_player_92") , "PLAIN DOWN"]; };
|
||||
DZE_ActionInProgress = true;
|
||||
|
||||
_id = _this select 2;
|
||||
_array = _this select 3;
|
||||
_vehicle = _array select 0;
|
||||
_part = _array select 1;
|
||||
_array = _this select 3;
|
||||
_vehicle = _array select 0;
|
||||
_part = _array select 1;
|
||||
_hitpoint = _array select 2;
|
||||
_type = typeOf _vehicle;
|
||||
|
||||
//
|
||||
_hasToolbox = "ItemToolbox" in items player;
|
||||
_section = _part in magazines player;
|
||||
|
||||
// moving this here because we need to know which part needed if we don't have it
|
||||
_nameType = getText(configFile >> "cfgVehicles" >> _type >> "displayName");
|
||||
_namePart = getText(configFile >> "cfgMagazines" >> _part >> "displayName");
|
||||
|
||||
s_player_repair_crtl = 1;
|
||||
|
||||
if (_section && _hasToolbox) then {
|
||||
|
||||
[1,1] call dayz_HungerThirst;
|
||||
player playActionNow "Medic";
|
||||
|
||||
_dis=20;
|
||||
_sfx = "repair";
|
||||
[player,_sfx,0,false,_dis] call dayz_zombieSpeak;
|
||||
[player,_dis,true,(getPosATL player)] spawn player_alertZombies;
|
||||
|
||||
r_interrupt = false;
|
||||
_animState = animationState player;
|
||||
r_doLoop = true;
|
||||
_started = false;
|
||||
_finished = false;
|
||||
|
||||
while {r_doLoop} do {
|
||||
_animState = animationState player;
|
||||
_isMedic = ["medic",_animState] call fnc_inString;
|
||||
if (_isMedic) then {
|
||||
_started = true;
|
||||
};
|
||||
if (_started && !_isMedic) then {
|
||||
r_doLoop = false;
|
||||
_finished = true;
|
||||
};
|
||||
if (r_interrupt) then {
|
||||
r_doLoop = false;
|
||||
};
|
||||
uiSleep 0.1;
|
||||
};
|
||||
r_doLoop = false;
|
||||
_type = typeOf _vehicle;
|
||||
|
||||
|
||||
if (_finished) then {
|
||||
|
||||
_damage = [_vehicle,_hitpoint] call object_getHit;
|
||||
_vehicle removeAction _id;
|
||||
|
||||
//dont waste loot on undamaged parts
|
||||
if (_damage > 0) then {
|
||||
|
||||
// ensure part was removed
|
||||
_num_removed = ([player,_part] call BIS_fnc_invRemove);
|
||||
|
||||
if(_num_removed == 1) then {
|
||||
|
||||
//Fix the part
|
||||
_selection = getText(configFile >> "cfgVehicles" >> _type >> "HitPoints" >> _hitpoint >> "name");
|
||||
|
||||
//vehicle is owned by whoever is in it, so we have to have each client try && fix it
|
||||
PVDZE_veh_SFix = [_vehicle,_selection,0];
|
||||
publicVariable "PVDZE_veh_SFix";
|
||||
if (local _vehicle) then {
|
||||
PVDZE_veh_SFix call object_setFixServer;
|
||||
};
|
||||
|
||||
_vehicle setvelocity [0,0,1];
|
||||
|
||||
//Success!
|
||||
cutText [format[(localize "str_epoch_player_166"),_namePart,_nameType], "PLAIN DOWN"];
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
} else {
|
||||
r_interrupt = false;
|
||||
if (vehicle player == player) then {
|
||||
[objNull, player, rSwitchMove,""] call RE;
|
||||
player playActionNow "stop";
|
||||
};
|
||||
cutText [(localize "str_epoch_player_93"), "PLAIN DOWN"];
|
||||
};
|
||||
|
||||
} else {
|
||||
cutText [format[(localize "str_epoch_player_167"),_namePart], "PLAIN DOWN"];
|
||||
};
|
||||
|
||||
{dayz_myCursorTarget removeAction _x} count s_player_repairActions;s_player_repairActions = [];
|
||||
{dayz_myCursorTarget removeAction _x} forEach s_player_repairActions;s_player_repairActions = [];
|
||||
dayz_myCursorTarget = objNull;
|
||||
|
||||
//check if repaired fully
|
||||
_hitpoints = _vehicle call vehicle_getHitpoints;
|
||||
_allFixed = true;
|
||||
{
|
||||
_damage = [_vehicle,_x] call object_getHit;
|
||||
if (_damage > 0) exitWith {
|
||||
_allFixed = false;
|
||||
};
|
||||
} count _hitpoints;
|
||||
//diag_log(format["%1 %2", __FILE__, _this]);
|
||||
|
||||
//update if repaired
|
||||
if (_allFixed) then {
|
||||
_vehicle setDamage 0;
|
||||
//["PVDZE_veh_Update",[_vehicle,"repair"]] call callRpcProcedure;
|
||||
PVDZE_veh_SFix = [_vehicle,_selection,0];
|
||||
publicVariable "PVDZE_veh_SFix";
|
||||
if (local _vehicle) then {
|
||||
PVDZE_veh_SFix call object_setFixServer;
|
||||
_hasToolbox = "ItemToolbox" in items player;
|
||||
_section = _part in magazines player;
|
||||
|
||||
//moving this here because we need to know which part needed if we don't have it
|
||||
_nameType = getText(configFile >> "cfgVehicles" >> _type >> "displayName");
|
||||
_namePart = getText(configFile >> "cfgMagazines" >> _part >> "displayName");
|
||||
|
||||
if (_section and _hasToolbox) then {
|
||||
player removeMagazine _part;
|
||||
player playActionNow "Medic";
|
||||
uisleep 1;
|
||||
|
||||
_dis=20;
|
||||
_sfx = "repair";
|
||||
[player,_sfx,0,false,_dis] call dayz_zombieSpeak;
|
||||
[player,_dis,true,(getPosATL player)] call player_alertZombies;
|
||||
|
||||
// Added Nutrition-Factor for work
|
||||
["Working",0,[20,40,15,0]] call dayz_NutritionSystem;
|
||||
|
||||
uisleep 5;
|
||||
|
||||
_damage = [_vehicle,_hitpoint] call object_getHit;
|
||||
_vehicle removeAction _id;
|
||||
//dont waste loot on undamaged parts
|
||||
if (_damage > 0) then {
|
||||
//Fix the part
|
||||
_selection = getText(configFile >> "cfgVehicles" >> _type >> "HitPoints" >> _hitpoint >> "name");
|
||||
|
||||
[_vehicle, _selection, 0, true] call fnc_veh_handleRepair;
|
||||
_vehicle setvelocity [0,0,1];
|
||||
|
||||
//Success!
|
||||
cutText [format [localize "str_player_04",_namePart,_nameType], "PLAIN DOWN"];
|
||||
} else {
|
||||
player addMagazine _part;
|
||||
};
|
||||
} else {
|
||||
cutText [format [localize "str_player_03",_namePart], "PLAIN DOWN"];
|
||||
};
|
||||
|
||||
s_player_repair_crtl = -1;
|
||||
|
||||
DZE_ActionInProgress = false;
|
||||
Reference in New Issue
Block a user