Too many mods destroy “indescructible” nodes

User avatar
Wuzzy
Member
 
Posts: 2161
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy

Too many mods destroy “indescructible” nodes

by Wuzzy » Fri Feb 20, 2015 05:56

Well, it turns out it is not quite easy to create a truly indestructible block.

Sure, when using minetest.remove_node, you can destroy everything. What I am talking about is creating a block which should be indestructible in normal gameplay.

A good start might be to add this code into the node definition:
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
groups = { immortal = 1 },


Now you are certain the node cannot be destroyed by mining.

However, the real problem comes when your node has to interact with other mods. I noticed that many mods are way too trigger happy when it comes to destroying nodes. As soon they destroy nodes, they completely ignore even the most basic properties.

All TNT and similar mods I know mercilessly destroy any node the TNT can reach. Including the TNT mod from minetest_game. The mods do not check if the node is part of the immortal group, so they destroy “indestructible” nodes.
This is not a problem unique to TNT mods, it affects all mods which blindly call minetest.remove_node or minetest.set_node on unknown nodes.

More mod makers need to be aware of this.


So here is my suggestion to mod makers:
Please be very cautios when calling minetest.remove_node / minetest.set_node on unknown nodes. You always have the risk of destroying a node which is not supposed to be destroyed.
First check if the node is in the immortal group. Only then proceed with deleting or replacing.


There is one exception to this rule: When you're debugging and testing. There is a mod which adds an admin stick, which removes EVERYTHING it touches. This is legitimate, as it is specifically designed to get rid of otherwise indestructible nodes and it is not designed for normal gameplay.


So, my fellow modders, what do you think? Do you agree with me? Would you change your modding style accordingly? Or do you have a different opinion?
 

User avatar
HeroOfTheWinds
Member
 
Posts: 470
Joined: Wed Apr 23, 2014 23:16
GitHub: HeroOfTheWinds
IRC: WindHero

Re: Too many mods destroy “indescructible” nodes

by HeroOfTheWinds » Fri Feb 20, 2015 06:42

I agree that more attention should be payed to keeping indestructible nodes indestructible. However, there are in fact extra measures that can be taken on the defensive side: Implement the on_destruct and after_destruct functions to put the block back in place after it is destroyed. Not perfect, especially if you had metadata in the node, but certainly takes out some 50% of offending mods.
Nam ex spatio, omnes res venire possunt.
Why let the ground limit you when you can reach for the sky?
Back to college now, yay for sophomore year schedules. :P
 

guideahon
Member
 
Posts: 37
Joined: Mon Jan 26, 2015 12:49
In-game: guideahon

Re: Too many mods destroy “indescructible” nodes

by guideahon » Fri Feb 20, 2015 19:55

Maybe another property can be made by the devs "minetest.check&remove_node" to be use by modders instead of minetest.remove_node? or viceversa, edit minetest.remove_node to check and make a new one minetest.remove_node_nocheck for admin privileges mods
 

User avatar
Wuzzy
Member
 
Posts: 2161
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy

Re: Too many mods destroy “indescructible” nodes

by Wuzzy » Fri Feb 20, 2015 20:28

guideahon's suggestion sounds like a good start.
 

User avatar
stu
Member
 
Posts: 737
Joined: Sat Feb 02, 2013 02:51
GitHub: stujones11

Re: Too many mods destroy “indescructible” nodes

by stu » Sat Feb 21, 2015 01:34

Wuzzy wrote:All TNT and similar mods I know mercilessly destroy any node the TNT can reach. Including the TNT mod from minetest_game. The mods do not check if the node is part of the immortal group, so they destroy “indestructible” nodes.
This is not a problem unique to TNT mods, it affects all mods which blindly call minetest.remove_node or minetest.set_node on unknown nodes.

To be fair, there aren't any indestructable nodes in minetest_game afaik, but then I do see your point.
I think the biggest issue with blasting is that checking every node will cause a considerable slow down,
I also think that it should be up to server ops and game makers to decide what is more important.
 

User avatar
false_chicken
Member
 
Posts: 35
Joined: Wed Feb 04, 2015 23:41
GitHub: falsechicken
In-game: false_chicken

Re: Too many mods destroy “indescructible” nodes

by false_chicken » Sat Feb 21, 2015 03:43

Nice PSA Wuzzy. Noted for any future projects.
DISCLAIMER: I am probably wrong.
 

User avatar
Dopium
Member
 
Posts: 233
Joined: Sat Jun 09, 2012 15:43

Re: Too many mods destroy “indescructible” nodes

by Dopium » Thu Apr 09, 2015 01:30

Great write up, i will have to take a look at your bedrock code as to how you went about "true" immortal
 

User avatar
fessmK
Member
 
Posts: 46
Joined: Wed Sep 25, 2013 15:56

Re: Too many mods destroy “indescructible” nodes

by fessmK » Fri May 08, 2015 23:22

I have a disruptor in quest test, I may make it to conform. However, making a node's selection box = nil helps a lot, except against tnt.(I used this in the dimensional separator) If tnt respected a node's on_blast() function, this could be used to make a node indestructible to tnt.
 

User avatar
Wuzzy
Member
 
Posts: 2161
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy

Re: Too many mods destroy “indescructible” nodes

by Wuzzy » Sat May 09, 2015 13:24

I don't know if it is a good idea to set the selection box to nil; this looks more like a hack and you are using this parameter in a way which is probably not intended by the programmers; so maybe this weirdness may change in future.
To make a node non-pointable, set pointable = false.

Oh, and about TNT, there is a pull request over there:
https://github.com/minetest/minetest_game/pull/450

:-)

There is nothing you, as a modder, can defend against Minetest Game's TNT right now (unless you directly hack Minetest Game), and this is really a fault in Minetest Game, so the fix has to be applied there.
 


Return to Modding Discussion

Who is online

Users browsing this forum: No registered users and 3 guests

cron