Code Monkey home page Code Monkey logo

simplefarming's Introduction

Simple Farming

Simple Farming is a module that adds the capability to grow plants in Terasology using seeds. After the plant is ripe, you can harvest the 'fruit' that is grown by that particular plant.

Farming

  1. Plant the seed in a ground.
  2. Wait for the plant to grow.
  3. Wait for the produce to ripe.
  4. Harvest the produce - you can do this by pressing E while facing the plant.
  5. Destroy expired plant OR go back to step 3.

Items

  • Un-Growth Can - Make the plant go 1 growth stage back.
  • Growth Can - Make the plant go 1 growth stage forward.

Creating New Plants

You can start making new plants by creating a new prefab file at assets/prefabs.

Usually for each plant you want to make these three prefabs:

  1. Seed Prefab (e.g. TestberrySeed.prefab)
  2. Fruit prefab (e.g. Testberry.prefab)
  3. Ripe Stage of The Plant Prefab (e.g. TestberryBushFull.prefab)

You will also need to create a .block file for each stage of the plant at assets/block, as well as the textures for each stage of the plant at blockTiles.

Seed Prefab

For a good example, see TestberrySeed.prefab at assets/prefabs

maxRandom & fixed set the duration of a particular stage. The plant can grow to the next stage randomly during the range between maxRandom and fixed. If the value in fixed is reached, the plant immediately grows to the next growth stage. This will make the plants not grow to the next stage all at the exact time - some will get there faster than others!

engine:halfblock can be used to create a half-size block. This can be useful if you are trying to characterize the plant being "small" in size during that particular growth stage. (For instance, in the first stage of TestBerry Plant, the plant is a half-block of berry bush block).

A compharison between a half-block and a full-block

    "growthStages": {
        "SimpleFarming:BerryBush:engine:halfblock": {
        "maxRandom": 5000,
        "fixed": 10000
    },
    "SimpleFarming:BerryBush": {
        "maxRandom": 5000,
        "fixed": 10000
    },
    "SimpleFarming:MatureBerryBush": {
        "maxRandom": 5000,
        "fixed": 10000
    },
    "SimpleFarming:TestberryBushFull": {
        "maxRandom": 5000,
        "fixed": 10000
    }
}

Fruit Prefab

For a good example, see Testberry.prefab at assets/prefabs

This prefab should be pretty intuitive. It creates the fruit that will be dropped when you harvest the plant that grows it.

Ripe Stage of The Plant Prefab

For a good example, see TestberryBushFull.prefab at assets/prefabs

This prefab manages the items that are are obtained when a particular plant is harvested.

Block Files

For a good example, see the .block files on assets/blocks

The block files sets the characteristics for the plant block. You can use basedOn to make that block have the characteristic of the block that it is based on.

tile should show where the texture for that particular block is located.

One thing that you need to pay attention when you want to create a stage that can be harvested is adding this code to the .block file. (Ex: TestberryBushFull.block)

"entity": {
    "prefab": "<Ripe stage of the plant prefab>"
}

This code will allow the game to know that this particular block is associated with a prefab that indicated that this stage is where the fruit is ripe and is ready to be harvested.

Produce Mechanisms

There's 2 kind of produce mechanism that you can make using the SimpleFarming module.

  1. Periodic
  2. Once A Periodic produce will grow again after it's harvest. On the other hand, a Once produce will only be a one-time harvest and after you harvest it, you need to plant it again from the seed.

To make a plant have a periodic produce mechanism, you need to add "UnGrowPlantOnHarvest": {}, in ripe stage of the plant prefab file, and vice versa.

Destroying a plant with produce, will also yield a produce.

Credits for Images:

  • Blueberry: Made by TheJYKoder (original)
  • BlueberryBushFull: Made by TheJYKoder(original)
  • Strawberry: Created by Patrick Wang. Original.
  • Gojiberry: Made by Harry Wang(original)
  • Apple: http://opengameart.org/content/good-fruits-m484-games
  • Apple seed by gkaretka (own work)
  • Apple bush full by gkaretka: merge of BerryBushFull and Apple

simplefarming's People

Contributors

josharias avatar marvel0usx avatar cervator avatar oniatus avatar rzats avatar xrtariq2594 avatar nihal111 avatar smsunarto avatar mjuvekar7 avatar kcirtaptrick avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.