Fix vanilla chop wood error

Players can now chop wood either with hatchet in their hands (faster) or
via right click on toolbelt (slower).
This commit is contained in:
ebaydayz
2016-04-21 12:28:00 -04:00
parent 7da7b9e5dd
commit 796c607173
5 changed files with 29 additions and 49 deletions

View File

@@ -8,23 +8,16 @@ if (_ammo isKindOf "Hatchet_Swing_Ammo" || _ammo isKindOf "Chainsaw_Swing_Ammo")
_findNearestTree = [];
{
if("" == typeOf _x) then {
if (alive _x) then {
_objName = _x call fn_getModelName;
// Exit since we found a tree
if (_objName in dayz_trees) exitWith {
_findNearestTree set [(count _findNearestTree),_x];
};
};
if (("" == typeOf _x) && {alive _x}) then {
_objName = _x call fn_getModelName;
// Exit since we found a tree
if (_objName in dayz_trees) exitWith { _findNearestTree set [count _findNearestTree,_x]; };
};
} count nearestObjects [getPosATL player, [], 20];
//diag_log ("POSITION: " + str(_endPos));
if (count(_findNearestTree) >= 1) then {
if (count _findNearestTree > 0) then {
_tree = _findNearestTree select 0;
@@ -38,10 +31,8 @@ if (_ammo isKindOf "Hatchet_Swing_Ammo" || _ammo isKindOf "Chainsaw_Swing_Ammo")
if (DZE_TEMP_treedmg < _damage) then {
if (_damage < 0.99) then {
if("" == typeOf _tree) then {
PVDZ_objgather_Knockdown = [_tree,player]; // Ask server to setDamage on tree
publicVariableServer "PVDZ_objgather_Knockdown";
};
PVDZ_objgather_Knockdown = [_tree,player]; // Ask server to setDamage on tree
publicVariableServer "PVDZ_objgather_Knockdown";
};
//diag_log ("DAMAGE: " + str(damage _tree));