mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-14 20:13:13 +03:00
Consolidate DZE_ActionInProgress and r_action_count to one variable
There is no point in having two variables for the same purpose. It is also pointless to keep an action count tally like r_action_count was doing, since it is only ever checked for being 0 or 1. Any count higher or lower than that is irrelevant. I will make this change in vanilla too.
This commit is contained in:
@@ -66,7 +66,7 @@ if(_todo == 1 || _todo == 0) then{
|
||||
[1,0] call fnc_vectorActionCleanup;
|
||||
[] spawn {
|
||||
while {true} do {
|
||||
if(!DZE_ActionInProgress || DZE_cancelBuilding) exitWith {[0,0] call fnc_vectorActionCleanup; vectorActionState = "CLOSE";};
|
||||
if(!dayz_actionInProgress || DZE_cancelBuilding) exitWith {[0,0] call fnc_vectorActionCleanup; vectorActionState = "CLOSE";};
|
||||
sleep 2;
|
||||
};
|
||||
};
|
||||
@@ -122,7 +122,7 @@ if(_todo == 2 || _todo == 0) then{
|
||||
[1,0] call fnc_degreeActionCleanup;
|
||||
[] spawn {
|
||||
while {true} do {
|
||||
if(!DZE_ActionInProgress || DZE_cancelBuilding) exitWith {[0,0] call fnc_degreeActionCleanup; degreeActionState = "CLOSE";};
|
||||
if(!dayz_actionInProgress || DZE_cancelBuilding) exitWith {[0,0] call fnc_degreeActionCleanup; degreeActionState = "CLOSE";};
|
||||
sleep 2;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -7,7 +7,7 @@ _toolCheck = _this select 2;
|
||||
_classname = getText (configFile >> "CfgMagazines" >> _item >> "ItemActions" >> "Build" >> "create");
|
||||
_requireplot = DZE_requireplot;
|
||||
// "Unable to build trader nearby."
|
||||
if (!canbuild) exitWith {DZE_ActionInProgress = false; format[localize "STR_EPOCH_PLAYER_136",localize "STR_EPOCH_TRADER"] call dayz_rollingMessages; [false, false];};
|
||||
if (!canbuild) exitWith {dayz_actionInProgress = false; format[localize "STR_EPOCH_PLAYER_136",localize "STR_EPOCH_TRADER"] call dayz_rollingMessages; [false, false];};
|
||||
|
||||
if(isNumber (configFile >> "CfgVehicles" >> _classname >> "requireplot")) then {
|
||||
_requireplot = getNumber(configFile >> "CfgVehicles" >> _classname >> "requireplot");
|
||||
@@ -27,7 +27,7 @@ _plotcheck = [player, false] call FNC_find_plots;
|
||||
_IsNearPlot = _plotcheck select 1;
|
||||
_nearestPole = _plotcheck select 2;
|
||||
|
||||
if(_isPole && {_IsNearPlot > 0}) exitWith {DZE_ActionInProgress = false; format[localize "str_epoch_player_44",_distance] call dayz_rollingMessages; [_canBuild, _isPole];};
|
||||
if(_isPole && {_IsNearPlot > 0}) exitWith {dayz_actionInProgress = false; format[localize "str_epoch_player_44",_distance] call dayz_rollingMessages; [_canBuild, _isPole];};
|
||||
|
||||
if(_IsNearPlot == 0) then {
|
||||
if (_requireplot == 0 || {_isLandFireDZ}) then {
|
||||
@@ -54,11 +54,11 @@ if(_IsNearPlot == 0) then {
|
||||
};
|
||||
};
|
||||
|
||||
if(!_canBuild) exitWith { DZE_ActionInProgress = false; format[localize "STR_EPOCH_PLAYER_135",_needText,_distance] call dayz_rollingMessages; [_canBuild, _isPole];};
|
||||
if(!_canBuild) exitWith { dayz_actionInProgress = false; format[localize "STR_EPOCH_PLAYER_135",_needText,_distance] call dayz_rollingMessages; [_canBuild, _isPole];};
|
||||
// Also count safes, lockboxes, vanilla buildables, tents and stashes against DZE_BuildingLimit
|
||||
_buildables = DZE_maintainClasses + DZE_LockableStorage + ["DZ_buildables","DZ_storage_base"];
|
||||
_center = if (isNull _nearestPole) then {_pos} else {_nearestPole};
|
||||
if ((count (nearestObjects [_center,_buildables,_distance])) >= DZE_BuildingLimit) exitWith {DZE_ActionInProgress = false; format[localize "str_epoch_player_41",_distance] call dayz_rollingMessages; [false, _isPole];};
|
||||
if ((count (nearestObjects [_center,_buildables,_distance])) >= DZE_BuildingLimit) exitWith {dayz_actionInProgress = false; format[localize "str_epoch_player_41",_distance] call dayz_rollingMessages; [false, _isPole];};
|
||||
|
||||
if (_toolCheck) then {
|
||||
_require = getArray (configFile >> "cfgMagazines" >> _item >> "ItemActions" >> "Build" >> "require");
|
||||
|
||||
@@ -30,8 +30,8 @@ _missingText = "";
|
||||
} forEach _missing;
|
||||
|
||||
_hasbuilditem = _item in magazines player;
|
||||
if (!_hasbuilditem) exitWith {DZE_ActionInProgress = false; format[localize "str_player_31",_text,"build"] call dayz_rollingMessages; false;};
|
||||
if (!_hasrequireditem) exitWith {DZE_ActionInProgress = false; format[localize "str_epoch_player_137",_missingText] call dayz_rollingMessages; false;};
|
||||
if (!_hasbuilditem) exitWith {dayz_actionInProgress = false; format[localize "str_player_31",_text,"build"] call dayz_rollingMessages; false;};
|
||||
if (!_hasrequireditem) exitWith {dayz_actionInProgress = false; format[localize "str_epoch_player_137",_missingText] call dayz_rollingMessages; false;};
|
||||
|
||||
//When calling this function in another script use a silent exitWith, unless you have something special to say. i.e. if (!_hasrequireditem) exitWith{};
|
||||
_hasrequireditem;
|
||||
@@ -1,5 +1,5 @@
|
||||
scriptName "Functions\misc\fn_damageActions.sqf";
|
||||
if (DZE_ActionInProgress) exitWith {};
|
||||
if (dayz_actionInProgress) exitWith {};
|
||||
#include "\z\addons\dayz_code\util\array.hpp";
|
||||
|
||||
/***********************************************************
|
||||
|
||||
@@ -4,7 +4,7 @@ scriptName "Functions\misc\fn_selfActions.sqf";
|
||||
- Function
|
||||
- [] call fnc_usec_selfActions;
|
||||
************************************************************/
|
||||
if (DZE_ActionInProgress) exitWith {};
|
||||
if (dayz_actionInProgress) exitWith {};
|
||||
private ["_canPickLight","_text","_dir","_canDoThis","_w2m","_bb","_waterHoles","_unlock","_lock","_totalKeys","_temp_keys","_temp_keys_names",
|
||||
"_hasKey","_oldOwner","_hasAttached","_isAnimal","_isZombie","_isHarvested","_isMan","_isFuel","_hasRawMeat","_hastinitem","_player_deleteBuild",
|
||||
"_player_lockUnlock_crtl","_displayName","_hasIgnators","_menu","_menu1","_allowTow","_liftHeli","_found","_posL","_posC","_height","_attached",
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
Made for DayZ Epoch please ask permission to use/edit/distrubute email vbawol@veteranbastards.com.
|
||||
*/
|
||||
private ["_obj","_ownerID","_alreadyPacking","_text","_playerNear","_ComboMatch","_objType"];
|
||||
if (DZE_ActionInProgress) exitWith {localize "str_epoch_player_10" call dayz_rollingMessages;};
|
||||
DZE_ActionInProgress = true;
|
||||
if (dayz_actionInProgress) exitWith {localize "str_epoch_player_10" call dayz_rollingMessages;};
|
||||
dayz_actionInProgress = true;
|
||||
|
||||
player removeAction s_player_lockvault;
|
||||
s_player_lockvault = 1;
|
||||
@@ -17,7 +17,7 @@ _lockedClass = getText (configFile >> "CfgVehicles" >> _objType >> "lockedClass"
|
||||
_text = getText (configFile >> "CfgVehicles" >> _objType >> "displayName");
|
||||
|
||||
// Silently exit if object no longer exists
|
||||
if (isNull _obj) exitWith { DZE_ActionInProgress = false; };
|
||||
if (isNull _obj) exitWith { dayz_actionInProgress = false; };
|
||||
["Working",0,[3,2,8,0]] call dayz_NutritionSystem;
|
||||
player playActionNow "Medic";
|
||||
uiSleep 1;
|
||||
@@ -25,16 +25,16 @@ uiSleep 1;
|
||||
uiSleep 5;
|
||||
|
||||
_playerNear = _obj call dze_isnearest_player;
|
||||
if (_playerNear) exitWith {DZE_ActionInProgress = false; localize "str_epoch_player_11" call dayz_rollingMessages;};
|
||||
if (_playerNear) exitWith {dayz_actionInProgress = false; localize "str_epoch_player_11" call dayz_rollingMessages;};
|
||||
|
||||
_ownerID = _obj getVariable["CharacterID","0"];
|
||||
_ComboMatch = (_ownerID == dayz_combination);
|
||||
if (DZE_permanentPlot) then {_ownerID = _obj getVariable["ownerPUID","0"];};
|
||||
|
||||
if (!_ComboMatch && (_ownerID != dayz_playerUID)) exitWith {DZE_ActionInProgress = false; s_player_lockvault = -1; format[localize "str_epoch_player_115",_text] call dayz_rollingMessages; };
|
||||
if (!_ComboMatch && (_ownerID != dayz_playerUID)) exitWith {dayz_actionInProgress = false; s_player_lockvault = -1; format[localize "str_epoch_player_115",_text] call dayz_rollingMessages; };
|
||||
|
||||
_alreadyPacking = _obj getVariable["packing",0];
|
||||
if (_alreadyPacking == 1) exitWith {DZE_ActionInProgress = false; s_player_lockvault = -1; format[localize "str_epoch_player_116",_text] call dayz_rollingMessages;};
|
||||
if (_alreadyPacking == 1) exitWith {dayz_actionInProgress = false; s_player_lockvault = -1; format[localize "str_epoch_player_116",_text] call dayz_rollingMessages;};
|
||||
_obj setVariable["packing",1];
|
||||
|
||||
if (!isNull _obj) then {
|
||||
@@ -53,4 +53,4 @@ if (!isNull _obj) then {
|
||||
format[localize "str_epoch_player_117",_text] call dayz_rollingMessages;
|
||||
};
|
||||
s_player_lockvault = -1;
|
||||
DZE_ActionInProgress = false;
|
||||
dayz_actionInProgress = false;
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
[_obj] call player_packTent;
|
||||
*/
|
||||
if (DZE_ActionInProgress) exitWith {localize "str_player_beingpacked" call dayz_rollingMessages;};
|
||||
DZE_ActionInProgress = true;
|
||||
if (dayz_actionInProgress) exitWith {localize "str_player_beingpacked" call dayz_rollingMessages;};
|
||||
dayz_actionInProgress = true;
|
||||
_obj = _this;
|
||||
_ownerID = _obj getVariable["CharacterID","0"];
|
||||
_objectID = _obj getVariable["ObjectID","0"];
|
||||
@@ -24,7 +24,7 @@ _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; DZE_ActionInProgress = false;};
|
||||
if (_alreadyPacking == 1) exitWith {localize "str_player_beingpacked" call dayz_rollingMessages; dayz_actionInProgress = false;};
|
||||
|
||||
_obj setVariable["packing",1];
|
||||
_dir = direction _obj;
|
||||
@@ -82,4 +82,4 @@ if (_ownerID in [dayz_characterID,dayz_playerUID] or typeOf _obj in _campItems)
|
||||
} else {
|
||||
localize "str_fail_tent_pack" call dayz_rollingMessages;
|
||||
};
|
||||
DZE_ActionInProgress = false;
|
||||
dayz_actionInProgress = false;
|
||||
@@ -3,18 +3,18 @@
|
||||
*/
|
||||
private ["_obj","_ownerID","_objectID","_objectUID","_alreadyPacking","_location1","_location2","_packedClass","_text","_playerNear"];
|
||||
|
||||
if (DZE_ActionInProgress) exitWith {localize "str_epoch_player_15" call dayz_rollingMessages;};
|
||||
DZE_ActionInProgress = true;
|
||||
if (dayz_actionInProgress) exitWith {localize "str_epoch_player_15" call dayz_rollingMessages;};
|
||||
dayz_actionInProgress = true;
|
||||
|
||||
_obj = _this;
|
||||
_packedClass = getText (configFile >> "CfgVehicles" >> (typeOf _obj) >> "packedClass");
|
||||
_text = getText (configFile >> "CfgVehicles" >> (typeOf _obj) >> "displayName");
|
||||
|
||||
// Silently exit if object no longer exists
|
||||
if (isNull _obj || !(alive _obj)) exitWith { DZE_ActionInProgress = false; };
|
||||
if (isNull _obj || !(alive _obj)) exitWith { dayz_actionInProgress = false; };
|
||||
|
||||
_playerNear = _obj call dze_isnearest_player;
|
||||
if (_playerNear) exitWith {DZE_ActionInProgress = false; localize "str_epoch_player_16" call dayz_rollingMessages;};
|
||||
if (_playerNear) exitWith {dayz_actionInProgress = false; localize "str_epoch_player_16" call dayz_rollingMessages;};
|
||||
|
||||
_ownerID = _obj getVariable["CharacterID","0"];
|
||||
_objectID = _obj getVariable["ObjectID","0"];
|
||||
@@ -25,12 +25,12 @@ if (DZE_permanentPlot) then {_ownerID = _obj getVariable["ownerPUID","0"];};
|
||||
player removeAction s_player_packvault;
|
||||
s_player_packvault = 1;
|
||||
|
||||
if (_objectID == "0" && _objectUID == "0") exitWith {DZE_ActionInProgress = false; s_player_packvault = -1; format[localize "str_epoch_player_118",_text] call dayz_rollingMessages;};
|
||||
if (_objectID == "0" && _objectUID == "0") exitWith {dayz_actionInProgress = false; s_player_packvault = -1; format[localize "str_epoch_player_118",_text] call dayz_rollingMessages;};
|
||||
|
||||
if (!_ComboMatch && (_ownerID != dayz_playerUID)) exitWith { DZE_ActionInProgress = false; s_player_packvault = -1; format[localize "str_epoch_player_119",_text] call dayz_rollingMessages;};
|
||||
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 {DZE_ActionInProgress = false; s_player_packvault = -1; format[localize "str_epoch_player_120",_text] call dayz_rollingMessages;};
|
||||
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;
|
||||
@@ -43,7 +43,7 @@ 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;
|
||||
DZE_ActionInProgress = false;
|
||||
dayz_actionInProgress = false;
|
||||
};
|
||||
|
||||
if (!isNull _obj && alive _obj) then {
|
||||
@@ -67,4 +67,4 @@ if (!isNull _obj && alive _obj) then {
|
||||
format[localize "str_epoch_player_123",_text] call dayz_rollingMessages;
|
||||
};
|
||||
s_player_packvault = -1;
|
||||
DZE_ActionInProgress = false;
|
||||
dayz_actionInProgress = false;
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
*/
|
||||
private ["_obj","_ownerID","_alreadyPacking","_playerNear","_claimedBy","_text","_objType","_ComboMatch"];
|
||||
|
||||
if (DZE_ActionInProgress) exitWith {localize "str_epoch_player_21" call dayz_rollingMessages;};
|
||||
DZE_ActionInProgress = true;
|
||||
if (dayz_actionInProgress) exitWith {localize "str_epoch_player_21" call dayz_rollingMessages;};
|
||||
dayz_actionInProgress = true;
|
||||
|
||||
{player removeAction _x} count s_player_combi;
|
||||
s_player_combi = [];
|
||||
@@ -17,14 +17,14 @@ _objType = typeOf _obj;
|
||||
|
||||
if !(_objType in DZE_LockedStorage) exitWith {
|
||||
s_player_unlockvault = -1;
|
||||
DZE_ActionInProgress = false;
|
||||
dayz_actionInProgress = false;
|
||||
};
|
||||
|
||||
_playerNear = _obj call dze_isnearest_player;
|
||||
if (_playerNear) exitWith {DZE_ActionInProgress = false; localize "str_epoch_player_20" call dayz_rollingMessages;};
|
||||
if (_playerNear) exitWith {dayz_actionInProgress = false; localize "str_epoch_player_20" call dayz_rollingMessages;};
|
||||
|
||||
// Silently exit if object no longer exists || alive
|
||||
if (isNull _obj || !(alive _obj)) exitWith { DZE_ActionInProgress = false; };
|
||||
if (isNull _obj || !(alive _obj)) exitWith { dayz_actionInProgress = false; };
|
||||
|
||||
_unlockedClass = getText (configFile >> "CfgVehicles" >> _objType >> "unlockedClass");
|
||||
_text = getText (configFile >> "CfgVehicles" >> _objType >> "displayName");
|
||||
@@ -35,7 +35,7 @@ _ownerID = _obj getVariable["CharacterID","0"];
|
||||
_ComboMatch = (_ownerID == dayz_combination);
|
||||
if (DZE_permanentPlot) then {_ownerID = _obj getVariable["ownerPUID","0"];};
|
||||
|
||||
if (_alreadyPacking == 1) exitWith {DZE_ActionInProgress = false; format[localize "str_epoch_player_124",_text] call dayz_rollingMessages;};
|
||||
if (_alreadyPacking == 1) exitWith {dayz_actionInProgress = false; format[localize "str_epoch_player_124",_text] call dayz_rollingMessages;};
|
||||
|
||||
if (_ComboMatch || (_ownerID == dayz_playerUID)) then {
|
||||
// Check if any players are nearby if not allow player to claim item.
|
||||
@@ -73,7 +73,7 @@ if (_ComboMatch || (_ownerID == dayz_playerUID)) then {
|
||||
format[localize "STR_BLD_UNLOCKED",_text] call dayz_rollingMessages;
|
||||
};
|
||||
} else {
|
||||
DZE_ActionInProgress = false;
|
||||
dayz_actionInProgress = false;
|
||||
format[localize "str_player_beinglooted",_text] call dayz_rollingMessages;
|
||||
};
|
||||
} else {
|
||||
@@ -86,4 +86,4 @@ if (_ComboMatch || (_ownerID == dayz_playerUID)) then {
|
||||
format[localize "STR_BLD_WRONG_COMBO",_text] call dayz_rollingMessages;
|
||||
};
|
||||
s_player_unlockvault = -1;
|
||||
DZE_ActionInProgress = false;
|
||||
dayz_actionInProgress = false;
|
||||
|
||||
@@ -4,13 +4,13 @@
|
||||
*/
|
||||
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"];
|
||||
|
||||
if (DZE_ActionInProgress) exitWith {localize "STR_EPOCH_PLAYER_52" call dayz_rollingMessages;};
|
||||
DZE_ActionInProgress = true;
|
||||
if (dayz_actionInProgress) exitWith {localize "STR_EPOCH_PLAYER_52" call dayz_rollingMessages;};
|
||||
dayz_actionInProgress = true;
|
||||
|
||||
// This is used to find correct upgrade based what upgrades was called allows multiple upgrades per vehicle.
|
||||
_upgrade = _this;
|
||||
|
||||
if (vehicle player != player) exitWith {DZE_ActionInProgress = false; localize "STR_EPOCH_ACTIONS_18" call dayz_rollingMessages;};
|
||||
if (vehicle player != player) exitWith {dayz_actionInProgress = false; localize "STR_EPOCH_ACTIONS_18" call dayz_rollingMessages;};
|
||||
|
||||
// look for nearest empty vehicle
|
||||
_findNearestVehicles = player nearEntities [["LandVehicle"],10];
|
||||
@@ -155,4 +155,4 @@ else {
|
||||
localize "STR_EPOCH_PLAYER_27" call dayz_rollingMessages;
|
||||
};
|
||||
|
||||
DZE_ActionInProgress = false;
|
||||
dayz_actionInProgress = false;
|
||||
|
||||
Reference in New Issue
Block a user