diff --git a/CHANGE LOG 1.0.6.2.txt b/CHANGE LOG 1.0.6.2.txt index b5c7e5a8d..89e582886 100644 --- a/CHANGE LOG 1.0.6.2.txt +++ b/CHANGE LOG 1.0.6.2.txt @@ -41,6 +41,7 @@ [FIXED] Purchased boats sometimes not spawning on helipad even when it is free of obstructions. [FIXED] Unable to fill water at some ponds and wells on Napf and Namalsk due to missing or misplaced waterHoleProxy. [FIXED] Potential undefined error for dayz_characterID on login. @oiad +[FIXED] Actions like cook, gather meat, repair, etc. are now interrupted properly if the player vaults, moves or enters a vehicle during the medic animation. #1942 @SmokeyBR [NOTE] Fixes below are included in the mission file and server pbo as part of server package 1.0.6.1A (March 10th 2017) [FIXED] Fixed food and drink going down 10x faster from melee and other "working" actions. diff --git a/SQF/dayz_code/actions/boil.sqf b/SQF/dayz_code/actions/boil.sqf index 33d618f51..0b00b65f7 100644 --- a/SQF/dayz_code/actions/boil.sqf +++ b/SQF/dayz_code/actions/boil.sqf @@ -1,4 +1,4 @@ -private ["_bottletext","_tin1text","_tin2text","_tintext","_hastinitem","_qty","_dis","_sfx","_WB2Add"]; +private ["_bottletext","_tin1text","_tin2text","_tintext","_hastinitem","_qty","_dis","_sfx","_WB2Add","_finished"]; if (dayz_actionInProgress) exitWith {localize "str_player_actionslimit" call dayz_rollingMessages;}; dayz_actionInProgress = true; @@ -8,10 +8,7 @@ _tin1text = getText (configFile >> "CfgMagazines" >> "TrashTinCan" >> "displayNa _tin2text = getText (configFile >> "CfgMagazines" >> "ItemSodaEmpty" >> "displayName"); _tintext = format["%1 / %2",_tin1text,_tin2text]; //_hasbottleitem = (("ItemWaterBottle" in magazines player) || {"ItemWaterBottleInfected" in magazines player} || {"ItemWaterBottleSafe" in magazines player}); -_qty = 0; -_qty = _qty + ({ -_x in ["ItemWaterBottleInfected","ItemWaterBottle","ItemWaterBottleSafe","ItemWaterbottle1oz","ItemWaterbottle2oz","ItemWaterbottle3oz","ItemWaterbottle4oz","ItemWaterbottle5oz","ItemWaterbottle6oz","ItemWaterbottle7oz","ItemWaterbottle8oz","ItemWaterbottle9oz"]; -} count magazines player); +_qty = {_x in ["ItemWaterBottleInfected","ItemWaterBottle","ItemWaterBottleSafe","ItemWaterbottle1oz","ItemWaterbottle2oz","ItemWaterbottle3oz","ItemWaterbottle4oz","ItemWaterbottle5oz","ItemWaterbottle6oz","ItemWaterbottle7oz","ItemWaterbottle8oz","ItemWaterbottle9oz"]} count magazines player; a_player_boil = true; player removeAction s_player_boil; //s_player_boil = -1; @@ -28,13 +25,17 @@ _hastinitem = false; if (!_hastinitem) exitWith {format[localize "str_player_31",_tintext,localize "str_player_31_fill"] call dayz_rollingMessages; a_player_boil = false; dayz_actionInProgress = false;}; */ if (_qty > 0) then { - player playActionNow "Medic"; - uiSleep 1; _dis=10; _sfx = "cook"; [player,_sfx,0,false,_dis] call dayz_zombieSpeak; [player,_dis,true,(getPosATL player)] call player_alertZombies; - uiSleep 5; + + _finished = ["Medic",1] call fn_loopAction; + + // Double check player did not drop item + _qty = {_x in ["ItemWaterBottleInfected","ItemWaterBottle","ItemWaterBottleSafe","ItemWaterbottle1oz","ItemWaterbottle2oz","ItemWaterbottle3oz","ItemWaterbottle4oz","ItemWaterbottle5oz","ItemWaterbottle6oz","ItemWaterbottle7oz","ItemWaterbottle8oz","ItemWaterbottle9oz"]} count magazines player; + + if (_qty == 0 or !_finished) exitWith {}; for "_x" from 1 to _qty do { _WB2Add = "ItemWaterBottleBoiled"; diff --git a/SQF/dayz_code/actions/cook.sqf b/SQF/dayz_code/actions/cook.sqf index 709c1f751..5dfb72d5a 100644 --- a/SQF/dayz_code/actions/cook.sqf +++ b/SQF/dayz_code/actions/cook.sqf @@ -1,4 +1,4 @@ -private ["_rawmeat","_cookedmeat","_meat","_meatcooked","_text","_qty","_dis","_sfx"]; +private ["_rawmeat","_cookedmeat","_meat","_meatcooked","_text","_qty","_dis","_sfx","_finished"]; if (dayz_actionInProgress) exitWith {localize "str_player_actionslimit" call dayz_rollingMessages;}; dayz_actionInProgress = true; //diag_log ("Cook Enabled"); @@ -8,21 +8,24 @@ s_player_cook = -1; _rawmeat = Dayz_meatraw; _cookedmeat = Dayz_meatcooked; a_player_cooking = true; +_finished = true; { _meat = _x; _meatcooked = _cookedmeat select (_rawmeat find _meat); if (_meat in magazines player) then { _text = getText (configFile >> "CfgMagazines" >> _meatcooked >> "displayName"); - _qty = {_x == _meat} count magazines player; - player playActionNow "Medic"; _dis=6; _sfx = "cook"; [player,_sfx,0,false,_dis] call dayz_zombieSpeak; [player,_dis,true,(getPosATL player)] call player_alertZombies; - - uiSleep _qty; + + _finished = ["Medic",1] call fn_loopAction; + if (!_finished) exitWith {}; + + _qty = {_x == _meat} count magazines player; + for "_x" from 1 to _qty do { player removeMagazine _meat; player addMagazine _meatcooked; @@ -31,6 +34,8 @@ a_player_cooking = true; }; format[localize "str_success_cooked",_qty,_text] call dayz_rollingMessages; }; + + if (!_finished) exitWith {}; } forEach _rawmeat; a_player_cooking = false; diff --git a/SQF/dayz_code/actions/fill_nearestVehicle.sqf b/SQF/dayz_code/actions/fill_nearestVehicle.sqf index 73874613c..ab383bc62 100644 --- a/SQF/dayz_code/actions/fill_nearestVehicle.sqf +++ b/SQF/dayz_code/actions/fill_nearestVehicle.sqf @@ -1,4 +1,4 @@ -private ["_isFuelTruck","_fuelTruckCapacity","_started","_finished","_animState","_isMedic","_newFuel","_abort","_newFuelSrc","_canSize","_vehicle","_configVeh","_capacity","_nameText","_fuelTruck","_findNearestVehicle"]; +private ["_isFuelTruck","_fuelTruckCapacity","_finished","_newFuel","_abort","_newFuelSrc","_canSize","_vehicle","_configVeh","_capacity","_nameText","_fuelTruck","_findNearestVehicle"]; if (dayz_actionInProgress) exitWith {localize "str_player_actionslimit" call dayz_rollingMessages;}; dayz_actionInProgress = true; @@ -15,10 +15,10 @@ if (!isNull _fuelTruck) then { _findNearestVehicle = []; { - if ((alive _x) && (_x != _fuelTruck) && (!(_x isKindOf "Man"))) exitWith { + if (_x != _fuelTruck) exitWith { _findNearestVehicle set [(count _findNearestVehicle),_x]; }; -} count (nearestObjects [player, ["AllVehicles"], 30]); +} count (([player] call fnc_getPos) nearEntities [["Air","LandVehicle","Ship"],30]); if (count _findNearestVehicle >= 1) then { // select the nearest one @@ -35,43 +35,10 @@ if (count _findNearestVehicle >= 1) then { _canSize = (_capacity / 10); format[localize "str_epoch_player_131",_nameText] call dayz_rollingMessages; - - // alert zombies [player,20,true,(getPosATL player)] spawn player_alertZombies; + _finished = ["Medic",1] call fn_loopAction; - _finished = false; - - // force animation - player playActionNow "Medic"; - - r_interrupt = false; - _animState = animationState player; - r_doLoop = true; - _started = 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; - - if(!_finished) then { - r_interrupt = false; - if ((vehicle player) == player) then { - [objNull, player, rSwitchMove,""] call RE; - player playActionNow "stop"; - }; + if (!_finished) then { _abort = true; } else { _newFuel = (((fuel _vehicle) * _capacity) + _canSize); diff --git a/SQF/dayz_code/actions/fill_startGenerator.sqf b/SQF/dayz_code/actions/fill_startGenerator.sqf index 0d3d1a044..59763a718 100644 --- a/SQF/dayz_code/actions/fill_startGenerator.sqf +++ b/SQF/dayz_code/actions/fill_startGenerator.sqf @@ -1,4 +1,4 @@ -private ["_vehicle","_started","_finished","_animState","_isMedic","_soundSource","_fuelCan","_emptyCan"]; +private ["_vehicle","_finished","_soundSource","_fuelCan","_emptyCan"]; if (dayz_actionInProgress) exitWith {localize "str_player_actionslimit" call dayz_rollingMessages;}; dayz_actionInProgress = true; @@ -7,46 +7,13 @@ player removeAction s_player_fillgen; s_player_fillgen = 1; // Use target from addaction -_vehicle = _this select 3; - -// force animation -player playActionNow "Medic"; - -r_interrupt = false; -_animState = animationState player; -r_doLoop = true; -_started = false; -_finished = false; +_vehicle = _this select 3; localize "str_epoch_player_25" call dayz_rollingMessages; [player,50,true,(getPosATL player)] spawn player_alertZombies; -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; - -if(!_finished) then { - r_interrupt = false; - if (vehicle player == player) then { - [objNull, player, rSwitchMove,""] call RE; - player playActionNow "stop"; - }; - localize "str_epoch_player_26" call dayz_rollingMessages; -}; +_finished = ["Medic",1] call fn_loopAction; _fuelCan = nil; { @@ -91,6 +58,8 @@ if (_finished) then { localize "str_epoch_player_28" call dayz_rollingMessages; }; +} else { + localize "str_epoch_player_26" call dayz_rollingMessages; }; dayz_actionInProgress = false; diff --git a/SQF/dayz_code/actions/fire_pack.sqf b/SQF/dayz_code/actions/fire_pack.sqf deleted file mode 100644 index d7d4b7a2e..000000000 --- a/SQF/dayz_code/actions/fire_pack.sqf +++ /dev/null @@ -1,14 +0,0 @@ -private "_obj"; -_obj = _this select 3; - -player playActionNow "Medic"; -uiSleep 6; - -if (_obj isKindOf "Land_fire") then { - dayz_hasFire = objNull; - deleteVehicle _obj; -}; - -localize "str_fireplace_removed" call dayz_rollingMessages; -player removeAction s_player_fireout; -s_player_fireout = -1; \ No newline at end of file diff --git a/SQF/dayz_code/actions/gather_meat.sqf b/SQF/dayz_code/actions/gather_meat.sqf index 0e81e9b1e..97856c93c 100644 --- a/SQF/dayz_code/actions/gather_meat.sqf +++ b/SQF/dayz_code/actions/gather_meat.sqf @@ -1,6 +1,5 @@ -private ["_item","_type","_hasHarvested","_knifeArray","_PlayerNear","_isListed","_activeKnife","_text","_dis","_sfx","_qty","_string","_isZombie","_humanity"]; +private ["_item","_type","_hasHarvested","_knifeArray","_PlayerNear","_isListed","_activeKnife","_text","_dis","_sfx","_qty","_string","_isZombie","_humanity","_finished"]; -_isZombie = _this isKindOf "zZombie_base"; if (dayz_actionInProgress) exitWith { localize "str_player_actionslimit" call dayz_rollingMessages; }; @@ -8,6 +7,7 @@ dayz_actionInProgress = true; _item = _this; _type = typeOf _item; +_isZombie = _type isKindOf "zZombie_base"; _hasHarvested = _item getVariable["meatHarvested",false]; _knifeArray = []; @@ -39,11 +39,13 @@ if ((count _knifeArray > 0) and !_hasHarvested) then { _isListed = isClass (configFile >> "CfgSurvival" >> "Meat" >> _type); _text = getText (configFile >> "CfgVehicles" >> _type >> "displayName"); - player playActionNow "Medic"; _dis=10; _sfx = "gut"; [player,_sfx,0,false,_dis] call dayz_zombieSpeak; [player,_dis,true,(getPosATL player)] call player_alertZombies; + + _finished = ["Medic",1] call fn_loopAction; + if (!_finished) exitWith {}; // Added Nutrition-Factor for work ["Working",0,[20,40,15,0]] call dayz_NutritionSystem; @@ -64,7 +66,6 @@ if ((count _knifeArray > 0) and !_hasHarvested) then { ["knives",0.2] call fn_dynamicTool; - uiSleep 6; if (_isZombie) then { // Reduce humanity for gutting zeds _humanity = player getVariable ["humanity",0]; diff --git a/SQF/dayz_code/actions/hotwire_veh.sqf b/SQF/dayz_code/actions/hotwire_veh.sqf index 0c7b10146..75da77505 100644 --- a/SQF/dayz_code/actions/hotwire_veh.sqf +++ b/SQF/dayz_code/actions/hotwire_veh.sqf @@ -1,4 +1,4 @@ -private ["_time","_vehicle","_removed","_vehType"]; +private ["_time","_vehicle","_removed","_vehType","_finished"]; _vehicle = _this select 3; if (dayz_actionInProgress) exitWith {localize "STR_EPOCH_PLAYER_32" call dayz_rollingMessages;}; @@ -12,10 +12,13 @@ s_player_lockUnlockInside_ctrl = 1; _removed = ([player,"ItemHotwireKit",1] call BIS_fnc_invRemove); if (_removed == 1) then { - player playActionNow "Medic"; [player,"repair",0,false] call dayz_zombieSpeak; [player,50,true,(getPosATL player)] spawn player_alertZombies; - uiSleep 8; + + _finished = ["Medic",1] call fn_loopAction; + if (!_finished) exitWith { + player addMagazine "ItemHotwireKit"; + }; _vehType = getText (configFile >> "CfgVehicles" >> typeOf _vehicle >> "displayName"); if ((random 10) <= 7.5) then { diff --git a/SQF/dayz_code/actions/jerry_fill.sqf b/SQF/dayz_code/actions/jerry_fill.sqf index 86025e023..83426ce2f 100644 --- a/SQF/dayz_code/actions/jerry_fill.sqf +++ b/SQF/dayz_code/actions/jerry_fill.sqf @@ -1,6 +1,6 @@ if (dayz_actionInProgress) exitWith {localize "str_player_actionslimit" call dayz_rollingMessages;}; dayz_actionInProgress = true; -private ["_qty","_dis","_sfx","_started","_finished","_animState","_isRefuel","_qty20","_qty5","_qty210","_magazines","_cursorTarget","_fuelAmount","_fuelNeeded"]; +private ["_qty","_dis","_sfx","_finished","_qty20","_qty5","_qty210","_magazines","_cursorTarget","_fuelAmount","_fuelNeeded"]; player removeAction s_player_fillfuel; //s_player_fillfuel = -1; @@ -29,70 +29,51 @@ if (_fuelAmount < _fuelNeeded) then {format[localize "str_fill_notenough",typeOf if (_fuelAmount < 5 or (_fuelAmount < 20 && _qty5 == 0) or (_fuelAmount < 210 && (_qty5 == 0 && _qty20 == 0))) exitWith {dayz_actionInProgress = false;}; if (_qty > 0) then { - player playActionNow "Medic"; - _dis=5; _sfx = "refuel"; [player,_sfx,0,false,_dis] call dayz_zombieSpeak; [player,_dis,true,(getPosATL player)] call player_alertZombies; - + + _finished = ["Medic",1] call fn_loopAction; + if (!_finished) exitWith {}; + // Added Nutrition-Factor for work ["Working",0,[20,40,15,0]] call dayz_NutritionSystem; - - 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; + + for "_x" from 1 to _qty5 do { + _fuelAmount = _cursorTarget getVariable "FuelAmount"; + + if (_fuelAmount >= 5) then { + _fuelAmount = _fuelAmount - 5; + _cursorTarget setVariable ["FuelAmount",_fuelAmount,true]; + player removeMagazine "ItemFuelcanEmpty"; + player addMagazine "ItemFuelcan"; + } else { + _qty = _qty - 1; }; - if (_started and !_isRefuel) then { - r_doLoop = false; - _finished = true; - }; - uiSleep 0.1; }; - - r_doLoop = false; - - if (_finished) then { - for "_x" from 1 to _qty5 do { - _fuelAmount = _cursorTarget getVariable "FuelAmount"; - - if (_fuelAmount >= 5) then { - _fuelAmount = _fuelAmount - 5; - _cursorTarget setVariable ["FuelAmount",_fuelAmount,true]; - player removeMagazine "ItemFuelcanEmpty"; - player addMagazine "ItemFuelcan"; - } else { - _qty = _qty - 1; - }; + for "_x" from 1 to _qty20 do { + _fuelAmount = _cursorTarget getVariable "FuelAmount"; + + if (_fuelAmount >= 20) then { + _fuelAmount = _fuelAmount - 20; + _cursorTarget setVariable ["FuelAmount",_fuelAmount,true]; + player removeMagazine "ItemJerrycanEmpty"; + player addMagazine "ItemJerrycan"; + } else { + _qty = _qty - 1; }; - for "_x" from 1 to _qty20 do { - _fuelAmount = _cursorTarget getVariable "FuelAmount"; - - if (_fuelAmount >= 20) then { - _fuelAmount = _fuelAmount - 20; - _cursorTarget setVariable ["FuelAmount",_fuelAmount,true]; - player removeMagazine "ItemJerrycanEmpty"; - player addMagazine "ItemJerrycan"; - } else { - _qty = _qty - 1; - }; - }; - for "_x" from 1 to _qty210 do { - _fuelAmount = _cursorTarget getVariable "FuelAmount"; - - if (_fuelAmount >= 210) then { - _fuelAmount = _fuelAmount - 210; - _cursorTarget setVariable ["FuelAmount",_fuelAmount,true]; - player removeMagazine "ItemFuelBarrelEmpty"; - player addMagazine "ItemFuelBarrel"; - } else { - _qty = _qty - 1; - }; + }; + for "_x" from 1 to _qty210 do { + _fuelAmount = _cursorTarget getVariable "FuelAmount"; + + if (_fuelAmount >= 210) then { + _fuelAmount = _fuelAmount - 210; + _cursorTarget setVariable ["FuelAmount",_fuelAmount,true]; + player removeMagazine "ItemFuelBarrelEmpty"; + player addMagazine "ItemFuelBarrel"; + } else { + _qty = _qty - 1; }; }; diff --git a/SQF/dayz_code/actions/modular_build.sqf b/SQF/dayz_code/actions/modular_build.sqf index fc5790739..58b82fa93 100644 --- a/SQF/dayz_code/actions/modular_build.sqf +++ b/SQF/dayz_code/actions/modular_build.sqf @@ -1,7 +1,6 @@ // If an array was passed redirect to vanilla player_build (Epoch items pass a string) if (!isNil "_this" && {typeName _this == "ARRAY"} && {count _this > 0}) exitWith {_this spawn player_buildVanilla;}; -private ["_abort","_reason","_distance","_isNear","_lockable","_isAllowedUnderGround","_offset","_classname","_zheightdirection","_zheightchanged","_rotate","_objectHelperPos","_objectHelperDir","_objHDiff","_position","_isOk","_dir","_vector","_cancel","_location2","_buildOffset","_location","_limit","_started","_finished","_animState","_isMedic","_proceed","_counter","_dis","_sfx","_combination_1_Display","_combination_1","_combination_2","_combination_3","_combination","_combinationDisplay","_combination_4","_num_removed","_tmpbuilt","_vUp","_classnametmp","_text","_ghost","_ghost2","_VectorWorkAround","_objectHelper","_location1","_object","_object2","_helperColor","_canDo","_pos","_onLadder","_vehicle","_inVehicle","_needNear","_canBuild"]; - +private ["_abort","_reason","_distance","_isNear","_lockable","_isAllowedUnderGround","_offset","_classname","_zheightdirection","_zheightchanged","_rotate","_objectHelperPos","_objectHelperDir","_objHDiff","_position","_isOk","_dir","_vector","_cancel","_location2","_buildOffset","_location","_limit","_finished","_proceed","_counter","_dis","_sfx","_combination_1_Display","_combination_1","_combination_2","_combination_3","_combination","_combinationDisplay","_combination_4","_num_removed","_tmpbuilt","_vUp","_classnametmp","_text","_ghost","_ghost2","_VectorWorkAround","_objectHelper","_location1","_object","_object2","_helperColor","_canDo","_pos","_onLadder","_vehicle","_inVehicle","_needNear","_canBuild"]; if (dayz_actionInProgress) exitWith {localize "str_epoch_player_40" call dayz_rollingMessages;}; dayz_actionInProgress = true; @@ -445,37 +444,13 @@ if (_canBuild select 0) then { while {_isOk} do { format[localize "str_epoch_player_139",_text, (_counter + 1),_limit] call dayz_rollingMessages; //report how many steps are done out of total limit - 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; - 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 || (player getVariable["combattimeout",0] >= diag_tickTime)) then { - r_doLoop = false; - }; - if (DZE_cancelBuilding) exitWith { - r_doLoop = false; - }; - uiSleep 0.1; - }; - r_doLoop = false; - + + _finished = ["Medic",1,{player getVariable["combattimeout",0] >= diag_tickTime or DZE_cancelBuilding}] call fn_loopAction; if(!_finished) exitWith { _isOk = false; @@ -490,7 +465,6 @@ if (_canBuild select 0) then { _isOk = false; _proceed = true; }; - }; if (_proceed) then { @@ -596,15 +570,8 @@ if (_canBuild select 0) then { localize "str_epoch_player_46" call dayz_rollingMessages; }; - } else { //if player was interrupted, cancel publish and stop build animations - r_interrupt = false; - if (vehicle player == player) then { - [objNull, player, rSwitchMove,""] call RE; - player playActionNow "stop"; - }; - + } else { //if player was interrupted cancel publish deleteVehicle _tmpbuilt; - localize "str_epoch_player_46" call dayz_rollingMessages; }; diff --git a/SQF/dayz_code/actions/object_build.sqf b/SQF/dayz_code/actions/object_build.sqf index cb0556066..5ebb0dc1c 100644 --- a/SQF/dayz_code/actions/object_build.sqf +++ b/SQF/dayz_code/actions/object_build.sqf @@ -105,6 +105,4 @@ if (_build) then { }; } foreach _items; format[localize "str_build_failed_02",_text] call dayz_rollingMessages; -}; - -dayz_actionInProgress = false; \ No newline at end of file +}; \ No newline at end of file diff --git a/SQF/dayz_code/actions/object_disassembly.sqf b/SQF/dayz_code/actions/object_disassembly.sqf index 16949d009..6e4c43bc4 100644 --- a/SQF/dayz_code/actions/object_disassembly.sqf +++ b/SQF/dayz_code/actions/object_disassembly.sqf @@ -13,8 +13,6 @@ if ((isNil "_cursorTarget") or {(isNull _cursorTarget)}) then { if(isNull _cursorTarget) exitWith { localize "str_disassembleNoOption" call dayz_rollingMessages; }; -if (player getVariable["alreadyBuilding",0] == 1) exitWith { localize "str_upgradeInProgress" call dayz_rollingMessages; }; - //Normal blocked stuff _onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1; _isWater = (surfaceIsWater (getPosATL player)) or dayz_isSwimming; @@ -23,6 +21,9 @@ if(_isWater or _onLadder) exitWith { localize "str_water_ladder_cant_do" call da _alreadyRemoving = _cursorTarget getVariable["ObjectLocked",0]; if (_alreadyRemoving == 1) exitWith { localize "str_disassembleInProgress" call dayz_rollingMessages; }; +if (dayz_actionInProgress) exitWith {localize "str_player_actionslimit" call dayz_rollingMessages;}; +dayz_actionInProgress = true; + _cursorTarget setVariable["ObjectLocked",1,true]; _characterID = _cursorTarget getVariable ["characterID","0"]; _objectID = _cursorTarget getVariable ["ObjectID","0"]; @@ -39,7 +40,7 @@ _entry = configFile >> "CfgVehicles" >> _upgrade; r_interrupt = false; _disassemblyParts = [] + (getArray (_entry >> "Disassembly" >> "removedParts")); -_disassemblyReturnChance = [] + (getNumber (_entry >> "Disassembly" >> "removedChance")); +_disassemblyReturnChance = getNumber (_entry >> "Disassembly" >> "removedChance"); for "_i" from 1 to 20 do { _parent = inheritsFrom _entry; @@ -161,4 +162,4 @@ if (!_realObjectStillThere) then { localize "str_disassembleDone" call dayz_rollingMessages; _cursorTarget setVariable["ObjectLocked",0,true]; - +dayz_actionInProgress = false; diff --git a/SQF/dayz_code/actions/object_dismantle.sqf b/SQF/dayz_code/actions/object_dismantle.sqf index 9927aab4d..0f7b48dc6 100644 --- a/SQF/dayz_code/actions/object_dismantle.sqf +++ b/SQF/dayz_code/actions/object_dismantle.sqf @@ -1,7 +1,7 @@ if (dayz_actionInProgress) exitWith { localize "str_player_actionslimit" call dayz_rollingMessages; }; dayz_actionInProgress = true; -private ["_object","_proceed","_rndattemps","_limit","_dismantleToo","_ownerID","_objectID","_objectUID","_playerID","_claimedBy","_tools","_exit","_end","_onLadder","_isWater","_isOk","_counter","_text","_dis","_sfx","_animState","_started","_finished","_isMedic"]; +private ["_object","_proceed","_rndattemps","_limit","_dismantleToo","_ownerID","_objectID","_objectUID","_playerID","_claimedBy","_tools","_exit","_end","_onLadder","_isWater","_isOk","_counter","_text","_dis","_sfx","_finished"]; _object = _this; _proceed = false; @@ -67,43 +67,14 @@ while {_isOk} do { if (_claimedBy != _playerID) exitWith { format[localize "str_player_beinglooted",_text] call dayz_rollingMessages; }; -//Run animation - player playActionNow "Medic"; - //Run SFX _dis=20; _sfx = "repair"; [player,_sfx,0,false,_dis] call dayz_zombieSpeak; [player,_dis,true,(getPosATL player)] spawn player_alertZombies; -// Working-Factor for chopping wood. - ["Working",0,[100,15,10,0]] call dayz_NutritionSystem; - -//Setup Vars - r_interrupt = false; - _animState = animationState player; - r_doLoop = true; - _started = false; - _finished = false; - -//run animation loop - while {r_doLoop} do { - _animState = animationState player; - _isMedic = ["medic",_animState] call fnc_inString; - if (_isMedic) then { - _started = true; - }; - if (_started and !_isMedic) then { - r_doLoop = false; - _finished = true; - }; - if (r_interrupt or (player getVariable["combattimeout",0] >= diag_tickTime)) then { - r_doLoop = false; - _finished = false; - }; - uiSleep 0.1; - }; - r_doLoop = false; +//Run animation loop + _finished = ["Medic",1,{player getVariable["combattimeout",0] >= diag_tickTime}] call fn_loopAction; //Interrupt and end if(!_finished) exitWith { @@ -112,7 +83,9 @@ while {_isOk} do { }; //Everything happened as it should - if(_finished) then { + if(_finished) then { + // Working-Factor for chopping wood. + ["Working",0,[100,15,10,0]] call dayz_NutritionSystem; //Add to Counter _counter = _counter + 1; //Try to dismantle diff --git a/SQF/dayz_code/actions/object_maintenance.sqf b/SQF/dayz_code/actions/object_maintenance.sqf index f19aa7b06..ce6474311 100644 --- a/SQF/dayz_code/actions/object_maintenance.sqf +++ b/SQF/dayz_code/actions/object_maintenance.sqf @@ -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; \ No newline at end of file diff --git a/SQF/dayz_code/actions/object_upgradeFireplace.sqf b/SQF/dayz_code/actions/object_upgradeFireplace.sqf index d04139963..f8b44e599 100644 --- a/SQF/dayz_code/actions/object_upgradeFireplace.sqf +++ b/SQF/dayz_code/actions/object_upgradeFireplace.sqf @@ -11,8 +11,8 @@ */ private ["_objclass","_cursorTarget","_item","_classname","_requiredTools","_requiredParts","_upgrade","_upgradeConfig", "_upgradeDisplayname","_onLadder","_isWater","_upgradeParts","_startUpgrade","_missingPartsConfig","_textMissingParts","_dis", -"_sfx","_ownerID","_objectID","_objectUID","_alreadyupgrading","_dir","_weapons","_magazines","_backpacks", -"_object","_objWpnTypes","_objWpnQty","_countr","_itemName","_vector"]; +"_sfx","_ownerID","_objectID","_objectUID","_dir","_weapons","_magazines","_backpacks", +"_object","_objWpnTypes","_objWpnQty","_countr","_itemName","_vector","_finished"]; _cursorTarget = _this select 0; @@ -22,6 +22,9 @@ if ((isNil "_cursorTarget") or {(isNull _cursorTarget)}) then { }; if (isNull _cursorTarget) exitWith {}; +if (dayz_actionInProgress) exitWith {localize "str_player_actionslimit" call dayz_rollingMessages;}; +dayz_actionInProgress = true; + _item = typeof _cursorTarget; //remove action menu @@ -59,7 +62,7 @@ _isWater = (surfaceIsWater (getPosATL player)) or dayz_isSwimming; _upgradeParts = []; _startUpgrade = true; -if(_isWater or _onLadder) exitWith { localize "str_CannotUpgrade" call dayz_rollingMessages; }; +if(_isWater or _onLadder) exitWith { localize "str_CannotUpgrade" call dayz_rollingMessages; dayz_actionInProgress = false; }; // lets check player has requiredTools for upgrade { @@ -89,12 +92,14 @@ if(_isWater or _onLadder) exitWith { localize "str_CannotUpgrade" call dayz_roll //Does object have a upgrade option. if ((_startUpgrade) AND (isClass(_upgradeConfig))) 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; + + _finished = ["Medic",1] call fn_loopAction; + //Double check player did not drop required parts + if (!_finished or (isNull _cursorTarget) or ({!(_x in magazines player)} count _upgradeParts > 0)) exitWith {}; // Added Nutrition-Factor for work ["Working",0,[100,15,5,0]] call dayz_NutritionSystem; @@ -104,15 +109,6 @@ if ((_startUpgrade) AND (isClass(_upgradeConfig))) then { _objectID = _cursorTarget getVariable ["ObjectID","0"]; _objectUID = _cursorTarget getVariable ["ObjectUID","0"]; - //Upgrade - _alreadyupgrading = _cursorTarget getVariable["alreadyupgrading",0]; - - if (_alreadyupgrading == 1) exitWith { localize "str_upgradeInProgress" call dayz_rollingMessages; }; - - _cursorTarget setVariable["alreadyupgrading",1]; - - uiSleep 0.03; - //Get location and direction of old item _dir = round getDir _cursorTarget; _vector = [vectorDir _cursorTarget,vectorUp _cursorTarget]; @@ -126,9 +122,6 @@ if ((_startUpgrade) AND (isClass(_upgradeConfig))) then { //get contents _magazines = getMagazineCargo _cursorTarget; - //replay animation - player playActionNow "Medic"; - deleteVehicle _cursorTarget; // remove parts from players inventory before creation of new tent. @@ -161,14 +154,10 @@ if ((_startUpgrade) AND (isClass(_upgradeConfig))) then { _countr = _countr + 1; } count _objWpnTypes; - uiSleep 3; - //Light fire [_object,true] call dayz_inflame; _object spawn player_fireMonitor; - //publish new tent - //[[[],[]],[[],[]],[[],[]]] PVDZ_obj_Publish = [dayz_characterID,_object,[_dir, _pos],[[[],[]],_magazines,[[],[]]]]; publicVariableServer "PVDZ_obj_Publish"; diag_log [diag_ticktime, __FILE__, "New Networked object, request to save to hive. PVDZ_obj_Publish:", PVDZ_obj_Publish]; @@ -178,4 +167,6 @@ if ((_startUpgrade) AND (isClass(_upgradeConfig))) then { } else { localize "str_upgradeNoOption" call dayz_rollingMessages; */ -}; \ No newline at end of file +}; + +dayz_actionInProgress = false; \ No newline at end of file diff --git a/SQF/dayz_code/actions/object_upgradeStorage.sqf b/SQF/dayz_code/actions/object_upgradeStorage.sqf index f7a5d2f54..11a434029 100644 --- a/SQF/dayz_code/actions/object_upgradeStorage.sqf +++ b/SQF/dayz_code/actions/object_upgradeStorage.sqf @@ -11,8 +11,8 @@ dayz_actionInProgress = true; private ["_cursorTarget","_item","_classname","_requiredTools","_requiredParts","_upgrade","_upgradeConfig", "_upgradeDisplayname","_onLadder","_isWater","_upgradeParts","_startUpgrade","_missingPartsConfig","_textMissingParts","_dis", -"_sfx","_ownerID","_objectID","_objectUID","_alreadyupgrading","_dir","_weapons","_magazines","_backpacks","_object", -"_objWpnTypes","_objWpnQty","_countr","_itemName","_vector","_playerNear"]; +"_sfx","_ownerID","_objectID","_objectUID","_dir","_weapons","_magazines","_backpacks","_object", +"_objWpnTypes","_objWpnQty","_countr","_itemName","_vector","_playerNear","_finished"]; _cursorTarget = _this select 3; @@ -98,24 +98,17 @@ if (_playerNear) exitWith {dayz_actionInProgress = false; localize "str_pickup_l //Does object have a upgrade option. if ((_startUpgrade) AND (isClass(_upgradeConfig))) 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; - + + _finished = ["Medic",1] call fn_loopAction; + //Double check player did not drop required parts + if (!_finished or (isNull _cursorTarget) or ({!(_x in magazines player)} count _upgradeParts > 0)) exitWith {}; + // Added Nutrition-Factor for work ["Working",0,[100,15,5,0]] call dayz_NutritionSystem; - - //Upgrade - _alreadyupgrading = _cursorTarget getVariable["alreadyupgrading",0]; - - if (_alreadyupgrading == 1) exitWith { localize "str_upgradeInProgress" call dayz_rollingMessages; }; - - _cursorTarget setVariable["alreadyupgrading",1,true]; - - uiSleep 0.03; //Get location and direction of old item _dir = round getDir _cursorTarget; @@ -134,9 +127,6 @@ if ((_startUpgrade) AND (isClass(_upgradeConfig))) then { _magazines = getMagazineCargo _cursorTarget; _backpacks = getBackpackCargo _cursorTarget; - //replay animation - player playActionNow "Medic"; - //remove old tent PVDZ_obj_Destroy = [_objectID,_objectUID,player]; publicVariableServer "PVDZ_obj_Destroy"; @@ -190,8 +180,6 @@ if ((_startUpgrade) AND (isClass(_upgradeConfig))) then { _countr = _countr + 1; } count _objWpnTypes; - uiSleep 3; - //publish new tent if (DZE_permanentPlot) then { _object setVariable ["ownerPUID",dayz_playerUID,true]; diff --git a/SQF/dayz_code/actions/object_upgradebuilding.sqf b/SQF/dayz_code/actions/object_upgradebuilding.sqf index 0565fd596..c319ecc12 100644 --- a/SQF/dayz_code/actions/object_upgradebuilding.sqf +++ b/SQF/dayz_code/actions/object_upgradebuilding.sqf @@ -9,7 +9,7 @@ private ["_nearByChoppers","_cursorTarget","_type","_class","_requiredTools","_requiredParts","_upgradeType","_producedParts","_randomCreate", "_upgradeClass","_onLadder","_isWater","_ok","_missing","_upgradeParts","_dis","_characterID","_objectID","_objectUID", - "_ownerArray","_ownerPasscode","_dir","_vector","_object","_puid","_clanArray","_wh","_variables"]; + "_ownerArray","_ownerPasscode","_dir","_vector","_object","_puid","_clanArray","_wh","_variables","_finished"]; _cursorTarget = _this; // ArmaA2 bug workaround: sometimes the object is null @@ -71,26 +71,25 @@ if (!_ok) exitWith { { player addMagazine _x; } foreach _upgradeParts; format [localize "str_upgradeMissingPart", _missing] call dayz_rollingMessages; }; - -//Upgrade Started -if ((player getVariable["alreadyBuilding",0]) == 1) exitWith { - { player addMagazine _x; } foreach _upgradeParts; - localize "str_upgradeInProgress" call dayz_rollingMessages; -}; -player setVariable["alreadyBuilding",1]; -//play animation -player playActionNow "Medic"; +if (dayz_actionInProgress) exitWith { + { player addMagazine _x; } forEach _upgradeParts; + localize "str_player_actionslimit" call dayz_rollingMessages; +}; +dayz_actionInProgress = true; + _dis=20; [player,"tentpack",0,false,_dis] call dayz_zombieSpeak; [player,_dis,true,(getPosATL player)] call player_alertZombies; +_finished = ["Medic",1] call fn_loopAction; +if (!_finished) exitWith { + { player addMagazine _x; } forEach _upgradeParts; + dayz_actionInProgress = false; +}; + // Added Nutrition-Factor for work ["Working",0,[100,15,5,0]] call dayz_NutritionSystem; - -//wait animation end -waitUntil {getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "disableWeapons") == 1}; -waitUntil {getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "disableWeapons") == 0}; //get data from old building. _characterID = _cursorTarget getVariable ["characterID","0"]; @@ -153,5 +152,5 @@ if (isServer) then { player reveal _object; //Make sure its unlocked -player setVariable["alreadyBuilding",0]; -localize "str_upgradeDone" call dayz_rollingMessages; \ No newline at end of file +localize "str_upgradeDone" call dayz_rollingMessages; +dayz_actionInProgress = false; \ No newline at end of file diff --git a/SQF/dayz_code/actions/pack.sqf b/SQF/dayz_code/actions/pack.sqf deleted file mode 100644 index 2754fb372..000000000 --- a/SQF/dayz_code/actions/pack.sqf +++ /dev/null @@ -1,11 +0,0 @@ -private ["_array","_object","_type"]; - -_array = _this select 3; -_object = _array select 0; -_type = TypeOf(_object); -player playActionNow "Medic"; -uiSleep 8; -player addBackpack format["%1_US_Bag_EP1",_type]; -deleteVehicle _object; -r_action = false; -call fnc_usec_medic_removeActions; \ No newline at end of file diff --git a/SQF/dayz_code/actions/player_attach_bomb.sqf b/SQF/dayz_code/actions/player_attach_bomb.sqf index 00b0fc1da..e095c4039 100644 --- a/SQF/dayz_code/actions/player_attach_bomb.sqf +++ b/SQF/dayz_code/actions/player_attach_bomb.sqf @@ -1,4 +1,4 @@ -private ["_theBomb","_vehicle","_curFuel","_newFuel","_timeLeft","_hasToolbox","_hasCarBomb","_dis","_sfx","_alreadyBombed","_hasCrowbar"]; +private ["_theBomb","_vehicle","_curFuel","_newFuel","_timeLeft","_hasToolbox","_hasCarBomb","_dis","_sfx","_alreadyBombed","_hasCrowbar","_finished"]; _vehicle = _this select 3; _hasToolbox = "ItemToolbox" in items player; @@ -12,27 +12,32 @@ if(!_hasCarBomb) exitWith { localize "str_bombMissing" call dayz_rollingMessages; }; +if (dayz_actionInProgress) exitWith {localize "str_player_actionslimit" call dayz_rollingMessages;}; +dayz_actionInProgress = true; + /* if(_vehicle getVariable["hasBomb",false]) exitWith { localize "str_bombAlready" call dayz_rollingMessages; }; */ -player removeMagazine "ItemCarBomb"; - -//wait a bit -player playActionNow "Medic"; -uiSleep 1; - //DO Animation _dis=20; _sfx = "tentunpack"; [player,_sfx,0,false,_dis] call dayz_zombieSpeak; [player,_dis,true,(getPosATL player)] spawn player_alertZombies; +_finished = ["Medic",1] call fn_loopAction; +if (!_finished or !("ItemCarBomb" in magazines player)) exitWith { + dayz_actionInProgress = false; +}; + +player removeMagazine "ItemCarBomb"; + //Send the Eventhandler to Server if(!_alreadyBombed) then { PVDZ_dayzCarBomb = [_vehicle,getPlayerUID player]; publicVariableServer "PVDZ_dayzCarBomb"; }; -localize "str_bombAttached" call dayz_rollingMessages; \ No newline at end of file +localize "str_bombAttached" call dayz_rollingMessages; +dayz_actionInProgress = false; \ No newline at end of file diff --git a/SQF/dayz_code/actions/player_breakin.sqf b/SQF/dayz_code/actions/player_breakin.sqf index 82edf092a..1ecf58660 100644 --- a/SQF/dayz_code/actions/player_breakin.sqf +++ b/SQF/dayz_code/actions/player_breakin.sqf @@ -1,5 +1,5 @@ private ["_brokein","_isOk","_hasSledgeHammer","_gps","_vars","_hasToolbox","_hasCrowbar","_limit","_proceed","_counter", -"_dis","_sfx","_roll","_animState","_started","_finished","_isMedic","_isGate","_values"]; +"_dis","_sfx","_roll","_finished","_isGate","_values"]; _target = _this select 3; _pos = getPos _target; @@ -51,40 +51,14 @@ while {_isOk} do { uiSleep 1; }; -//Run animation - player playActionNow "Medic"; - //Run SFX _dis=20; _sfx = "repair"; [player,_sfx,0,false,_dis] call dayz_zombieSpeak; [player,_dis,true,(getPosATL player)] spawn player_alertZombies; -//Setup Vars - r_interrupt = false; - _animState = animationState player; - r_doLoop = true; - _started = false; - _finished = false; - -//run animation loop - while {r_doLoop} do { - _animState = animationState player; - _isMedic = ["medic",_animState] call fnc_inString; - if (_isMedic) then { - _started = true; - }; - if (_started and !_isMedic) then { - r_doLoop = false; - _finished = true; - }; - if (r_interrupt) then { - r_doLoop = false; - _finished = false; - }; - uiSleep 0.1; - }; - r_doLoop = false; +//Run animation loop + _finished = ["Medic",1] call fn_loopAction; //Interrupt and end if(!_finished) exitWith { @@ -139,12 +113,6 @@ if (isnil "_proceed") exitwith {}; //Interrupted for some reason if (!_proceed) then { - r_interrupt = false; - if (vehicle player == player) then { - [objNull, player, rSwitchMove,""] call RE; - player playActionNow "stop"; - }; - localize "STR_BLD_BREAKIN_CANCELLED" call dayz_rollingMessages; }; diff --git a/SQF/dayz_code/actions/player_build.sqf b/SQF/dayz_code/actions/player_build.sqf index 1b9e00a29..43ed524c2 100644 --- a/SQF/dayz_code/actions/player_build.sqf +++ b/SQF/dayz_code/actions/player_build.sqf @@ -4,7 +4,7 @@ if (!isNil "_this" && {typeName _this == "ARRAY"} && {count _this > 0}) exitWith DayZ Base Building Made for DayZ Epoch please ask permission to use/edit/distrubute email vbawol@veteranbastards.com. */ -private ["_location","_pos","_dir","_classname","_item","_cancel","_reason","_started","_finished","_animState","_isMedic","_dis","_sfx","_tmpbuilt","_onLadder","_require","_text","_offset","_isOk","_location1","_location2","_counter","_limit","_proceed","_num_removed","_position","_object","_canBuildOnPlot","_distance","_classnametmp","_ghost","_lockable","_zheightchanged","_rotate","_combination_1","_combination_2","_combination_3","_combination_4","_combination","_combination_1_Display","_combinationDisplay","_zheightdirection","_abort","_isNear","_needNear","_vehicle","_inVehicle","_objHDiff","_isAllowedUnderGround","_canBuild"]; +private ["_location","_pos","_dir","_classname","_item","_cancel","_reason","_finished","_dis","_sfx","_tmpbuilt","_onLadder","_require","_text","_offset","_isOk","_location1","_location2","_counter","_limit","_proceed","_num_removed","_position","_object","_canBuildOnPlot","_distance","_classnametmp","_ghost","_lockable","_zheightchanged","_rotate","_combination_1","_combination_2","_combination_3","_combination_4","_combination","_combination_1_Display","_combinationDisplay","_zheightdirection","_abort","_isNear","_needNear","_vehicle","_inVehicle","_objHDiff","_isAllowedUnderGround","_canBuild"]; if (dayz_actionInProgress) exitWith {localize "str_epoch_player_40" call dayz_rollingMessages;}; dayz_actionInProgress = true; @@ -324,41 +324,14 @@ if (_canBuild select 0) then { _counter = 0; while {_isOk} do { - format[localize "str_epoch_player_139",_text, (_counter + 1),_limit] call dayz_rollingMessages; - 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; - 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 || (player getVariable["combattimeout",0] >= diag_tickTime)) then { - r_doLoop = false; - }; - if (DZE_cancelBuilding) exitWith { - r_doLoop = false; - }; - uiSleep 0.1; - }; - r_doLoop = false; - + _finished = ["Medic",1,{player getVariable["combattimeout",0] >= diag_tickTime or DZE_cancelBuilding}] call fn_loopAction; if(!_finished) exitWith { _isOk = false; @@ -373,7 +346,6 @@ if (_canBuild select 0) then { _isOk = false; _proceed = true; }; - }; if (_proceed) then { @@ -477,14 +449,7 @@ if (_canBuild select 0) then { localize "str_epoch_player_46" call dayz_rollingMessages; }; } else { - r_interrupt = false; - if (vehicle player == player) then { - [objNull, player, rSwitchMove,""] call RE; - player playActionNow "stop"; - }; - deleteVehicle _tmpbuilt; - localize "str_epoch_player_46" call dayz_rollingMessages; }; } else { diff --git a/SQF/dayz_code/actions/player_buildVanilla.sqf b/SQF/dayz_code/actions/player_buildVanilla.sqf index ef23abb44..b264b67f7 100644 --- a/SQF/dayz_code/actions/player_buildVanilla.sqf +++ b/SQF/dayz_code/actions/player_buildVanilla.sqf @@ -11,6 +11,9 @@ private ["_classType","_item","_action","_missingTools","_missingItem","_emergin Needs a full rewrite to keep up with the demand of everything we plan to add. */ +if (dayz_actionInProgress) exitWith {localize "str_player_actionslimit" call dayz_rollingMessages;}; +dayz_actionInProgress = true; + call gear_ui_init; closeDialog 1; @@ -25,7 +28,6 @@ if (count _this > 2) then { }; _emergingLevel = 1.1; -dayz_actionInProgress = true; _isClass = switch (1==1) do { case (isClass (configFile >> "CfgMagazines" >> _item)): {"CfgMagazines"}; @@ -52,12 +54,9 @@ _keepOnSlope = 0 == (getNumber (configFile >> "CfgVehicles" >> _classname >> "ca _onLadder = {getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder") == 1}; _isWater = {(surfaceIsWater (getPosATL _object)) or dayz_isSwimming}; -if (0 != count Dayz_constructionContext) then { +if (0 != count Dayz_constructionContext) exitWith { dayz_actionInProgress = false; - //cutText [localize "str_already_building", "PLAIN DOWN"]; - _msg = localize "str_already_building"; - _msg call dayz_rollingMessages; - diag_log [ diag_ticktime, __FILE__, 'already building, exiting', Dayz_constructionContext, typeName Dayz_constructionContext]; + localize "str_already_building" call dayz_rollingMessages; }; // item is missin - this really is pointless but it aint broke so dont fix it @@ -297,7 +296,7 @@ _position = getPosATL _object; _actionBuildHidden = true; _actionCancel = player addAction [localize "str_player_build_cancel", "\z\addons\dayz_code\actions\object_build.sqf", [_object, _requiredParts, _classname, _text, false, 0, "none"], 1, true, true, "", "0 != count Dayz_constructionContext"]; -while {dayz_actionInProgress and Dayz_constructionContext select 4} do { +while {Dayz_constructionContext select 4} do { // force the angle so that the ghost is showing always the same side _angleRef=Dayz_constructionContext select 1; diff --git a/SQF/dayz_code/actions/player_buildingDowngrade.sqf b/SQF/dayz_code/actions/player_buildingDowngrade.sqf index c9d495cdf..0f326234b 100644 --- a/SQF/dayz_code/actions/player_buildingDowngrade.sqf +++ b/SQF/dayz_code/actions/player_buildingDowngrade.sqf @@ -2,7 +2,7 @@ DayZ Base Building Upgrades Made for DayZ Epoch please ask permission to use/edit/distrubute email vbawol@veteranbastards.com. */ -private ["_location","_dir","_classname","_text","_object","_objectID","_objectUID","_newclassname","_refund","_obj","_upgrade","_objectCharacterID","_ownerID","_i","_invResult","_itemOut","_countOut","_abortInvAdd","_addedItems"]; +private ["_location","_dir","_classname","_text","_object","_objectID","_objectUID","_newclassname","_refund","_obj","_upgrade","_objectCharacterID","_ownerID","_i","_invResult","_itemOut","_countOut","_abortInvAdd","_addedItems","_finished"]; if (dayz_actionInProgress) exitWith {localize "str_epoch_player_48" call dayz_rollingMessages;}; dayz_actionInProgress = true; @@ -37,13 +37,15 @@ _text = getText (configFile >> "CfgVehicles" >> _classname >> "displayName"); _upgrade = getArray (configFile >> "CfgVehicles" >> _classname >> "downgradeBuilding"); if ((count _upgrade) > 0) then { - _newclassname = _upgrade select 0; - _refund = _upgrade select 1; - ["Working",0,[3,2,4,0]] call dayz_NutritionSystem; - player playActionNow "Medic"; + [player,20,true,(getPosATL player)] spawn player_alertZombies; + + _finished = ["Medic",1] call fn_loopAction; + if (!_finished) exitWith {}; + + ["Working",0,[3,2,4,0]] call dayz_NutritionSystem; _invResult = false; _abortInvAdd = false; diff --git a/SQF/dayz_code/actions/player_buildingMaint.sqf b/SQF/dayz_code/actions/player_buildingMaint.sqf index 0fc62055e..c94a6f59e 100644 --- a/SQF/dayz_code/actions/player_buildingMaint.sqf +++ b/SQF/dayz_code/actions/player_buildingMaint.sqf @@ -2,7 +2,7 @@ DayZ Base Building Maintenance Made for DayZ Epoch please ask permission to use/edit/distrubute email vbawol@veteranbastards.com. */ -private ["_location","_dir","_classname","_missing","_text","_proceed","_num_removed","_object","_missingQty","_itemIn","_countIn","_qty","_removed","_removed_total","_tobe_removed_total","_objectID","_objectUID","_temp_removed_array","_textMissing","_requirements","_obj","_upgrade","_objectCharacterID"]; +private ["_location","_dir","_classname","_missing","_text","_proceed","_num_removed","_object","_missingQty","_itemIn","_countIn","_qty","_removed","_removed_total","_tobe_removed_total","_objectID","_objectUID","_temp_removed_array","_textMissing","_requirements","_obj","_upgrade","_objectCharacterID","_finished"]; if (dayz_actionInProgress) exitWith {localize "str_epoch_player_52" call dayz_rollingMessages;}; dayz_actionInProgress = true; @@ -47,10 +47,13 @@ _proceed = true; if(_qty < _countIn) exitWith { _missing = _itemIn; _missingQty = (_countIn - _qty); _proceed = false; }; } forEach _requirements; -if (_proceed) then { - ["Working",0,[20,40,15,0]] call dayz_NutritionSystem; - player playActionNow "Medic"; +if (_proceed) then { [player,20,true,(getPosATL player)] spawn player_alertZombies; + + _finished = ["Medic",1] call fn_loopAction; + if (!_finished) exitWith {}; + + ["Working",0,[20,40,15,0]] call dayz_NutritionSystem; _temp_removed_array = []; _removed_total = 0; @@ -89,6 +92,5 @@ if (_proceed) then { format[localize "STR_EPOCH_ACTIONS_6",_missingQty, _textMissing] call dayz_rollingMessages; }; - dayz_actionInProgress = false; s_player_maint_build = -1; \ No newline at end of file diff --git a/SQF/dayz_code/actions/player_chopWood.sqf b/SQF/dayz_code/actions/player_chopWood.sqf index 72e993a7c..621f629b7 100644 --- a/SQF/dayz_code/actions/player_chopWood.sqf +++ b/SQF/dayz_code/actions/player_chopWood.sqf @@ -1,5 +1,5 @@ -private ["_dis","_sfx","_breaking","_countOut","_counter","_isOk","_proceed","_animState","_started","_finished","_isMedic","_itemOut","_tree","_distance2d"]; +private ["_dis","_sfx","_breaking","_countOut","_counter","_isOk","_proceed","_finished","_itemOut","_tree","_distance2d"]; call gear_ui_init; closeDialog 1; @@ -26,41 +26,18 @@ if (!isNull _tree) then { _proceed = false; while {_isOk} do { - //play action - player playActionNow "Medic"; - //setup alert and speak _dis=20; _sfx = "chopwood"; [player,_sfx,0,false,_dis] call dayz_zombieSpeak; [player,_dis,true,(getPosATL player)] call player_alertZombies; + + //play action + _finished = ["Medic",1] call fn_loopAction; // Working-Factor for chopping wood. ["Working",0,[50,10,5,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 and !_isMedic) then { - r_doLoop = false; - _finished = true; - }; - if (r_interrupt) then { - r_doLoop = false; - }; - - uiSleep 0.1; - }; - if(!_finished) exitWith { _isOk = false; _proceed = false; @@ -118,13 +95,6 @@ if (!isNull _tree) then { }; if !(_proceed) then { localize "str_player_24_Stoped" call dayz_rollingMessages; - - r_interrupt = false; - - if (vehicle player == player) then { - [objNull, player, rSwitchMove,""] call RE; - player playActionNow "stop"; - }; }; //adding melee mags back if needed switch (primaryWeapon player) do { diff --git a/SQF/dayz_code/actions/player_copyKey.sqf b/SQF/dayz_code/actions/player_copyKey.sqf index 5fc5f92de..78ffa8ccf 100644 --- a/SQF/dayz_code/actions/player_copyKey.sqf +++ b/SQF/dayz_code/actions/player_copyKey.sqf @@ -1,4 +1,4 @@ -private ["_item","_config","_pos","_onLadder","_create","_started","_finished","_animState","_isMedic","_num_removed","_text","_haskey","_hastoolweapon","_isNear","_hasTinBar"]; +private ["_item","_config","_pos","_onLadder","_create","_finished","_num_removed","_text","_haskey","_hastoolweapon","_isNear","_hasTinBar"]; if (dayz_actionInProgress) exitWith {localize "str_epoch_player_56" call dayz_rollingMessages;}; dayz_actionInProgress = true; @@ -25,36 +25,13 @@ call gear_ui_init; // require one tin bar per key _hasTinBar = "ItemTinBar" in magazines player; if (!_hasTinBar) exitWith {dayz_actionInProgress = false; localize "str_epoch_player_59" call dayz_rollingMessages;}; -player playActionNow "Medic"; [player,"repair",0,false] call dayz_zombieSpeak; [player,50,true,_pos] 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; - -if(_finished) then { +_finished = ["Medic",1] call fn_loopAction; +if (_finished) then { _num_removed = ([player,"ItemTinBar"] call BIS_fnc_invRemove); if(_num_removed == 1) then { @@ -64,11 +41,6 @@ if(_finished) then { localize "str_epoch_player_61" call dayz_rollingMessages; }; } else { - r_interrupt = false; - if (vehicle player == player) then { - [objNull, player, rSwitchMove,""] call RE; - player playActionNow "stop"; - }; localize "str_epoch_player_61" call dayz_rollingMessages; }; dayz_actionInProgress = false; diff --git a/SQF/dayz_code/actions/player_craftItem.sqf b/SQF/dayz_code/actions/player_craftItem.sqf index b3348f8fc..82ab405c7 100644 --- a/SQF/dayz_code/actions/player_craftItem.sqf +++ b/SQF/dayz_code/actions/player_craftItem.sqf @@ -23,7 +23,7 @@ class ItemActions }; }; */ -private ["_tradeComplete","_onLadder","_canDo","_selectedRecipeOutput","_boiled","_proceed","_itemIn","_countIn","_missing","_missingQty","_qty","_itemOut","_countOut","_started","_finished","_animState","_isMedic","_removed","_tobe_removed_total","_textCreate","_textMissing","_selectedRecipeInput","_selectedRecipeInputStrict","_num_removed","_removed_total","_temp_removed_array","_abort","_waterLevel","_waterLevel_lowest","_reason","_isNear","_selectedRecipeTools","_distance","_crafting","_needNear","_item","_baseClass","_num_removed_weapons","_outputWeapons","_inputWeapons","_randomOutput","_craft_doLoop","_selectedWeapon","_selectedMag","_sfx"]; +private ["_tradeComplete","_onLadder","_canDo","_selectedRecipeOutput","_boiled","_proceed","_itemIn","_countIn","_missing","_missingQty","_qty","_itemOut","_countOut","_finished","_removed","_tobe_removed_total","_textCreate","_textMissing","_selectedRecipeInput","_selectedRecipeInputStrict","_num_removed","_removed_total","_temp_removed_array","_abort","_waterLevel","_waterLevel_lowest","_reason","_isNear","_selectedRecipeTools","_distance","_crafting","_needNear","_item","_baseClass","_num_removed_weapons","_outputWeapons","_inputWeapons","_randomOutput","_craft_doLoop","_selectedWeapon","_selectedMag","_sfx"]; if (dayz_actionInProgress) exitWith {localize "str_player_actionslimit" call dayz_rollingMessages;}; dayz_actionInProgress = true; @@ -113,33 +113,10 @@ if (_canDo) then { if (_proceed) then { localize "str_epoch_player_62" call dayz_rollingMessages; - player playActionNow "Medic"; - [player,_sfx,0,false] call dayz_zombieSpeak; [player,50,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; + _finished = ["Medic",1] call fn_loopAction; if (_finished) then { _removed_total = 0; // count total of removed items @@ -254,11 +231,6 @@ if (_canDo) then { }; } else { - r_interrupt = false; - if (vehicle player == player) then { - [objNull, player, rSwitchMove,""] call RE; - player playActionNow "stop"; - }; localize "str_epoch_player_64" call dayz_rollingMessages; _craft_doLoop = false; }; diff --git a/SQF/dayz_code/actions/player_craftItemVanilla.sqf b/SQF/dayz_code/actions/player_craftItemVanilla.sqf index a3e1515f3..9452f89cc 100644 --- a/SQF/dayz_code/actions/player_craftItemVanilla.sqf +++ b/SQF/dayz_code/actions/player_craftItemVanilla.sqf @@ -10,7 +10,7 @@ failChance = 1; */ //diag_log("crafting system"); -private ["_config","_input","_output","_required","_failChance","_hasInput","_availabeSpace","_classname","_isClass","_onLadder","_hasTools","_avail","_selection","_item","_amount","_itemName","_freeSlots","_slotType","_i","_j","_dis","_sfx"]; +private ["_config","_input","_output","_required","_failChance","_hasInput","_availabeSpace","_classname","_isClass","_onLadder","_hasTools","_avail","_selection","_item","_amount","_itemName","_freeSlots","_slotType","_i","_j","_dis","_sfx","_finished"]; if (dayz_actionInProgress) exitWith {localize "str_player_actionslimit" call dayz_rollingMessages;}; dayz_actionInProgress = true; @@ -129,14 +129,15 @@ if(!r_drag_sqf and !r_player_unconscious and !_onLadder) then { //player playActionNow "PutDown"; call gear_ui_init; closeDialog 1; - player playActionNow "Medic"; - uiSleep 2; - //setup alert and speak + _dis=20; _sfx = if (_classname == "equip_rope") then {"bandage"} else {"chopwood"}; [player,_sfx,0,false,_dis] call dayz_zombieSpeak; [player,_dis,true,(getPosATL player)] call player_alertZombies; + _finished = ["Medic",1] call fn_loopAction; + if (!_finished) exitWith {}; + { _item = _x select 0; _amount = _x select 2; @@ -155,7 +156,7 @@ if(!r_drag_sqf and !r_player_unconscious and !_onLadder) then { //uiSleep 0.1; }; } forEach _input; - uiSleep 3; + { _item = _x select 0; _selection = _x select 1; diff --git a/SQF/dayz_code/actions/player_createstash.sqf b/SQF/dayz_code/actions/player_createstash.sqf index eb388fd04..23f6bf60c 100644 --- a/SQF/dayz_code/actions/player_createstash.sqf +++ b/SQF/dayz_code/actions/player_createstash.sqf @@ -1,4 +1,4 @@ -private ["_playerPos","_item","_location","_config","_text","_dir","_dis","_sfx","_consumetext","_stashname","_stashtype","_stash","_consume","_hasitemcount","_worldspace"]; +private ["_playerPos","_item","_location","_config","_text","_dir","_dis","_sfx","_consumetext","_stashname","_stashtype","_stash","_consume","_hasitemcount","_worldspace","_finished"]; //check if can pitch here call gear_ui_init; @@ -45,16 +45,16 @@ if ((count _worldspace) == 2) then { player removeMagazine _consume; _dir = round(direction player); - //wait a bit - player playActionNow "Medic"; - uiSleep 1; - _dis=20; _sfx = "tentunpack"; [player,_sfx,0,false,_dis] call dayz_zombieSpeak; [player,_dis,true,(getPosATL player)] call player_alertZombies; + + _finished = ["Medic",1] call fn_loopAction; + if (!_finished) exitWith { + player addMagazine _consume; + }; - uiSleep 5; //place tent (local) _stash = createVehicle [_stashtype, _location, [], 0, "CAN_COLLIDE"]; _stash setdir _dir; diff --git a/SQF/dayz_code/actions/player_destroyTent.sqf b/SQF/dayz_code/actions/player_destroyTent.sqf index 4c073c86b..9ea854e3d 100644 --- a/SQF/dayz_code/actions/player_destroyTent.sqf +++ b/SQF/dayz_code/actions/player_destroyTent.sqf @@ -1,4 +1,4 @@ -private ["_emptycan","_objectID","_objectUID","_obj","_fuelArray","_matchArray","_alreadyDestroying","_randomJerryCan","_fireIntensity","_dis","_sfx"]; +private ["_emptycan","_objectID","_objectUID","_obj","_fuelArray","_matchArray","_randomJerryCan","_fireIntensity","_dis","_sfx","_finished"]; //Tent Object _obj = _this select 3; @@ -27,19 +27,22 @@ _matchArray = []; if ((count _fuelArray == 0)) exitwith { systemChat (localize ("str_setFireFuel")); }; if ((count _matchArray == 0)) exitwith { systemChat (localize ("str_setFireMatches")); }; -//Play normal action animation -player playActionNow "Medic"; +if (dayz_actionInProgress) exitWith { localize "str_player_actionslimit" call dayz_rollingMessages; }; +dayz_actionInProgress = true; //Actionmenu tools player removeAction s_player_destroytent; s_player_destroytent = -1; -//Make sure you can only destroy once -_alreadyDestroying = _obj getVariable["alreadyDestroying",0]; +_dis=20; +_sfx = "tentpack"; +[player,_sfx,0,false,_dis] call dayz_zombieSpeak; +[player,_dis,true,(getPosATL player)] call player_alertZombies; -if (_alreadyDestroying == 1) exitWith {localize "str_TentAlreadyLit" call dayz_rollingMessages;}; - -_obj setVariable["alreadyDestroying",1]; +_finished = ["Medic",1] call fn_loopAction; +if (!_finished or (isNull _obj)) exitWith { + dayz_actionInProgress = false; +}; //Jerry can system ** Needs redoing //Select random can from array @@ -49,24 +52,20 @@ _name = getText (configFile >> "CfgMagazines" >> _randomJerryCan >> "displayName _emptycan = getText (configFile >> "CfgMagazines" >> _randomJerryCan >> "emptycan"); _fireIntensity = getNumber (configFile >> "CfgMagazines" >> _randomJerryCan >> "fireIntensity"); +if !(_randomJerryCan in magazines player) exitWith { + localize "str_setFireFuel" call dayz_rollingMessages; + dayz_actionInProgress = false; +}; + player removeMagazine _randomJerryCan; player addMagazine _emptycan; ["matches",0.3] call fn_dynamicTool; -//Normal alerts -_dis=20; -_sfx = "tentpack"; -[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 3; - -_activatingPlayer = player; -PVDZ_obj_Destroy = [_objectID,_objectUID, _activatingPlayer]; +PVDZ_obj_Destroy = [_objectID,_objectUID,player]; publicVariableServer "PVDZ_obj_Destroy"; //Send killed for object @@ -86,4 +85,5 @@ publicVariable "PVDZ_obj_Fire"; _obj inflame true; //_obj spawn player_fireMonitor; -localize "str_success_tent_destroyed" call dayz_rollingMessages; \ No newline at end of file +localize "str_success_tent_destroyed" call dayz_rollingMessages; +dayz_actionInProgress = false; \ No newline at end of file diff --git a/SQF/dayz_code/actions/player_fixBottle.sqf b/SQF/dayz_code/actions/player_fixBottle.sqf index 553549950..039e63d90 100644 --- a/SQF/dayz_code/actions/player_fixBottle.sqf +++ b/SQF/dayz_code/actions/player_fixBottle.sqf @@ -1,21 +1,30 @@ -private ["_bottle","_tape","_fixedBottle"]; +private ["_bottle","_tape","_fixedBottle","_finished"]; _bottle = _this; _tape = "equip_duct_tape"; _fixedBottle = "ItemWaterBottleUnfilled"; + +if (dayz_actionInProgress) exitWith { localize "str_player_actionslimit" call dayz_rollingMessages; }; +dayz_actionInProgress = true; + call gear_ui_init; closeDialog 0; // Check if the player has the tape if (_tape in magazines player) then { - //Fix the bottle - player playActionNow "Medic"; - [player,"bandage",0,false] call dayz_zombieSpeak; - uiSleep 6; - player removeMagazine _bottle; - player removeMagazine _tape; - player addMagazine _fixedBottle; - localize "str_fix_water_bottle" call dayz_rollingMessages; + [player,"bandage",0,false] call dayz_zombieSpeak; + _finished = ["Medic",1] call fn_loopAction; + if (!_finished) exitWith {}; + + // Check again to make sure player didn't drop item + if (_tape in magazines player) then { + player removeMagazine _bottle; + player removeMagazine _tape; + player addMagazine _fixedBottle; + localize "str_fix_water_bottle" call dayz_rollingMessages; + }; } else { //If the player doesn't have the tape localize "str_fix_water_bottle_fail" call dayz_rollingMessages; -}; \ No newline at end of file +}; + +dayz_actionInProgress = false; \ No newline at end of file diff --git a/SQF/dayz_code/actions/player_fixTools.sqf b/SQF/dayz_code/actions/player_fixTools.sqf index 584e1ffaf..b750b7ac8 100644 --- a/SQF/dayz_code/actions/player_fixTools.sqf +++ b/SQF/dayz_code/actions/player_fixTools.sqf @@ -1,5 +1,5 @@ //fixHatchet old file -private ["_tool","_tape","_fixedItem","_config","_dName","_handle"]; +private ["_tool","_tape","_fixedItem","_config","_dName","_handle","_finished"]; _tool = _this; _config = configFile >> "CfgWeapons" >> _tool; @@ -12,21 +12,26 @@ _tape = "equip_duct_tape"; //Handle _handle = "equip_lever"; +if (dayz_actionInProgress) exitWith { localize "str_player_actionslimit" call dayz_rollingMessages; }; +dayz_actionInProgress = true; + call gear_ui_init; closeDialog 0; // Check if the player has the tape -if ((_tape in magazines player) && (_handle in magazines player)) then { - //Fix the tool - player playActionNow "Medic"; +if ((_tape in magazines player) && (_handle in magazines player) && (_tool in items player)) then { [player,"bandage",0,false] call dayz_zombieSpeak; - uiSleep 6; - player removeWeapon _tool; - player removeMagazine _tape; - player removeMagazine _handle; - player addWeapon _fixedItem; - format[localize "str_fixToolSuccess", _dName] call dayz_rollingMessages; + _finished = ["Medic",1] call fn_loopAction; + if (!_finished) exitWith {}; + // Check again to make sure player didn't drop item + if ((_tape in magazines player) && (_handle in magazines player) && (_tool in items player)) then { + player removeWeapon _tool; + player removeMagazine _tape; + player removeMagazine _handle; + player addWeapon _fixedItem; + format[localize "str_fixToolSuccess", _dName] call dayz_rollingMessages; + }; } else { //If the player doesn't have the mats. if (!(_tape in magazines player)) then { if (!(_handle in magazines player)) then { @@ -37,4 +42,6 @@ if ((_tape in magazines player) && (_handle in magazines player)) then { } else { localize "str_fixtoolMissingHandle" call dayz_rollingMessages; }; -}; \ No newline at end of file +}; + +dayz_actionInProgress = false; \ No newline at end of file diff --git a/SQF/dayz_code/actions/player_harvestPlant.sqf b/SQF/dayz_code/actions/player_harvestPlant.sqf index c9bbc380d..57e6cf9f4 100644 --- a/SQF/dayz_code/actions/player_harvestPlant.sqf +++ b/SQF/dayz_code/actions/player_harvestPlant.sqf @@ -3,7 +3,7 @@ Usage: spawn player_harvestPlant; Made for DayZ Epoch please ask permission to use/edit/distrubute email vbawol@veteranbastards.com. */ -private ["_isOk","_i","_objName","_started","_finished","_animState","_isMedic","_proceed","_itemOut","_countOut","_plant","_findNearestPlant","_index","_invResult","_text","_playerNear"]; +private ["_isOk","_i","_objName","_finished","_proceed","_itemOut","_countOut","_plant","_findNearestPlant","_index","_invResult","_text","_playerNear"]; if (dayz_actionInProgress) exitWith {localize "str_epoch_player_72" call dayz_rollingMessages;}; dayz_actionInProgress = true; @@ -31,34 +31,11 @@ if (count _findNearestPlant >= 1) then { _isOk = true; _proceed = false; while {_isOk} do { - player playActionNow "Medic"; [player,20,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; - [player,"chopwood",0,false] call dayz_zombieSpeak; - }; - if (r_interrupt) then { - r_doLoop = false; - }; + [player,"chopwood",0,false] call dayz_zombieSpeak; - uiSleep 0.1; + _finished = ["Medic",1] call fn_loopAction; - }; - if(!_finished) exitWith { _isOk = false; _proceed = false; @@ -103,11 +80,6 @@ if (count _findNearestPlant >= 1) then { format[localize "str_epoch_player_143",_i,_text] call dayz_rollingMessages; }; } else { - r_interrupt = false; - if (vehicle player == player) then { - [objNull, player, rSwitchMove,""] call RE; - player playActionNow "stop"; - }; localize "str_epoch_player_73" call dayz_rollingMessages; }; } else { diff --git a/SQF/dayz_code/actions/player_loadCrate.sqf b/SQF/dayz_code/actions/player_loadCrate.sqf index 2c48da4cc..9dc33f42f 100644 --- a/SQF/dayz_code/actions/player_loadCrate.sqf +++ b/SQF/dayz_code/actions/player_loadCrate.sqf @@ -1,4 +1,4 @@ -private ["_dir","_classname","_b0x1337","_location","_item","_config","_create_raw","_create","_qty","_type","_hasCrate","_hasTool"]; +private ["_dir","_classname","_b0x1337","_location","_item","_config","_create_raw","_create","_qty","_type","_hasCrate","_hasTool","_finished"]; if (dayz_actionInProgress) exitWith {localize "str_epoch_player_75" call dayz_rollingMessages;}; dayz_actionInProgress = true; @@ -27,6 +27,11 @@ if ((_location select 2) < 0) then { _location set [2,0]; }; +_finished = ["Medic",1] call fn_loopAction; +if (!_finished or !(_item in magazines player)) exitWith { + dayz_actionInProgress = false; +}; + //remove (partially) full crate player removeMagazine _item; _dir = getDir player; @@ -36,9 +41,6 @@ _classname = "WeaponHolder"; player addMagazine "bulk_empty"; ["Working",0,[20,40,15,0]] call dayz_NutritionSystem; -// Change to optional wait to complete -player playActionNow "Medic"; -uiSleep 6; _b0x1337 = createVehicle [_classname, _location, [], 0, "CAN_COLLIDE"]; _b0x1337 setDir _dir; diff --git a/SQF/dayz_code/actions/player_makefire.sqf b/SQF/dayz_code/actions/player_makefire.sqf index ad5547725..4fea9ee1f 100644 --- a/SQF/dayz_code/actions/player_makefire.sqf +++ b/SQF/dayz_code/actions/player_makefire.sqf @@ -1,9 +1,12 @@ -private ["_item","_config","_exit","_text","_booleans","_worldspace","_dir","_location","_dis","_fire","_tool","_itemPile","_posASL","_testSea"]; +private ["_item","_config","_exit","_text","_booleans","_worldspace","_dir","_location","_fire","_tool","_itemPile","_posASL","_testSea","_finished"]; _tool = _this; call gear_ui_init; closeDialog 0; +if (dayz_actionInProgress) exitWith { localize "str_player_actionslimit" call dayz_rollingMessages; }; +dayz_actionInProgress = true; + _item = "ItemLog"; _itemPile = "PartWoodPile"; _config = configFile >> "CfgMagazines" >> _item; @@ -14,19 +17,25 @@ if (_tool == "PartWoodPile") then { _exit = true; {if (_x in DayZ_Ignitors) exitWith {_exit = false};} forEach (items player); }; -if (_exit) exitWith {(localize "str_fireplace_noMatches") call dayz_rollingMessages;}; +if (_exit) exitWith { + localize "str_fireplace_noMatches" call dayz_rollingMessages; + dayz_actionInProgress = false; +}; // item is missing or tools are missing if (!(_item in magazines player) && !(_itemPile in magazines player)) exitWith { - //localize "str_player_22" call dayz_rollingMessages; - (localize "str_player_22") call dayz_rollingMessages; + localize "str_player_22" call dayz_rollingMessages; + dayz_actionInProgress = false; }; _booleans = []; //testonLadder, testSea, testPond, testBuilding, testSlope, testDistance _worldspace = ["Land_Fire_DZ", player, _booleans] call fn_niceSpot; // player on ladder or in a vehicle -if (_booleans select 0) exitWith { localize "str_player_21" call dayz_rollingMessages; }; +if (_booleans select 0) exitWith { + localize "str_player_21" call dayz_rollingMessages; + dayz_actionInProgress = false; +}; _testSea = true; _posASL = getPosASL player; @@ -37,9 +46,17 @@ if ((_booleans select 1) && _posASL select 2 > 2) then { }; // object would be in the water (pool or sea) -if ((_booleans select 1 && _testSea) OR (_booleans select 2)) exitWith { localize "str_player_26" call dayz_rollingMessages; }; +if ((_booleans select 1 && _testSea) OR (_booleans select 2)) exitWith { + localize "str_player_26" call dayz_rollingMessages; + dayz_actionInProgress = false; +}; if ((count _worldspace) == 2) then { + [player,20,true,(getPosATL player)] call player_alertZombies; + + _finished = ["Medic",1] call fn_loopAction; + if (!_finished or (!(_item in magazines player) && !(_itemPile in magazines player))) exitWith {}; + if (_item in magazines player) then { player removeMagazine _item; } else { @@ -48,19 +65,12 @@ if ((count _worldspace) == 2) then { _dir = _worldspace select 0; _location = _worldspace select 1; - player playActionNow "Medic"; - uiSleep 1; // fireplace location may not be in front of player (but in 99% time it should) player setDir _dir; player setPosATL (getPosATL player); - _dis=20; - [player,_dis,true,(getPosATL player)] call player_alertZombies; - // Added Nutrition-Factor for work ["Working",0,[20,40,15,0]] call dayz_NutritionSystem; - - uiSleep 5; _fire = createVehicle ["Land_Fire_DZ", [0,0,0], [], 0, "CAN_COLLIDE"]; _fire setDir _dir; @@ -82,4 +92,6 @@ if ((count _worldspace) == 2) then { localize "str_fireplace_01" call dayz_rollingMessages; } else { localize "str_fireplace_02" call dayz_rollingMessages; -}; \ No newline at end of file +}; + +dayz_actionInProgress = false; \ No newline at end of file diff --git a/SQF/dayz_code/actions/player_mineStone.sqf b/SQF/dayz_code/actions/player_mineStone.sqf index a4b1b25a9..a7d8480ef 100644 --- a/SQF/dayz_code/actions/player_mineStone.sqf +++ b/SQF/dayz_code/actions/player_mineStone.sqf @@ -1,12 +1,11 @@ -private ["_item","_result","_dis","_sfx","_num","_breaking","_counter","_rocks","_findNearestRock", -"_objName","_countOut","_isOk","_proceed","_animState","_started","_finished","_isMedic","_itemOut","_wpPos","_nearByPile"]; +private ["_item","_dis","_sfx","_breaking","_counter","_rocks","_findNearestRock","_objName","_countOut","_isOk","_proceed","_finished","_itemOut"]; _item = _this; call gear_ui_init; closeDialog 1; -if(dayz_workingInprogress) exitWith { localize "STR_MINING_IN_PROGRESS" call dayz_rollingMessages; }; -dayz_workingInprogress = true; +if (dayz_actionInProgress) exitWith { localize "str_player_actionslimit" call dayz_rollingMessages; }; +dayz_actionInProgress = true; // allowed rocks list move this later _rocks = ["r2_boulder1.p3d","r2_boulder2.p3d","r2_rock1.p3d","r2_rock2.p3d","r2_rocktower.p3d","r2_rockwall.p3d","r2_stone.p3d"]; @@ -22,56 +21,28 @@ _findNearestRock = objNull; if (!isNull _findNearestRock) then { _countOut = 2 + floor(random 3); - //Remove melee magazines (BIS_fnc_invAdd fix) (add new melee ammo to array if needed) - {player removeMagazines _x} forEach ["Hatchet_Swing","Crowbar_Swing","Machete_Swing","Fishing_Swing","Sledge_Swing"]; - // Start stone mining loop _counter = 0; _isOk = true; _proceed = false; while {_isOk} do { - //play action - player playActionNow "Medic"; - //setup alert and speak _dis=20; _sfx = "minestone"; [player,_sfx,0,false,_dis] call dayz_zombieSpeak; [player,_dis,true,(getPosATL player)] call player_alertZombies; - - // Working-Factor for mining stone. - ["Working",0,[100,15,10,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 and !_isMedic) then { - r_doLoop = false; - _finished = true; - }; - if (r_interrupt) then { - r_doLoop = false; - }; - - uiSleep 0.1; - }; + _finished = ["Medic",1] call fn_loopAction; if(!_finished) exitWith { _isOk = false; _proceed = false; }; - if(_finished) then { + if(_finished) then { + ["Working",0,[100,15,10,0]] call dayz_NutritionSystem; + _breaking = false; if (dayz_toolBreaking && {[0.09] call fn_chance}) then { _breaking = true; @@ -106,32 +77,15 @@ if (!isNull _findNearestRock) then { }; _isOk = false; _proceed = true; - uiSleep 1; }; format[localize "str_mining_progress", _counter,(_countOut - _counter)] call dayz_rollingMessages; }; if (!_proceed) then { localize "str_mining_canceled" call dayz_rollingMessages; - - r_interrupt = false; - - if (vehicle player == player) then { - [objNull, player, rSwitchMove,""] call RE; - player playActionNow "stop"; - }; - }; - - //adding melee mags back if needed - switch (primaryWeapon player) do { - case "MeleeHatchet": {player addMagazine 'Hatchet_Swing';}; - case "MeleeCrowbar": {player addMagazine 'Crowbar_Swing';}; - case "MeleeMachete": {player addMagazine 'Machete_Swing';}; - case "MeleeFishingPole": {player addMagazine 'Fishing_Swing';}; - case "MeleeSledge": {player addMagazine 'Sledge_Swing';}; }; } else { localize "str_mining_no_rocks" call dayz_rollingMessages; }; -dayz_workingInprogress = false; \ No newline at end of file +dayz_actionInProgress = false; \ No newline at end of file diff --git a/SQF/dayz_code/actions/player_tearClothes.sqf b/SQF/dayz_code/actions/player_tearClothes.sqf index 0af011f66..da89a2fc5 100644 --- a/SQF/dayz_code/actions/player_tearClothes.sqf +++ b/SQF/dayz_code/actions/player_tearClothes.sqf @@ -1,4 +1,4 @@ -private ["_skin","_rnd","_rounded","_itemtocreate","_i","_config","_result"]; +private ["_skin","_rnd","_rounded","_itemtocreate","_i","_config","_result","_finished"]; _skin = _this; _config = configFile >> "CfgMagazines" >> _skin; @@ -9,11 +9,20 @@ _rounded = round _rnd; call gear_ui_init; closeDialog 0; +if (dayz_actionInProgress) exitWith { localize "str_player_actionslimit" call dayz_rollingMessages; }; +dayz_actionInProgress = true; + //Tear the clothes -player playActionNow "Medic"; [player,"bandage",0,false] call dayz_zombieSpeak; -uiSleep 6; -if !(_skin in magazines player) exitWith {localize "str_tear_clothes_0" call dayz_rollingMessages;}; +_finished = ["Medic",1] call fn_loopAction; +if (!_finished) exitWith { + dayz_actionInProgress = false; +}; + +if !(_skin in magazines player) exitWith { + localize "str_tear_clothes_0" call dayz_rollingMessages; + dayz_actionInProgress = false; +}; player removeMagazine _skin; switch (_rounded) do { @@ -48,4 +57,6 @@ while {_i < _rounded} do { [_itemtocreate,1,1] call fn_dropItem; }; }; -true call dz_fn_meleeMagazines; \ No newline at end of file +true call dz_fn_meleeMagazines; + +dayz_actionInProgress = false; \ No newline at end of file diff --git a/SQF/dayz_code/actions/player_upgrade.sqf b/SQF/dayz_code/actions/player_upgrade.sqf index 165ace782..22ec9f4e3 100644 --- a/SQF/dayz_code/actions/player_upgrade.sqf +++ b/SQF/dayz_code/actions/player_upgrade.sqf @@ -2,7 +2,7 @@ DayZ Base Building Upgrades Made for DayZ Epoch please ask permission to use/edit/distrubute email vbawol@veteranbastards.com. */ -private ["_location","_dir","_classname","_missing","_text","_proceed","_num_removed","_object","_missingQty","_itemIn","_countIn","_qty","_removed","_removed_total","_tobe_removed_total","_objectID","_objectUID","_temp_removed_array","_textMissing","_newclassname","_requirements","_obj","_upgrade","_lockable","_combination_1","_combination_2","_combination_3","_combination","_objectCharacterID","_ownerID","_qtyBP","_forEachIndex","_bpMags","_countNew","_bp2Remove","_count","_friendsArr","_vector","_temp_BP_removed_array"]; +private ["_location","_dir","_classname","_missing","_text","_proceed","_num_removed","_object","_missingQty","_itemIn","_countIn","_qty","_removed","_removed_total","_tobe_removed_total","_objectID","_objectUID","_temp_removed_array","_textMissing","_newclassname","_requirements","_obj","_upgrade","_lockable","_combination_1","_combination_2","_combination_3","_combination","_objectCharacterID","_ownerID","_qtyBP","_forEachIndex","_bpMags","_countNew","_bp2Remove","_count","_friendsArr","_vector","_temp_BP_removed_array","_finished"]; if (dayz_actionInProgress) exitWith {localize "str_epoch_player_52" call dayz_rollingMessages;}; dayz_actionInProgress = true; @@ -51,9 +51,10 @@ if ((count _upgrade) > 0) then { } forEach _requirements; if (_proceed) then { - ["Working",0,[3,2,4,0]] call dayz_NutritionSystem; - player playActionNow "Medic"; [player,20,true,(getPosATL player)] spawn player_alertZombies; + _finished = ["Medic",1] call fn_loopAction; + if (!_finished) exitWith {}; + ["Working",0,[3,2,4,0]] call dayz_NutritionSystem; _temp_removed_array = []; _temp_BP_removed_array = []; diff --git a/SQF/dayz_code/actions/remove.sqf b/SQF/dayz_code/actions/remove.sqf index be1ca0741..99bcc4720 100644 --- a/SQF/dayz_code/actions/remove.sqf +++ b/SQF/dayz_code/actions/remove.sqf @@ -4,7 +4,7 @@ dayz_actionInProgress = true; delete object from db with extra waiting by [VB]AWOL parameters: _obj */ -private ["_obj","_objectID","_objectUID","_started","_finished","_animState","_isMedic","_isOk","_proceed","_counter","_limit","_objType","_sfx","_dis","_itemOut","_countOut","_selectedRemoveOutput","_nearestPole","_ownerID","_refundpart","_isWreck","_IsNearPlot","_brokenTool","_removeTool","_isDestructable","_isRemovable","_objOwnerID","_isOwnerOfObj","_preventRefund","_ipos","_item","_radius","_isWreckBuilding","_nameVehicle","_isModular","_success","_lootGroupIndex","_output"]; +private ["_obj","_objectID","_objectUID","_finished","_isOk","_proceed","_counter","_limit","_objType","_itemOut","_countOut","_selectedRemoveOutput","_nearestPole","_ownerID","_refundpart","_isWreck","_IsNearPlot","_brokenTool","_removeTool","_isDestructable","_isRemovable","_objOwnerID","_isOwnerOfObj","_preventRefund","_ipos","_item","_radius","_isWreckBuilding","_nameVehicle","_isModular","_success","_lootGroupIndex","_output"]; player removeAction s_player_deleteBuild; s_player_deleteBuild = 1; @@ -92,35 +92,8 @@ while {_isOk} do { format[localize "str_epoch_player_163",_nameVehicle,(_counter + 1),_limit] call dayz_rollingMessages; - player playActionNow "Medic"; - _dis=20; - [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; - _sfx = "repair"; - [player,_sfx,0,false,_dis] call dayz_zombieSpeak; - }; - if (r_interrupt) then { - r_doLoop = false; - }; - - uiSleep 0.1; - - }; + [player,"repair",0,false,20] call dayz_zombieSpeak; + _finished = ["Medic",1] call fn_loopAction; if(!_finished) exitWith { _isOk = false; @@ -277,13 +250,6 @@ if (_proceed && _success) then { } else { localize "str_epoch_player_91" call dayz_rollingMessages; }; - -} else { - r_interrupt = false; - if (vehicle player == player) then { - [objNull, player, rSwitchMove,""] call RE; - player playActionNow "stop"; - }; }; dayz_actionInProgress = false; s_player_deleteBuild = -1; diff --git a/SQF/dayz_code/actions/repair.sqf b/SQF/dayz_code/actions/repair.sqf index 37d76f4f9..f172e4cbf 100644 --- a/SQF/dayz_code/actions/repair.sqf +++ b/SQF/dayz_code/actions/repair.sqf @@ -1,6 +1,6 @@ if (dayz_actionInProgress) exitWith {localize "str_player_actionslimit" call dayz_rollingMessages;}; dayz_actionInProgress = true; -private ["_array","_vehicle","_part","_hitpoint","_type","_hasToolbox","_section","_nameType","_namePart","_damage","_selection","_dis","_sfx","_hitpoints","_allFixed","__FILE__"]; +private ["_array","_vehicle","_part","_hitpoint","_type","_nameType","_namePart","_damage","_selection","_dis","_sfx","_hitpoints","_allFixed","_finished"]; _id = _this select 2; _array = _this select 3; @@ -15,28 +15,25 @@ dayz_myCursorTarget = objNull; //diag_log(format["%1 %2", __FILE__, _this]); -_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"; - sleep 1; - +if ("ItemToolbox" in items player && (_part in magazines player)) then { _dis=20; _sfx = "repair"; [player,_sfx,0,false,_dis] call dayz_zombieSpeak; [player,_dis,true,(getPosATL player)] call player_alertZombies; + + _finished = ["Medic",1] call fn_loopAction; + + // Check again to make sure player did not drop item + if (!_finished or !(_part in magazines player)) exitWith {}; + player removeMagazine _part; // Added Nutrition-Factor for work ["Working",0,[20,40,15,0]] call dayz_NutritionSystem; - sleep 5; - _damage = [_vehicle,_hitpoint] call object_getHit; _vehicle removeAction _id; //dont waste loot on undamaged parts diff --git a/SQF/dayz_code/actions/salvage.sqf b/SQF/dayz_code/actions/salvage.sqf index e6b943edf..84a0ab30b 100644 --- a/SQF/dayz_code/actions/salvage.sqf +++ b/SQF/dayz_code/actions/salvage.sqf @@ -1,7 +1,7 @@ -private ["_array","_vehicle","_part","_hitpoint","_type","_isOK","_brokenPart","_cancel","_started","_finished","_hasToolbox","_nameType","_namePart","_animState","_isMedic","_damage","_BreakableParts","_selection","_wpn","_classname","_ismelee"]; +private ["_array","_vehicle","_part","_hitpoint","_type","_isOK","_brokenPart","_cancel","_finished","_hasToolbox","_nameType","_namePart","_damage","_BreakableParts","_selection","_wpn","_classname","_ismelee"]; -if (dayz_salvageInProgress) exitWith { localize "str_salvage_inprogress" call dayz_rollingMessages; }; -dayz_salvageInProgress = true; +if (dayz_actionInProgress) exitWith {localize "str_player_actionslimit" call dayz_rollingMessages;}; +dayz_actionInProgress = true; _array = _this select 3; _vehicle = _array select 0; @@ -10,8 +10,6 @@ _hitpoint = _array select 2; _type = typeOf _vehicle; _isOK = false; _brokenPart = false; -_started = false; -_finished = false; _hasToolbox = "ItemToolbox" in items player; _cancel = false; @@ -27,28 +25,14 @@ if (_hasToolbox) then { if ((_vehicle distance (_x select 0)) < (_x select 1)) exitWith {_cancel = true;}; } count DZE_SafeZonePosArray; if (_cancel) exitWith { (localize "str_salvage_safezone") call dayz_rollingMessages;}; - player playActionNow "Medic"; + [player,"repair",0,false] call dayz_zombieSpeak; [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; - - while {r_doLoop} do { - _animState = animationState player; - _isMedic = ["medic",_animState] call fnc_inString; - if (_isMedic) then { _started = true; }; - if (_started and !_isMedic) then { r_doLoop = false; _finished = true; }; - if (r_interrupt) then { r_doLoop = false; }; - uiSleep 0.1; - }; - r_doLoop = false; + _finished = ["Medic",1] call fn_loopAction; if (_finished) then { + ["Working",0,[20,40,15,0]] call dayz_NutritionSystem; //Remove melee magazines (BIS_fnc_invAdd fix) false call dz_fn_meleeMagazines; _damage = [_vehicle,_hitpoint] call object_getHit; @@ -87,11 +71,6 @@ if (_hasToolbox) then { }; true call dz_fn_meleeMagazines; } else { - r_interrupt = false; - if (vehicle player == player) then { - [objNull, player, rSwitchMove,""] call RE; - player playActionNow "stop"; - }; localize "str_salvage_canceled" call dayz_rollingMessages; }; } else { @@ -100,7 +79,7 @@ if (_hasToolbox) then { dayz_myCursorTarget = objNull; s_player_repair_crtl = -1; -dayz_salvageInProgress = false; +dayz_actionInProgress = false; //adding melee mags back if needed _wpn = primaryWeapon player; diff --git a/SQF/dayz_code/actions/siphonFuel.sqf b/SQF/dayz_code/actions/siphonFuel.sqf index 0d8c07911..23142f663 100644 --- a/SQF/dayz_code/actions/siphonFuel.sqf +++ b/SQF/dayz_code/actions/siphonFuel.sqf @@ -1,4 +1,4 @@ -private ["_vehicle","_curFuel","_newFuel","_started","_finished","_animState","_isMedic","_location1","_location2","_abort", +private ["_vehicle","_curFuel","_newFuel","_finished","_location1","_location2","_abort", "_canNameEmpty","_canSizeEmpty","_canTypeEmpty","_canName","_canSize","_configCanEmpty","_configVeh","_capacity","_nameText", "_availableCansEmpty","_hasHose","_PlayerNear"]; @@ -6,12 +6,12 @@ _vehicle = _this select 3; player removeAction s_player_siphonfuel; _hasHose = "equip_hose" in magazines player; -if (dayz_siphonFuelInProgress) exitWith { localize "str_siphon_inprogress" call dayz_rollingMessages; }; if (!_hasHose) exitWith {localize "str_siphon_hose" call dayz_rollingMessages; }; _PlayerNear = {isPlayer _x} count ((getPosATL _vehicle) nearEntities ["CAManBase", 10]) > 1; if (_PlayerNear) exitWith {localize "str_pickup_limit_5" call dayz_rollingMessages;}; -dayz_siphonFuelInProgress = true; +if (dayz_actionInProgress) exitWith {localize "str_player_actionslimit" call dayz_rollingMessages;}; +dayz_actionInProgress = true; _abort = false; // Static vehicle fuel information @@ -52,39 +52,8 @@ _nameText = getText(_configVeh >> "displayName"); // alert zombies [player,20,true,(getPosATL player)] call player_alertZombies; - if(!dayz_isSwimming) then { - // force animation - player playActionNow "Medic"; - - r_interrupt = false; - _animState = animationState player; - r_doLoop = true; - _started = false; - - while {r_doLoop} do { - _animState = animationState player; - _isMedic = ["medic",_animState] call fnc_inString; - if (_isMedic) then { - _started = true; - }; - if (_started and !_isMedic) then { - r_doLoop = false; - _finished = true; - }; - if (r_interrupt) then { - r_doLoop = false; - }; - uiSleep 0.1; - }; - r_doLoop = false; - - if(!_finished) then { - r_interrupt = false; - if (vehicle player == player) then { - [objNull, player, rSwitchMove,""] call RE; - player playActionNow "stop"; - }; - }; + if (!dayz_isSwimming) then { + _finished = ["Medic",1] call fn_loopAction; } else { // Alternate method in water make sure player stays in one spot for 6 seconds _location1 = getPosATL player; @@ -151,4 +120,4 @@ _nameText = getText(_configVeh >> "displayName"); if(_abort) exitWith {}; } forEach magazines player; -dayz_siphonFuelInProgress = false; \ No newline at end of file +dayz_actionInProgress = false; \ No newline at end of file diff --git a/SQF/dayz_code/actions/stopGenerator.sqf b/SQF/dayz_code/actions/stopGenerator.sqf index 8015d1376..7b0e6f312 100644 --- a/SQF/dayz_code/actions/stopGenerator.sqf +++ b/SQF/dayz_code/actions/stopGenerator.sqf @@ -1,6 +1,6 @@ -private ["_vehicle","_started","_finished","_animState","_isMedic","_soundObject"]; +private ["_vehicle","_finished","_soundObject"]; -if (dayz_actionInProgress) exitWith {localize "str_epoch_player_99" call dayz_rollingMessages;}; +if (dayz_actionInProgress) exitWith {localize "str_player_actionslimit" call dayz_rollingMessages;}; dayz_actionInProgress = true; player removeAction s_player_fillgen; @@ -9,56 +9,24 @@ s_player_fillgen = 1; // Use target from addaction _vehicle = _this select 3; -player playActionNow "Medic"; - -r_interrupt = false; -_animState = animationState player; -r_doLoop = true; -_started = false; -_finished = false; - localize "str_epoch_player_100" call dayz_rollingMessages; [player,50,true,(getPosATL player)] spawn player_alertZombies; -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; +_finished = ["Medic",1] call fn_loopAction; -if(!_finished) then { - r_interrupt = false; - if (vehicle player == player) then { - [objNull, player, rSwitchMove,""] call RE; - player playActionNow "stop"; - }; +if (!_finished) then { localize "str_epoch_player_26" call dayz_rollingMessages; -}; +} else { + // find sound and delete + _soundObject = _vehicle getVariable "GeneratorSound"; -if (_finished) then { + deleteVehicle _soundObject; - // find sound && delete - _soundObject = _vehicle getVariable "GeneratorSound"; - - deleteVehicle _soundObject; - - // Stop generator - _vehicle setVariable ["GeneratorRunning", false,true]; + // Stop generator + _vehicle setVariable ["GeneratorRunning",false,true]; - localize "str_epoch_player_101" call dayz_rollingMessages; - + localize "str_epoch_player_101" call dayz_rollingMessages; }; dayz_actionInProgress = false; diff --git a/SQF/dayz_code/actions/tent_pitch.sqf b/SQF/dayz_code/actions/tent_pitch.sqf deleted file mode 100644 index 94b52c7c9..000000000 --- a/SQF/dayz_code/actions/tent_pitch.sqf +++ /dev/null @@ -1,104 +0,0 @@ -private ["_item","_config","_text","_booleans","_worldspace","_dir","_location","_dis","_sfx","_tent","_classname","_object","_boundingBox","_maxPoint","_actionBuild","_actionCancel"]; -/* -private ["_item", "_config", "_text", "_booleans", "_worldspace", "_dir", "_location", "_dis", "_sfx", "_tent"]; - -call gear_ui_init; - -_item = _this; - -_config = configFile >> "CfgMagazines" >> _item; -_text = getText (_config >> "displayName"); -_classname = getText (_config >> "tentmodel"); - -//diag_log ("Classname: "+str(_classname)); -//diag_log ("Item: "+str(_item)); - -if (dayz_actionInProgress) exitWith { localize "str_player_actionslimit" call dayz_rollingMessages; }; -dayz_actionInProgress = true; - -// item is missing or tools are missing -if ((!(_item IN magazines player))) exitWith { - dayz_actionInProgress = false; - format[localize "str_player_31",_text,localize "str_player_31_pitch"] call dayz_rollingMessages; -}; - -_booleans = []; //testonLadder, testSea, testPond, testBuilding, testSlope, testDistance - - //remove tentbag - player removeMagazine _item; - //_dir = _worldspace select 0; - //_location = _worldspace select 1; - - //wait a bit - //player playActionNow "Medic"; - sleep 1; - // tent location may not be in front of player - //player setDir _dir; - //player setPosATL (getPosATL player); - - _dis=20; - _sfx = "tentunpack"; - - //sleep 5; - - localize "str_player_build_rotate" call dayz_rollingMessages; - _location = getMarkerpos "respawn_west"; - _object = createVehicle [_classname, _location, [], 0, "NONE"]; - - // Attach item - _boundingBox = boundingBox _object; - _maxPoint = ((_boundingBox select 1) select 0) max ((_boundingBox select 1) select 1); - _object setPosATL [getPosATL _object select 0, getPosATL _object select 1, 0.01]; - _object attachTo [player, [0, _maxPoint + 1, 0.3]]; - - //Vars - player setVariable ["constructionObject", _object]; - _object setVariable ["characterID",dayz_characterID,true]; - - //Actions - _actionBuild = player addAction [localize "str_player_build_complete", "\z\addons\dayz_code\actions\object_build.sqf", [_object, _item, _classname, _text, true, _booleans, _dis, _sfx], 1, true]; - _actionCancel = player addAction [localize "str_player_build_cancel", "\z\addons\dayz_code\actions\object_build.sqf", [_object, _item, _classname, _text, false, _booleans, _dis, _sfx], 1, true]; - - sleep 0.01; - - while {!isNull (player getVariable "constructionObject")} do { - if (vehicle player != player) then { - player action ["eject", vehicle player]; - }; - - if (speed player > 10 or speed player <= -8) then { - localize "str_player_build_movingfast" call dayz_rollingMessages; - player playMove "amovpercmstpssurwnondnon"; - }; - - sleep 0.2; - - if (!alive player) then { - [[],[],[],[_object, _item, _classname, _text, false, _booleans, _dis, _sfx]] call object_build; - }; - }; - - player removeAction _actionBuild; - player removeAction _actionCancel; -*/ -/* - sleep 5; - - _tent = createVehicle ["TentStorage", getMarkerpos "respawn_west", [], 0, "CAN_COLLIDE"]; - _tent setDir _dir; - _tent setPos _location; // follow terrain slope (works above sea level) - player reveal _tent; - _location = getPosATL _tent; - - _tent setVariable ["characterID",dayz_characterID,true]; - PVDZ_obj_Publish = [dayz_characterID,_tent,[_dir,_location],_classname]; - publicVariableServer "PVDZ_obj_Publish"; - - localize "str_success_tent_pitch" call dayz_rollingMessages; - sleep 1; -} else { - localize "str_fail_tent_pitch" call dayz_rollingMessages; -}; - -dayz_actionInProgress = false; -*/ \ No newline at end of file diff --git a/SQF/dayz_code/actions/tow_AttachStraps.sqf b/SQF/dayz_code/actions/tow_AttachStraps.sqf index ad494e22a..bdf132e5d 100644 --- a/SQF/dayz_code/actions/tow_AttachStraps.sqf +++ b/SQF/dayz_code/actions/tow_AttachStraps.sqf @@ -1,4 +1,4 @@ -private ["_vehicle","_started","_finished","_animState","_isMedic","_abort","_configVeh","_nameText","_findNearestVehicles","_findNearestVehicle","_IsNearVehicle","_towTruck","_towTruckSize","_allowedSize"]; +private ["_vehicle","_finished","_configVeh","_nameText","_findNearestVehicles","_findNearestVehicle","_IsNearVehicle","_towTruck","_towTruckSize","_allowedSize"]; if (dayz_actionInProgress) exitWith {localize "str_epoch_player_96" call dayz_rollingMessages;}; dayz_actionInProgress = true; @@ -37,45 +37,9 @@ if(_IsNearVehicle >= 1) then { // alert zombies [player,20,true,(getPosATL player)] spawn player_alertZombies; - _finished = false; - - // force animation - player playActionNow "Medic"; - - r_interrupt = false; - _animState = animationState player; - r_doLoop = true; - _started = 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; - - if(!_finished) then { - r_interrupt = false; - - if (vehicle player == player) then { - [objNull, player, rSwitchMove,""] call RE; - player playActionNow "stop"; - }; - _abort = true; - }; + _finished = ["Medic",1] call fn_loopAction; if (_finished) then { - if((sizeOf typeOf _vehicle) <= _allowedSize) then { if([_vehicle,_towTruck] call fnc_isInsideBuilding && ((vectorUp _vehicle) select 2) > 0.5) then { if(typeOf _towTruck == "TOW_DZE" ) then { @@ -93,9 +57,6 @@ if(_IsNearVehicle >= 1) then { }; }; - - - } else { localize "str_epoch_player_27" call dayz_rollingMessages; }; diff --git a/SQF/dayz_code/actions/tow_DetachStraps.sqf b/SQF/dayz_code/actions/tow_DetachStraps.sqf index 32f766655..9ce98eb28 100644 --- a/SQF/dayz_code/actions/tow_DetachStraps.sqf +++ b/SQF/dayz_code/actions/tow_DetachStraps.sqf @@ -1,4 +1,4 @@ -private ["_vehicle","_started","_finished","_animState","_isMedic","_configVeh","_nameText","_towTruck","_inTow"]; +private ["_vehicle","_finished","_configVeh","_nameText","_towTruck","_inTow"]; if (dayz_actionInProgress) exitWith {localize "str_epoch_player_96" call dayz_rollingMessages;}; dayz_actionInProgress = true; @@ -14,7 +14,7 @@ _inTow = _towTruck getVariable ["DZEinTow", false]; if(_inTow) then { - // select vehicl in tow + // select vehicle in tow _vehicle = _towTruck getVariable ["DZEvehicleInTow", objNull]; if(!(isNull _towTruck)) then { @@ -26,41 +26,7 @@ if(_inTow) then { // alert zombies [player,20,true,(getPosATL player)] spawn player_alertZombies; - _finished = false; - - // force animation - player playActionNow "Medic"; - - r_interrupt = false; - _animState = animationState player; - r_doLoop = true; - _started = 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; - - if(!_finished) then { - r_interrupt = false; - - if (vehicle player == player) then { - [objNull, player, rSwitchMove,""] call RE; - player playActionNow "stop"; - }; - }; + _finished = ["Medic",1] call fn_loopAction; if (_finished) then { diff --git a/SQF/dayz_code/compile/fn_loopAction.sqf b/SQF/dayz_code/compile/fn_loopAction.sqf new file mode 100644 index 000000000..2c9a2f9cd --- /dev/null +++ b/SQF/dayz_code/compile/fn_loopAction.sqf @@ -0,0 +1,51 @@ +/* + Runs playActionNow the specified number of times. + Entering a vehicle, moving or vaulting interrupts the loop. + Must be called from a scheduled context (script executed by spawn or execVM) + + Params: + _this select 0: String: Action name to play + _this select 1: Number: Number of times to play action + _this select 2: (Optional) Code: Extra condition that interrupts action when true + + Returns: + Bool: True (finished), false (interrupted) + + Usage: + _finished = ["Medic",1] call fn_loopAction; +*/ +private ["_action","_extra","_loop","_loops","_started"]; + +_action = _this select 0; +_loops = _this select 1; +_extra = if (count _this > 2) then {_this select 2} else {{false}}; + +r_interrupt = false; +_started = false; +_loop = 0; + +while {_loop < _loops && !r_interrupt && !(call _extra) && (vehicle player == player)} do { + if (!_started) then { + player playActionNow _action; + _started = true; + }; + + if ([_action,animationState player] call fnc_inString) then { + waitUntil { + getNumber(configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "disableWeapons") == 0 //Finished or entered a vehicle + or r_interrupt or (call _extra) + }; + _loop = _loop + 1; + _started = false; + }; + + uiSleep 0.1; +}; + +if (vehicle player == player && (r_interrupt or (call _extra))) then { + [objNull, player, rSwitchMove, ""] call RE; + player playActionNow "Stop"; +}; + +//Player did not interrupt by moving, entering a vehicle or extra condition +(!r_interrupt && !(call _extra) && (vehicle player == player)) \ No newline at end of file diff --git a/SQF/dayz_code/compile/fn_selfActions.sqf b/SQF/dayz_code/compile/fn_selfActions.sqf index 3d13aef63..157239db0 100644 --- a/SQF/dayz_code/compile/fn_selfActions.sqf +++ b/SQF/dayz_code/compile/fn_selfActions.sqf @@ -378,17 +378,6 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur }; }; -// Not needed. -/* - if(_cursorTarget == dayz_hasFire) then { - if ((s_player_fireout < 0) && !(_cursorTarget call isInflamed) && (player distance _cursorTarget < 3)) then { - s_player_fireout = player addAction [localize "str_actions_self_06", "\z\addons\dayz_code\actions\fire_pack.sqf",_cursorTarget, 0, false, true]; - }; - } else { - player removeAction s_player_fireout; - s_player_fireout = -1; - }; -*/ if (_isAlive) then { _restrict = _typeOfCursorTarget in DZE_restrictRemoval; @@ -1041,8 +1030,6 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur s_player_cook = -1; player removeAction s_player_boil; s_player_boil = -1; - player removeAction s_player_fireout; - s_player_fireout = -1; player removeAction s_player_packtent; s_player_packtent = -1; player removeAction s_player_packtentinfected; diff --git a/SQF/dayz_code/compile/keyboard.sqf b/SQF/dayz_code/compile/keyboard.sqf index 39a5cca85..259e155d6 100644 --- a/SQF/dayz_code/compile/keyboard.sqf +++ b/SQF/dayz_code/compile/keyboard.sqf @@ -148,9 +148,7 @@ if (isNil "keyboard_keys") then { }; }; _interrupt = { - if (vehicle player == player) then { //allow med actions in moving vehicles - r_interrupt = true; - }; + r_interrupt = true; if (DZE_Surrender) then {call dze_surrender_off}; if (dayz_autoRun) then {call dayz_autoRunOff;}; }; @@ -187,13 +185,6 @@ if (isNil "keyboard_keys") then { }; _handled = true; }; - // tents and stash construction - _object = player getVariable ["constructionObject", objNull]; - if (!isNull _object) then { - _dir = getDir _object - 3; - _object setDir _dir; - _handled = true; - }; dayz_dodge = true; }; _build_right = { @@ -210,35 +201,29 @@ if (isNil "keyboard_keys") then { }; _handled = true; }; - // tents and stash construction - _object = player getVariable ["constructionObject", objNull]; - if (!isNull _object) then { - _dir = getDir _object + 3; - _object setDir _dir; - _handled = true; - }; dayz_dodge = true; }; _build_camOnOff = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_buildCamera.sqf"; _build_str8OnOff = { + r_interrupt = true; + if (0 != count Dayz_constructionContext) then { Dayz_constructionContext set [ 5, !(Dayz_constructionContext select 5) ]; _handled = true; - r_interrupt = true; }; if (animationState player in ["bunnyhopunarmed","bunnyhoprifle"]) then { //Fixes invisible weapon switch glitch if double tapping vault with no weapon in hands _handled = true; }; - if (player isKindOf "PZombie_VB") then { + if (player isKindOf "PZombie_VB") then { _handled = true; // do not allow player zombies to vault or jump } else { - _nearbyObjects = nearestObjects[getPosATL player, dayz_disallowedVault, 8]; + _nearbyObjects = nearestObjects [getPosATL player, dayz_disallowedVault, 8]; if (count _nearbyObjects > 0) then { - if ((diag_tickTime - dayz_lastCheckBit > 4)) then { + if (diag_tickTime - dayz_lastCheckBit > 4) then { [objNull, player, rSwitchMove,"GetOver"] call RE; player playActionNow "GetOver"; dayz_lastCheckBit = diag_tickTime; diff --git a/SQF/dayz_code/compile/player_packTent.sqf b/SQF/dayz_code/compile/player_packTent.sqf index 4a50ba03c..3fb4727f1 100644 --- a/SQF/dayz_code/compile/player_packTent.sqf +++ b/SQF/dayz_code/compile/player_packTent.sqf @@ -4,7 +4,7 @@ if (dayz_actionInProgress) exitWith {localize "str_player_actionslimit" call dayz_rollingMessages;}; dayz_actionInProgress = true; -private ["_alreadyPacking","_backpacks","_bag","_campItems","_countr","_dir","_holder","_magazines","_obj","_objWpnQty","_objWpnTypes","_objectID","_objectUID","_ownerID","_packobj","_playerNear","_pos","_weapons"]; +private ["_alreadyPacking","_backpacks","_bag","_campItems","_countr","_dir","_holder","_magazines","_obj","_objWpnQty","_objWpnTypes","_objectID","_objectUID","_ownerID","_packobj","_playerNear","_pos","_weapons","_finished"]; _obj = _this; _ownerID = _obj getVariable["CharacterID","0"]; @@ -14,10 +14,6 @@ if (DZE_permanentPlot) then { _ownerID = _obj getVariable["ownerPUID","0"]; }; -// Make sure you are the closest player to the tent -_playerNear = _obj call dze_isnearest_player; -if (_playerNear) exitWith {dayz_actionInProgress = false; localize "str_epoch_player_16" call dayz_rollingMessages;}; - // Make sure no other players are nearby _playerNear = {isPlayer _x} count (([_obj] call FNC_GetPos) nearEntities ["CAManBase",10]) > 1; if (_playerNear) exitWith {dayz_actionInProgress = false; localize "str_pickup_limit_5" call dayz_rollingMessages;}; @@ -32,7 +28,6 @@ s_player_packtentinfected = -1; _campItems = ["IC_DomeTent","IC_Tent"]; if (_ownerID in [dayz_characterID,dayz_playerUID] or typeOf _obj in _campItems) then { - player playActionNow "Medic"; _alreadyPacking = _obj getVariable["packing",0]; if (_alreadyPacking == 1) exitWith {localize "str_player_beingpacked" call dayz_rollingMessages;}; @@ -42,7 +37,10 @@ if (_ownerID in [dayz_characterID,dayz_playerUID] or typeOf _obj in _campItems) [player,"tentpack",0,false,20] call dayz_zombieSpeak; [player,20,true,getPosATL player] call player_alertZombies; - uiSleep 3; + + _finished = ["Medic",1] call fn_loopAction; + if (isNull _obj) exitWith {}; + if (!_finished) exitWith {_obj setVariable["packing",0,true];}; //place tent (local) _bag = createVehicle [_packobj, _pos, [], 0, "CAN_COLLIDE"]; diff --git a/SQF/dayz_code/compile/player_packVault.sqf b/SQF/dayz_code/compile/player_packVault.sqf index f920ae8d0..05bc0da38 100644 --- a/SQF/dayz_code/compile/player_packVault.sqf +++ b/SQF/dayz_code/compile/player_packVault.sqf @@ -1,7 +1,7 @@ /* [_obj] spawn player_packVault; */ -private ["_obj","_ownerID","_objectID","_objectUID","_alreadyPacking","_location1","_location2","_packedClass","_text","_playerNear"]; +private ["_obj","_ownerID","_objectID","_objectUID","_location1","_location2","_packedClass","_text","_playerNear","_finished"]; if (dayz_actionInProgress) exitWith {localize "str_epoch_player_15" call dayz_rollingMessages;}; dayz_actionInProgress = true; @@ -13,6 +13,7 @@ _text = getText (configFile >> "CfgVehicles" >> (typeOf _obj) >> "displayName"); // Silently exit if object no longer exists if (isNull _obj || !(alive _obj)) exitWith { dayz_actionInProgress = false; }; +// Server_handleSafeGear runs unscheduled and exits if object is null, so more secure check is not needed _playerNear = _obj call dze_isnearest_player; if (_playerNear) exitWith {dayz_actionInProgress = false; localize "str_epoch_player_16" call dayz_rollingMessages;}; @@ -29,10 +30,6 @@ if (_objectID == "0" && _objectUID == "0") exitWith {dayz_actionInProgress = fal if (!_ComboMatch && (_ownerID != dayz_playerUID)) exitWith { dayz_actionInProgress = false; s_player_packvault = -1; format[localize "str_epoch_player_119",_text] call dayz_rollingMessages;}; -_alreadyPacking = _obj getVariable["packing",0]; -if (_alreadyPacking == 1) exitWith {dayz_actionInProgress = false; s_player_packvault = -1; format[localize "str_epoch_player_120",_text] call dayz_rollingMessages;}; -_obj setVariable["packing",1]; - format[localize "str_epoch_player_121",_text] call dayz_rollingMessages; uiSleep 1; _location1 = getPosATL player; @@ -41,18 +38,18 @@ _location2 = getPosATL player; if(_location1 distance _location2 > 0.1) exitWith { format[localize "str_epoch_player_122",_text] call dayz_rollingMessages; - _obj setVariable["packing",0]; s_player_packvault = -1; dayz_actionInProgress = false; }; if (!isNull _obj && alive _obj) then { - ["Working",0,[3,2,4,0]] call dayz_NutritionSystem; - player playActionNow "Medic"; [player,"tentpack",0,false] call dayz_zombieSpeak; - uiSleep 3; - disableUserInput true; // Make sure player can not modify gear while it is being added + _finished = ["Medic",1] call fn_loopAction; + if (isNull _obj or !_finished) exitWith {}; + + ["Working",0,[3,2,4,0]] call dayz_NutritionSystem; + (findDisplay 106) closeDisplay 0; // Close gear dze_waiting = nil; @@ -62,7 +59,6 @@ if (!isNull _obj && alive _obj) then { publicVariableServer "PVDZE_handleSafeGear"; //wait for response from server to verify pack was logged and gear added before proceeding waitUntil {!isNil "dze_waiting"}; - disableUserInput false; // Gear is done being added now format[localize "str_epoch_player_123",_text] call dayz_rollingMessages; }; diff --git a/SQF/dayz_code/compile/player_upgradeVehicle.sqf b/SQF/dayz_code/compile/player_upgradeVehicle.sqf index 7feb9c705..c4f881786 100644 --- a/SQF/dayz_code/compile/player_upgradeVehicle.sqf +++ b/SQF/dayz_code/compile/player_upgradeVehicle.sqf @@ -2,7 +2,7 @@ DayZ Epoch Vehicle Upgrades Made for DayZ Unleashed by [VB]AWOL please ask permission to use/edit/distrubute email vbawol@veteranbastards.com. */ -private ["_proceed","_itemIn","_countIn","_missing","_missingQty","_qty","_removed","_tobe_removed_total","_textMissing","_num_removed","_removed_total","_temp_removed_array","_countr","_objectID","_objectUID","_location","_dir","_objectCharacterID","_weapons","_magazines","_backpacks","_classname","_object","_holder","_objWpnTypes","_objWpnQty","_newclassname","_requirements","_upgrade","_vehicle","_findNearestVehicles","_findNearestVehicle","_IsNearVehicle"]; +private ["_proceed","_itemIn","_countIn","_missing","_missingQty","_qty","_removed","_tobe_removed_total","_textMissing","_num_removed","_removed_total","_objectID","_objectUID","_location","_dir","_objectCharacterID","_classname","_newclassname","_upgrade","_vehicle","_findNearestVehicles","_findNearestVehicle","_IsNearVehicle","_finished","_temp_removed_array_mag","_temp_removed_array_wep"]; if (dayz_actionInProgress) exitWith {localize "STR_EPOCH_PLAYER_52" call dayz_rollingMessages;}; dayz_actionInProgress = true; @@ -32,7 +32,7 @@ if (_IsNearVehicle >= 1) then { _classname = typeOf _vehicle; - // lookup vehicle && find if any upgrades are available + // lookup vehicle and find if any upgrades are available _upgrade = getArray (configFile >> "CfgVehicles" >> _classname >> "Upgrades" >> _upgrade); if (!isNil "_upgrade" && (count _upgrade) > 0) then { @@ -59,9 +59,9 @@ if (_IsNearVehicle >= 1) then { } forEach _requirementsWeapon; if (_proceed) then { - - player playActionNow "Medic"; [player,20,true,(getPosATL player)] spawn player_alertZombies; + _finished = ["Medic",1] call fn_loopAction; + if (!_finished) exitWith {}; _temp_removed_array_mag = []; _temp_removed_array_wep = []; diff --git a/SQF/dayz_code/init/compiles.sqf b/SQF/dayz_code/init/compiles.sqf index d6f3892a3..cdc157c19 100644 --- a/SQF/dayz_code/init/compiles.sqf +++ b/SQF/dayz_code/init/compiles.sqf @@ -19,6 +19,7 @@ if (!isDedicated) then { fn_dropItem = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_dropItem.sqf"; fn_dynamicTool = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_dynamicTool.sqf"; fn_exitSwim = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_exitSwim.sqf"; + fn_loopAction = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_loopAction.sqf"; fn_nearWaterHole = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_nearWaterHole.sqf"; player_zombieCheck = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_zombieCheck.sqf"; //Run on a players computer, checks if the player is near a zombie player_zombieAttack = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_zombieAttack.sqf"; //Run on a players computer, causes a nearby zombie to attack them diff --git a/SQF/dayz_code/init/variables.sqf b/SQF/dayz_code/init/variables.sqf index 973ced72e..81eb01680 100644 --- a/SQF/dayz_code/init/variables.sqf +++ b/SQF/dayz_code/init/variables.sqf @@ -165,7 +165,6 @@ dayz_resetSelfActions = { s_player_fire = -1; s_player_cook = -1; s_player_boil = -1; - s_player_fireout = -1; s_player_packtent = -1; s_player_packtentinfected = -1; s_player_fillfuel = -1; @@ -307,7 +306,6 @@ r_antiB_done = false; r_antiD_done = false; carryClick = false; dayz_actionInProgress = false; -dayz_workingInprogress = false; gear_done = false; //player warming up vars @@ -650,8 +648,6 @@ if (!isDedicated) then { dayzState = -1; dayz_onBack = ""; dayz_fishingInprogress = false; - dayz_siphonFuelInProgress = false; - dayz_salvageInProgress = false; lastSpawned = diag_tickTime; lastSepsis = 0; NORRN_dropAction = -1; diff --git a/SQF/dayz_code/medical/bandage.sqf b/SQF/dayz_code/medical/bandage.sqf index 480743cfb..b57416f03 100644 --- a/SQF/dayz_code/medical/bandage.sqf +++ b/SQF/dayz_code/medical/bandage.sqf @@ -1,47 +1,25 @@ -private ["_started","_finished","_animState","_isMedic","_id","_unit","_item"]; +private ["_finished","_id","_unit","_item"]; _unit = (_this select 3) select 0; _item = (_this select 3) select 1; +if (dayz_actionInProgress) exitWith {localize "str_player_actionslimit" call dayz_rollingMessages;}; +dayz_actionInProgress = true; + player removeMagazine _item; closedialog 0; call fnc_usec_medic_removeActions; r_action = false; -if (vehicle player == player) then { - //not in a vehicle - player playActionNow "Medic"; -}; - -r_interrupt = false; -_animState = animationState player; -r_doLoop = true; -_started = false; -_finished = false; [player,"bandage",0,false] call dayz_zombieSpeak; -while {r_doLoop} do { - _animState = animationState player; - _isMedic = ["medic",_animState] call fnc_inString; - if (_isMedic) then { - _started = true; - }; - if (_started and !_isMedic) then { - r_doLoop = false; - _finished = true; - }; - if (r_interrupt) then { - r_doLoop = false; - }; - if (vehicle player != player) then { - uiSleep 3; - r_doLoop = false; - _finished = true; - }; - uiSleep 0.1; +if (vehicle player != player) then { + uiSleep 3; + _finished = true; +} else { + _finished = ["Medic",1] call fn_loopAction; }; -r_doLoop = false; if (_finished) then { if ((_unit == player) or (vehicle player != player)) then { @@ -58,8 +36,7 @@ if (_finished) then { [20,0] call player_humanityChange; }; } else { - r_interrupt = false; - [objNull, player, rSwitchMove,""] call RE; - player playActionNow "stop"; player addMagazine _item; -}; \ No newline at end of file +}; + +dayz_actionInProgress = false; \ No newline at end of file diff --git a/SQF/dayz_code/medical/brokeBones.sqf b/SQF/dayz_code/medical/brokeBones.sqf index 38aaf945b..33142668d 100644 --- a/SQF/dayz_code/medical/brokeBones.sqf +++ b/SQF/dayz_code/medical/brokeBones.sqf @@ -1,46 +1,24 @@ -private ["_started","_finished","_animState","_isMedic","_id","_unit","_item","_humanityGain"]; +private ["_finished","_id","_unit","_item","_humanityGain"]; _unit = (_this select 3) select 0; _item = (_this select 3) select 1; +if (dayz_actionInProgress) exitWith {localize "str_player_actionslimit" call dayz_rollingMessages;}; +dayz_actionInProgress = true; + player removeMagazine _item; -_unit setVariable ["hit_legs",0]; -_unit setVariable ["hit_hands",0]; - if (vehicle player == player) then { - //not in a vehicle - player playActionNow "Medic"; + _finished = ["Medic",1] call fn_loopAction; +} else { + uiSleep 3; + _finished = true; }; -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 and !_isMedic) then { - r_doLoop = false; - _finished = true; - }; - if (r_interrupt) then { - r_doLoop = false; - }; - if (vehicle player != player) then { - uiSleep 3; - r_doLoop = false; - _finished = true; - }; - uiSleep 0.1; -}; -r_doLoop = false; - if (_finished) then { + _unit setVariable ["hit_legs",0]; + _unit setVariable ["hit_hands",0]; + if (_unit == player) then { //give to player, Ie the player fixed himself @@ -65,7 +43,6 @@ if (_finished) then { publicVariableServer "PVDZ_send"; } else { player addMagazine _item; - r_interrupt = false; - [objNull, player, rSwitchMove,""] call RE; - player playActionNow "stop"; -}; \ No newline at end of file +}; + +dayz_actionInProgress = false; \ No newline at end of file diff --git a/SQF/dayz_code/medical/epinephrine.sqf b/SQF/dayz_code/medical/epinephrine.sqf index 203c7a655..858484b7d 100644 --- a/SQF/dayz_code/medical/epinephrine.sqf +++ b/SQF/dayz_code/medical/epinephrine.sqf @@ -1,17 +1,18 @@ -// bleed.sqf +private ["_finished","_isDead","_unit"]; + _unit = (_this select 3) select 0; _isDead = _unit getVariable["USEC_isDead",false]; call fnc_usec_medic_removeActions; -player removeMagazine "ItemEpinephrine"; -player playActionNow "Medic"; +if (dayz_actionInProgress) exitWith {localize "str_player_actionslimit" call dayz_rollingMessages;}; +dayz_actionInProgress = true; -uiSleep 3; +_finished = ["Medic",1] call fn_loopAction; -if (!_isDead) then { +if (!_isDead && _finished && ("ItemEpinephrine" in magazines player)) then { + player removeMagazine "ItemEpinephrine"; _unit setVariable ["NORRN_unconscious", false, true]; _unit setVariable ["USEC_isCardiac",false,true]; - uiSleep 5; //give humanity [25,0] call player_humanityChange; @@ -20,4 +21,5 @@ if (!_isDead) then { publicVariableServer "PVDZ_send"; }; -r_action = false; \ No newline at end of file +r_action = false; +dayz_actionInProgress = false; \ No newline at end of file diff --git a/SQF/dayz_code/medical/morphine.sqf b/SQF/dayz_code/medical/morphine.sqf index a8eea213f..f38f0d511 100644 --- a/SQF/dayz_code/medical/morphine.sqf +++ b/SQF/dayz_code/medical/morphine.sqf @@ -1,47 +1,26 @@ -private ["_started","_finished","_animState","_isMedic","_id","_unit"]; +private ["_finished","_id","_unit"]; _unit = (_this select 3) select 0; -player removeMagazine "ItemMorphine"; +if (dayz_actionInProgress) exitWith {localize "str_player_actionslimit" call dayz_rollingMessages;}; +dayz_actionInProgress = true; -_unit setVariable ["hit_legs",0]; -_unit setVariable ["hit_hands",0]; +player removeMagazine "ItemMorphine"; call fnc_usec_medic_removeActions; r_action = false; if (vehicle player == player) then { - //not in a vehicle - player playActionNow "Medic"; + _finished = ["Medic",1] call fn_loopAction; +} else { + uiSleep 3; + _finished = true; }; -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 and !_isMedic) then { - r_doLoop = false; - _finished = true; - }; - if (r_interrupt) then { - r_doLoop = false; - }; - if (vehicle player != player) then { - uiSleep 3; - r_doLoop = false; - _finished = true; - }; - uiSleep 0.1; -}; -r_doLoop = false; if (_finished) then { -if ((_unit == player) or (vehicle player != player)) then { + _unit setVariable ["hit_legs",0]; + _unit setVariable ["hit_hands",0]; + + if ((_unit == player) or (vehicle player != player)) then { //Self Healing _id = [player,player] execVM "\z\addons\dayz_code\medical\publicEH\medMorphine.sqf"; } else { @@ -55,7 +34,6 @@ if ((_unit == player) or (vehicle player != player)) then { publicVariableServer "PVDZ_send"; } else { player addMagazine "ItemMorphine"; - r_interrupt = false; - [objNull, player, rSwitchMove,""] call RE; - player playActionNow "stop"; -}; \ No newline at end of file +}; + +dayz_actionInProgress = false; \ No newline at end of file diff --git a/SQF/dayz_code/medical/wipes.sqf b/SQF/dayz_code/medical/wipes.sqf index ddd6260ab..1fee083be 100644 --- a/SQF/dayz_code/medical/wipes.sqf +++ b/SQF/dayz_code/medical/wipes.sqf @@ -1,42 +1,22 @@ -private ["_started","_finished","_animState","_isMedic","_id","_unit"]; +private ["_finished","_unit"]; _unit = (_this select 3) select 0; + +if (dayz_actionInProgress) exitWith {localize "str_player_actionslimit" call dayz_rollingMessages;}; +dayz_actionInProgress = true; + player removeMagazine "ItemAntibacterialWipe"; call fnc_usec_medic_removeActions; r_action = false; -if (vehicle player == player) then { - //not in a vehicle - player playActionNow "Medic"; -}; - -r_interrupt = false; -_animState = animationState player; -r_doLoop = true; -_started = false; -_finished = false; [player,"bandage",0,false] call dayz_zombieSpeak; -while {r_doLoop} do { - _animState = animationState player; - _isMedic = ["medic",_animState] call fnc_inString; - if (_isMedic) then { - _started = true; - }; - if (_started and !_isMedic) then { - r_doLoop = false; - _finished = true; - }; - if (r_interrupt) then { - r_doLoop = false; - }; - if (vehicle player != player) then { - uiSleep 3; - r_doLoop = false; - _finished = true; - }; - uiSleep 0.1; + +if (vehicle player == player) then { + _finished = ["Medic",1] call fn_loopAction; +} else { + uiSleep 3; + _finished = true; }; -r_doLoop = false; if (_finished) then { //["PVCDZ_hlt_Bandage",[_unit,player]] call broadcastRpcCallAll; @@ -52,8 +32,7 @@ if (_finished) then { player setVariable ["sepsisStarted", nil]; }; } else { - r_interrupt = false; - [objNull, player, rSwitchMove,""] call RE; - player playActionNow "stop"; player addMagazine "ItemAntibacterialWipe"; -}; \ No newline at end of file +}; + +dayz_actionInProgress = false; \ No newline at end of file diff --git a/SQF/dayz_code/stringtable.xml b/SQF/dayz_code/stringtable.xml index 79d66471c..a1b70c5bd 100644 --- a/SQF/dayz_code/stringtable.xml +++ b/SQF/dayz_code/stringtable.xml @@ -167,14 +167,6 @@ Upéct jídlo Cuire la Nourriture - - Remove fireplace - Feuerstelle zerstören - Убрать костер - Remover Fogata - Retirer le Feu de camp - Odstranit ohniště - Pack Tent Zelt abbauen @@ -1133,15 +1125,6 @@ Création de %1 réussie Úspěšně jste vyrobili %1 - - Salvage already in progress. - La recuperación ya está en curso. - Демонтаж в процессе. - Demontáž již probíhá. - Récupération déjà en cours. - Die Demontage läuft bereits. - Reeds bezig met bergen. - You have destroyed %1 while attempting to remove from %2 @@ -1271,15 +1254,6 @@ Siphonner le réservoir Treibstoff aus Tank abzapfen - - Siphon already in progress. - Сливаем топливо. - El sifón ya está en progreso. - Přečerpávání již probíhá. - Siphonnage en cours. - Der Treibstoff fließt bereits ab. - Reeds bezig met brandstofverplaatsing. - Preparing to siphon, stand still to fill %1. @@ -1438,14 +1412,6 @@ Impossible de mettre le feu, pas de carburant. Ohne Benzin kannst du das nicht anzünden. - - This tent is already being set on fire. - Эта палатка уже горит. - Esta tienda de campaña ya está siendo incendiada. - Tento stan je již zapálen. - Cette tente est déjà en feu. - Das Zelt brennt schon. - Resting interrupted, proceeding to stand up. Отдых прерван, встаем... @@ -1631,13 +1597,6 @@ Vylepšení dokončeno. Erweiterung durchgeführt. - - Object is already upgrading - Объект уже улучшается. - L'amélioration est déjà en cours - Objekt je právě vylepšován. - Dieses Objekt wird gerade erweitert. - Object has no upgrade option. Объект нельзя улучшить. @@ -6630,22 +6589,6 @@ Vous avez réussi à détruire une tente. Úspěšně jste zničili stan. - - You have pitched your tent - Du hast das Zelt erfolgreich aufgeschlagen. - Вы установили палатку. - Asentaste tu carpa. - Vous avez installé votre tente. - Postavili jste stan. - - - You cannot place a Tent here. The area must be flat, and free of other objects - Du kannst hier kein Zelt aufbauen, da der Untergrund nicht flach und frei von Hindernissen ist. - Палатку нужно ставить на ровную поверхность, без объектов поблизости. - No puedes asentar tu carpa aquí. El área debe ser plana y libre de otros objetos. - Vous ne pouvez pas placer de tente ici. Le sol doit être plat et dégagé. - Stan zde nelze postavit. Plocha musí být rovná a dostatečně veliká. - You have created a %1. Du hast eine %1 hergestellt. @@ -6734,14 +6677,6 @@ Vous ne pouvez pas faire de feu de camp ici. Le sol doit être plat et dégagé. Ohniště zde nelze postavit. Plocha musí být rovná a dostatečně veliká. - - Fireplace has been removed - Die Feuerstelle wurde abgebaut. - Костер убран. - La fogata fue removida. - Le feu de camp a été retiré. - Ohniště bylo odstraněno. - %1 has been gutted, %2 meat steaks now on the carcass Du hast das Tier (%1) ausgenommen. Vom verbleibenden Fleisch kannst du %2 Stücke abschneiden. @@ -7151,11 +7086,6 @@ V blízkosti nejsou žádné skály. Es befinden sich keine Felsen in der Nähe. - - Mining already in progress! - Добыча в процессе! - Du bist bereits dabei etwas abzubauen! - Cannot add %1 to back. No se pudo agregar %1 a la espalda. @@ -7400,14 +7330,6 @@ Utilisez A et E pour tourner l'objet, et V pour le pencher. Použijte Q a E pro rotaci objektu, V pro naklopení. Poté vyberte vámi požadovanou akci. - - You are moving too fast! - Du bewegst dich zu schnell! - Вы слишком быстро двигаетесь! - ¡Te estás moviendo muy rápido! - Vous vous déplacez trop vite! - Pohybujete se příliš rychle! - Complete Build Bau fertigstellen @@ -11891,14 +11813,6 @@ déjà en cours. již probíhá. - - Stop is already in progress. - Stoppen des Generators bereits im Gange. - Уже останавливается. - Bezig met stoppen. - L'arrêt est déjà en cours. - Zastavování již probíhá. - Preparing to stop generator, move to cancel. Generator wird abgeschaltet, bewege dich um den Vorgang abzubrechen. @@ -12003,14 +11917,6 @@ Vous ne pouvez pas emballer %1, vous n'en connaissez pas la combinaison. Nemůžete sbalit %1, neznáte správnou kombinaci. - - %1 is already being packed. - Diese(r) %1 wird bereits gepackt. - %1 уже запакован. - Deze %1 wordt al reeds ingepakt. - %1 est déjà en cours d'emballage. - Balení %1 již probíhá. - Packing %1, move from this position to cancel within 5 seconds. %1 wird gepackt. Bewege dich in den nächsten 5 Sekunden um den Vorgang abzubrechen. diff --git a/SQF/dayz_code/system/player_monitor.fsm b/SQF/dayz_code/system/player_monitor.fsm index a1d935213..0f73c1d5f 100644 --- a/SQF/dayz_code/system/player_monitor.fsm +++ b/SQF/dayz_code/system/player_monitor.fsm @@ -856,7 +856,6 @@ class FSM "" \n "//player variables" \n "dayz_characterID = _charID;" \n - "dayz_hasFire = objNull; //records players Fireplace object" \n "dayz_myCursorTarget = objNull;" \n "dayz_myPosition = getPosATL player; //Last recorded position" \n "dayz_lastMeal = (_lastAte * 60);" \n