Sync near player checks

Checking if the player is the closest is not always the best idea, this
fixes a few dupes and syncs the distance for all player checks
This commit is contained in:
oiad
2020-06-13 11:26:44 +12:00
parent ac79d91ca0
commit b06d3d4623
16 changed files with 147 additions and 216 deletions

View File

@@ -5,7 +5,7 @@ _userList = (findDisplay 711195) displayCtrl 7101;
lbClear _userList;
_closePeople = if (DZE_doorManagementMustBeClose) then { player nearEntities ["CAManBase", 10] } else { playableUnits };
_closePeople = if (DZE_doorManagementMustBeClose) then {player nearEntities ["CAManBase", 12]} else {playableUnits};
{
if (isPlayer _x) then {

View File

@@ -1,8 +1,6 @@
private ["_item","_type","_hasHarvested","_knifeArray","_PlayerNear","_isListed","_activeKnife","_text","_dis","_sfx","_qty","_string","_isZombie","_humanity","_finished"];
if (dayz_actionInProgress) exitWith {
localize "str_player_actionslimit" call dayz_rollingMessages;
};
if (dayz_actionInProgress) exitWith {localize "str_player_actionslimit" call dayz_rollingMessages;};
dayz_actionInProgress = true;
_item = _this;
@@ -12,7 +10,7 @@ _hasHarvested = _item getVariable["meatHarvested",false];
_knifeArray = [];
_PlayerNear = {isPlayer _x} count ((getPosATL _item) nearEntities ["CAManBase", 10]) > 1;
_PlayerNear = {isPlayer _x} count ((getPosATL _item) nearEntities ["CAManBase", 12]) > 1;
if (_PlayerNear) exitWith {localize "str_pickup_limit_5" call dayz_rollingMessages; dayz_actionInProgress = false;};
//Count how many active tools the player has
@@ -34,7 +32,7 @@ if ((count _knifeArray) < 1) exitWith {
if ((count _knifeArray > 0) and !_hasHarvested) then {
//Use sharpest knife player has
_activeKnife = _knifeArray select 0;
//Get Animal Type
_isListed = isClass (configFile >> "CfgSurvival" >> "Meat" >> _type);
_text = getText (configFile >> "CfgVehicles" >> _type >> "displayName");
@@ -43,7 +41,7 @@ if ((count _knifeArray > 0) and !_hasHarvested) then {
_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 {};
@@ -60,12 +58,12 @@ if ((count _knifeArray > 0) and !_hasHarvested) then {
} else {
PVCDZ_obj_GutBody =[_item,_qty];
publicVariable "PVCDZ_obj_GutBody";
//if (!achievement_Gut) then {achievement_Gut = true;};
};
["knives",0.2] call fn_dynamicTool;
if (_isZombie) then {
// Reduce humanity for gutting zeds
_humanity = player getVariable ["humanity",0];
@@ -79,4 +77,5 @@ if ((count _knifeArray > 0) and !_hasHarvested) then {
uiSleep 0.02;
_string call dayz_rollingMessages;
};
dayz_actionInProgress = false;

View File

@@ -16,145 +16,101 @@ private ["_cursorTarget","_item","_classname","_requiredTools","_requiredParts",
_cursorTarget = _this select 3;
//get ownerID from old tent.
_ownerID = _cursorTarget getVariable ["characterID","0"];
_objectID = _cursorTarget getVariable ["ObjectID","0"];
_objectUID = _cursorTarget getVariable ["ObjectUID","0"];
//make sure the player is still looking at something to get the cursorTarget and UID
if (isNil "_cursorTarget" or {isNull _cursorTarget} or {_objectUID == "0" && (_objectID == "0")}) exitWith {
localize "str_cursorTargetNotFound" call dayz_rollingMessages;
dayz_actionInProgress = false;
};
_item = typeof _cursorTarget;
//diag_log (str(_item));
_item = typeOf _cursorTarget;
//remove action menu
player removeAction s_player_upgradestorage;
s_player_upgradestorage = -1;
//Not needed
//_itemName = getText (configFile >> "CfgVehicles" >> _item >> "displayName");
////diag_log (str(_itemName));
//Get tools needed
_classname = configFile >> "CfgVehicles" >> _item;
_requiredTools = getArray (_classname >> "Upgrade" >> "requiredTools");
//diag_log (str(_requiredTools));
//get parts needed
_requiredParts = getArray (_classname >> "Upgrade" >> "requiredParts");
//diag_log (str(_requiredParts));
//get item to create
_upgrade = getText (_classname >> "Upgrade" >> "create");
//diag_log (str(_upgrade));
//Display name of upgrade part
_upgradeConfig = configFile >> "CfgVehicles" >> _upgrade;
//diag_log (str(_upgradeConfig));
_upgradeDisplayname = getText (_upgradeConfig >> "displayName");
//diag_log (str(_upgradeDisplayname));
//Normal blocked stuff
_onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
_isWater = (surfaceIsWater (getPosATL player)) or dayz_isSwimming;
_onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
_isWater = (surfaceIsWater (getPosATL player)) or dayz_isSwimming;
if (_isWater or _onLadder) exitWith {dayz_actionInProgress = false; localize "str_CannotUpgrade" call dayz_rollingMessages;};
_upgradeParts = [];
_startUpgrade = true;
if(_isWater or _onLadder) exitWith {dayz_actionInProgress = false; localize "str_CannotUpgrade" call dayz_rollingMessages;};
// Make sure no other players are nearby
_playerNear = {isPlayer _x} count (([_cursorTarget] call FNC_GetPos) nearEntities ["CAManBase",10]) > 1;
_playerNear = {isPlayer _x} count (([_cursorTarget] call FNC_GetPos) nearEntities ["CAManBase", 12]) > 1;
if (_playerNear) exitWith {dayz_actionInProgress = false; localize "str_pickup_limit_5" call dayz_rollingMessages;};
// lets check player has requiredTools for upgrade
{
if (!(_x IN items player)) exitWith {
if (!(_x in items player)) exitWith {
_missingPartsConfig = configFile >> "CfgWeapons" >> _x;
_textMissingParts = getText (_missingPartsConfig >> "displayName");
format [localize "str_missing_to_do_this", _textMissingParts] call dayz_rollingMessages;
_startUpgrade = false;
};
} count _requiredTools;
// lets check player has requiredParts for upgrade
{
if (!(_x IN magazines player)) exitWith {
if (!(_x in magazines player)) exitWith {
_missingPartsConfig = configFile >> "CfgMagazines" >> _x;
_textMissingParts = getText (_missingPartsConfig >> "displayName");
format [localize "str_missing_to_do_this", _textMissingParts] call dayz_rollingMessages;
_startUpgrade = false;
};
if (_x IN magazines player) then {
_upgradeParts set [count _upgradeParts, _x];
};
if (_x in magazines player) then {_upgradeParts set [count _upgradeParts, _x];};
} count _requiredParts;
//Does object have a upgrade option.
if ((_startUpgrade) AND (isClass(_upgradeConfig))) then {
if ((_startUpgrade) && (isClass(_upgradeConfig))) then {
_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;
[player,_dis,true,(getPosATL player)] call player_alertZombies;
_finished = ["Medic",1] call fn_loopAction;
if (!_finished || (isNull _cursorTarget) || ({!(_x in magazines player)} count _upgradeParts > 0)) exitWith {}; //Double check player did not drop required parts
//Get location and direction of old item
_dir = round getDir _cursorTarget;
_vector = [vectorDir _cursorTarget,vectorUp _cursorTarget];
//reset orientation before measuring position, otherwise the new object will be placed incorrectly. -foxy
_cursorTarget setDir 0;
_pos = getPosATL _cursorTarget;
//diag_log [ "dir/angle/pos", _dir, _vector, _pos];
if (abs(((_vector select 1) select 2) - 1) > 0.001) then { _pos set [2,0]; };
//diag_log [ "dir/angle/pos - reset elevation if angle is straight", _dir, _vector, _pos];
//get contents
if (abs(((_vector select 1) select 2) - 1) > 0.001) then { _pos set [2,0]; };
_weapons = getWeaponCargo _cursorTarget;
_magazines = getMagazineCargo _cursorTarget;
_backpacks = getBackpackCargo _cursorTarget;
//remove old tent
PVDZ_obj_Destroy = [_objectID,_objectUID,player,_pos,dayz_authKey,false];
publicVariableServer "PVDZ_obj_Destroy";
deleteVehicle _cursorTarget;
// remove parts from players inventory before creation of new tent.
{
player removeMagazine _x;
_upgradeParts = _upgradeParts - [_x];
} count _upgradeParts;
//create new tent
_object = createVehicle [_upgrade, getMarkerpos "respawn_west", [], 0, "CAN_COLLIDE"];
//reseting orientation to make sure the object goes where it's supposed to -foxy
_object setDir 0;
_object setPosATL _pos;
_object setVectorDirAndUp _vector;
//set ownerID from old tent.
_object setVariable ["characterID",_ownerID];
//Make sure player knows about the new object
player reveal _object;
[_weapons,_magazines,_backpacks,_object] call fn_addCargo;
//publish new tent
if (DZE_permanentPlot) then {
_object setVariable ["ownerPUID",dayz_playerUID,true];
PVDZ_obj_Publish = [dayz_characterID,_object,[_dir,_pos,dayz_playerUID],[_weapons,_magazines,_backpacks],player,dayz_authKey];

View File

@@ -12,15 +12,15 @@ private ["_nearByChoppers","_cursorTarget","_type","_class","_requiredTools","_r
"_ownerArray","_ownerPasscode","_dir","_vector","_object","_puid","_clanArray","_wh","_variables","_finished"];
_cursorTarget = _this;
// ArmaA2 bug workaround: sometimes the object is null
if ((isNil "_cursorTarget") or {(isNull _cursorTarget)}) then {
_cursorTarget = nearestObjects [ player modelToWorld [0,1.5,0] , ["DZ_buildables","BuiltItems"], 1.5];
_cursorTarget = if (count _cursorTarget == 0) then { objNull } else { _cursorTarget select 0 };
_cursorTarget = nearestObjects [player modelToWorld [0,1.5,0] , ["DZ_buildables","BuiltItems"], 1.5];
_cursorTarget = if (count _cursorTarget == 0) then {objNull} else {_cursorTarget select 0};
};
if (isNull _cursorTarget) exitWith {};
_nearByChoppers = _cursorTarget nearObjects ["Helicopter", 10];
if (count _nearByChoppers > 1) exitwith { localize "str_upgradevehctooClose" call dayz_rollingMessages; };
if (count _nearByChoppers > 1) exitwith {localize "str_upgradevehctooClose" call dayz_rollingMessages;};
_type = typeof _cursorTarget;
_class = configFile >> "CfgVehicles" >> _type;
@@ -29,54 +29,52 @@ _requiredParts = getArray (_class >> "Upgrade" >> "requiredParts");
_upgradeType = getText (_class >> "Upgrade" >> "create");
_producedParts = getArray (_class >> "Upgrade" >> "produce");
//Allow random choice of items if specified.
if (isArray(configFile >> "CfgVehicles" >> _type >> "Upgrade" >> "randomcreate")) then {
_randomCreate = getArray (_class >> "Upgrade" >> "randomcreate");
_upgradeType = _randomCreate call BIS_fnc_selectRandom;
};
_upgradeClass = configFile >> "CfgVehicles" >> _upgradeType;
if (!isClass _upgradeClass) exitWith { localize "str_upgradeNoOption" call dayz_rollingMessages; };
if (!isClass _upgradeClass) exitWith {localize "str_upgradeNoOption" call dayz_rollingMessages;};
_onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
_isWater = (surfaceIsWater (getPosATL player)) or dayz_isSwimming;
if(_isWater or _onLadder) exitWith { localize "str_water_ladder_cant_do" call dayz_rollingMessages; };
if (_isWater or _onLadder) exitWith {localize "str_water_ladder_cant_do" call dayz_rollingMessages;};
_playerNear = {isPlayer _x} count (([_cursorTarget] call fnc_getPos) nearEntities ["CAManBase",10]) > 1;
if (_playerNear) exitWith { localize "str_pickup_limit_5" call dayz_rollingMessages; };
_playerNear = {isPlayer _x} count (([_cursorTarget] call fnc_getPos) nearEntities ["CAManBase", 12]) > 1;
if (_playerNear) exitWith {localize "str_pickup_limit_5" call dayz_rollingMessages;};
// lets check player has requiredTools for upgrade
_ok = true;
_missing = "";
{
if (!(_x IN items player)) exitWith {
//systemchat("Missing tools for upgrade." +str());
if (!(_x in items player)) exitWith {
_missing = getText (configFile >> "CfgWeapons" >> _x >> "displayName");
_ok = false;
};
} count _requiredTools;
if (!_ok) exitWith { format [localize "str_upgradeMissingTool", _missing] call dayz_rollingMessages; };
// lets check player has requiredParts for upgrade
if (!_ok) exitWith {format [localize "str_upgradeMissingTool", _missing] call dayz_rollingMessages;};
_ok = true;
_upgradeParts = [];
{
if (!(_x IN magazines player)) exitWith {
if (!(_x in magazines player)) exitWith {
_missing = getText (configFile >> "CfgMagazines" >> _x >> "displayName");
_ok = false;
};
if (_x IN magazines player) then {
if (_x in magazines player) then {
_upgradeParts set [count _upgradeParts, _x];
player removeMagazine _x;
};
} count _requiredParts;
if (!_ok) exitWith {
{ player addMagazine _x; } foreach _upgradeParts;
{player addMagazine _x;} foreach _upgradeParts;
format [localize "str_upgradeMissingPart", _missing] call dayz_rollingMessages;
};
if (dayz_actionInProgress) exitWith {
{ player addMagazine _x; } forEach _upgradeParts;
{player addMagazine _x;} forEach _upgradeParts;
localize "str_player_actionslimit" call dayz_rollingMessages;
};
dayz_actionInProgress = true;
@@ -86,28 +84,25 @@ _dis=20;
[player,_dis,true,(getPosATL player)] call player_alertZombies;
_finished = ["Medic",1] call fn_loopAction;
if (!_finished) exitWith {
{ player addMagazine _x; } forEach _upgradeParts;
{player addMagazine _x;} forEach _upgradeParts;
dayz_actionInProgress = false;
};
// Added Nutrition-Factor for work
["Working",0,[100,15,5,0]] call dayz_NutritionSystem;
//get data from old building.
_characterID = _cursorTarget getVariable ["characterID","0"];
_objectID = _cursorTarget getVariable ["ObjectID","0"];
_objectUID = _cursorTarget getVariable ["ObjectUID","0"];
//Person who owns the fence can be disa,abled by this person.
_ownerArray = _cursorTarget getVariable ["ownerArray",[]];
//Get passcode of fence.
_ownerPasscode = _cursorTarget getVariable ["padlockCombination",[]];
_dir = round getDir _cursorTarget;
_vector = [vectorDir _cursorTarget,vectorUp _cursorTarget];
_pos = getposATL _cursorTarget;
//diag_log [ "dir/angle/pos", _dir, _vector, _pos];
if (abs(((_vector select 1) select 2) - 1) > 0.001) then { _pos set [2,0]; };
//diag_log [ "dir/angle/pos - reset elevation if angle is straight", _dir, _vector, _pos];
if (abs(((_vector select 1) select 2) - 1) > 0.001) then {_pos set [2,0];};
_object = createVehicle [_upgradeType, getMarkerpos "respawn_west", [], 0, "CAN_COLLIDE"];
//if (_object isKindOf "DZ_buildables") then { _object allowDamage false; };
@@ -125,24 +120,23 @@ _object setVariable ["ownerArray",_ownerArray,true];
_object setVariable ["padlockCombination",_ownerPasscode,true];
_object setVariable ["characterID",_characterID,true];
//remove old object
//deleteVehicle _cursorTarget;
PVDZ_obj_Destroy = [_objectID,_objectUID,player,_cursorTarget,dayz_authKey];
publicVariableServer "PVDZ_obj_Destroy";
// create a weaponholder with dismissed parts
_wh = "WeaponHolder" createVehicle (getPosATL player);
{
if (isClass (configFile >> "CfgMagazines" >> _x))
then { _wh addMagazineCargoGlobal [_x, 1]; }
else { _wh addWeaponCargoGlobal [_x, 1]; };
if (isClass (configFile >> "CfgMagazines" >> _x)) then {
_wh addMagazineCargoGlobal [_x, 1];
} else {
_wh addWeaponCargoGlobal [_x, 1];
};
} forEach _producedParts;
//publish new object
_variables = [["ownerArray", _ownerArray],["padlockCombination", _ownerPasscode]];
PVDZ_obj_Publish = [dayz_characterID,_object,[_dir,_pos],_variables,player,dayz_authKey];
publicVariableServer "PVDZ_obj_Publish";
diag_log [diag_ticktime, __FILE__, "New Networked object, request to save to hive. PVDZ_obj_Publish:", PVDZ_obj_Publish];
/*
//Send maintenance info
PVDZ_veh_Save = [_object,"maintenance"];
@@ -151,9 +145,7 @@ if (isServer) then {
PVDZ_veh_Save call server_updateObject;
};*/
//Make sure player knows about the new object
player reveal _object;
//Make sure its unlocked
localize "str_upgradeDone" call dayz_rollingMessages;
dayz_actionInProgress = false;

View File

@@ -36,7 +36,7 @@ _claimedBy = _holder getVariable["claimed","0"];
if (_claimedBy != _playerID) exitWith { format[localize "str_player_beinglooted",_text] call dayz_rollingMessages; };
if (_classname isKindOf "Bag_Base_EP1") exitWith {
_PlayerNear = {isPlayer _x} count ((getPosATL _holder) nearEntities ["CAManBase", 10]) > 1;
_PlayerNear = {isPlayer _x} count ((getPosATL _holder) nearEntities ["CAManBase", 12]) > 1;
if (_PlayerNear) exitWith {localize "str_pickup_limit_4" call dayz_rollingMessages;};
_hasBag = unitBackpack player;

View File

@@ -16,7 +16,7 @@ _objectCharacterID = _obj getVariable ["CharacterID","0"];
if (DZE_Lock_Door != _objectCharacterID) exitWith {dayz_actionInProgress = false; s_player_downgrade_build = -1; localize "str_epoch_player_49" call dayz_rollingMessages;};
_playerNear = {isPlayer _x} count (([_obj] call FNC_GetPos) nearEntities ["CAManBase", 10]) > 1;
_playerNear = {isPlayer _x} count (([_obj] call FNC_GetPos) nearEntities ["CAManBase", 12]) > 1;
if (_playerNear) exitWith {dayz_actionInProgress = false; s_player_downgrade_build = -1; localize "str_pickup_limit_5" call dayz_rollingMessages;};
_objectID = _obj getVariable ["ObjectID","0"];
@@ -65,13 +65,12 @@ if ((count _upgrade) > 0) then {
} count _refund;
true call dz_fn_meleeMagazines;
if(_i != 0) then {
_location = _obj getVariable["OEMPos",(getposATL _obj)];
if (_i != 0) then {
_location = _obj getVariable["OEMPos",getPosATL _obj];
_dir = getDir _obj;
_vector = [(vectorDir _obj),(vectorUp _obj)];
// Reset the character ID on locked doors before they inherit the newclassname
if (_classname in DZE_DoorsLocked) then {
_obj setVariable ["CharacterID",dayz_characterID,true];
_objectCharacterID = dayz_characterID;
@@ -87,9 +86,7 @@ if ((count _upgrade) > 0) then {
format[localize "str_epoch_player_142",_text] call dayz_rollingMessages;
if (DZE_GodModeBase && {!(_classname in DZE_GodModeBaseExclude)}) then {
_object addEventHandler ["HandleDamage",{false}];
};
if (DZE_GodModeBase && {!(_classname in DZE_GodModeBaseExclude)}) then {_object addEventHandler ["HandleDamage",{false}];};
if (DZE_permanentPlot) then {
_ownerID = _obj getVariable["ownerPUID","0"];

View File

@@ -26,16 +26,15 @@ _findNearestPlant = [];
if (count _findNearestPlant >= 1) then {
_plant = _findNearestPlant select 0;
// Start chop plant loop
_isOk = true;
_proceed = false;
while {_isOk} do {
[player,20,true,(getPosATL player)] spawn player_alertZombies;
[player,"chopwood",0,false] call dayz_zombieSpeak;
_finished = ["Medic",1] call fn_loopAction;
if(!_finished) exitWith {
_isOk = false;
_proceed = false;
@@ -48,12 +47,10 @@ if (count _findNearestPlant >= 1) then {
};
if (_proceed) then {
// Make sure no other players are nearby
_playerNear = {isPlayer _x} count (([_plant] call FNC_GetPos) nearEntities ["CAManBase",10]) > 1;
_playerNear = {isPlayer _x} count (([_plant] call FNC_GetPos) nearEntities ["CAManBase", 12]) > 1;
if (_playerNear) exitWith {dayz_actionInProgress = false; localize "str_pickup_limit_5" call dayz_rollingMessages;};
//Remove melee magazines (BIS_fnc_invAdd fix)
false call dz_fn_meleeMagazines;
false call dz_fn_meleeMagazines; //Remove melee magazines (BIS_fnc_invAdd fix)
["Working",0,[3,2,4,0]] call dayz_NutritionSystem;
_invResult = false;
_i = 0;
@@ -66,11 +63,10 @@ if (count _findNearestPlant >= 1) then {
true call dz_fn_meleeMagazines;
_text = getText (configFile >> "CfgMagazines" >> _itemOut >> "displayName");
if(_i != 0) then {
if (_i != 0) then {
if ("" == typeOf _plant) then {
// Ask server to setDamage on plant and sync for JIP
PVDZ_objgather_Knockdown = [_plant,player];
PVDZ_objgather_Knockdown = [_plant,player]; // Ask server to setDamage on plant and sync for JIP
publicVariableServer "PVDZ_objgather_Knockdown";
} else {
deleteVehicle _plant;
@@ -85,4 +81,5 @@ if (count _findNearestPlant >= 1) then {
} else {
localize "str_epoch_player_74" call dayz_rollingMessages;
};
dayz_actionInProgress = false;

View File

@@ -9,8 +9,7 @@ if (vehicle player != player) exitWith {localize "str_player_fail_wear1" call da
//if (!isNull (unitBackpack player)) exitWith {localize "STR_EPOCH_ACTIONS_9" call dayz_rollingMessages;};
if ("CSGAS" in (magazines player)) exitWith {localize "STR_EPOCH_ACTIONS_10" call dayz_rollingMessages;};
// Make sure no other players are nearby
_playerNear = {isPlayer _x} count (([player] call FNC_GetPos) nearEntities ["CAManBase",12]) > 1;
_playerNear = {isPlayer _x} count (([player] call FNC_GetPos) nearEntities ["CAManBase", 12]) > 1;
if (_playerNear) exitWith {localize "STR_EPOCH_PLAYER_84" call dayz_rollingMessages;};
if (_this in DZE_RestrictSkins) exitWith {format[localize "str_epoch_player_315",_this] call dayz_rollingMessages;};

View File

@@ -5,7 +5,7 @@ _userList = (findDisplay 711194) displayCtrl 7001;
lbClear _userList;
_closePeople = if (DZE_plotManagementMustBeClose) then { player nearEntities ["CAManBase", 10] } else { playableUnits };
_closePeople = if (DZE_plotManagementMustBeClose) then {player nearEntities ["CAManBase", 12]} else {playableUnits};
{
if (isPlayer _x) then {

View File

@@ -39,14 +39,14 @@ _isWreckBuilding = _objType in DZE_isWreckBuilding;
_isMine = _objType in ["Land_iron_vein_wreck","Land_silver_vein_wreck","Land_gold_vein_wreck"];
_isModular = _obj isKindOf "ModularItems";
_PlayerNear = {isPlayer _x} count (([_obj] call FNC_GetPos) nearEntities ["CAManBase", 10]) > 1;
_PlayerNear = {isPlayer _x} count (([_obj] call FNC_GetPos) nearEntities ["CAManBase", 12]) > 1;
if (_PlayerNear && (_isMine or _objType == "Land_ammo_supply_wreck")) exitWith {dayz_actionInProgress = false; localize "str_pickup_limit_5" call dayz_rollingMessages;};
_limit = 3;
if (DZE_StaticConstructionCount > 0) then {
_limit = DZE_StaticConstructionCount;
}
else {
} else {
if (isNumber (configFile >> "CfgVehicles" >> _objType >> "constructioncount")) then {
_limit = getNumber(configFile >> "CfgVehicles" >> _objType >> "constructioncount");
};

View File

@@ -4,7 +4,7 @@ private ["_isMotorcycle","_hits","_part","_color","_vehicle","_PlayerNear","_hit
_vehicle = _this select 3;
{dayz_myCursorTarget removeAction _x} count s_player_repairActions;s_player_repairActions = [];
_PlayerNear = {isPlayer _x} count ((getPosATL _vehicle) nearEntities ["CAManBase", 10]) > 1;
_PlayerNear = {isPlayer _x} count ((getPosATL _vehicle) nearEntities ["CAManBase", 12]) > 1;
if (_PlayerNear) exitWith {dayz_myCursorTarget = objNull; localize "str_pickup_limit_5" call dayz_rollingMessages;};
dayz_myCursorTarget = _vehicle;
@@ -82,7 +82,6 @@ if (!_is6WheelType) then {
} count _hitpoints;
if (count _hitpoints > 0 ) then {
// Localized in A2OA\Expansion\dta\languagecore
_cancel = dayz_myCursorTarget addAction [localize "str_action_cancel_action", "\z\addons\dayz_code\actions\repair_cancel.sqf","repair", 0, true, false];
s_player_repairActions set [count s_player_repairActions,_cancel];
s_player_repair_crtl = 1;

View File

@@ -2,41 +2,37 @@ private ["_vehicle","_curFuel","_newFuel","_finished","_location1","_location2",
"_canNameEmpty","_canSizeEmpty","_canTypeEmpty","_canName","_canSize","_configCanEmpty","_configVeh","_capacity","_nameText",
"_availableCansEmpty","_hasHose","_PlayerNear"];
if (dayz_actionInProgress) exitWith {localize "str_player_actionslimit" call dayz_rollingMessages;};
dayz_actionInProgress = true;
_vehicle = _this select 3;
player removeAction s_player_siphonfuel;
_hasHose = "equip_hose" in magazines player;
if (!_hasHose) exitWith {localize "str_siphon_hose" call dayz_rollingMessages; };
_PlayerNear = {isPlayer _x} count ((getPosATL _vehicle) nearEntities ["CAManBase", 10]) > 1;
_PlayerNear = {isPlayer _x} count ((getPosATL _vehicle) nearEntities ["CAManBase", 12]) > 1;
if (_PlayerNear) exitWith {localize "str_pickup_limit_5" call dayz_rollingMessages;};
if (dayz_actionInProgress) exitWith {localize "str_player_actionslimit" call dayz_rollingMessages;};
dayz_actionInProgress = true;
_abort = false;
// Static vehicle fuel information
_configVeh = configFile >> "cfgVehicles" >> typeOf _vehicle;
_capacity = getNumber(_configVeh >> "fuelCapacity");
_nameText = getText(_configVeh >> "displayName");
// Loop to find containers that can could hold fuel and fill them
{
_configCanEmpty = configFile >> "CfgMagazines" >> _x;
//diag_log format["Looking for: %1", _x];
if(_x in DayZ_fuelCansEmpty) then {
// Get Empty can size
if (_x in DayZ_fuelCansEmpty) then {
_canNameEmpty = _x;
_canSizeEmpty = getNumber(_configCanEmpty >> "fuelQuantity");
_canTypeEmpty = getText(_configCanEmpty >> "displayName");
// Get Full can size
_canName = getText(_configCanEmpty >> "fullCan");
_canSize = getNumber(configFile >> "cfgMagazines" >> _canName >> "fuelQuantity");
// is empty
if(_canSizeEmpty == 0) then {
_curFuel = ((fuel _vehicle) * _capacity);
_newFuel = (_curFuel - _canSize);
if (_canSizeEmpty == 0) then {
_curFuel = ((fuel _vehicle) * _capacity);
_newFuel = (_curFuel - _canSize);
// calculate new fuel
if (_capacity == 0) then {
@@ -48,8 +44,7 @@ _nameText = getText(_configVeh >> "displayName");
if (_newFuel > 0) then {
format[localize "str_siphon_preparing",_canTypeEmpty] call dayz_rollingMessages;
_finished = false;
// alert zombies
[player,20,true,(getPosATL player)] call player_alertZombies;
if (!dayz_isSwimming) then {
@@ -66,8 +61,8 @@ _nameText = getText(_configVeh >> "displayName");
if (_finished) then {
// Get vehicle fuel levels again
_curFuel = ((fuel _vehicle) * _capacity);
_newFuel = (_curFuel - _canSize);
_curFuel = ((fuel _vehicle) * _capacity);
_newFuel = (_curFuel - _canSize);
// calculate minimum needed fuel
if (_capacity == 0) then {
@@ -87,37 +82,35 @@ _nameText = getText(_configVeh >> "displayName");
// Play sound
[player,"refuel",0,false] call dayz_zombieSpeak;
// Add filled can
player addMagazine _canName;
// Added Nutrition-Factor for work
["Working",0,[20,40,15,0]] call dayz_NutritionSystem;
format[localize "str_siphon_drained",_nameText,_canSize] call dayz_rollingMessages;
call fnc_usec_medic_removeActions;
r_action = false;
uiSleep 1;
} else {
_abort = true;
};
};
} else {
format[localize "str_siphon_notenough",_nameText] call dayz_rollingMessages;
_abort = true;
};
};
} else {
localize "str_siphon_canceled" call dayz_rollingMessages;
_abort = true;
};
};
} else {
format[localize "str_siphon_notenough",_nameText] call dayz_rollingMessages;
_abort = true;
};
};
};
if(_abort) exitWith {};
if (_abort) exitWith {};
} forEach magazines player;
dayz_actionInProgress = false;

View File

@@ -17,37 +17,36 @@ _objType = typeOf _obj;
_lockedClass = getText (configFile >> "CfgVehicles" >> _objType >> "lockedClass");
_text = getText (configFile >> "CfgVehicles" >> _objType >> "displayName");
// Silently exit if object no longer exists
if (isNull _obj) exitWith { dayz_actionInProgress = false; };
if (isNull _obj) exitWith {dayz_actionInProgress = false;};
// Server_handleSafeGear is called unscheduled and exits if the object is null, so two players locking at the same time will not work
_playerNear = _obj call dze_isnearest_player;
if (_playerNear) exitWith {dayz_actionInProgress = false; localize "str_epoch_player_11" call dayz_rollingMessages;};
_playerNear = {isPlayer _x} count (([_obj] call FNC_GetPos) nearEntities ["CAManBase", 12]) > 1;
if (_playerNear) exitWith {dayz_actionInProgress = false; localize "str_pickup_limit_5" 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 {dayz_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;};
if (!isNull _obj) then {
(findDisplay 106) closeDisplay 0; // Close gear
dze_waiting = nil;
[_lockedClass,objNull] call fn_waitForObject;
if (_lockedClass == "LockboxStorageLocked") then {
[player,"lockboxclose",0,false] call dayz_zombieSpeak;
} else {
[player,"safeclose",0,false] call dayz_zombieSpeak;
};
PVDZE_handleSafeGear = [player,_obj,1];
publicVariableServer "PVDZE_handleSafeGear";
//wait for response from server to verify safe was logged and saved before proceeding
waitUntil {!isNil "dze_waiting"};
publicVariableServer "PVDZE_handleSafeGear";
waitUntil {!isNil "dze_waiting"}; // wait for response from server to verify safe was logged and saved before proceeding
format[localize "str_epoch_player_117",_text] call dayz_rollingMessages;
};
s_player_lockvault = -1;
dayz_actionInProgress = false;

View File

@@ -1,24 +1,26 @@
/*
[_obj] call player_packTent;
[_obj] call player_packTent;
*/
if (dayz_actionInProgress) exitWith {localize "str_player_actionslimit" call dayz_rollingMessages;};
dayz_actionInProgress = true;
private ["_alreadyPacking","_backpacks","_bag","_campItems","_dir","_holder","_magazines","_obj","_objectID","_objectUID","_ownerID","_packobj","_playerNear","_pos","_weapons","_finished","_posPlayer","_text"];
private ["_alreadyPacking","_backpacks","_bag","_campItems","_dir","_holder","_magazines","_obj","_objectID","_objectUID","_ownerID","_packobj","_playerNear","_pos","_weapons","_finished","_posPlayer","_text","_typeOf"];
_obj = _this;
_typeOf = typeOf _obj;
_ownerID = _obj getVariable["CharacterID","0"];
_objectID = _obj getVariable["ObjectID","0"];
_objectUID = _obj getVariable["ObjectUID","0"];
if (DZE_permanentPlot) then {
_ownerID = _obj getVariable["ownerPUID","0"];
};
// Make sure no other players are nearby
_playerNear = {isPlayer _x} count (([_obj] call FNC_GetPos) nearEntities ["CAManBase",10]) > 1;
_playerNear = {isPlayer _x} count (([_obj] call FNC_GetPos) nearEntities ["CAManBase", 12]) > 1;
if (_playerNear) exitWith {dayz_actionInProgress = false; localize "str_pickup_limit_5" call dayz_rollingMessages;};
_packobj = getText (configFile >> "CfgVehicles" >> typeOf _obj >> "pack");
_packobj = getText (configFile >> "CfgVehicles" >> _typeOf >> "pack");
player removeAction s_player_packtent;
s_player_packtent = -1;
@@ -27,7 +29,7 @@ s_player_packtentinfected = -1;
_campItems = ["IC_DomeTent","IC_Tent"];
if (_ownerID in [dayz_characterID,dayz_playerUID] or typeOf _obj in _campItems) then {
if (_ownerID in [dayz_characterID,dayz_playerUID] || {_typeOf in _campItems}) then {
_alreadyPacking = _obj getVariable["packing",0];
if (_alreadyPacking == 1) exitWith {localize "str_player_beingpacked" call dayz_rollingMessages;};
@@ -38,7 +40,7 @@ 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;
_text = getText (configFile >> "CfgVehicles" >> (typeOf _obj) >> "displayName");
_text = getText (configFile >> "CfgVehicles" >> _typeOf >> "displayName");
format[localize "str_epoch_player_121",_text] call dayz_rollingMessages;
_finished = ["Medic",1] call fn_loopAction;
@@ -48,11 +50,8 @@ if (_ownerID in [dayz_characterID,dayz_playerUID] or typeOf _obj in _campItems)
_posPlayer = getPosATL player;
_pos set [2,_posPlayer select 2];
if (_pos select 2 < 0) then {
_pos set [2,0];
};
if (_pos select 2 < 0) then {_pos set [2,0];};
//place tent (local)
_bag = _packobj createVehicle [0,0,0];
_bag setDir _dir;
_bag setPosATL _pos;
@@ -76,4 +75,5 @@ if (_ownerID in [dayz_characterID,dayz_playerUID] or typeOf _obj in _campItems)
} else {
localize "str_fail_tent_pack" call dayz_rollingMessages;
};
dayz_actionInProgress = false;

View File

@@ -2,21 +2,20 @@ if (dayz_actionInProgress) exitWith {localize "str_player_actionslimit" call day
dayz_actionInProgress = true;
/*
[_obj] spawn player_packVault;
[_obj] spawn player_packVault;
*/
private ["_obj","_ownerID","_objectID","_objectUID","_location1","_location2","_packedClass","_text","_playerNear","_finished","_ComboMatch"];
private ["_obj","_ownerID","_objectID","_objectUID","_location1","_location2","_packedClass","_text","_playerNear","_finished","_ComboMatch","_typeOf"];
_obj = _this;
_packedClass = getText (configFile >> "CfgVehicles" >> (typeOf _obj) >> "packedClass");
_text = getText (configFile >> "CfgVehicles" >> (typeOf _obj) >> "displayName");
_typeOf = typeOf _obj;
_packedClass = getText (configFile >> "CfgVehicles" >> _typeOf >> "packedClass");
_text = getText (configFile >> "CfgVehicles" >> _typeOf >> "displayName");
// Silently exit if object no longer exists
if (isNull _obj || !(alive _obj)) exitWith { dayz_actionInProgress = false; };
// Server_handleSafeGear is called unscheduled and exits if the object is null, so two players packing at the same time will not work
_playerNear = _obj call dze_isnearest_player;
if (_playerNear) exitWith {dayz_actionInProgress = false; localize "str_epoch_player_16" call dayz_rollingMessages;};
_playerNear = {isPlayer _x} count (([_obj] call FNC_GetPos) nearEntities ["CAManBase", 12]) > 1;
if (_playerNear) exitWith {dayz_actionInProgress = false; localize "str_pickup_limit_5" call dayz_rollingMessages;};
_ownerID = _obj getVariable["CharacterID","0"];
_objectID = _obj getVariable["ObjectID","0"];
@@ -29,7 +28,7 @@ s_player_packvault = 1;
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 { dayz_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;};
format[localize "str_epoch_player_121",_text] call dayz_rollingMessages;
uiSleep 1;
@@ -37,17 +36,17 @@ _location1 = getPosATL player;
uiSleep 5;
_location2 = getPosATL player;
if(_location1 distance _location2 > 0.1) exitWith {
if (_location1 distance _location2 > 0.1) exitWith {
format[localize "str_epoch_player_122",_text] call dayz_rollingMessages;
s_player_packvault = -1;
dayz_actionInProgress = false;
};
if (!isNull _obj && alive _obj) then {
if (!isNull _obj && {alive _obj}) then {
[player,"tentpack",0,false] call dayz_zombieSpeak;
_finished = ["Medic",1] call fn_loopAction;
if (isNull _obj or !_finished) exitWith {};
if (isNull _obj || !_finished) exitWith {};
["Working",0,[3,2,4,0]] call dayz_NutritionSystem;
@@ -58,10 +57,11 @@ if (!isNull _obj && alive _obj) then {
PVDZE_handleSafeGear = [player,_obj,2];
publicVariableServer "PVDZE_handleSafeGear";
//wait for response from server to verify pack was logged and gear added before proceeding
waitUntil {!isNil "dze_waiting"};
waitUntil {!isNil "dze_waiting"}; // wait for response from server to verify pack was logged and gear added before proceeding
format[localize "str_epoch_player_123",_text] call dayz_rollingMessages;
};
s_player_packvault = -1;
dayz_actionInProgress = false;

View File

@@ -20,9 +20,8 @@ if !(_objType in DZE_LockedStorage) exitWith {
dayz_actionInProgress = false;
};
// Server_handleSafeGear is called unscheduled and exits if the object is null, so two players unlocking at the same time will not work
_playerNear = _obj call dze_isnearest_player;
if (_playerNear) exitWith {dayz_actionInProgress = false; localize "str_epoch_player_20" call dayz_rollingMessages;};
_playerNear = {isPlayer _x} count (([_obj] call FNC_GetPos) nearEntities ["CAManBase", 12]) > 1;
if (_playerNear) exitWith {dayz_actionInProgress = false; localize "str_pickup_limit_5" call dayz_rollingMessages;};
if (isNull _obj || !(alive _obj)) exitWith { dayz_actionInProgress = false; };
@@ -52,8 +51,8 @@ if (_ComboMatch || (_ownerID == dayz_playerUID)) then {
PVDZE_handleSafeGear = [player,_obj,0];
publicVariableServer "PVDZE_handleSafeGear";
//wait for response from server to verify safe was logged before proceeding
waitUntil {!isNil "dze_waiting"};
waitUntil {!isNil "dze_waiting"}; // wait for response from server to verify safe was logged before proceeding
format[localize "STR_BLD_UNLOCKED",_text] call dayz_rollingMessages;
} else {
@@ -71,5 +70,6 @@ if (_ComboMatch || (_ownerID == dayz_playerUID)) then {
format [localize "str_epoch_player_19",round(dayz_lastCodeFail - diag_tickTime)] call dayz_rollingMessages;
};
s_player_unlockvault = -1;
dayz_actionInProgress = false;