Add support for harvesting added plants

Closes #1928
This commit is contained in:
ebayShopper
2017-04-04 13:32:06 -04:00
parent cb09bb6bc9
commit 496681cd9b
8 changed files with 53 additions and 72 deletions

View File

@@ -1,5 +1,6 @@
[NEW] Added a few loot positions for Namalsk and Takistan. @skigoggles
[NEW] Added DZE_limitPlots so admins can limit plot poles to 1 per UID, disabled by default. @oiad
[NEW] Pumpkin, sunflower, and hemp plants spawned with createVehicle can be harvested with a knife now. #1928 @F507DMT
[UPDATED] Zombie pathing. Zeds should now run more direct to players.
@@ -27,6 +28,8 @@
[FIXED] The DayZ police car can no longer be upgraded to car_sedan_DZE1. #1929 @F507DMT
[FIXED] Group tags sometimes printing WARNING: Function 'name' - x is dead to RPT.
[FIXED] Group saving issue which could potentially join a player to a random group or not save group properly after death.
[FIXED] Harvested pumpkin, sunflower, and hemp plants no longer respawn after relog (allowed infinite harvesting).
[FIXED] Multiple players can no longer harvest the same plant at once. #1928 @F507DMT
[NOTE] Fixes below are included in the mission file and server pbo as part of server package 1.0.6.1A (March 10th 2017)
[FIXED] Fixed food and drink going down 10x faster from melee and other "working" actions.

View File

