Actions Done

This commit is contained in:
icomrade
2016-02-29 10:45:53 -05:00
parent a47c3dc137
commit b667d01c1c
27 changed files with 1958 additions and 1094 deletions

View File

@@ -1,9 +1,8 @@
private ["_vehicle","_part","_hitpoint","_type","_selection","_array","_started","_finished","_animState","_isMedic","_isOK","_brokenPart","_findPercent","_damage","_hasToolbox","_nameType","_namePart"];
if(DZE_ActionInProgress) exitWith { cutText [(localize "str_epoch_player_94") , "PLAIN DOWN"]; };
DZE_ActionInProgress = true;
if (dayz_salvageInProgress) exitWith {cutText [localize "str_salvage_inprogress", "PLAIN DOWN"]; };
dayz_salvageInProgress = true;
//_id = _this select 2;
_array = _this select 3;
_vehicle = _array select 0;
_part = _array select 1;
@@ -12,110 +11,102 @@ _type = typeOf _vehicle;
_isOK = false;
_brokenPart = false;
_started = false;
_finished = false;
//
_hasToolbox = "ItemToolbox" in items player;
_hasToolbox = "ItemToolbox" in items 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");
_nameType = getText(configFile >> "cfgVehicles" >> _type >> "displayName");
_namePart = getText(configFile >> "cfgMagazines" >> _part >> "displayName");
{_vehicle removeAction _x} count s_player_repairActions;s_player_repairActions = [];
{_vehicle removeAction _x} forEach s_player_repairActions;
s_player_repairActions = [];
s_player_repair_crtl = 1;
if (_hasToolbox) then {
[1,1] call dayz_HungerThirst;
player playActionNow "Medic";
[player,"repair",0,false] call dayz_zombieSpeak;
[player,50,true,(getPosATL player)] spawn player_alertZombies;
[player,50,true,(getPosATL player)] call player_alertZombies;
// Added Nutrition-Factor for work
["Working",0,[20,40,15,0]] call dayz_NutritionSystem;
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;
if (_isMedic) then { _started = true; };
if (_started and !_isMedic) then { r_doLoop = false; _finished = true; };
if (r_interrupt) then { r_doLoop = false; };
sleep 0.1;
};
r_doLoop = false;
if (_finished) then {
_damage = [_vehicle,_hitpoint] call object_getHit;
// _vehicle removeAction _id;
//dont allow removal of damaged parts
if (_damage < 1) then {
_BreakableParts = ["HitGlass1","HitGlass2","HitGlass3","HitGlass4","HitGlass5","HitGlass6","HitLGlass","HitRGlass","HitEngine","HitFuel","HitHRotor"];
if (_hitpoint in _BreakableParts) then {
_findPercent = (1 - _damage) * 10;
if(ceil (random _findPercent) == 1) then {
_isOK = true;
_brokenPart = true;
_isOK = true;
_brokenPart = true;
} else {
_isOK = [player,_part] call BIS_fnc_invAdd;
_brokenPart = false;
};
} else {
//Remove melee ammo due to the way ammo is working.
{player removeMagazines _x} count MeleeMagazines;
_isOK = [player,_part] call BIS_fnc_invAdd;
_brokenPart = false;
};
if (_isOK) then {
//break 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,1],_vehicle] call broadcastRpcCallIfLocal;
PVDZE_veh_SFix = [_vehicle,_selection,1];
publicVariable "PVDZE_veh_SFix";
if (local _vehicle) then {
PVDZE_veh_SFix call object_setFixServer;
};
_vehicle setvelocity [0,0,1];
if(_brokenPart) then {
//Failed!
cutText [format[(localize "str_epoch_player_168"),_namePart,_nameType], "PLAIN DOWN"];
if (_isOK) then {
_selection = getText(configFile >> "cfgVehicles" >> _type >> "HitPoints" >> _hitpoint >> "name");
if ((_hitpoint == "HitEngine") or (_hitpoint == "HitFuel")) then {
[_vehicle, _selection, 0.89] call fnc_veh_handleDam;
} else {
//Success!
cutText [format[(localize "str_epoch_player_169"),_namePart,_nameType], "PLAIN DOWN"];
[_vehicle, _selection, 1] call fnc_veh_handleDam;
};
_vehicle call fnc_veh_ResetEH;
_vehicle setvelocity [0,0,1];
if(_brokenPart) then {
cutText [format [localize "str_salvage_destroyed",_namePart,_nameType], "PLAIN DOWN"];
} else {
cutText [format [localize "str_salvage_removed",_namePart,_nameType], "PLAIN DOWN"];
};
} else {
cutText [localize "STR_DAYZ_CODE_2", "PLAIN DOWN"];
cutText [localize "str_player_24", "PLAIN DOWN"];
};
};
} else {
r_interrupt = false;
if (vehicle player == player) then {
[objNull, player, rSwitchMove,""] call RE;
player playActionNow "stop";
};
cutText [(localize "str_epoch_player_95"), "PLAIN DOWN"];
cutText [localize "str_salvage_canceled", "PLAIN DOWN"];
};
} else {
cutText [format[(localize "str_epoch_player_170"),_namePart], "PLAIN DOWN"];
cutText [format [localize "str_salvage_toolbox",_namePart], "PLAIN DOWN"];
};
dayz_myCursorTarget = objNull;
s_player_repair_crtl = -1;
DZE_ActionInProgress = false;
dayz_salvageInProgress = false;
//adding melee mags back if needed
_wpn = primaryWeapon player;
//diag_log format["Classname: %1, WPN: %2", _classname,_wpn];
_ismelee = (getNumber (configFile >> "CfgWeapons" >> _wpn >> "melee") == 1);
if (_ismelee) then {
call dayz_meleeMagazineCheck;
};