Update vanilla chop wood

Vanilla commits:
a17b0572eb
7793017310
This commit is contained in:
ebayShopper
2018-01-17 16:43:12 -05:00
parent 6caba339c9
commit 07d8543e1d
4 changed files with 26 additions and 37 deletions

View File

@@ -48,23 +48,7 @@ while {_isOk} do {
//check chance, for a maximum amount of 5 loops allowing 5 possiable chances to breakin we also now divide the max chance by the amount of trys.
_sledgeChance = [((_values select 1) / _limit)] call fn_chance;
_crowBarChance = [((_values select 2) / _limit)] call fn_chance;
//Check if we have the tools to start
_hasSledgeHammer = "ItemSledge" in items player;
_hasCrowbar = "ItemCrowbar" in items player;
if (!_hasSledgeHammer) exitWith {
_proceed = nil;
localize "STR_BLD_BREAKIN_NEED_SLEDGE" call dayz_rollingMessages;
uiSleep 1;
};
if (!_hasCrowbar) exitWith {
_proceed = nil;
localize "STR_BLD_BREAKIN_NEED_CROWBAR" call dayz_rollingMessages;
uiSleep 1;
};
//Run SFX
_dis=20;
_sfx = "repair";
@@ -74,8 +58,12 @@ while {_isOk} do {
//Run animation loop
_finished = ["Medic",1] call fn_loopAction;
//Make sure player did not drop sledge or crowbar
_hasSledgeHammer = "ItemSledge" in items player;
_hasCrowbar = "ItemCrowbar" in items player;
//Everything happened as it should
if(_finished) then {
if (_finished && _hasSledgeHammer && _hasCrowbar) then {
//Add to Counter
_counter = _counter + 1;
} else {

View File

@@ -1,5 +1,7 @@
if (dayz_actionInProgress) exitWith { localize "str_player_actionslimit" call dayz_rollingMessages; };
dayz_actionInProgress = true;
private ["_dis","_sfx","_breaking","_countOut","_counter","_isOk","_proceed","_finished","_itemOut","_tree","_distance2d","_chanceResult"];
private ["_dis","_sfx","_breaking","_countOut","_counter","_isOk","_proceed","_finished","_itemOut","_tree","_distance2d","_chanceResult","_weapons"];
call gear_ui_init;
closeDialog 1;
@@ -17,8 +19,6 @@ _tree = objNull;
if (!isNull _tree) then {
_distance2d = [player, _tree] call BIS_fnc_distance2D;
if (_distance2d > 5) exitWith {localize "str_player_23" call dayz_rollingMessages;};
//Remove melee magazines (BIS_fnc_invAdd fix) (add new melee ammo to array if needed)
{player removeMagazines _x} forEach ["Hatchet_Swing","Crowbar_Swing","Machete_Swing","Fishing_Swing"];
// Start chop tree loop
_counter = 0;
@@ -29,7 +29,6 @@ if (!isNull _tree) then {
_chanceResult = dayz_HarvestingChance call fn_chance;
while {_isOk} do {
//setup alert and speak
_dis=20;
_sfx = "chopwood";
[player,_sfx,0,false,_dis] call dayz_zombieSpeak;
@@ -37,8 +36,11 @@ if (!isNull _tree) then {
//play action
_finished = ["Medic",1] call fn_loopAction;
if(!_finished) exitWith {
_weapons = weapons player;
_weapons set [count _weapons,dayz_onBack];
//Make sure player did not drop hatchet
if (!_finished or !("MeleeHatchet" in _weapons or ("ItemHatchet" in _weapons))) exitWith {
_isOk = false;
_proceed = false;
};
@@ -56,6 +58,7 @@ if (!isNull _tree) then {
} else {
if (dayz_onBack == "MeleeHatchet") then {
dayz_onBack = "";
if (!isNull findDisplay 106) then {findDisplay 106 displayCtrl 1209 ctrlSetText "";};
};
};
};
@@ -97,13 +100,8 @@ if (!isNull _tree) then {
if !(_proceed) then {
localize "str_player_24_Stoped" call dayz_rollingMessages;
};
//adding melee mags back if needed
switch (primaryWeapon player) do {
case "MeleeHatchet": {player addMagazine 'Hatchet_Swing';};
case "MeleeCrowbar": {player addMagazine 'Crowbar_Swing';};
case "MeleeMachete": {player addMagazine 'Machete_Swing';};
case "MeleeFishingPole": {player addMagazine 'Fishing_Swing';};
};
} else {
localize "str_player_23" call dayz_rollingMessages;
};
dayz_actionInProgress = false;

View File

@@ -1,4 +1,4 @@
private ["_mineChance","_item","_dis","_sfx","_breaking","_counter","_rocks","_findNearestRock","_objName","_countOut","_isOk","_proceed","_finished","_itemOut"];
private ["_mineChance","_item","_dis","_sfx","_breaking","_counter","_rocks","_findNearestRock","_objName","_countOut","_isOk","_proceed","_finished","_itemOut","_weapons"];
_item = _this;
call gear_ui_init;
@@ -30,20 +30,22 @@ if (!isNull _findNearestRock) then {
_mineChance = dayz_HarvestingChance call fn_chance;
while {_isOk} do {
//setup alert and speak
_dis=20;
_sfx = "minestone";
[player,_sfx,0,false,_dis] call dayz_zombieSpeak;
[player,_dis,true,(getPosATL player)] call player_alertZombies;
_finished = ["Medic",1] call fn_loopAction;
if(!_finished) exitWith {
_weapons = weapons player;
_weapons set [count _weapons,dayz_onBack];
//Make sure player did not drop pickaxe
if (!_finished or !("MeleePickaxe" in _weapons or ("ItemPickaxe" in _weapons))) exitWith {
_isOk = false;
_proceed = false;
};
if(_finished) then {
if (_finished) then {
["Working",0,[100,15,10,0]] call dayz_NutritionSystem;
_breaking = false;
@@ -57,6 +59,7 @@ if (!isNull _findNearestRock) then {
} else {
if (dayz_onBack == "MeleePickaxe") then {
dayz_onBack = "";
if (!isNull findDisplay 106) then {findDisplay 106 displayCtrl 1209 ctrlSetText "";};
};
};
};