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

@@ -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;