mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-14 04:02:37 +03:00
Add playerNear check to downgrading
Fixes dupe while downgrading locked doors, thanks @Shu for reporting
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
DayZ Base Building Upgrades
|
DayZ Base Building Upgrades
|
||||||
Made for DayZ Epoch please ask permission to use/edit/distrubute email vbawol@veteranbastards.com.
|
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","_finished"];
|
private ["_location","_dir","_classname","_text","_object","_objectID","_objectUID","_newclassname","_refund","_obj","_upgrade","_objectCharacterID","_ownerID","_i","_invResult","_itemOut","_countOut","_abortInvAdd","_addedItems","_finished","_playerNear"];
|
||||||
|
|
||||||
if (dayz_actionInProgress) exitWith {localize "str_epoch_player_48" call dayz_rollingMessages;};
|
if (dayz_actionInProgress) exitWith {localize "str_epoch_player_48" call dayz_rollingMessages;};
|
||||||
dayz_actionInProgress = true;
|
dayz_actionInProgress = true;
|
||||||
@@ -10,49 +10,41 @@ dayz_actionInProgress = true;
|
|||||||
player removeAction s_player_downgrade_build;
|
player removeAction s_player_downgrade_build;
|
||||||
s_player_downgrade_build = 1;
|
s_player_downgrade_build = 1;
|
||||||
|
|
||||||
// get cursortarget from addaction
|
|
||||||
_obj = _this select 3;
|
_obj = _this select 3;
|
||||||
|
|
||||||
// Current charID
|
_objectCharacterID = _obj getVariable ["CharacterID","0"];
|
||||||
_objectCharacterID = _obj getVariable ["CharacterID","0"];
|
|
||||||
|
|
||||||
|
|
||||||
if (DZE_Lock_Door != _objectCharacterID) exitWith {dayz_actionInProgress = false; localize "str_epoch_player_49" call dayz_rollingMessages;};
|
if (DZE_Lock_Door != _objectCharacterID) exitWith {dayz_actionInProgress = false; localize "str_epoch_player_49" call dayz_rollingMessages;};
|
||||||
|
|
||||||
// Find objectID
|
_playerNear = {isPlayer _x} count (([_obj] call FNC_GetPos) nearEntities ["CAManBase", 10]) > 1;
|
||||||
_objectID = _obj getVariable ["ObjectID","0"];
|
if (_playerNear) exitWith {dayz_actionInProgress = false; localize "str_pickup_limit_5" call dayz_rollingMessages;};
|
||||||
|
|
||||||
// Find objectUID
|
_objectID = _obj getVariable ["ObjectID","0"];
|
||||||
_objectUID = _obj getVariable ["ObjectUID","0"];
|
_objectUID = _obj getVariable ["ObjectUID","0"];
|
||||||
|
|
||||||
if (_objectID == "0" && _objectUID == "0") exitWith {dayz_actionInProgress = false; s_player_upgrade_build = -1; localize "str_epoch_player_50" call dayz_rollingMessages;};
|
if (_objectID == "0" && _objectUID == "0") exitWith {dayz_actionInProgress = false; s_player_upgrade_build = -1; localize "str_epoch_player_50" call dayz_rollingMessages;};
|
||||||
|
|
||||||
// Get classname
|
|
||||||
_classname = typeOf _obj;
|
_classname = typeOf _obj;
|
||||||
|
|
||||||
// Find display name
|
|
||||||
_text = getText (configFile >> "CfgVehicles" >> _classname >> "displayName");
|
_text = getText (configFile >> "CfgVehicles" >> _classname >> "displayName");
|
||||||
|
|
||||||
// Find next upgrade
|
|
||||||
_upgrade = getArray (configFile >> "CfgVehicles" >> _classname >> "downgradeBuilding");
|
_upgrade = getArray (configFile >> "CfgVehicles" >> _classname >> "downgradeBuilding");
|
||||||
|
|
||||||
if ((count _upgrade) > 0) then {
|
if ((count _upgrade) > 0) then {
|
||||||
_newclassname = _upgrade select 0;
|
_newclassname = _upgrade select 0;
|
||||||
_refund = _upgrade select 1;
|
_refund = _upgrade select 1;
|
||||||
|
|
||||||
[player,20,true,(getPosATL player)] spawn player_alertZombies;
|
[player,20,true,(getPosATL player)] spawn player_alertZombies;
|
||||||
|
|
||||||
_finished = ["Medic",1] call fn_loopAction;
|
_finished = ["Medic",1] call fn_loopAction;
|
||||||
if (!_finished) exitWith {};
|
if (!_finished) exitWith {};
|
||||||
|
|
||||||
["Working",0,[3,2,4,0]] call dayz_NutritionSystem;
|
["Working",0,[3,2,4,0]] call dayz_NutritionSystem;
|
||||||
|
|
||||||
_invResult = false;
|
_invResult = false;
|
||||||
_abortInvAdd = false;
|
_abortInvAdd = false;
|
||||||
_i = 0;
|
_i = 0;
|
||||||
_addedItems = [];
|
_addedItems = [];
|
||||||
//Remove melee magazines (BIS_fnc_invAdd fix)
|
false call dz_fn_meleeMagazines; // Remove melee magazines (BIS_fnc_invAdd fix)
|
||||||
false call dz_fn_meleeMagazines;
|
|
||||||
|
|
||||||
{
|
{
|
||||||
_itemOut = _x select 0;
|
_itemOut = _x select 0;
|
||||||
@@ -70,16 +62,12 @@ if ((count _upgrade) > 0) then {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (_abortInvAdd) exitWith {};
|
if (_abortInvAdd) exitWith {};
|
||||||
|
|
||||||
} count _refund;
|
} count _refund;
|
||||||
true call dz_fn_meleeMagazines;
|
true call dz_fn_meleeMagazines;
|
||||||
|
|
||||||
// all parts added proceed
|
|
||||||
if(_i != 0) then {
|
if(_i != 0) then {
|
||||||
// Get position
|
|
||||||
_location = _obj getVariable["OEMPos",(getposATL _obj)];
|
_location = _obj getVariable["OEMPos",(getposATL _obj)];
|
||||||
|
|
||||||
// Get direction
|
|
||||||
_dir = getDir _obj;
|
_dir = getDir _obj;
|
||||||
_vector = [(vectorDir _obj),(vectorUp _obj)];
|
_vector = [(vectorDir _obj),(vectorUp _obj)];
|
||||||
|
|
||||||
@@ -91,17 +79,10 @@ if ((count _upgrade) > 0) then {
|
|||||||
|
|
||||||
_classname = _newclassname;
|
_classname = _newclassname;
|
||||||
|
|
||||||
// Create new object
|
|
||||||
_object = createVehicle [_classname, [0,0,0], [], 0, "CAN_COLLIDE"];
|
_object = createVehicle [_classname, [0,0,0], [], 0, "CAN_COLLIDE"];
|
||||||
|
|
||||||
// Set direction
|
|
||||||
_object setDir _dir;
|
_object setDir _dir;
|
||||||
_object setVariable["memDir",_dir,true];
|
_object setVariable["memDir",_dir,true];
|
||||||
|
|
||||||
// Set vector
|
|
||||||
_object setVectorDirAndUp _vector;
|
_object setVectorDirAndUp _vector;
|
||||||
|
|
||||||
// Set location
|
|
||||||
_object setPosATL _location;
|
_object setPosATL _location;
|
||||||
|
|
||||||
format[localize "str_epoch_player_142",_text] call dayz_rollingMessages;
|
format[localize "str_epoch_player_142",_text] call dayz_rollingMessages;
|
||||||
@@ -109,7 +90,7 @@ if ((count _upgrade) > 0) then {
|
|||||||
if (DZE_GodModeBase && {!(_classname in DZE_GodModeBaseExclude)}) then {
|
if (DZE_GodModeBase && {!(_classname in DZE_GodModeBaseExclude)}) then {
|
||||||
_object addEventHandler ["HandleDamage",{false}];
|
_object addEventHandler ["HandleDamage",{false}];
|
||||||
};
|
};
|
||||||
|
|
||||||
if (DZE_permanentPlot) then {
|
if (DZE_permanentPlot) then {
|
||||||
_ownerID = _obj getVariable["ownerPUID","0"];
|
_ownerID = _obj getVariable["ownerPUID","0"];
|
||||||
_object setVariable ["ownerPUID",_ownerID,true];
|
_object setVariable ["ownerPUID",_ownerID,true];
|
||||||
|
|||||||
Reference in New Issue
Block a user