mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-14 12:12:34 +03:00
Fix copy key failing when player has no backpack
Related to #1567, so I made this a function so it can be reused. People should call this whenever they are adding a toolbelt item which the player may already have. It has localized strings and handles spawning the weapon holder on water, land and rooftop. Tested both the sledgehammer and key copying. Confirmed all three conditions are working.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
private ["_item","_config","_pos","_onLadder","_create","_started","_finished","_animState","_isMedic","_qty","_b0x1337","_num_removed","_text","_haskey","_hastoolweapon","_isNear","_hasTinBar"];
|
||||
private ["_item","_config","_pos","_onLadder","_create","_started","_finished","_animState","_isMedic","_num_removed","_text","_haskey","_hastoolweapon","_isNear","_hasTinBar"];
|
||||
|
||||
if(DZE_ActionInProgress) exitWith { cutText [(localize "str_epoch_player_56") , "PLAIN DOWN"]; };
|
||||
DZE_ActionInProgress = true;
|
||||
@@ -59,12 +59,8 @@ if(_finished) then {
|
||||
_num_removed = ([player,"ItemTinBar"] call BIS_fnc_invRemove);
|
||||
|
||||
if(_num_removed == 1) then {
|
||||
// output key to backpack if space
|
||||
_create = _item;
|
||||
_qty = 1;
|
||||
_b0x1337 = unitBackpack player;
|
||||
_b0x1337 addWeaponCargoGlobal [_create,_qty];
|
||||
cutText [(localize "str_epoch_player_60") , "PLAIN DOWN"];
|
||||
_create call player_addDuplicateTool;
|
||||
} else {
|
||||
cutText [(localize "str_epoch_player_61") , "PLAIN DOWN"];
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user