A new Mod : A Withering Fence

Hi every one, finally my first post/mod on the forums. I’ve been here for a while already, (since alpha 14) reading and learning and now I’m ready to take the big jump and contribute some work.

2 Weeks ago on stream Allie made some weathervanes, one of them was a withered one, so I mentioned that it would be great to have the normal ones over time turn into the withered ones.

A Idea was born, and i already had some experience with the decay system of the crops, unfortunately that component gave me lots of problems, but I found a similar one even better suited for this task. The “evolve” component. So one thing lead to another and the “withering” component was born.

This mod adds only 1 item to the carpenters recipe list, but is more meant for other modder’s, so they can use the wither component in there mods.
The mod can be downloaded here : wf.smod
This Video shows the visual effect of the withering fence.

To use the component, u just need to add the following sections to your entity:

code block

   "type": "entity",
   "components": {
      "wf:wither": {}     
   "entity_data": {
      "stonehearth:wither_data": {
         "current_stage": "normal",
         "next_stage": "wf:withered_fence",    <=== Entity to change in after the withering period
         "wither_time": "1h"     <== the time after which your entity changes

Till next time, and keep those heartlings running to make amazing towns.

Update 1 : Made code better visible in the post by aplying code tags.
Update 2 : Added a link to a short video of the visual effect of the withering fence (as requested by @Ayla ).


Perfect. I did a quick read through of evolve and your withered, but not in-depth or a side by side comparison. I’m just curious exactly what you changed?

I’ve made a few changes to solve problems that did not occur with trees.

  1. when placing the item the evolve system did not use the “force iconic = false”, because tree’s don’t have an iconic form, I need to or it would place an iconic fence.
  2. Then the problem occurred when turning the fence 90° degrees, it wither into the original position not the turned one, in the wither function I added a copy of the rotation of the component who was withering.
  3. The most difficult problem : when I picked the fence back up (let it bring back to the stockpile) it would not wither anymore when i placed it back down, so instead of listen the on_added_to_world() once in the init I used a recursive function to re listen so every time the item is placed down again the wither timer starts.

Any screenshots? XD im curious

Here’s pictures from his mod.

1 Like