Building: Agriculture
Making a Crop
A crop is defined by three distinct objects: a seed object, a field object and a fruit object. A seed object is simply an object that can be planted. Once planted, a field object is created. The field object tracks the growth conditions and maturation of the crop it represents. Once the field object matures, it can be harvested. The process of harvesting will create a certain number of fruit objects, depending on the health of the crop compared to its nominal yield.Making a Seed Object
A seed object should be a normal carryable object. At the moment, seeds are not produced by growing crops, so be sure to set a reasonable cost. What defines a seed object as a seed object is that it has the property 'agri.crop' set to the id of the field object.Example: template_seeds_1 (sugarcane seeds) has agri.crop set to template_sugarcane_1 (sugarcane field).
Existing code allows for the automatic generation of a 'grower's information' label description, which will be appended to the existing description, using data directly from the agri.crop object. If you would like to use this facility, set your seed object's 'treatas' to be 'template_seeds_2'. Alternately, copy the lua.after_examine code from template_seeds_2 and modify the messaging yourself.
Making a Crop Object
A crop object is the meat of a crop. It contains all the information on nominal yield, nominal growth conditions, fruit, etc. ALL of the following properties must be set, or things will go screwy.Name | Type | Desc |
---|---|---|
agri.fruit | object id | The id of the object to be created on harvest |
agri.growthname | string | The name of the crop's fruit or growth items |
agri.growthstr | string | The name of the crop's 'infrastructure' (e.g. trees, stalks, bushes, plants) |
agri.cycle | integer | The amount of time for the crop to mature, in Real Life Minutes |
agri.cycletime | integer | The amount of time between growth cycles. This should be some factor of the integer in agri.cycle. |
agri.yield | integer | The amount of fruit objects that a perfectly-healthy crop will produce. |
agri.acidity.max | integer | The maximum acidity level the crop can withstand, in centi-pH. Acceptable range is from 000 to 1400 (700 = 7.0 = neutral) |
agri.acidity.min | integer | The minimum acidity level the crop can withstand, int centi-pH. |
agri.acidity.mod.max | integer | The maximum amount by which the crop will change acidity at each growth cycle, in centi-pH. Negative values are acceptable and mean that the crop makes the soil acidic. |
agri.acidity.mod.min | integer | The minimum amount by which the crop will change acidity at each growth cycle, in centi-pH. |
agri.fertility.max | integer | The maximum KPN mineral content the crop can withstand, in parts per million. Acceptable range is from 0 to 1000000. |
agri.fertility.min | integer | The minimum KPN mineral content the crop can withstand, in parts per million. |
agri.fertility.mod.max | integer | The maximum amount by which the crop will change KPN mineral content per growth cycle. This should be negative for most crops. Unit is parts per million. |
agri.fertility.mod.min | integer | The minimum amount by which the crop will change KPN mineral content per growth cycle. This should be negative for most crops. Unit is parts per million. |
agri.insolation.max | integer | The maximum amount of solar radiation which the crop can withstand, in deci-sunlight-hours. Acceptable range is from 0 to 12000 (200x earth normal). Terran environments average 40 to 80. |
agri.insolation.min | integer | The minimum amount of solar radiation which the crop can withstand, in deci-sunlight-hours. |
agri.moisture.max | integer | The maximum amount of soil moisture which the crop can withstand, in millimeters per year. Acceptable range is from 0 to 100000. Temperate Terran environments average about 400 to 1000. |
agri.moisture.min | integer | The minimum amount of soil moisture which the crop can withstand, in millimeters per year. |
agri.moisture.mod.max | integer | The maximum amount by which the crop will change soil moisture during a given growth cycle, in millimeters per year. This should be a negative value for all crops except in extremely unusual circumstances. |
agri.moisture.mod.min | integer | The minimum amount by which the crop will change soil moisture during a given growth cycle, in millimeters per year. This should be a negative value for all crops except in extremely unusual circumstances. |
agri.temp.max | integer | The maximum ambient temperature which the crop can withstand, in degrees Celsius. Acceptable range is from -272 to 1000. |
agri.temp.min | integer | The minimum ambient temperature which the crop can withstand, in degrees Celsius. |
treatas | string | This should be set to 'template_crop_1'. |
plan.growth | string | This should have a delay of 60*agri.cycletime (seconds), and an action of 'trap growth'. |
Making a Fruit Object
A fruit object can actually be any object. It has one distinguishing characteristic: 'agri.seed'. This string property should be set to the id of the seed object that it will produce when placed into a seed-extracting machine. If you don't want your crop to produce seeds from its fruit, leave this property unset.Also, after being harvested, six floating-point/string properties will be set on each fruit object. Their range is from 0 to 1. 0 in any of these means the named environmental factor was outside of acceptable ranges for growth or that the fruit is of awful health. A flat 0 will never occur naturally from the model. 1 in any of these means the named environmental factor was ideal for growth, or that the fruit is in perfect health. A flat 1 will rarely be produced by the simulation.
Name | Desc |
---|---|
!agri.acidity | The average percentage congruence of nominal soil acidity over the fruit's growth. |
!agri.fertility | The average percentage congruence of nominal soil KPN content over the fruit's growth. |
!agri.insolation | The average percentage congruence of nominal solar radiation over the fruit's growth. |
!agri.moisture | The average percentage congruence of nominal soil moisture over the fruit's growth. |
!agri.temperature | The average percentage congruence of nominal ambient temperature over the fruit's growth. |
!agri.condition | The overall condition of the fruit, as expressed in a percentage. |
Making a Farm Location
A farming location is much simpler than a crop, provided you have already set up an environmental control object, or set environmental defaults on a zone.Setting up a Zone for Agriculture
Five integer properties must be set on a zone object for farms to exist within in without the use of environment control objects.env.acidity defines the default acidity level of the soil within the zone, measured in centi-pH. Acceptable ranges are from 0 to 1400. Example measurements: Distilled water is 700, seawater is 800, pure acid is 0, pure alkali is 1400. Terran norms range between 400 and 900.
env.fertility defines the default concentration of KPN chemicals (potassiates, nitrates, and phosphors) in the soil within the zone, measured in parts per million. Acceptable ranges are from 0 to 1000000. Terran norms for arable land range widely, between 1000 and 10000.
env.insolation defines the default average amount of solar radiation that impacts the zone, measured in deci-sunlight-hours. Acceptable ranges are any integer >= 0. Terran norms for temperate climates are about 50 to 70.
env.moisture defines the default average amount of moisture that falls on the zone's soil, measured in millimeters annually. Acceptable ranges are any integer >= 0. Examples: 0 to 50 are deserts. 150 to 300 would dry savannas or scrublands. 150 to 300 would be arctic tundras. 300 to 600 would be wet savannas or grasslands. 750 to 1500 would be temperate forests. >= 1500 would be generally wet, tropical conditions. >= 2500 are extremely wet conditions rarely found outside of tropical rainforests.
env.temperature defines the default average ambient temperature in the zone's climate, measured in degrees Celsius. Acceptable range is any integer >= -273.
Environmental Control Objects
Technically, an environmental control object is any object with the above 5 env.* properties set on it. Any object can 'forward' its environmental decisions to any other object - just set the 'env.proxy' property (string) to the id of the object which will handle that object's environmental variables.In terms of farm rooms, if env.proxy is set, then the agriculture system will go to the object named as the environmental proxy, and check for the env.proxy property there. If it is set, it will repeat the process. Once the system finishes following the trail of env.proxy settings, it returns the env.* variables it finds to the simulation.
If env.proxy is not set on the farm room, the system will, by default, attempt to load the settings directly from the zone that the farm room is in - skipping any env.proxy settings that that zone has.
(The system will detect loops and halt on the last object in a loop.)
Making a Room Farmable
Once you have either set env.proxy to your environmental control object, or set the env.* variables on the room's zone, all that needs to be done to make a room farmable is to set the 'Arable' flag on it.If you would like players to be able to water their crops, then you must set one more thing. The floor object for the room must either copy the lua.before_poured_upon code from template_ground_2, or must have its treatas set to template_ground_2.
Fertilization occurs in other objects, and cannot be prevented.
Greenhouses
A common occurance is for a room to be a greenhouse, which allows the farmer to control the temperature and radiation levels within the room to a significant degree. A simple one-room greenhouse has been constructed at yoru_20.To make a one-room greenhouse like yoru_20, you must do three things. First, set env.proxy to be the room's id. Second, set the five env.* variables on the room. Third, either copy the lua.say code from yoru_20, or set the room's treatas to yoru_20.
The messaging for the lua.say code mentions a computer object saying things, so you may wish to copy the code instead of setting a treatas, in order to modify the messaging and the environmental limits.
Peripheral Objects
There are two important peripheral functions to agriculture: watering and fertilizing. Watering is accomplished simply by pouring a water-filled container on the ground or emptying a water-filled container in a farm room.To make a fertilizing object, you need to make an object that is gettable and preferably has a reasonable cost set. The only way to get fertilizer, currently, is by buying it. The fertilizer object should have its treatas set to template_fertilizer_1. It should also have agri.acidity set to the acidity of the fertilizer, in centi-pH, and agri.fertility set to the KPN value added, in parts per million. Note that acidity will be applied as a change between 1-10% (randomly) in difference from the current value, whereas fertility will be simply added in.