@@ -1,27 +1,20 @@
private ["_addedTree","_objType","_item","_result","_dis","_sfx","_num","_breaking","_countOut","_findNearestTree","_objName","_counter","_isOk","_proceed","_animState","_started","_finished","_isMedic","_itemOut","_tree","_distance2d"];
private ["_dis","_sfx","_breaking","_countOut","_counter","_isOk","_proceed","_animState","_started","_finished","_isMedic","_itemOut","_tree","_distance2d"];
_item = _this;
call gear_ui_init;
closeDialog 1;
_countOut = floor(random 3) + 2;
_findNearestTree = [];
_tree = objNull;
{
_objType = typeOf _x;
_addedTree = _objType in dayz_treeTypes;
if ((_objType == "" or _addedTree) && {alive _x}) then {
_objName = _x call fn_getModelName;
if (typeOf _x in dayz_treeTypes && {alive _x} && {(_x call fn_getModelName) in dayz_trees}) exitWith {
// Exit since we found a tree
//model name has "remote" on client when tree is spawned on server with createVehicle
if (_objName in dayz_trees or _addedTree) exitWith { _findNearestTree set [count _findNearestTree,_x]; };
_tree = _x;
};
} count nearestObjects [getPosATL player, [], 20];
//if (["forest",dayz_surfaceType] call fnc_inString) then {// Need tree object for PVDZ_objgather_Knockdown
if (count _findNearestTree > 0) then {
_tree = _findNearestTree select 0;
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)

View File

@@ -3,51 +3,31 @@
Usage: spawn player_harvestPlant;
Made for DayZ Epoch please ask permission to use/edit/distrubute email vbawol@veteranbastards.com.
*/
private ["_isOk","_i","_objName","_started","_finished","_animState","_isMedic","_proceed","_itemOut","_countOut","_tree","_trees","_findNearestTree","_index","_invResult","_treesOutput","_text"];
private ["_isOk","_i","_objName","_started","_finished","_animState","_isMedic","_proceed","_itemOut","_countOut","_plant","_findNearestPlant","_index","_invResult","_text","_playerNear"];
if (dayz_actionInProgress) exitWith {localize "str_epoch_player_72" call dayz_rollingMessages;};
dayz_actionInProgress = true;
// allowed trees list move this later
_trees = ["pumpkin.p3d","p_helianthus.p3d","p_fiberplant_ep1.p3d"];
_treesOutput = ["FoodPumpkin","FoodSunFlowerSeed","ItemKiloHemp"];
//_item = _this;
call gear_ui_init;
_countOut = 0;
_findNearestTree = [];
_findNearestPlant = [];
{
if("" == typeOf _x) then {
if (alive _x) then {
_objName = _x call fn_getModelName;
// Exit since we found a tree
if (_objName in _trees) exitWith {
_findNearestTree set [(count _findNearestTree),_x];
_index = _trees find _objName;
_itemOut = _treesOutput select _index;
_countOut = 1;
};
if (typeOf _x in dayz_plantTypes && {alive _x}) then {
_objName = _x call fn_getModelName;
if (_objName in dayz_plant) then {
_findNearestPlant set [count _findNearestPlant,_x];
_index = dayz_plant find _objName;
_itemOut = dayz_plantOutput select _index;
_countOut = 1;
};
};
} count nearestObjects [([player] call FNC_getPos), [], 10];
//diag_log format["DEBUG TREES: %1", _findNearestTree];
if (count _findNearestPlant >= 1) then {
_plant = _findNearestPlant select 0;
if (count(_findNearestTree) >= 1) then {
_tree = _findNearestTree select 0;
// Start chop tree loop
// Start chop plant loop
_isOk = true;
_proceed = false;
while {_isOk} do {
@@ -91,6 +71,10 @@ if (count(_findNearestTree) >= 1) then {
};
if (_proceed) then {
// Make sure no other players are nearby
_playerNear = {isPlayer _x} count (([_plant] call FNC_GetPos) nearEntities ["CAManBase",10]) > 1;
if (_playerNear) exitWith {dayz_actionInProgress = false; localize "str_pickup_limit_5" call dayz_rollingMessages;};
//Remove melee magazines (BIS_fnc_invAdd fix)
false call dz_fn_meleeMagazines;
["Working",0,[3,2,4,0]] call dayz_NutritionSystem;
@@ -107,12 +91,13 @@ if (count(_findNearestTree) >= 1) then {
_text = getText (configFile >> "CfgMagazines" >> _itemOut >> "displayName");
if(_i != 0) then {
// chop down tree
if("" == typeOf _tree) then {
_tree setDamage 1;
if ("" == typeOf _plant) then {
// Ask server to setDamage on plant and sync for JIP
PVDZ_objgather_Knockdown = [_plant,player];
publicVariableServer "PVDZ_objgather_Knockdown";
} else {
deleteVehicle _plant;
};
//diag_log format["DEBUG TREE DAMAGE: %1", _tree];
format[localize "str_epoch_player_154",_i,_text] call dayz_rollingMessages;
} else {
format[localize "str_epoch_player_143",_i,_text] call dayz_rollingMessages;

View File

@@ -9,9 +9,17 @@ _i = 0;
if (58 == _objInfo select _i) exitWith {};
_i = _i + 1;
} count _objInfo;
_i = _i + 2; // skip the ": " part
for "_k" from _i to _lenInfo do {
_objName set [(count _objName), (_objInfo select _k)];
};
if (!local _this) then {
//Strip " remote" from the end to return the same name for local and remote objects
_objName resize ((count _objName) - 7);
};
_objName = toLower(toString(_objName));
_objName

View File

@@ -1,29 +1,19 @@
private ["_addedTree","_objType","_unit","_ammo","_weapon","_projectile"];
private ["_unit","_ammo","_weapon","_projectile","_tree"];
_unit = _this select 0;
_weapon = _this select 1;
_ammo = _this select 4;
_projectile = _this select 6;
if (_ammo in ["Hatchet_Swing_Ammo","Chainsaw_Swing_Ammo"]) then {
_findNearestTree = [];
_tree = objNull;
{
_objType = typeOf _x;
_addedTree = _objType in dayz_treeTypes;
if ((_objType == "" or _addedTree) && {alive _x}) then {
_objName = _x call fn_getModelName;
if (typeOf _x in dayz_treeTypes && {alive _x} && {(_x call fn_getModelName) in dayz_trees}) exitWith {
// Exit since we found a tree
//model name has "remote" on client when tree is spawned on server with createVehicle
if (_objName in dayz_trees or _addedTree) exitWith { _findNearestTree set [count _findNearestTree,_x]; };
_tree = _x;
};
} count nearestObjects [getPosATL player, [], 20];
//diag_log ("POSITION: " + str(_endPos));
if (count _findNearestTree > 0) then {
_tree = _findNearestTree select 0;
if (!isNull _tree) then {
// get 2d distance
_distance2d = [player, _tree] call BIS_fnc_distance2D;

View File

@@ -60,10 +60,8 @@ DayZ_GearedObjects = ["Car","Helicopter","Motorcycle","Ship","TentStorage_base",
DayZ_RestingAnims = ["amovpsitmstpsnonwpstdnon_ground","amovpsitmstpsnonwpstdnon_smoking","amovpsitmstpsraswrfldnon_weaponcheck1","amovpsitmstpsraswrfldnon"];
dayz_typedBags = ["bloodTester","bloodBagANEG","bloodBagAPOS","bloodBagBNEG","bloodBagBPOS","bloodBagABNEG","bloodBagABPOS","bloodBagONEG","bloodBagOPOS","wholeBloodBagANEG","wholeBloodBagAPOS","wholeBloodBagBNEG","wholeBloodBagBPOS","wholeBloodBagABNEG","wholeBloodBagABPOS","wholeBloodBagONEG","wholeBloodBagOPOS"];
dayz_playerAchievements = []; //[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
//Needed for ambient map trees
dayz_plant = ["pumpkin.p3d","p_helianthus.p3d","p_fiberplant_ep1.p3d"];
dayz_trees = ["ind_timbers.p3d","t_picea2s_snow.p3d","b_corylus.p3d","t_quercus3s.p3d","t_larix3s.p3d","t_pyrus2s.p3d","str_briza_kriva.p3d","dd_borovice.p3d","les_singlestrom_b.p3d","les_singlestrom.p3d","smrk_velky.p3d","smrk_siroky.p3d","smrk_maly.p3d","les_buk.p3d","str krovisko vysoke.p3d","str_fikovnik_ker.p3d","str_fikovnik.p3d","str vrba.p3d","hrusen2.p3d","str dub jiny.p3d","str lipa.p3d","str briza.p3d","p_akat02s.p3d","jablon.p3d","p_buk.p3d","str_topol.p3d","str_topol2.p3d","p_osika.p3d","t_picea3f.p3d","t_picea2s.p3d","t_picea1s.p3d","t_fagus2w.p3d","t_fagus2s.p3d","t_fagus2f.p3d","t_betula1f.p3d","t_betula2f.p3d","t_betula2s.p3d","t_betula2w.p3d","t_alnus2s.p3d","t_acer2s.p3d","t_populus3s.p3d","t_quercus2f.p3d","t_sorbus2s.p3d","t_malus1s.p3d","t_salix2s.p3d","t_picea1s_w.p3d","t_picea2s_w.p3d","t_ficusb2s_ep1.p3d","t_populusb2s_ep1.p3d","t_populusf2s_ep1.p3d","t_amygdalusc2s_ep1.p3d","t_pistacial2s_ep1.p3d","t_pinuse2s_ep1.p3d","t_pinuss3s_ep1.p3d","t_prunuss2s_ep1.p3d","t_pinusn2s.p3d","t_pinusn1s.p3d","t_pinuss2f.p3d","t_poplar2f_dead_pmc.p3d","misc_torzotree_pmc.p3d","misc_burnspruce_pmc.p3d","brg_cocunutpalm8.p3d","brg_umbrella_acacia01b.p3d","brg_jungle_tree_canopy_1.p3d","brg_jungle_tree_canopy_2.p3d","brg_cocunutpalm4.p3d","brg_cocunutpalm3.p3d","palm_01.p3d","palm_02.p3d","palm_03.p3d","palm_04.p3d","palm_09.p3d","palm_10.p3d","brg_cocunutpalm2.p3d","brg_jungle_tree_antiaris.p3d","brg_cocunutpalm1.p3d","str habr.p3d","brg_bird_1.p3d","brg_bird_2.p3d","brg_bird_3.p3d","brg_umbrella_acacia02b.p3d","brg_africandoumpalm_1.p3d","brg_umbrella_acacia04b.p3d","brg_datepalm_4.p3d","brg_datepalm_1.p3d","brg_umbrella_acacia03b.p3d","brg_bottle_4.p3d","brg_aloe1.p3d","brg_umbrella_acacia03.p3d","brg_umbrella_acacia01.p3d","brg_umbrella_acacia04.p3d","brg_aloe2.p3d","brg_umbrella_acacia02.p3d","brg_aloe3.p3d","brg_bottle_1.p3d","brg_datepalm_3.p3d","brg_datepalm_2.p3d","brg_baobab_1.p3d","brg_bottle_2.p3d","brg_bottle_3.p3d","t_fraxinus2s.p3d","t_carpinus2s.p3d"];
//Needed for trees spawned with createVehicle like POI (typeOf returns class instead of "")
dayz_treeTypes = ["MAP_t_picea1s","MAP_t_picea2s","MAP_t_picea3f","MAP_t_pinusN2s","MAP_t_pinusS2f","MAP_t_populus3s","MAP_t_betula2s","MAP_t_fagus2s","MAP_t_fagus2W","MAP_t_malus1s"];
Dayz_meatraw =
[
@@ -576,6 +574,10 @@ if (!isDedicated) then {
DayZ_fuelCans = ["ItemJerrycan","ItemFuelcan","ItemFuelBarrel"];
DayZ_fuelCansEmpty = ["ItemJerrycanEmpty","ItemFuelcanEmpty","ItemFuelBarrelEmpty"];
DayZ_fuelSources = ["Land_Ind_TankSmall","Land_fuel_tank_big","Land_fuel_tank_stairs","Land_fuel_tank_stairs_ep1","Land_wagon_tanker","Land_fuelstation","Land_fuelstation_army","Land_smd_fuelstation_army","land_fuelstation_w","Land_benzina_schnell"];
dayz_plantOutput = ["FoodPumpkin","FoodSunFlowerSeed","ItemKiloHemp"];
dayz_plantTypes = ["","MAP_pumpkin","MAP_p_Helianthus","fiberplant"];
//Needed for trees spawned with createVehicle like POI (typeOf returns class instead of "")
dayz_treeTypes = ["","MAP_t_picea1s","MAP_t_picea2s","MAP_t_picea3f","MAP_t_pinusN2s","MAP_t_pinusS2f","MAP_t_populus3s","MAP_t_betula2s","MAP_t_fagus2s","MAP_t_fagus2W","MAP_t_malus1s"];
//temperature variables
dayz_temperatur = 36; //TeeChange

View File

@@ -453,10 +453,10 @@ if (dayz_townGenerator) then {execVM "\z\addons\dayz_server\system\lit_fireplace
_uid = getPlayerUID _player;
_treeModel = _tree call fn_getModelName;
if ((_dis < 30) && (_treeModel in dayz_trees) && (_uid != "")) then {
if (_dis < 30 && (_treeModel in dayz_trees or (_treeModel in dayz_plant)) && (_uid != "")) then {
_tree setDamage 1;
dayz_choppedTrees set [count dayz_choppedTrees,_tree];
diag_log format["Server setDamage on tree %1 chopped down by %2(%3)",_treeModel,_name,_uid];
diag_log format["Server setDamage on tree or plant %1 chopped down by %2(%3)",_treeModel,_name,_uid];
};
};

View File

@@ -31,7 +31,7 @@
5 playableUnits !"for [{_y=0},{_y < count(playableUnits)},{_y=_y+1}] do {" !"typeName player == \"OBJECT\" && {(player in playableUnits" !"AND {((alive _x) AND {((vehicle _x) distance _obj < 150)})}} count playableUnits)}) then {" !="_local = { _unit distance _x < _dis; } count playableUnits <= 1;" !"if (!_isOk) exitWith {false};\nuiSleep 0.001;\n} forEach playableUnits;" !"ManagementMustBeClose) then { player nearEntities [\"CAManBase\", 10] } else { playableUnits };"
5 selectPlayer !"addSwitchableUnit dayz_originalPlayer;\nsetPlayable dayz_originalPlayer;\nselectPlayer dayz_originalPlayer;" !"addSwitchableUnit _newUnit;\nsetPlayable _newUnit;\nselectPlayer _newUnit;"
5 serverCommand !="_character = if (serverCommandAvailable \"#kick\") then { call sched_tg_follow } else { player };" !"serverCommand (\"#vote kick \" + _selectedName);"
5 setDamage !"([4654,9595,0] nearestObject 145259) setDamage 1;\n([4654,9595,0] nearestObject 145260) setDamage 1;" !"if (_entity isKindOf \"Animal\") then {\n_entity setDamage 1;" !"player setDamage 1;\n\nif (dayz_onBack != \"\") then {\n_body addWeapon dayz_onBack;" !"if(\"\" == typeOf _tree) then {\n_tree setDamage 1;\n};" !"if (_ent isKindOf \"Animal\" || _ent isKindOf \"zZombie_base\") then {\n_ent setDamage 1;"
5 setDamage !"([4654,9595,0] nearestObject 145259) setDamage 1;\n([4654,9595,0] nearestObject 145260) setDamage 1;" !"if (_entity isKindOf \"Animal\") then {\n_entity setDamage 1;" !"player setDamage 1;\n\nif (dayz_onBack != \"\") then {\n_body addWeapon dayz_onBack;" !"if (_ent isKindOf \"Animal\" || _ent isKindOf \"zZombie_base\") then {\n_ent setDamage 1;"
5 setDammage
5 SetEventHandler !"\n_menu ctrlSetEventHandler [\"ButtonClick\",_compile];\n};" !"inGameUISetEventHandler [\"Action\",\"false\"];"
5 setMarkerAlpha