|
| 1 | +--- |
| 2 | +title: it-drugs - Required Items |
| 3 | +description: A guide explaining how to add required items to a plant. |
| 4 | +--- |
| 5 | + |
| 6 | +import { Callout } from '@components/Callout' |
| 7 | + |
| 8 | +# Add required items |
| 9 | +A desired feature is that items are required when an item is planted or harvested, this feature is now available with version <span style={{color: "green"}}>**v1.3.0**</span> but not active by default in the Config.lua. |
| 10 | +To add the feature the following code must be added to each plant. |
| 11 | + |
| 12 | +```lua copy |
| 13 | +reqItems = { -- Items required to plant the seed |
| 14 | + ["planting"] = { |
| 15 | + }, |
| 16 | + ["harvesting"] = { |
| 17 | + } |
| 18 | +}, |
| 19 | +``` |
| 20 | +In each of the 2 categories you can add as many items as you want, the schema you have to use is as follows: |
| 21 | + |
| 22 | +```lua copy |
| 23 | +['item_amount'] = {amount = number, remove = true or false}, |
| 24 | +``` |
| 25 | + |
| 26 | +**Example:** |
| 27 | +```lua |
| 28 | +['watering_can'] = {amount = 1, remove = true}, |
| 29 | +``` |
| 30 | + |
| 31 | +<Callout type="warning"> |
| 32 | +Please remember to register all the items you list here in your inventory! |
| 33 | +</Callout> |
| 34 | + |
| 35 | +## Full example |
| 36 | + |
| 37 | +```lua |
| 38 | +['weed_lemonhaze_seed'] = { |
| 39 | + label = 'Lemon Haze', -- Label for the plant |
| 40 | + plantType = 'plant1', -- Choose plant types from (plant1, plant2, small_plant) |
| 41 | + growthTime = 2, -- Cutsom growth time in minutes false if you want to use the global growth time |
| 42 | + onlyZone = false, -- Set to zone id if you want to plant this seed only in a specific zone |
| 43 | + zones = {'weed_zone_one', 'weed_zone_two'}, -- Zones where the seed can be planted |
| 44 | + products = { -- Item the plant is going to produce when harvested with the max amount |
| 45 | + ['weed_lemonhaze'] = {min = 1, max = 4}, |
| 46 | + --['other_item'] = {min = 1, max = 2} |
| 47 | + }, |
| 48 | + seed = { |
| 49 | + chance = 50, -- Percent of getting back the seed |
| 50 | + min = 1, -- Min amount of seeds |
| 51 | + max = 2 -- Max amount of seeds |
| 52 | + }, |
| 53 | + time = 3000, -- Time it takes to plant/harvest in miliseconds |
| 54 | + reqItems = { -- Items required to plant the seed |
| 55 | + ["planting"] = { |
| 56 | + ['watering_can'] = {amount = 1, remove = true}, |
| 57 | + ['shovel'] = {amount = 1, remove = false}, |
| 58 | + }, |
| 59 | + ["harvesting"] = { |
| 60 | + ['watering_can'] = {amount = 1, remove = true}, |
| 61 | + ['shovel'] = {amount = 1, remove = false}, |
| 62 | + } |
| 63 | + } |
| 64 | +}, |
| 65 | +``` |
0 commit comments