The farming system code has been created in an attempt to make expansion as easy as possible. The main building blocks are:
The plant script is used in all plants, trees, fields etc. A plant is something that requires a 'water' source in order to grow through the stages of 'new', 'growing' and 'ripe'. When ripe the plant allows for harvest of one item (which can of course be a coalesced object) and then repeats the above stages. Plants can also produce various by-products such as roots, leaves etc. Plants can repeat the various stages indefinitely if supplied with sufficient water. Plants do not move around (although can be animated).
The animal script is used in all animals. An animal requires both a 'water' source and a 'food' source and grows through the stages of waiting to be born (either in pregnant mother or out in egg form), then baby then adult. Adult animals can give various products such as manure, eggs, feathers, milk etc. Animals have the option of moving around and can be made to mate. Animals have a finite lifespan and will eventually die of old age even if sufficient water and food are always available to them. Animals can, however, be turned into 'pets' which are 'low maintenance animals that can be set to not need food/water. Pets do not age so can be kept indefinitely.
The product script is used in all 'products', that is items that are rezzed as part of another process (such as from an animal or plant, from storage, or from a machine) Products do not contain the product script until they are rezzed, at which point the item doing the rezzing gives the product script to it. This makes it easy to ensure that rezzed products always contain the latest scripts. Products generally have a 'shelf life' but can be stored indefinitely in storage units (putting an item into a store and then taking it out will reset the shelf life to the product's maximum value.)
The storage script is used in all items that have a place to store products. Storage units can be set to store any number of products (i.e 1 or more). By default, storage units show how full they are in terms of a percentage, but they can also be set to use 'units' e.g. 150/300 if it is desired to store a large number of items in one store.
The machine script is used in all items that take in one or more products as 'ingredients' and give back a different product after a defined period of time. Machines can be set to run autonomously or require an avatar to be 'seated' all the time the process is running.
Feeders (feeder.lsl & feeder_grass.lsl)
There are two feeder scripts, the first allows you to create a simple feeder that only requires a 'water' source for it to work. The second version requires the feeder to hold both water and food. A feeder can automatically top up water and food levels from nearby water sources and storage. Animals take water and food from feeders as and when they require it.
Storage Wells (storage_well.lsl)
A storage-well is an item that fills up with a selected product over time. As an example, water towers fill up with water. Storage wells can be set to either work independently or to require a source of power such as wind or electricity. Storage wells allow you to take out the product at any time (assuming the level is sufficient for at least one portion).
Converters take in one or more products and convert them to another. You can only take out the converted product when the conversion process is 100% complete.
Insects are similar to storage-wells in that they produce a product over time, however, you can only take out 100% of the product. Insects can be set to require something be close to them for them to work. They also can be set with various handling conditions that are required to create the product.
The surface code is used to allow products to neatly sit in a certain place. When a product is first rezzed it can be set to look for a particular surface to head to (e.g. food items may look for a table to go to). Note that products on surfaces continue to age in the normal way.
The electricity system uses region messages to collect, distribute and utilize power over an entire region. The various scripts are covered later.
The HUD allows for avatars to interact with the farm system such as through eating, washing, resting etc. This is covered later.
This work by Buzzy Cnayl is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
Based on a work at https://satyrfarm.github.io/