Fix tool loss due to duplicate matchbox and knife issue #1849

This commit is contained in:
ebaydayz
2017-01-03 15:30:50 -05:00
parent d124a5d2f7
commit 0c15002109
20 changed files with 110 additions and 283 deletions

View File

@@ -44,6 +44,7 @@
[FIXED] Players can not purchase a negative number of items anymore.
[FIXED] Removed antiwall glitch blocks for vanilla hospitals since Epoch uses DayZero hospitals. @jOoPs
[FIXED] Switching weapons properly interrupts autorun now. #1850 @DeVloek
[FIXED] Duplicate matchbox or knife error when lighting a fire or gutting with multiple matchboxes or knives on toolbelt. #1849 @DeVloek
[NOTE] The fixes below are included in the 1.0.6 Build C server package released December 29th, 2016 (http://dayzepoch.com/a2dayzepoch.php)
[FIXED] Hive child 309 errors that resulted in broken saving of newly built storage object inventory. @icomrade

View File

@@ -61,6 +61,7 @@ class ItemKnifeBlunt : ItemKnife_Base
{
scope = public;
descriptionShort = $STR_EQUIP_CODE_DESC_4;
sharpnessRemaining = "ItemKnifeBlunt";
class ItemActions
{
class FixKnife

View File

@@ -17,14 +17,9 @@ class ItemMatchboxEmpty : ItemMatchbox_base
//Loot Spawn Table.
class ItemMatchbox : ItemMatchbox_base
{
scope = public;
class Ignators
{
chance = 0.12;
matches = -1;
qtyRemaining = "Item5Matchbox";
};
scope = public;
matches = -1;
qtyRemaining = "Item5Matchbox";
class ItemActions
{
@@ -41,50 +36,30 @@ class ItemMatchbox : ItemMatchbox_base
class Item5Matchbox : ItemMatchbox
{
descriptionShort = $STR_EQUIP_DESC_3_A;
class Ignators
{
matches = 5;
qtyRemaining = "Item4Matchbox";
};
matches = 5;
qtyRemaining = "Item4Matchbox";
};
class Item4Matchbox : ItemMatchbox
{
descriptionShort = $STR_EQUIP_DESC_3_B;
class Ignators
{
qtyRemaining = "Item3Matchbox";
matches = 4;
};
qtyRemaining = "Item3Matchbox";
matches = 4;
};
class Item3Matchbox : ItemMatchbox
{
descriptionShort = $STR_EQUIP_DESC_3_C;
class Ignators
{
qtyRemaining = "Item2Matchbox";
matches = 3;
};
qtyRemaining = "Item2Matchbox";
matches = 3;
};
class Item2Matchbox : ItemMatchbox
{
descriptionShort = $STR_EQUIP_DESC_3_D;
class Ignators
{
qtyRemaining = "Item1Matchbox";
matches = 2;
};
qtyRemaining = "Item1Matchbox";
matches = 2;
};
class Item1Matchbox : ItemMatchbox
{
descriptionShort = $STR_EQUIP_DESC_3_E;
class Ignators
{
qtyRemaining = "ItemMatchboxEmpty";
matches = 1;
};
qtyRemaining = "ItemMatchboxEmpty";
matches = 1;
};

View File

@@ -1,4 +1,4 @@
private ["_item","_type","_hasHarvested","_knifeArray","_PlayerNear","_isListed","_activeKnife","_text","_dis","_sfx","_sharpnessRemaining","_qty","_chance","_string","_isZombie","_humanity"];
private ["_item","_type","_hasHarvested","_knifeArray","_PlayerNear","_isListed","_activeKnife","_text","_dis","_sfx","_qty","_string","_isZombie","_humanity"];
_isZombie = _this isKindOf "zZombie_base";
if (dayz_actionInProgress) exitWith {
@@ -36,10 +36,8 @@ if ((count _knifeArray) < 1) exitWith {
};
if ((count _knifeArray > 0) and !_hasHarvested) then {
private "_qty";
//Select random can from array
_activeKnife = _knifeArray call BIS_fnc_selectRandom;
//Use sharpest knife player has
_activeKnife = _knifeArray select 0;
//Get Animal Type
_isListed = isClass (configFile >> "CfgSurvival" >> "Meat" >> _type);
@@ -68,29 +66,7 @@ if ((count _knifeArray > 0) and !_hasHarvested) then {
//if (!achievement_Gut) then {achievement_Gut = true;};
};
if (dayz_knifeDulling) then {
_sharpnessRemaining = getText (configFile >> "cfgWeapons" >> _activeKnife >> "sharpnessRemaining");
switch _activeKnife do {
case "ItemKnife" : {
//_chance = getNumber (configFile >> "cfgWeapons" >> _activeKnife >> "chance");
if ([0.2] call fn_chance) then {
player removeWeapon _activeKnife;
player addWeapon _sharpnessRemaining;
//systemChat (localize "str_info_bluntknife");
localize "str_info_bluntknife" call dayz_rollingMessages;
};
};
case "ItemKnifeBlunt" : {
//do nothing
};
default {
player removeWeapon _activeKnife;
player addWeapon _sharpnessRemaining;
};
};
};
["knives",0.2] call fn_dynamicTool;
uiSleep 6;
if (_isZombie) then {

View File

@@ -1,4 +1,4 @@
private ["_object","_proceed","_rndattemps","_limit","_dismantleToo","_ownerID","_objectID","_objectUID","_playerID","_claimedBy","_tools","_exit","_end","_onLadder","_isWater","_isOk","_counter","_text","_dis","_sfx","_animState","_started","_finished","_isMedic","_holder"];
private ["_object","_proceed","_rndattemps","_limit","_dismantleToo","_ownerID","_objectID","_objectUID","_playerID","_claimedBy","_tools","_exit","_end","_onLadder","_isWater","_isOk","_counter","_text","_dis","_sfx","_animState","_started","_finished","_isMedic"];
_object = _this;
_proceed = false;
@@ -11,9 +11,6 @@ _limit = 1 + round(random _rndattemps);
//Dismantle magazine type
_dismantleToo = getText (configFile >> "CfgVehicles" >> (typeOf _object) >> "dismantle" >> "dismantleToo");
//Object location
_pos = getposATL _object;
//Object info
_ownerID = _object getVariable["CharacterID","0"];
_objectID = _object getVariable["ObjectID","0"];
@@ -165,9 +162,5 @@ if (_proceed) then {
//Need to update for sanity no client should ever create or delete anything
deleteVehicle _object;
//PVDZ_obj_Create = ["WeaponHolder",_pos,["ItemTankTrap"]];
//publicVariableServer "PVDZ_obj_Create";
_holder = createVehicle ["WeaponHolder", _pos, [], 0, "CAN_COLLIDE"];
_holder addmagazinecargoGlobal [_dismantleToo,1];
[_dismantleToo,1,1] call fn_dropItem;
};

View File

@@ -94,7 +94,7 @@ if (count _findNearestTree > 0) then {
_counter = _counter + 1;
_itemOut = "PartWoodPile";
//Drop Item to ground
_itemOut call fn_dropItem;
[_itemOut,1,1] call fn_dropItem;
};
if ((_counter == _countOut) || _breaking) exitWith {

View File

@@ -130,7 +130,7 @@ if (_output != "") then
//wait a while before dropping the output item
uiSleep 3;
//Drop Item to ground
_output call fn_dropItem;
[_output,1,1] call fn_dropItem;
};
};
};

View File

@@ -102,7 +102,7 @@ if (_canDo) then {
{if (_x in Dayz_Gutting) exitWith {_hastoolweapon = true};} forEach (items player);
};
if (_x == "ItemMatchbox") then {
{if (_x in Dayz_Ignators) exitWith {_hastoolweapon = true};} forEach (items player);
{if (_x in DayZ_Ignitors) exitWith {_hastoolweapon = true};} forEach (items player);
};
if (!_hastoolweapon) exitWith { _craft_doLoop = false; _missingTools = true; _missing = _x; };
} forEach _selectedRecipeTools;

View File

@@ -1,4 +1,4 @@
private ["_cantype","_emptycan","_intensity","_objectID","_objectUID","_obj","_fuelArray","_matchArray","_alreadyDestorying","_randomJerryCan","_fireIntensity","_randomBoxMatches","_qtyRemaining","_dis","_sfx"];
private ["_emptycan","_objectID","_objectUID","_obj","_fuelArray","_matchArray","_alreadyDestorying","_randomJerryCan","_fireIntensity","_dis","_sfx"];
//Tent Object
_obj = _this select 3;
@@ -52,28 +52,7 @@ _fireIntensity = getNumber (configFile >> "CfgMagazines" >> _randomJerryCan >> "
player removeMagazine _randomJerryCan;
player addMagazine _emptycan;
//Match system ** Needs redoing
//Select random matchbox
_randomBoxMatches = _matchArray call BIS_fnc_selectRandom;
_qtyRemaining = getText (configFile >> "cfgWeapons" >> _randomBoxMatches >> "Ignators" >> "qtyRemaining");
if (dayz_matchboxCount) then {
switch _randomBoxMatches do {
case "ItemMatchbox" : {
if ([0.3] call fn_chance) then {
player removeWeapon _randomBoxMatches;
player addWeapon _qtyRemaining;
//info box.
systemChat (localize "str_info_limitedbox");
};
};
default {
player removeWeapon _randomBoxMatches;
player addWeapon _qtyRemaining;
};
};
};
["matches",0.3] call fn_dynamicTool;
//Normal alerts
_dis=20;

View File

@@ -95,7 +95,7 @@ if (!isNull _findNearestRock) then {
_itemOut = "ItemStone";
//Drop Item to ground
_itemOut call fn_dropItem;
[_itemOut,1,1] call fn_dropItem;
};
if ((_counter >= _countOut) || _breaking) exitWith {

View File

@@ -1,4 +1,4 @@
private ["_skin","_rnd","_rounded","_itemtocreate","_i","_config","_infoText","_result","_nearByPile","_pile","__FILE__"];
private ["_skin","_rnd","_rounded","_itemtocreate","_i","_config","_result"];
_skin = _this;
_config = configFile >> "CfgMagazines" >> _skin;
@@ -8,7 +8,6 @@ _rnd = random 3;
_rounded = round _rnd;
call gear_ui_init;
closeDialog 0;
_infoText = "";
//Tear the clothes
player playActionNow "Medic";
@@ -46,17 +45,7 @@ while {_i < _rounded} do {
if (!_result) then {
systemchat (localize ("str_tear_clothes_noroom"));
_nearByPile = nearestObjects [getPosATL player, ["WeaponHolder","WeaponHolderBase"], 2];
_pile = if (count _nearByPile > 0) then {_nearByPile select 0};
if (count _nearByPile == 0) then {
_pos = player modeltoWorld [0,1,0];
_pos set [2, 0];
//diag_log format [ "%1 itempos:%2 _nearByPile:%3", __FILE__, _pos, _nearByPile];
_pile = createVehicle ["WeaponHolder", _pos, [], 0.0, "CAN_COLLIDE"];
_pile setPosATL _pos;
};
_pile addMagazineCargoGlobal [_itemtocreate,1];
[_itemtocreate,1,1] call fn_dropItem;
};
};
true call dz_fn_meleeMagazines;

View File

@@ -12,18 +12,7 @@ _this: string - toolbelt item classname to check and add
How to use:
"ItemSledge" call player_addDuplicateTool;
*/
private ["_bag","_dropOnFloor"];
_dropOnFloor = {
private ["_location","_object"];
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];
};
private "_bag";
if (_this in items player) then {
_bag = unitBackpack player;
@@ -31,7 +20,8 @@ if (_this in items player) then {
systemChat format[localize "str_epoch_player_313",_this];
_bag addWeaponCargoGlobal [_this,1];
} else {
_this call _dropOnFloor;
[_this,2,1] call fn_dropItem;
systemChat format[localize "str_epoch_player_314",_this];
};
} else {
//Remove melee magazines (BIS_fnc_invAdd fix)
@@ -39,7 +29,8 @@ if (_this in items player) then {
if !([player,_this] call BIS_fnc_invAdd) then {
systemChat localize "str_epoch_player_107";
_this call _dropOnFloor;
[_this,2,1] call fn_dropItem;
systemChat format[localize "str_epoch_player_314",_this];
};
true call dz_fn_meleeMagazines;
};

View File

@@ -1,11 +1,13 @@
private ["_item","_pos","_nearByPile","_holder"];
private ["_amount","_item","_pos","_nearByPile","_holder","_type"];
//Radius to search for holder
#define PILE_SEARCH_RADIUS 2
//Location to offset the holder
#define PILE_OFFSET [0,0,0]
_item = _this;
_item = _this select 0;
_type = _this select 1;
_amount = _this select 2;
_holder = objNull;
//Lets get the location of the player in the world
@@ -32,7 +34,11 @@ if (count _nearByPile == 0) then {
};
//Add the item to the holder or to the newly created holder.
_holder addMagazineCargoGlobal [_item,1];
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;

View File

@@ -0,0 +1,49 @@
private ["_chance","_dynamic","_hasTool","_message","_needed","_newItem","_oneLeft","_remaining","_toolBelt"];
_chance = _this select 1;
_toolBelt = items player;
switch (_this select 0) do {
case "matches": {
_dynamic = dayz_matchboxCount;
_newItem = "qtyRemaining";
_needed = DayZ_Ignitors;
_message = "str_info_limitedbox";
};
case "knives": {
_dynamic = dayz_knifeDulling;
_newItem = "sharpnessRemaining";
_needed = Dayz_Gutting;
_message = "str_info_bluntknife";
};
};
{
_hasTool = _x in _toolBelt;
if (_hasTool && !_dynamic) exitWith {};
_oneLeft = _x in ["Item1Matchbox","ItemKnife1"];
_remaining = getText (configFile >> "CfgWeapons" >> _x >> _newItem);
// Use lowest quantity matches first to prevent duplicate tool being added
// Use knife with least remaining uses first, except dull knife
if (_hasTool && (!(_remaining in _toolBelt) or _oneLeft)) exitWith {
if (_x in ["ItemKnife","ItemMatchbox"]) then {
if ([_chance] call fn_chance) then {
player removeWeapon _x;
player addWeapon _remaining;
localize _message call dayz_rollingMessages;
};
} else {
player removeWeapon _x;
if (_remaining in _toolBelt) then {
//Drop dull knife or empty matchbox if player already has one. Prevents duplicate tool.
player removeWeapon _remaining;
[_remaining,2,1] call fn_dropItem;
};
player addWeapon _remaining;
};
};
} forEach _needed;
_hasTool

View File

@@ -7,7 +7,7 @@ scriptName "Functions\misc\fn_selfActions.sqf";
if (dayz_actionInProgress) exitWith {};
private ["_canPickLight","_text","_unlock","_lock","_totalKeys","_temp_keys","_temp_keys_names",
"_hasKey","_oldOwner","_hasAttached","_isZombie","_isHarvested","_isMan","_isFuel","_hasRawMeat","_hastinitem","_player_deleteBuild",
"_player_lockUnlock_crtl","_displayName","_hasIgnators","_menu","_menu1","_allowTow","_liftHeli","_found","_posL","_posC","_height","_attached",
"_player_lockUnlock_crtl","_displayName","_hasIgnitors","_menu","_menu1","_allowTow","_liftHeli","_found","_posL","_posC","_height","_attached",
"_combi","_findNearestGen","_humanity_logic","_low_high","_cancel","_buy","_buyV","_humanity","_traderMenu","_warn","_typeOfCursorTarget",
"_isVehicle","_isBicycle","_isDestructable","_isGenerator","_ownerID","_isVehicletype","_hasBarrel","_hasFuel20","_hasFuel5","_hasEmptyFuelCan",
"_itemsPlayer","_hasToolbox","_hasbottleitem","_isAlive","_isPlant","_istypeTent","_upgradeItems","_isDisallowRefuel","_isDog",
@@ -453,8 +453,8 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur
};
//other tents
if (_istypeTent) then {
_hasIgnators = {_x in DayZ_Ignitors} count _itemsPlayer > 0;
if ((_hasFuel20 or _hasFuel5 or _hasBarrel) && _hasIgnators) then {
_hasIgnitors = {_x in DayZ_Ignitors} count _itemsPlayer > 0;
if ((_hasFuel20 or _hasFuel5 or _hasBarrel) && _hasIgnitors) then {
if (s_player_destroytent < 0) then {
s_player_destroytent = player addAction [localize "str_actions_self_destroytent", "\z\addons\dayz_code\actions\player_destroyTent.sqf",_cursorTarget, 0, false, true];
};

View File

@@ -34,7 +34,7 @@ if (_ammo isKindOf "Hatchet_Swing_Ammo" || _ammo isKindOf "Chainsaw_Swing_Ammo")
publicVariableServer "PVDZ_objgather_Knockdown";
};
_itemOut = if (_ammo isKindOf "Chainsaw_Swing_Ammo") then {"PartWoodLumber"} else {"PartWoodPile"}; // Log can be crafted to > 2x plank > 4x woodpile
_itemOut call fn_dropItem;
[_itemOut,1,1] call fn_dropItem;
_distance = 60;
[player,_distance,false,getPosATL player] spawn player_alertZombies;

View File

@@ -16,7 +16,8 @@ if (!isDedicated) then {
call compile preprocessFileLineNumbers "\z\addons\dayz_code\util\compile.sqf";
call compile preprocessFileLineNumbers "\z\addons\dayz_code\loot\compile.sqf";
fn_dropItem = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_dropItem.sqf"; //fnc to drop items. _item call fn_dropItem;
fn_dropItem = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_dropItem.sqf";
fn_dynamicTool = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_dynamicTool.sqf";
fn_nearWaterHole = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_nearWaterHole.sqf";
BIS_Effects_Burn = compile preprocessFile "\ca\Data\ParticleEffects\SCRIPTS\destruction\burn.sqf";
player_zombieCheck = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_zombieCheck.sqf"; //Run on a players computer, checks if the player is near a zombie
@@ -286,24 +287,7 @@ if (!isDedicated) then {
};
_cantSee
};
/*
dayz_dropItem = {
private ["_nearByPile","_item"];
_type = _this select 0;
_dropItem = _this select 1;
_dropAmount = _this select 2;
_nearByPile = nearestObjects [(getPosATL player), ["WeaponHolder","WeaponHolderBase"],2];
if (count _nearByPile == 0) then {
_item = createVehicle ["WeaponHolder", (getPosATL player), [], 0.0, "CAN_COLLIDE"];
} else {
_item = _nearByPile select 0;
};
_item addMagazineCargoGlobal [_dropItem,_dropAmount];
_item setvelocity [0,0,1];
};
*/
dayz_NutritionSystem = {
private ["_type","_baseRegen","_nutrition","_calorieCount","_hungerCount","_thirstCount","_tempCount","_Thirst","_Hunger","_bloodregen","_golbalNutrition"];
//["type",regen,[NutritionTable,thirst(Working Class),hunger(Working Class)]]
@@ -535,7 +519,7 @@ if (!isDedicated) then {
_matches = 0;
{
if (configName inheritsFrom (configfile >> "cfgWeapons" >> _x) == "ItemMatchbox") then { // iskindOf does not work here?!
_matches = _matches + getNumber(configfile >> "cfgWeapons" >> _x >> "Ignators" >> "matches");
_matches = _matches + getNumber(configfile >> "cfgWeapons" >> _x >> "matches");
player removeWeapon _x;
};
} count (items player);
@@ -749,37 +733,12 @@ dayz_reduceItems = {
true
};
dayz_inflame = {
private ["_object","_hasTool"];
private "_object";
_object = _this select 0;
// true = light the fire
if (_this select 1) then {
_hasTool = false;
{
if (_x in items player) exitWith {
if (dayz_matchboxCount) then {
_matches = getNumber(configfile >> "cfgWeapons" >> _x >> "Ignators" >> "matches");
_qtyRemaining = getText(configfile >> "cfgWeapons" >> _x >> "Ignators" >> "qtyRemaining");
//diag_log format["%1[%2,%3]",_x,_matches,_qtyRemaining];
if (_matches == -1) then {
if ([getNumber(configfile >> "cfgWeapons" >> _x >> "Ignators" >> "chance")] call fn_chance) then {
player removeWeapon _x;
player addWeapon _qtyRemaining;
};
} else {
// remove a match
player removeWeapon _x;
player addWeapon _qtyRemaining;
};
};
_hasTool = true;
};
} count DayZ_Ignitors;
if (_hasTool) then { _object inflame true; };
if (_this select 1) then { // light the fire
if (["matches",0.12] call fn_dynamicTool) then { _object inflame true; };
} else { // put out the fire
_object inflame false;
};
@@ -806,7 +765,7 @@ dayz_inflame_showMenu = {
};
dayz_inflame_other = {
private ["_fireplace","_ret","_flame","_islit","_hasTool","_isLit","_pos"];
private ["_fireplace","_ret","_flame","_islit","_isLit","_pos"];
_fireplace = _this select 0;
if (_this select 1) then { // true = light the fire
@@ -818,32 +777,8 @@ dayz_inflame_other = {
_pos = _fireplace modelToWorld (_fireplace selectionPosition "ohniste"); // ATL
_flame setPosATL _pos;
};
_hasTool = false;
{
if (_x in items player) exitWith {
if (dayz_matchboxCount) then {
_matches = getNumber(configfile >> "cfgWeapons" >> _x >> "Ignators" >> "matches");
_qtyRemaining = getText(configfile >> "cfgWeapons" >> _x >> "Ignators" >> "qtyRemaining");
//diag_log format["%1[%2,%3]",_x,_matches,_qtyRemaining];
if (_matches == -1) then {
if ([getNumber(configfile >> "cfgWeapons" >> _x >> "Ignators" >> "chance")] call fn_chance) then {
player removeWeapon _x;
player addWeapon _qtyRemaining;
};
} else {
// remove a match
player removeWeapon _x;
player addWeapon _qtyRemaining;
};
};
_hasTool = true;
};
} count DayZ_Ignitors;
if (_hasTool) then { _flame inflame true; };
if (["matches",0.12] call fn_dynamicTool) then { _flame inflame true; };
} else { // put out the fire
_flame = nearestObjects [_fireplace, ["flamable_DZ"], 1];
if (count _flame > 0) then { (_flame select 0) inflame false; };
@@ -880,31 +815,6 @@ isInflamed = {
!(isNull _flame) && {(inflamed _flame)}
};
//Matchbox combine system.
dayz_combine_Inventory = {
private ["_qty","_fullBox","_remain"];
//ItemMatchbox,ItemAntibiotic
_qty = 0;
{
if (configName inheritsFrom (configfile >> "cfgWeapons" >> _x) == "ItemMatchbox") then {
_qty = _qty + getNumber(configfile >> "cfgWeapons" >> _x >> "Ignators" >> "matches");
player removeWeapon _x;
};
} count (items player);
// limit to 1 fullbox and 1 used matchbox
_fullBox = floor (_qty / 5);
_remain = _qty % 5;
if (_fullBox > 0) then { player addWeapon "Item5Matchbox"; };
if (_fullBox > 1) then {
player addWeapon "Item4Matchbox";
} else {
if (_remain > 0) then { player addWeapon ("Item"+str(_remain)+"Matchbox"); };
};
};
dayz_engineSwitch = {
//private["_unit","_humanity","_delay"];
_vehicle = _this select 0;

View File

@@ -44,8 +44,8 @@ Return value indicates whether the item was actually removed. */
/* Adds the specifed item on the ground at the player's feet.
The weaponholder containing the item is returned. Returns null if the function fails.*/
#define Player_DropWeapon(class) ([0, class] call dz_fn_player_dropItem)
#define Player_DropMagazine(class) ([1, class] call dz_fn_player_dropItem)
#define Player_DropWeapon(class) ([class,2,1] call fn_dropItem)
#define Player_DropMagazine(class) ([class,1,1] call fn_dropItem)
#define Player_GetStance_STAND 1
#define Player_GetStance_KNEEL 2

View File

@@ -107,49 +107,6 @@ dz_fn_player_addItem =
};
};
dz_fn_player_dropItem =
{
#define DROP_ITEM_WEAPON_HOLDER_SEARCH_RADIUS 2
#define DROP_ITEM_WEAPON_HOLDER_PLAYER_OFFSET [0,0,0]
Debug_Assert(!Player_IsOnLadder());
if (Player_IsInVehicle()) exitWith
{
diag_log "WARNING: dz_fn_player_dropItem called while player was in a vehicle.";
objNull
};
private ["_pos","_near","_wh"];
//Lets get the location of the player in the world
_pos = player modeltoWorld DROP_ITEM_WEAPON_HOLDER_PLAYER_OFFSET;
_pos set [2, 0];
//Find WeaponHolders close to the player.
_near = _pos nearObjects ["WeaponHolder", DROP_ITEM_WEAPON_HOLDER_SEARCH_RADIUS];
_wh = nil;
if (count _near > 0) then
{ _wh = _near select 0; };
else
{ _wh = createVehicle ["WeaponHolder", _pos, [], 0, "CAN_COLLIDE"]; }
if (_this select 0 == 0) then
{ _wh addWeaponCargoGlobal [_this select 1, 1]; }
else
{ _wh addMagazineCargoGlobal [_this select 1, 1]; };
//Reveal the item
player reveal _wh;
_wh
#undef DROP_ITEM_WEAPON_HOLDER_SEARCH_RADIUS
#undef DROP_ITEM_WEAPON_HOLDER_PLAYER_OFFSET
};
dz_fn_player_removeWeapon =
{
Player_RemoveWeapon_Fast(_this)

View File

@@ -42,7 +42,7 @@
5 setMarkerSize
5 setMarkerText !",if (_vehicle == _x) then {name _x} else {_vehicle call dayz_getCrew}];\n_marker setMarkerColorLocal \"ColorGreen\";"
5 setMarkerType !",if (_vehicle == _x) then {name _x} else {_vehicle call dayz_getCrew}];\n_marker setMarkerColorLocal \"ColorGreen\";"
5 setPosASL !="_unit setPosAsl [(_position select 0), (_position select 1), (LHA_height+1)];" !="_objectHelper setPosASL _position;" !="_tmpbuilt setPosASL _location;" !="_b0x1337 setPosASL (getPosASL player);" !"_obj setPosASL [_center select 0, " !"_obj setPosASL [_a, " !"_objectSnapGizmo setPosASL " !"_para setposasl [\n" !"_thingy setPosASL (ATLToASL _pos);" !"if (surfaceIsWater _location) then {_object setPosASL (getPosASL player);"
5 setPosASL !="_unit setPosAsl [(_position select 0), (_position select 1), (LHA_height+1)];" !="_objectHelper setPosASL _position;" !="_tmpbuilt setPosASL _location;" !="_b0x1337 setPosASL (getPosASL player);" !"_obj setPosASL [_center select 0, " !"_obj setPosASL [_a, " !"_objectSnapGizmo setPosASL " !"_para setposasl [\n" !"_thingy setPosASL (ATLToASL _pos);"
5 setTerrainGrid !"if (dayz_REsec == 1) then {call compile preprocessFileLineNumbers \""
5 setUnitRecoilCoefficient
5 setVehicle !="_this setVehicleInit \"this setVectorUp [0,0,1];\";" !"if(_status) then {\n_vehicle setVehicleLock \"LOCKED\";\n} else {\n_vehicle setVehicleLock \"UNLOCKED\";\n};"