mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-14 12:12:34 +03:00
Add handling of full toolbelt
Tested and confirmed working in all cases with both copy key and sledgehammer crafting.
This commit is contained in:
@@ -1,29 +1,21 @@
|
|||||||
/*
|
/*
|
||||||
Description:
|
Description:
|
||||||
Checks whether the player already has the tool on their toolbelt and then adds it. Useful for batch crafting tools.
|
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.
|
1. If they don't then it adds it to their toolbelt. If the toolbelt is full it is dropped on the floor.
|
||||||
2. If they do then it adds it to their backpack. If their backpack is full it simply falls on the ground.
|
2. If they do then it adds it to their backpack. If their backpack is full it spills out on the floor.
|
||||||
3. If they have no backpack it spawns on the floor as a last resort.
|
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.
|
The player is given an appropriate systemChat message in each case.
|
||||||
|
|
||||||
Parameter:
|
Parameter:
|
||||||
_this: string - toolbelt item classname to check and add
|
_this: string - toolbelt item classname to check and add
|
||||||
|
|
||||||
Returns:
|
|
||||||
false if item is not a duplicate, otherwise true
|
|
||||||
|
|
||||||
How to use:
|
How to use:
|
||||||
"ItemSledge" call player_addDuplicateTool;
|
"ItemSledge" call player_addDuplicateTool;
|
||||||
*/
|
*/
|
||||||
private ["_bag","_hasTool","_location","_object"];
|
private ["_bag","_dropOnFloor"];
|
||||||
_hasTool = true;
|
|
||||||
|
|
||||||
if (_this in items player) then {
|
_dropOnFloor = {
|
||||||
_bag = unitBackpack player;
|
private ["_location","_object"];
|
||||||
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];
|
systemChat format[(localize "str_epoch_player_314"),_this];
|
||||||
_location = player modeltoworld [0,0.3,0];
|
_location = player modeltoworld [0,0.3,0];
|
||||||
if ((_location select 2) < 0) then {_location set [2,0];};
|
if ((_location select 2) < 0) then {_location set [2,0];};
|
||||||
@@ -32,9 +24,18 @@ if (_this in items player) then {
|
|||||||
_object setVariable ["permaLoot",true];
|
_object setVariable ["permaLoot",true];
|
||||||
_object addWeaponCargoGlobal [_this,1];
|
_object addWeaponCargoGlobal [_this,1];
|
||||||
};
|
};
|
||||||
} else {
|
|
||||||
_hasTool = false;
|
|
||||||
player addWeapon _this;
|
|
||||||
};
|
|
||||||
|
|
||||||
_hasTool
|
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 {
|
||||||
|
_this call _dropOnFloor;
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
if !([player,_this] call BIS_fnc_invAdd) then {
|
||||||
|
systemChat (localize "str_epoch_player_107");
|
||||||
|
_this call _dropOnFloor;
|
||||||
|
};
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user