mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-13 19:52:38 +03:00
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:
@@ -13,11 +13,11 @@ class MeleeHatchet : MeleeWeapon
|
|||||||
|
|
||||||
class ItemActions
|
class ItemActions
|
||||||
{
|
{
|
||||||
/*class Use // Must hit tree to chop wood on Epoch, see player_harvest
|
class Use
|
||||||
{
|
{
|
||||||
text = $STR_ACTIONS_CHOPWOOD;
|
text = $STR_ACTIONS_CHOPWOOD;
|
||||||
script = "spawn player_chopWood";
|
script = "spawn player_chopWood";
|
||||||
};*/
|
};
|
||||||
|
|
||||||
class Toolbelt
|
class Toolbelt
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,11 +9,11 @@ class ItemHatchet : ItemCore
|
|||||||
|
|
||||||
class ItemActions
|
class ItemActions
|
||||||
{
|
{
|
||||||
/*class Use // Must hit tree to chop wood on Epoch, see player_harvest
|
class Use
|
||||||
{
|
{
|
||||||
text = $STR_ACTIONS_CHOPWOOD;
|
text = $STR_ACTIONS_CHOPWOOD;
|
||||||
script = "spawn player_chopWood;";
|
script = "spawn player_chopWood;";
|
||||||
};*/
|
};
|
||||||
|
|
||||||
class ToBack
|
class ToBack
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,38 +1,27 @@
|
|||||||
|
|
||||||
private ["_item","_result","_dis","_sfx","_num","_breaking","_countOut","_woodCutting","_findNearestTree","_objName","_counter","_isOk","_proceed","_animState","_started","_finished","_isMedic","_itemOut"];
|
private ["_item","_result","_dis","_sfx","_num","_breaking","_countOut","_findNearestTree","_objName","_counter","_isOk","_proceed","_animState","_started","_finished","_isMedic","_itemOut","_tree","_distance2d"];
|
||||||
|
|
||||||
//if (!isnil "faco_player_chopWood") exitWith { _this call faco_player_chopWood };
|
//if (!isnil "faco_player_chopWood") exitWith { _this call faco_player_chopWood };
|
||||||
|
|
||||||
_item = _this;
|
_item = _this;
|
||||||
call gear_ui_init;
|
call gear_ui_init;
|
||||||
closeDialog 1;
|
closeDialog 1;
|
||||||
_countOut = 3;
|
_countOut = floor(random 3) + 2;
|
||||||
_woodCutting = false;
|
|
||||||
|
|
||||||
|
_findNearestTree = [];
|
||||||
if (["forest",dayz_surfaceType] call fnc_inString) then {
|
{
|
||||||
_countOut = floor(random 3) + 2;
|
if (("" == typeOf _x) && {alive _x}) then {
|
||||||
_woodCutting = true;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
_findNearestTree = objNull;
|
|
||||||
{
|
|
||||||
_objName = _x call fn_getModelName;
|
_objName = _x call fn_getModelName;
|
||||||
// Exit since we found a tree
|
// Exit since we found a tree
|
||||||
if (_objName in dayz_trees) exitWith { _findNearestTree = _x; };
|
if (_objName in dayz_trees) exitWith { _findNearestTree set [count _findNearestTree,_x]; };
|
||||||
} foreach nearestObjects [getPosATL player, [], 8];
|
|
||||||
|
|
||||||
_countOut = floor(random 3) + 2;
|
|
||||||
|
|
||||||
if (!isNull _findNearestTree) then {
|
|
||||||
_woodCutting = true;
|
|
||||||
} else {
|
|
||||||
localize "str_player_23" call dayz_rollingMessages;
|
|
||||||
};
|
};
|
||||||
};
|
} count nearestObjects [getPosATL player, [], 20];
|
||||||
|
|
||||||
|
//if (["forest",dayz_surfaceType] call fnc_inString) then {// Need tree object for PVDZ_objgather_Knockdown
|
||||||
if (_woodCutting) then {
|
if (count _findNearestTree > 0) then {
|
||||||
|
_tree = _findNearestTree select 0;
|
||||||
|
_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)
|
//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"];
|
{player removeMagazines _x} forEach ["Hatchet_Swing","Crowbar_Swing","Machete_Swing","Fishing_Swing"];
|
||||||
|
|
||||||
@@ -122,11 +111,9 @@ if (_woodCutting) then {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (_proceed) then {
|
if (_proceed) then {
|
||||||
if ("" == typeOf _findNearestTree) then {
|
//remove vehicle, Need to ask server to remove.
|
||||||
//remove vehicle, Need to ask server to remove.
|
PVDZ_objgather_Knockdown = [_tree,player];
|
||||||
PVDZ_objgather_Knockdown = [_findNearestTree,player];
|
publicVariableServer "PVDZ_objgather_Knockdown";
|
||||||
publicVariableServer "PVDZ_objgather_Knockdown";
|
|
||||||
};
|
|
||||||
//"Chopping down tree." call dayz_rollingMessages;
|
//"Chopping down tree." call dayz_rollingMessages;
|
||||||
//localize "str_player_25" call dayz_rollingMessages;
|
//localize "str_player_25" call dayz_rollingMessages;
|
||||||
} else {
|
} else {
|
||||||
@@ -146,4 +133,6 @@ if (_woodCutting) then {
|
|||||||
case "MeleeMachete": {player addMagazine 'Machete_Swing';};
|
case "MeleeMachete": {player addMagazine 'Machete_Swing';};
|
||||||
case "MeleeFishingPole": {player addMagazine 'Fishing_Swing';};
|
case "MeleeFishingPole": {player addMagazine 'Fishing_Swing';};
|
||||||
};
|
};
|
||||||
|
} else {
|
||||||
|
localize "str_player_23" call dayz_rollingMessages;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -8,23 +8,16 @@ if (_ammo isKindOf "Hatchet_Swing_Ammo" || _ammo isKindOf "Chainsaw_Swing_Ammo")
|
|||||||
|
|
||||||
_findNearestTree = [];
|
_findNearestTree = [];
|
||||||
{
|
{
|
||||||
if("" == typeOf _x) then {
|
if (("" == typeOf _x) && {alive _x}) then {
|
||||||
|
_objName = _x call fn_getModelName;
|
||||||
if (alive _x) then {
|
// Exit since we found a tree
|
||||||
|
if (_objName in dayz_trees) exitWith { _findNearestTree set [count _findNearestTree,_x]; };
|
||||||
_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];
|
} count nearestObjects [getPosATL player, [], 20];
|
||||||
|
|
||||||
//diag_log ("POSITION: " + str(_endPos));
|
//diag_log ("POSITION: " + str(_endPos));
|
||||||
|
|
||||||
if (count(_findNearestTree) >= 1) then {
|
if (count _findNearestTree > 0) then {
|
||||||
|
|
||||||
_tree = _findNearestTree select 0;
|
_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 (DZE_TEMP_treedmg < _damage) then {
|
||||||
|
|
||||||
if (_damage < 0.99) then {
|
if (_damage < 0.99) then {
|
||||||
if("" == typeOf _tree) then {
|
PVDZ_objgather_Knockdown = [_tree,player]; // Ask server to setDamage on tree
|
||||||
PVDZ_objgather_Knockdown = [_tree,player]; // Ask server to setDamage on tree
|
publicVariableServer "PVDZ_objgather_Knockdown";
|
||||||
publicVariableServer "PVDZ_objgather_Knockdown";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//diag_log ("DAMAGE: " + str(damage _tree));
|
//diag_log ("DAMAGE: " + str(damage _tree));
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ if (!isDedicated) then {
|
|||||||
player_removeAttachment = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_removeAttachment.sqf";
|
player_removeAttachment = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_removeAttachment.sqf";
|
||||||
player_fillWater = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\water_fill.sqf";
|
player_fillWater = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\water_fill.sqf";
|
||||||
player_makeFire = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_makefire.sqf";
|
player_makeFire = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_makefire.sqf";
|
||||||
//player_chopWood = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_chopWood.sqf"; //Epoch uses player_harvest instead
|
player_chopWood = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_chopWood.sqf";
|
||||||
player_mineStone = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_mineStone.sqf";
|
player_mineStone = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_mineStone.sqf";
|
||||||
if (DZE_modularBuild) then {
|
if (DZE_modularBuild) then {
|
||||||
player_build = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\modular_build.sqf";
|
player_build = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\modular_build.sqf";
|
||||||
|
|||||||
Reference in New Issue
Block a user