Fix floating loot after remove, pack or output from fn_dropItem

This commit is contained in:
A Man
2019-10-23 12:46:08 +02:00
parent a09bb81a7a
commit 1268f55f32
5 changed files with 59 additions and 39 deletions

View File

@@ -17,15 +17,18 @@ _nearByPile= nearestObjects [_pos, ["WeaponHolder","WeaponHolderBase"],PILE_SEAR
if (count _nearByPile == 0) then {
//No weapon holders found in the radius, spawn a new one
_holder = createVehicle ["WeaponHolder", _pos, [], 0, "CAN_COLLIDE"];
_holder = "WeaponHolder" createVehicle [0,0,0];
_holder setPosATL _pos;
} else {
//Found a near by weapon holder lets select it.
_holder = _nearByPile select 0;
if (!_manualPos) then {
private "_objects";
//check to make sure the player can see the selected weapon holder.
_objects = lineIntersectsWith [(_holder modeltoWorld PILE_OFFSET), _pos, player, _holder, true];
//Can you see the current selected weapon holder
if (count _objects > 0) then {
//Unable to see the current selected weapon holder within the radius lets create a new one.
@@ -42,4 +45,4 @@ switch _type do {
};
//Revel the item
player reveal _holder;
player reveal _holder;

View File

@@ -4,7 +4,7 @@
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"];
private ["_alreadyPacking","_backpacks","_bag","_campItems","_dir","_holder","_magazines","_obj","_objectID","_objectUID","_ownerID","_packobj","_playerNear","_pos","_weapons","_finished","_posPlayer"];
_obj = _this;
_ownerID = _obj getVariable["CharacterID","0"];
@@ -42,13 +42,21 @@ if (_ownerID in [dayz_characterID,dayz_playerUID] or typeOf _obj in _campItems)
if (isNull _obj) exitWith {};
if (!_finished) exitWith {_obj setVariable["packing",0,true];};
_posPlayer = getPosATL player;
_pos set [2,_posPlayer select 2];
if (_pos select 2 < 0) then {
_pos set [2,0];
};
//place tent (local)
_bag = createVehicle [_packobj, _pos, [], 0, "CAN_COLLIDE"];
_bag = _packobj createVehicle [0,0,0];
_bag setDir _dir;
player reveal _bag;
_holder = createVehicle ["WeaponHolder", _pos, [], 0, "CAN_COLLIDE"];
_bag setPosATL _pos;
_holder = "WeaponHolder" createVehicle [0,0,0];
_holder setPosATL _pos;
_weapons = getWeaponCargo _obj;
_magazines = getMagazineCargo _obj;
_backpacks = getBackpackCargo _obj;
@@ -59,6 +67,8 @@ if (_ownerID in [dayz_characterID,dayz_playerUID] or typeOf _obj in _campItems)
[_weapons,_magazines,_backpacks,_holder] call fn_addCargo;
player reveal _holder;
localize "str_success_tent_pack" call dayz_rollingMessages;
} else {
localize "str_fail_tent_pack" call dayz_rollingMessages;

View File

@@ -1,10 +1,11 @@
if (dayz_actionInProgress) exitWith {localize "str_player_actionslimit" call dayz_rollingMessages;};
dayz_actionInProgress = true;
/*
[_obj] spawn player_packVault;
*/
private ["_obj","_ownerID","_objectID","_objectUID","_location1","_location2","_packedClass","_text","_playerNear","_finished"];
if (dayz_actionInProgress) exitWith {localize "str_player_actionslimit" call dayz_rollingMessages;};
dayz_actionInProgress = true;
private ["_obj","_ownerID","_objectID","_objectUID","_location1","_location2","_packedClass","_text","_playerNear","_finished","_ComboMatch"];
_obj = _this;
_packedClass = getText (configFile >> "CfgVehicles" >> (typeOf _obj) >> "packedClass");
@@ -31,11 +32,11 @@ 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;};
format[localize "str_epoch_player_121",_text] call dayz_rollingMessages;
uiSleep 1;
uiSleep 1;
_location1 = getPosATL player;
uiSleep 5;
_location2 = getPosATL player;
if(_location1 distance _location2 > 0.1) exitWith {
format[localize "str_epoch_player_122",_text] call dayz_rollingMessages;
s_player_packvault = -1;
@@ -44,22 +45,22 @@ if(_location1 distance _location2 > 0.1) exitWith {
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 {};
["Working",0,[3,2,4,0]] call dayz_NutritionSystem;
(findDisplay 106) closeDisplay 0; // Close gear
dze_waiting = nil;
[_packedClass,objNull] call fn_waitForObject;
PVDZE_handleSafeGear = [player,_obj,2];
publicVariableServer "PVDZE_handleSafeGear";
publicVariableServer "PVDZE_handleSafeGear";
//wait for response from server to verify pack was logged and gear added before proceeding
waitUntil {!isNil "dze_waiting"};
format[localize "str_epoch_player_123",_text] call dayz_rollingMessages;
};
s_player_packvault = -1;