Light effects

Lights in stonehearth are normally looping effects. We can use them together with cubemitter tracks, so that the light is more apparent.

The effect file

These are example tracks from the effect file:

  "light": {
     "type": "light",
     "light": "/rayyas_children/data/horde/animatedlights/fire/hearth/hearth.lamp.animatedlight.json",
     "transforms": { "x": 3, "y": 3, "z": 0 },
     "shadows": true
  },
  "light2": {
     "type": "light",
     "light": "/rayyas_children/data/horde/animatedlights/fire/hearth/hearth.lamp.animatedlight.json",
     "transforms": { "x": -3, "y": 3, "z": 0 },
     "shadows": true
  }

They have very few properties:

Creating animated lights files

Example of an animatedlight JSON file:

  {
     "name": "fire",
     "duration": 1800,
     "loops": true,
     "intensity": {
        "over_lifetime": {
           "kind": "CONSTANT",
           "values": [0.8]
        }
     },
     "radius": {
        "start": {
           "kind": "CONSTANT",
           "values": [10]
        }
     },
     "color": {
        "start": {
           "kind": "CONSTANT",
           "values": [0.89, 0.227, 0.085]
        }
     }
  }

We have the usual "name", "duration" (in milliseconds) and "loops" properties. Animated lights normally loop.

Then we have these 3 properties:

All of these properties can have "start" and/or "over_lifetime" fields. The "start" can be "CONSTANT" or "RANDOM_BETWEEN", and the "over_lifetime" can be "CONSTANT", "RANDOM_BETWEEN", "CURVE" or "RANDOM_BETWEEN_CURVES". See this table for examples on how to set up the "values" depending on the "kind".

Testing light effects

We can test light effects without having to restart the game each time by using the user_settings option mentioned here.

How to create light effects in SHED

At the time this guide was written, SHED won't be able to detect the effects if they're not inside the directories mentioned above. So make sure you're using the same directory structure than in the stonehearth mod (your__mod_namespace/data/horde/animatedlights).

Go to the Effects Editor, select the 'Lights' tab and clone an existing light:

cloning_animatedlight_file

Then edit the values in the web (CEF) editor at the right or in the JSON editor in the middle. Some tips about the curve editors can be found here.