From 0799e7e183779a47e6018d1aedd95d43ecc18b8a Mon Sep 17 00:00:00 2001 From: A Man Date: Wed, 18 May 2022 18:14:22 +0200 Subject: [PATCH] Update object revealing This replaces 'player reveal object' with a function that acutal reveals the objects to the player. This fixes that objects were not usable after building. --- SQF/dayz_code/actions/modular_build.sqf | 2 ++ SQF/dayz_code/actions/player_buildingDowngrade.sqf | 4 ++-- SQF/dayz_code/actions/player_dropWeapon.sqf | 3 ++- SQF/dayz_code/actions/player_loadCrate.sqf | 3 ++- SQF/dayz_code/actions/player_upgrade.sqf | 4 ++-- SQF/dayz_code/actions/remove.sqf | 5 ++--- SQF/dayz_code/compile/fn_dropItem.sqf | 13 +++++++------ SQF/dayz_code/compile/player_packTent.sqf | 4 ++-- 8 files changed, 21 insertions(+), 17 deletions(-) diff --git a/SQF/dayz_code/actions/modular_build.sqf b/SQF/dayz_code/actions/modular_build.sqf index b15183d8e..28f5590e2 100644 --- a/SQF/dayz_code/actions/modular_build.sqf +++ b/SQF/dayz_code/actions/modular_build.sqf @@ -1355,6 +1355,8 @@ if (_canBuild) then { _classname = _classnameBuild; + [_classname,objNull] call fn_waitForObject; + local _builtObject = _classname createVehicle [0,0,0]; //_builtObject setDir _dir; // setDir is incompatible with setVectorDirAndUp and should not be used together on the same object https://community.bistudio.com/wiki/setVectorDirAndUp diff --git a/SQF/dayz_code/actions/player_buildingDowngrade.sqf b/SQF/dayz_code/actions/player_buildingDowngrade.sqf index a459e3e52..9da3d76f8 100644 --- a/SQF/dayz_code/actions/player_buildingDowngrade.sqf +++ b/SQF/dayz_code/actions/player_buildingDowngrade.sqf @@ -100,6 +100,8 @@ if (count _upgrade > 0) then { _classname = _newclassname; + [_classname,objNull] call fn_waitForObject; + local _object = createVehicle [_classname, [0,0,0], [], 0, "CAN_COLLIDE"]; //_object setDir _dir; // setdir is incompatible with setVectorDirAndUp and should not be used together on the same object https://community.bistudio.com/wiki/setVectorDirAndUp _object setVariable["memDir", _dir, true]; @@ -133,8 +135,6 @@ if (count _upgrade > 0) then { _object setVariable ["ownerPUID", _ownerID, true]; PVDZE_obj_Swap = [_objectCharacterID, _object, [_dir, _position, dayz_playerUID, _vector], _classname, _obj, player, [], dayz_authKey]; publicVariableServer "PVDZE_obj_Swap"; - player reveal _object; - } else { _text = getText(configFile >> "CfgMagazines" >> _itemOut >> "displayName"); diff --git a/SQF/dayz_code/actions/player_dropWeapon.sqf b/SQF/dayz_code/actions/player_dropWeapon.sqf index cf06b28e8..c46d52206 100644 --- a/SQF/dayz_code/actions/player_dropWeapon.sqf +++ b/SQF/dayz_code/actions/player_dropWeapon.sqf @@ -36,8 +36,9 @@ if (_item == dayz_onBack && carryClick) then { _item = if (_droppedType == "") then {_this} else {_droppedType}; }; +[format["WeaponHolder_%1",_item],objNull] call fn_waitForObject; + _bag = createVehicle [format["WeaponHolder_%1",_item],getPosATL player,[], 1, "CAN_COLLIDE"]; _bag modelToWorld getPosATL player; _bag setDir (getDir player); -player reveal _bag; dayz_actionInProgress = false; \ No newline at end of file diff --git a/SQF/dayz_code/actions/player_loadCrate.sqf b/SQF/dayz_code/actions/player_loadCrate.sqf index c405d1687..5543b519f 100644 --- a/SQF/dayz_code/actions/player_loadCrate.sqf +++ b/SQF/dayz_code/actions/player_loadCrate.sqf @@ -44,6 +44,8 @@ player addMagazine "bulk_empty"; ["Working",0,[20,40,15,0]] call dayz_NutritionSystem; +[_classname,objNull] call fn_waitForObject; + _b0x1337 = createVehicle [_classname, _location, [], 0, "CAN_COLLIDE"]; _b0x1337 setDir _dir; @@ -63,7 +65,6 @@ if (surfaceIsWater _location) then { _b0x1337 setPosATL _location; }; -player reveal _b0x1337; DZE_GearCheckBypass = true; //Bypass gear menu checks since dialog will always open on crate player action ["Gear", _b0x1337]; diff --git a/SQF/dayz_code/actions/player_upgrade.sqf b/SQF/dayz_code/actions/player_upgrade.sqf index cc7a7d04c..22a83b81e 100644 --- a/SQF/dayz_code/actions/player_upgrade.sqf +++ b/SQF/dayz_code/actions/player_upgrade.sqf @@ -144,6 +144,8 @@ if ((count _upgrade) > 0) then { local _objectCharacterID = _obj getVariable ["CharacterID","0"]; _classname = _newclassname; + [_classname,objNull] call fn_waitForObject; + local _object = createVehicle [_classname, [0,0,0], [], 0, "CAN_COLLIDE"]; //_object setDir _dir; // setdir is incompatible with setVectorDirAndUp and should not be used together on the same object https://community.bistudio.com/wiki/setVectorDirAndUp _object setVariable["memDir", _dir, true]; @@ -225,8 +227,6 @@ if ((count _upgrade) > 0) then { }; publicVariableServer "PVDZE_obj_Swap"; - player reveal _object; - } else { {player addMagazine _x;} count _temp_removed_array; diff --git a/SQF/dayz_code/actions/remove.sqf b/SQF/dayz_code/actions/remove.sqf index b23dc7dca..2ec218b36 100644 --- a/SQF/dayz_code/actions/remove.sqf +++ b/SQF/dayz_code/actions/remove.sqf @@ -432,7 +432,7 @@ if (_proceed && _success) then { /////////////////////////////////////////////////////////////////////////////////// if (count _selectedRemoveOutput > 0) then { - + ["WeaponHolder",objNull] call fn_waitForObject; local _item = "WeaponHolder" createVehicle [0,0,0]; _item setDir _iDir; @@ -509,7 +509,7 @@ if (_proceed && _success) then { if (_type == 5) exitWith { for "_i" from 1 to _countOut do { - + [_itemOut,objNull] call fn_waitForObject; local _bpObj = _itemOut createVehicle [0,0,0]; // create backpack local _bpPos = [_iPos, _bpDist, _bpDir] call BIS_fnc_relPos; // position it a short distance away from the spawn point @@ -536,7 +536,6 @@ if (_proceed && _success) then { if (_totalCount > 0) then { // Only reveal refund if there is something there. Random ranges can produce zero results. _sleep = 1; _item setPosATL _iPos; - player reveal _item; DZE_GearCheckBypass = true; // Bypass gear menu checks since dialogue will always open on item player action ["Gear", _item]; diff --git a/SQF/dayz_code/compile/fn_dropItem.sqf b/SQF/dayz_code/compile/fn_dropItem.sqf index 076f9dbfa..a8eb593fd 100644 --- a/SQF/dayz_code/compile/fn_dropItem.sqf +++ b/SQF/dayz_code/compile/fn_dropItem.sqf @@ -15,7 +15,9 @@ _holder = objNull; //Check if a holder is close by the player. _nearByPile= nearestObjects [_pos, ["WeaponHolder","WeaponHolderBase"],PILE_SEARCH_RADIUS]; -if (count _nearByPile == 0) then { +if (count _nearByPile == 0) then { + ["WeaponHolder",objNull] call fn_waitForObject; + //No weapon holders found in the radius, spawn a new one _holder = "WeaponHolder" createVehicle [0,0,0]; _holder setPosATL _pos; @@ -30,7 +32,9 @@ if (count _nearByPile == 0) then { _objects = lineIntersectsWith [(_holder modeltoWorld PILE_OFFSET), _pos, player, _holder, true]; //Can you see the current selected weapon holder - if (count _objects > 0) then { + if (count _objects > 0) then { + ["WeaponHolder",objNull] call fn_waitForObject; + //Unable to see the current selected weapon holder within the radius lets create a new one. _holder = createVehicle ["WeaponHolder", _pos, [], 0, "CAN_COLLIDE"]; }; @@ -42,7 +46,4 @@ switch _type do { case 1: {_holder addMagazineCargoGlobal [_item,_amount];}; case 2: {_holder addWeaponCargoGlobal [_item,_amount];}; case 3: {_holder addBackpackCargoGlobal [_item,_amount];}; -}; - -//Revel the item -player reveal _holder; +}; \ No newline at end of file diff --git a/SQF/dayz_code/compile/player_packTent.sqf b/SQF/dayz_code/compile/player_packTent.sqf index ad671669a..6572bf12b 100644 --- a/SQF/dayz_code/compile/player_packTent.sqf +++ b/SQF/dayz_code/compile/player_packTent.sqf @@ -68,6 +68,8 @@ if ((_ownerID == dayz_playerUID) || {_objType in ["IC_DomeTent","IC_Tent"]}) the _bag setDir _dir; _bag setPosATL _pos; + ["WeaponHolder",objNull] call fn_waitForObject; + local _holder = "WeaponHolder" createVehicle [0,0,0]; // any packed items go here _holder setPosATL _pos; @@ -80,8 +82,6 @@ if ((_ownerID == dayz_playerUID) || {_objType in ["IC_DomeTent","IC_Tent"]}) the [_weapons, _magazines, _backpacks, _holder] call fn_addCargo; // pile everything onto the ground - player reveal _holder; - localize "str_success_tent_pack" call dayz_rollingMessages; // Your tent has been packed } else { localize "str_fail_tent_pack" call dayz_rollingMessages; // You cannot pack this tent, it is not yours