mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-15 04:23:13 +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:
@@ -36,6 +36,7 @@
|
|||||||
[FIXED] Trader menu expected array error #1618-1620 @ebaydayz
|
[FIXED] Trader menu expected array error #1618-1620 @ebaydayz
|
||||||
[FIXED] Loading screen issue where you can walk around and see a black screen #1610 @deanreid
|
[FIXED] Loading screen issue where you can walk around and see a black screen #1610 @deanreid
|
||||||
[FIXED] Crafting a sledgehammer with one already in your toolbelt no longer eats your parts. #1567 #1667 @Namindu
|
[FIXED] Crafting a sledgehammer with one already in your toolbelt no longer eats your parts. #1567 #1667 @Namindu
|
||||||
|
[FIXED] Copy key failing when player doesn't have a backpack @ebaydayz
|
||||||
[FIXED] DarkUI hunger and thirst inconsistency with vanilla UI and health system @SplenectomY @icomrade #1622
|
[FIXED] DarkUI hunger and thirst inconsistency with vanilla UI and health system @SplenectomY @icomrade #1622
|
||||||
[FIXED] Fire barrels not being detected over water @pj999 @icomrade #1559 #1564
|
[FIXED] Fire barrels not being detected over water @pj999 @icomrade #1559 #1564
|
||||||
[FIXED] Opening supply crates over water no longer drops the items on the sea floor @pj999 @icomrade #1558
|
[FIXED] Opening supply crates over water no longer drops the items on the sea floor @pj999 @icomrade #1558
|
||||||
|
|||||||
@@ -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"]; };
|
if(DZE_ActionInProgress) exitWith { cutText [(localize "str_epoch_player_56") , "PLAIN DOWN"]; };
|
||||||
DZE_ActionInProgress = true;
|
DZE_ActionInProgress = true;
|
||||||
@@ -59,12 +59,8 @@ if(_finished) then {
|
|||||||
_num_removed = ([player,"ItemTinBar"] call BIS_fnc_invRemove);
|
_num_removed = ([player,"ItemTinBar"] call BIS_fnc_invRemove);
|
||||||
|
|
||||||
if(_num_removed == 1) then {
|
if(_num_removed == 1) then {
|
||||||
// output key to backpack if space
|
|
||||||
_create = _item;
|
_create = _item;
|
||||||
_qty = 1;
|
_create call player_addDuplicateTool;
|
||||||
_b0x1337 = unitBackpack player;
|
|
||||||
_b0x1337 addWeaponCargoGlobal [_create,_qty];
|
|
||||||
cutText [(localize "str_epoch_player_60") , "PLAIN DOWN"];
|
|
||||||
} else {
|
} else {
|
||||||
cutText [(localize "str_epoch_player_61") , "PLAIN DOWN"];
|
cutText [(localize "str_epoch_player_61") , "PLAIN DOWN"];
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -222,20 +222,8 @@ if (_canDo) then {
|
|||||||
_craft_doLoop = false;
|
_craft_doLoop = false;
|
||||||
};
|
};
|
||||||
{
|
{
|
||||||
if ((_x == "ItemSledge") && {_x in items player}) then {
|
if (_x == "ItemSledge") then {
|
||||||
_bag = unitBackpack player;
|
_x call player_addDuplicateTool;
|
||||||
if (!isNull _bag) then {
|
|
||||||
systemChat format[(localize "str_epoch_player_313"),_x];
|
|
||||||
_bag addWeaponCargoGlobal [_x,1];
|
|
||||||
} else {
|
|
||||||
systemChat format[(localize "str_epoch_player_314"),_x];
|
|
||||||
_location = player modeltoworld [0,0.3,0];
|
|
||||||
if ((_location select 2) < 0) then {_location set [2,0];};
|
|
||||||
_object = createVehicle ["WeaponHolder",_location,[],0,"CAN_COLLIDE"];
|
|
||||||
if (surfaceIsWater _location) then {_object setPosASL (getPosASL player);} else {_object setPosATL _location;};
|
|
||||||
_object setVariable ["permaLoot",true];
|
|
||||||
_object addWeaponCargoGlobal [_x,1];
|
|
||||||
};
|
|
||||||
} else {
|
} else {
|
||||||
player addWeapon _x;
|
player addWeapon _x;
|
||||||
};
|
};
|
||||||
|
|||||||
40
SQF/dayz_code/compile/fn_addDuplicateTool.sqf
Normal file
40
SQF/dayz_code/compile/fn_addDuplicateTool.sqf
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
/*
|
||||||
|
Description:
|
||||||
|
Checks whether the player already has the tool on their toolbelt and then adds it. Useful for batch crafting tools.
|
||||||
|
1. If they don't then it adds it to their toolbelt.
|
||||||
|
2. If they do then it adds it to their backpack. If their backpack is full it simply falls on the ground.
|
||||||
|
3. If they have no backpack it spawns on the floor as a last resort.
|
||||||
|
The player is given an appropriate systemChat message in case 2 or 3.
|
||||||
|
|
||||||
|
Parameter:
|
||||||
|
_this: string - toolbelt item classname to check and add
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
false if item is not a duplicate, otherwise true
|
||||||
|
|
||||||
|
How to use:
|
||||||
|
"ItemSledge" call player_addDuplicateTool;
|
||||||
|
*/
|
||||||
|
private ["_bag","_hasTool","_location","_object"];
|
||||||
|
_hasTool = true;
|
||||||
|
|
||||||
|
if (_this in items player) then {
|
||||||
|
_bag = unitBackpack player;
|
||||||
|
if (!isNull _bag) then {
|
||||||
|
systemChat format[(localize "str_epoch_player_313"),_this];
|
||||||
|
_bag addWeaponCargoGlobal [_this,1];
|
||||||
|
} else {
|
||||||
|
systemChat format[(localize "str_epoch_player_314"),_this];
|
||||||
|
_location = player modeltoworld [0,0.3,0];
|
||||||
|
if ((_location select 2) < 0) then {_location set [2,0];};
|
||||||
|
_object = createVehicle ["WeaponHolder",_location,[],0,"CAN_COLLIDE"];
|
||||||
|
if (surfaceIsWater _location) then {_object setPosASL (getPosASL player);} else {_object setPosATL _location;};
|
||||||
|
_object setVariable ["permaLoot",true];
|
||||||
|
_object addWeaponCargoGlobal [_this,1];
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
_hasTool = false;
|
||||||
|
player addWeapon _this;
|
||||||
|
};
|
||||||
|
|
||||||
|
_hasTool
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
/*
|
/*
|
||||||
Description:
|
Description:
|
||||||
Checks whether the player has the required items (magazines) || not
|
Checks whether the player has the required items (magazines) or not
|
||||||
&& displays a message if an item is missing.
|
and displays a message if an item is missing.
|
||||||
|
|
||||||
Parameter(s):
|
Parameter(s):
|
||||||
_this: <array> list of item names the player is required to have (can also be an sub-array with item name && quantity)
|
_this: <array> list of item names the player is required to have (can also be an sub-array with item name and quantity)
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
Boolean (true if the player has all required items)
|
Boolean (true if the player has all required items)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
Description:
|
Description:
|
||||||
Checks whether the player has the required tools equipped || not
|
Checks whether the player has the required tools equipped or not
|
||||||
&& displays a message if a tool is missing from the tool belt.
|
and displays a message if a tool is missing from the tool belt.
|
||||||
|
|
||||||
Parameter(s):
|
Parameter(s):
|
||||||
_this: <array> list of tool names the player is required to have
|
_this: <array> list of tool names the player is required to have
|
||||||
|
|||||||
@@ -141,6 +141,7 @@ if (!isDedicated) then {
|
|||||||
onPreloadFinished "if (!isNil 'init_keyboard') then { [] spawn init_keyboard; }; dayz_preloadFinished = true;";
|
onPreloadFinished "if (!isNil 'init_keyboard') then { [] spawn init_keyboard; }; dayz_preloadFinished = true;";
|
||||||
|
|
||||||
// helper functions
|
// helper functions
|
||||||
|
player_addDuplicateTool = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_addDuplicateTool.sqf";
|
||||||
player_hasTools = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_hasTools.sqf";
|
player_hasTools = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_hasTools.sqf";
|
||||||
player_checkItems = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_checkItems.sqf";
|
player_checkItems = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_checkItems.sqf";
|
||||||
player_removeItems = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_removeItems.sqf";
|
player_removeItems = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_removeItems.sqf";
|
||||||
|
|||||||
@@ -3306,16 +3306,6 @@
|
|||||||
<French>\n\nConstruire une clé requiert une barre de fer</French>
|
<French>\n\nConstruire une clé requiert une barre de fer</French>
|
||||||
<Czech>\n\nNa vytvoření klíče potřebujete 1 cihličku cínu</Czech>
|
<Czech>\n\nNa vytvoření klíče potřebujete 1 cihličku cínu</Czech>
|
||||||
</Key>
|
</Key>
|
||||||
<Key ID="STR_EPOCH_PLAYER_60">
|
|
||||||
<Original>\n\nCopied key has been added to your backpack.</Original>
|
|
||||||
<English>\n\nCopied key has been added to your backpack.</English>
|
|
||||||
<German>\n\nDer kopierte Schlüssel wurde Ihrem Rücksack hinzugefügt.</German>
|
|
||||||
<Russian>\n\nСкопированный ключ был добавлен в ваш рюкзак.</Russian>
|
|
||||||
<!-- <Spanish></Spanish> -->
|
|
||||||
<Dutch>\n\nDe gekopieerde sleutel is in je rugzak gestopt.</Dutch>
|
|
||||||
<French>\n\nLe double de la clé a été ajouté dans votre sac à dos.</French>
|
|
||||||
<Czech>Zkopírovaný klíč byl přidán do batohu</Czech>
|
|
||||||
</Key>
|
|
||||||
<Key ID="STR_EPOCH_PLAYER_61">
|
<Key ID="STR_EPOCH_PLAYER_61">
|
||||||
<Original>\n\nCanceled Key Crafting.</Original>
|
<Original>\n\nCanceled Key Crafting.</Original>
|
||||||
<English>\n\nCanceled Key Crafting.</English>
|
<English>\n\nCanceled Key Crafting.</English>
|
||||||
|
|||||||
Reference in New Issue
Block a user