Hello this is my first mod. I am not yet very proficient and comfortable with the modding API so this mod is far from perfect. This is the result of me playing around with active block modifiers.
This mod makes nodes rot into rotten nodes. Nodes can become rotten if they are in contact with air.
When a node rots it will transform into one of three different rotten nodes:
50 % chance (type #1)
- This node acts just like normal nodes.
- This node acts like sand and will fall when nearby nodes get updated.
- This node acts like a normal node but will "listen" for nearby entities. When it finds an entity it will turn into a falling node (type #2) and fall. This makes it risky to walk on rotten nodes as you never know when one might fall below your feet.
All three variations have the same texture and take the same amount of time to destroy. The player will recieve a node of type #1 when he/she destroys a rotten node.
Rot will also quickly spread to nearby nodes if the player does not remove the infected nodes.
By default rot will come to the world each 2nd hour with a chance of 1/16 for each node. It will then spread to nearby nodes each 30 minutes with a chance of 1/4. You can tweak these settings by changing the variables at the top of the "init.lua" file.
By default this mod will only make planks, pine planks and jungle planks rot. It is possible to make logs rot too but that is disabled since it will mess with the facing of the logs. If you want trees to rot but do not care about the facing you can add these lines at the end of the "init.lua" file.
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
register_rotten_node("tree", "default:tree")
register_rotten_node("pinetree", "default:pinetree")
register_rotten_node("jungletree", "default:jungletree")
It would be cool if stairs could rot aswell but I have not figured out how to do that (suggestions are welcome).
I have released the code under WTFPL so feel free to do whatever you want with it.
Download: https://github.com/ryvnf/minetest-rot-mod
BUGS:
There is one major bug... It seems like every single node possible will become rotten instantly when the player is far away from the nodes when they rot. I have no idea of why this happens but I hope someone who is better with "Active Block Modifiers" can explain. :)