Add harvestable plants and compost barrels

- Add 8 harvestable plants with proper output - Server Admins can add them to the game
- Add 2 Compost barrels - an empty and a full version
- Re-work of player_harvestPlant to fix a few bugs when different types of harvestable plants are near
- Add harvestable plant output config
This commit is contained in:
A Man
2022-03-18 15:24:37 +01:00
parent 9384e0112c
commit 84064ec893
6 changed files with 248 additions and 59 deletions

View File

@@ -543,6 +543,31 @@ class CfgSurvival {
yield = 2;
rawfoodtype = "FoodrabbitRaw";
};
};
class Plants {
class Plant_Pumpkin_DZE {
qty = 4;
};
class Plant_Sunflower_DZE {
qty = 3;
};
class Plant_Potato_DZE {
qty = 7;
};
class Plant_Carrot_DZE {
qty = 7;
};
class Plant_Hemp_DZE {
qty = 2;
};
class Plant_Tea_DZE {
qty = 3;
};
class Plant_Tobacco_DZE {
qty = 2;
};
class Plant_Garlic_DZE {
qty = 7;
};
};
};

View File

@@ -1472,3 +1472,43 @@ class metal_container_2d_kit: CA_Magazine // 2x red
};
};
};
class compost_barrel_empty_kit: CA_Magazine
{
scope = 2;
count = 1;
type = 256;
displayName = $STR_EPOCH_COMPOST_BARREL_EMTPY;
descriptionShort = $STR_EPOCH_COMPOST_BARREL_EMTPY_DESC;
model = "\z\addons\dayz_epoch\models\supply_crate.p3d";
picture = "\z\addons\dayz_epoch\pictures\equip_wooden_crate_ca.paa";
class ItemActions {
class Build {
text = $STR_EPOCH_BUILD_COMPOST_BARREL;
script = "spawn player_build;";
require[] = {};
create = "Compost_Barrel_Empty_DZE";
};
};
};
class compost_barrel_full_kit: CA_Magazine
{
scope = 2;
count = 1;
type = 256;
displayName = $STR_EPOCH_COMPOST_BARREL_FULL;
descriptionShort = $STR_EPOCH_COMPOST_BARREL_FULL_DESC;
model = "\z\addons\dayz_epoch\models\supply_crate.p3d";
picture = "\z\addons\dayz_epoch\pictures\equip_wooden_crate_ca.paa";
class ItemActions {
class Build {
text = $STR_EPOCH_BUILD_COMPOST_BARREL;
script = "spawn player_build;";
require[] = {"ItemShovel"};
create = "Compost_Barrel_Full_DZE";
};
};
};

View File

@@ -51,6 +51,26 @@ class Dayz_Plant1: Plant_Base {
};
};
class Compost_Barrel_Base_DZE : NonStrategic {
scope = 0;
icon = "\ca\data\data\Unknown_object.paa";
model = "\CA\Structures\Misc\Armory\Barels\barrel_empty.p3d";
armor = 100;
mapsize = 2;
vehicleClass = "DayZ Epoch Plants";
};
class Compost_Barrel_Empty_DZE : Compost_Barrel_Base_DZE {
scope = 2;
displayName = $STR_EPOCH_COMPOST_BARREL_EMTPY;
};
class Compost_Barrel_Full_DZE : Compost_Barrel_Base_DZE {
scope = 2;
displayName = $STR_EPOCH_COMPOST_BARREL_FULL;
model = "\CA\Structures\Misc\Armory\Barels\barrel_sand.p3d";
};
class Plant_Patch_Base_DZE : NonStrategic {
scope = 0;
model = "\z\addons\dayz_communityassets\models\stash_small.p3d";
@@ -94,3 +114,56 @@ class Plant_Patch_Tea_DZE : Plant_Patch_Base_DZE {
scope = 2;
displayname = $STR_EPOCH_PLANT_PATCH_TEA;
};
class Plant_Patch_Garlic_DZE : Plant_Patch_Base_DZE {
scope = 2;
displayname = $STR_EPOCH_PLANT_PATCH_GARLIC;
};
class Plant_Pumpkin_DZE : Plant_Patch_Base_DZE {
scope = 2;
displayName = $STR_EPOCH_PLANT_PUMPKIN;
model = "\ca\plants2\plant\pumpkin.p3d";
};
class Plant_Sunflower_DZE : Plant_Patch_Base_DZE {
scope = 2;
displayName = $STR_EPOCH_PLANT_SUNFLOWER;
model = "\ca\plants2\plant\p_helianthus.p3d";
};
class Plant_Potato_DZE : Plant_Patch_Base_DZE {
scope = 2;
displayName = $STR_EPOCH_PLANT_POTATO;
model = "\ca\plants2\plant\p_urtica.p3d";
};
class Plant_Carrot_DZE : Plant_Patch_Base_DZE {
scope = 2;
displayName = $STR_EPOCH_PLANT_CARROT;
model = "\ca\plants2\plant\p_carduus.p3d";
};
class Plant_Hemp_DZE : Plant_Patch_Base_DZE {
scope = 2;
displayName = $STR_EPOCH_PLANT_HEMP;
model = "\ca\plants_e\plant\p_fiberplant_ep1.p3d";
};
class Plant_Tea_DZE : Plant_Patch_Base_DZE {
scope = 2;
displayName = $STR_EPOCH_PLANT_TEA;
model = "\ca\plants2\clutter\c_wideLeafPlant.p3d";
};
class Plant_Tobacco_DZE : Plant_Patch_Base_DZE {
scope = 2;
displayName = $STR_EPOCH_PLANT_TOBACCO;
model = "\ca\plants2\bush\b_betulaHumilis.p3d";
};
class Plant_Garlic_DZE : Plant_Patch_Base_DZE {
scope = 2;
displayName = $STR_EPOCH_PLANT_GARLIC;
model = "z\addons\dayz_communityassets\models\comfrey_up_small.p3d";
};

View File

@@ -4,66 +4,57 @@
Made for DayZ Epoch please ask permission to use/edit/distrubute email vbawol@veteranbastards.com.
*/
closeDialog 0;
if (dayz_actionInProgress) exitWith {localize "str_epoch_player_72" call dayz_rollingMessages;};
dayz_actionInProgress = true;
closeDialog 0;
private ["_isOk","_i","_objName","_finished","_proceed","_itemOut","_countOut","_plant","_findNearestPlant","_index","_invResult","_text","_playerNear"];
local _plant = objNull;
local _itemOut = "";
local _type = "";
_countOut = 0;
_findNearestPlant = [];
{
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];
local _obj = _x;
_type = typeOf _obj;
if (alive _obj && {_type in dayz_plantTypes}) exitwith {
local _objName = _obj call fn_getModelName;
if (_objName in ["pumpkin.p3d","p_helianthus.p3d","p_fiberplant_ep1.p3d"] || _type != "" && {_objName in dayz_plant}) exitWith {
_index = dayz_plant find _objName;
_itemOut = dayz_plantOutput select _index;
_countOut = 1;
_plant = _obj;
};
};
} count nearestObjects [([player] call FNC_getPos), [], 10];
if (count _findNearestPlant >= 1) then {
_plant = _findNearestPlant select 0;
_isOk = true;
_proceed = false;
while {_isOk} do {
if !(isNull _plant) then {
[player,(getPosATL player),20,"chopwood"] spawn fnc_alertZombies;
local _finished = ["Medic",1] call fn_loopAction;
_finished = ["Medic",1] call fn_loopAction;
if(!_finished) exitWith {
_isOk = false;
_proceed = false;
};
if(_finished) exitWith {
_isOk = false;
_proceed = true;
};
};
if (_proceed) then {
_playerNear = {isPlayer _x} count (([_plant] call FNC_GetPos) nearEntities ["CAManBase", 12]) > 1;
if (_finished) then {
local _playerNear = {isPlayer _x} count (([_plant] call FNC_GetPos) nearEntities ["CAManBase", 12]) > 1;
if (_playerNear) exitWith {dayz_actionInProgress = false; localize "str_pickup_limit_5" call dayz_rollingMessages;};
false call dz_fn_meleeMagazines; //Remove melee magazines (BIS_fnc_invAdd fix)
["Working",0,[3,2,4,0]] call dayz_NutritionSystem;
_invResult = false;
_i = 0;
local _invResult = false;
local _groundDrop = false;
local _i = 0;
local _j = 0;
local _countOut = getNumber(configFile >> "CfgSurvival" >> "Plants" >> _type >> "qty");
_countOut = 1 + floor(random _countOut);
for "_x" from 1 to _countOut do {
_invResult = [player,_itemOut] call BIS_fnc_invAdd;
if(_invResult) then {
_i = _i + 1;
if !(_invResult) then {
[_itemOut,1,1] call fn_dropItem;
_groundDrop = true;
_j = _j + 1;
};
_i = _i + 1;
};
true call dz_fn_meleeMagazines;
_text = getText (configFile >> "CfgMagazines" >> _itemOut >> "displayName");
local _text = getText (configFile >> "CfgMagazines" >> _itemOut >> "displayName");
if (_i != 0) then {
if ("" == typeOf _plant) then {
@@ -72,7 +63,11 @@ if (count _findNearestPlant >= 1) then {
} else {
deleteVehicle _plant;
};
if (_groundDrop) then {
format[localize "str_success_gathered",_text,(_i-_j),_j,_text] call dayz_rollingMessages;
} else {
format[localize "str_epoch_player_154",_i,_text] call dayz_rollingMessages;
};
} else {
format[localize "str_epoch_player_143",_i,_text] call dayz_rollingMessages;
};

File diff suppressed because one or more lines are too long

View File

@@ -6389,11 +6389,11 @@
</Key>
<Key ID="str_success_gathered">
<!-- %1 itemout name %2 itemout quantity %3 quantity left -->
<English>You have collected %2 %1. %3 Dropped.</English>
<German>Du hast %2x %1 aufgesammelt. Die restlichen %3 liegen noch auf dem Boden.</German>
<Russian>Вы собрали %1 (%2). %3 осталось.</Russian>
<French>Vous avez récolté %2 %1. %3 Dropped.</French>
<Czech>Nasbírali jste %2x %1. Zbývá ještě %3.</Czech>
<English>You have collected %2x %1. %3 %4 dropped on the ground.</English>
<German>Du hast %2x %1 aufgesammelt. Die restlichen %3 %4 liegen noch auf dem Boden.</German>
<Russian>Вы собрали %1 (%2). %3 %4 осталось.</Russian>
<French>Vous avez récolté %2x %1. %3 %4 Dropped.</French>
<Czech>Nasbírali jste %2x %1. Zbývá ještě %3 %4.</Czech>
</Key>
<Key ID="str_failed_noroom">
<English>Unable to gather due to space, 3 main slots are needed.</English>
@@ -23642,12 +23642,12 @@
<Czech>Downgradnuli jste %1.</Czech>
</Key>
<Key ID="STR_EPOCH_PLAYER_143">
<English>%1 of %2 could not be added to your inventory. (not enough room?)</English>
<German>%1 von %2 konnte dem Inventar nicht hinzugefügt werden. (Inventar voll?)</German>
<English>%1x %2 could not be added to your inventory. (not enough room?)</English>
<German>%1x %2 konnte dem Inventar nicht hinzugefügt werden. (Inventar voll?)</German>
<Russian>%2 (в количестве: %1) не может быть добавлен в ваш инвентарь. (Недостаточно места?)</Russian>
<Dutch>%1 van %2 kon niet worden toegevoegd aan je inventaris (vol?)</Dutch>
<French>%1 sur %2 ne peuvent être ajoutés à votre inventaire. (pas assez de place ?)</French>
<Czech>%1 z %2 nemohl být přidán do inventáře. (nedostatek místa?)</Czech>
<Dutch>%1x %2 kon niet worden toegevoegd aan je inventaris (vol?)</Dutch>
<French>%1x %2 ne peuvent être ajoutés à votre inventaire. (pas assez de place ?)</French>
<Czech>%1x %2 nemohl být přidán do inventáře. (nedostatek místa?)</Czech>
</Key>
<Key ID="STR_EPOCH_PLAYER_145">
<English>Missing Parts after first check Item: %1 / %2</English>
@@ -23679,11 +23679,11 @@
<Czech>%3 hotovo, chybí ještě %1 %2</Czech>
</Key>
<Key ID="STR_EPOCH_PLAYER_154">
<English>%1 of %2 has been successfully added to your inventory.</English>
<German>%1 %2 wurde erfolgreich deinem Inventar hinzugefügt.</German>
<English>%1x %2 has been successfully added to your inventory.</English>
<German>%1x %2 wurde erfolgreich deinem Inventar hinzugefügt.</German>
<Russian>%2 (в количестве: %1) успешно добавлен в ваш инвентарь.</Russian>
<Dutch>%1 %2 is aan je inventaris toegevoegd.</Dutch>
<Czech>%1 %2 bylo úspěšně přidáno do Vašeho inventáře.</Czech>
<Dutch>%1x %2 is aan je inventaris toegevoegd.</Dutch>
<Czech>%1x %2 bylo úspěšně přidáno do Vašeho inventáře.</Czech>
</Key>
<Key ID="STR_EPOCH_PLAYER_155">
<English>Mining Ore, walk away at any time to cancel. (%1/%2)</English>
@@ -35138,6 +35138,26 @@
<German>Müllhaufen</German>
<Russian>Мусорная куча</Russian>
</Key>
<Key ID="STR_EPOCH_COMPOST_BARREL_EMTPY">
<English>Compost Barrel (Empty)</English>
<German>Kompostfass (Leer)</German>
</Key>
<Key ID="STR_EPOCH_COMPOST_BARREL_EMTPY_DESC">
<English>Compost Barrel (Empty)</English>
<German>Kompostfass (Leer)</German>
</Key>
<Key ID="STR_EPOCH_COMPOST_BARREL_FULL">
<English>Compost Barrel (Full)</English>
<German>Kompostfass (Voll)</German>
</Key>
<Key ID="STR_EPOCH_COMPOST_BARREL_FULL_DESC">
<English>Compost Barrel (Full)</English>
<German>Kompostfass (Voll)</German>
</Key>
<Key ID="STR_EPOCH_BUILD_COMPOST_BARREL">
<English>Build Compost Barrel</English>
<German>Kompostfass bauen</German>
</Key>
<Key ID="STR_EPOCH_PLANT_PATCH_PUMPKIN">
<English>Pumpkin patch</English>
<German>Kürbisbeet</German>
@@ -35173,6 +35193,42 @@
<German>Teepflanzenbeet</German>
<Russian>Чайный участок</Russian>
</Key>
<Key ID="STR_EPOCH_PLANT_PATCH_GARLIC">
<English>Garlic patch</English>
<German>Knoblauchbeet</German>
</Key>
<Key ID="STR_EPOCH_PLANT_PUMPKIN">
<English>Pumpkin Plant</English>
<German>Kürbispflanze</German>
</Key>
<Key ID="STR_EPOCH_PLANT_SUNFLOWER">
<English>Sunflower</English>
<German>Sonnenblume</German>
</Key>
<Key ID="STR_EPOCH_PLANT_POTATO">
<English>Potato Plant</English>
<German>Kartoffelpflanze</German>
</Key>
<Key ID="STR_EPOCH_PLANT_CARROT">
<English>Carrot Plant</English>
<German>Karottenpflanze</German>
</Key>
<Key ID="STR_EPOCH_PLANT_HEMP">
<English>Hemp Plant</English>
<German>Cannabispflanze</German>
</Key>
<Key ID="STR_EPOCH_PLANT_TEA">
<English>Tea Plant</English>
<German>Teepflanze</German>
</Key>
<Key ID="STR_EPOCH_PLANT_TOBACCO">
<English>Tobacco Plant</English>
<German>Tabakpflanze</German>
</Key>
<Key ID="STR_EPOCH_PLANT_GARLIC">
<English>Garlic Plant</English>
<German>Knoblauchpflanze</German>
</Key>
<Key ID="STR_EPOCH_ITEM_NOTEBOOK">
<English>Notebook</English>
<Russian>Ноутбук</Russian>