-
Notifications
You must be signed in to change notification settings - Fork 572
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Disabling TNT #1085
Disabling TNT #1085
Conversation
OK, this isn't so bad. I wouldn't mind this getting merged. |
Or... What about allowing the recipe, but TNT cannot be lit by people without a privilege? (Maybe protection_bypass? IDK) This means TNT can still be used for decorative purposes. (Although you run the risk of stupid people becoming moderators.) Just throwing this idea out there. |
This would be usable for mods, actually. A priv would have to be given, but unless you have twenty moderators, it wouldn't be that hard to change. (Remember when we added noclip? You probably don't, but it was annoying.) |
Mods have little use for privs. Privs are for users. @tenplus1 just wants his cows to explode using the TNT api, without having TNT blocks available to players. |
Oops, I'm pretty sure we mean entirely different things.
My idea was that users can still place TNT, but cannot light it. However, a user with a certain priv, such as 'tnt' or 'protection_bypass' could light TNT. (I thought of protection_bypass because you can blow up TNT right next to a protected area, and destroy blocks in that area.) |
This way gunpowder needed to be disabled too, as well as mesecons. In my opinion, the best way is to disable TNT igniting entirely, but keeping If you really think moderators need TNT and not WorldEdit, let them have “admin_tnt” that is not craftable at least, and maybe can only be ignited directly by a user with certain privileges |
This is starting to go entirely off-topic. the patch by @tenplus1 is fine, as-is (maybe also remove gunpowder node?). If you want additional features please request them in a separate issue. I don't want a cosmetic TNT block. minetest_game doesn't do stuff like that - there is no cosmetic chest, there is no cosmetic furnace, no cosmetic apple, etc.. |
+1 On-topic, this would also be very useful for my shooter mod. I would prefer to keep the gunpowder node if possible, although it would probably be more consistent to remove that too. |
@sofar Yes, this is going off-topic... (Actually, there are cosmetic glasses and bottles, and cosmetic shelves...) |
They are not intended to be cosmetic, and the shelves are functional? I believe you can even put water in the bottles? |
I think this pr should be left as is and let mods add decorative tnt. I think majority of servers that disable tnt would not care for deco tnt imho. |
@sofar Nope. The bottles cannot be filled with water. Even if they could, you couldn't do much with them. (Implement a brewing system?) The bookshelves can store your books, and with written books, it even has a purpose. But vessels shelves can store items (bottles) that you don't need in the first place. (Unless they get a use at some point.) Actually, the original purpose of the bookshelves, before they had inventories, was to be a decorative node, and solely a decorative node. An expensive one back then too, since I'm not sure papyrus could be farmed. @DonBatman Actually, that sounds like a better idea. I wanted to throw out this idea for anyone to hear, but it just turned into an argument... |
Wouldn't it be better to not disable |
sure, yes, that would be better. |
@@ -4,7 +4,7 @@ local singleplayer = minetest.is_singleplayer() | |||
local setting = minetest.setting_getbool("enable_tnt") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'setting' needs a more descriptive name like 'enable_tnt'
I support this PR.
This needs fixing.
'minetest.setting_get' can return nil, but see my line comments the 'local setting' should be true or false. If you add another commit i can squash these on merge. |
Please also disable the ABM. |
(singleplayer and setting == false) then | ||
return | ||
local enable_tnt = minetest.setting_getbool("enable_tnt") | ||
if (not singleplayer and not enable_tnt) or |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getbool can return 'nil' so this line should not be changed, as it was checking for setting == false or setting == nil
Please only enable the ABM if 'enable_tnt'. |
local enable_tnt = minetest.setting_getbool("enable_tnt") | ||
if (not singleplayer and enable_tnt ~= true) or | ||
(singleplayer and enable_tnt == false) then | ||
enable_tnt = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The entire if-statement can be removed. It doesn't serve a purpose without the return
anymore.
The second part of the statement sets enable_tnt
only to false
if it already is false
.
The first part when it is either false
or nil
in multiplayer (which doesn't make a difference to the enabled state later, because false
and nil
are treated there the same)
Having server admin properly set TNT status is a good thing, same with disabling fire. Minetest should only set a default and not choose depending on singleplayer/creative status. |
Defaulting to false on multiplayer is for good reason due to the chaos that is often caused by badly behaved players using TNT. Server owners may not think about optional TNT until it's too late. |
IRC: |
return | ||
end | ||
-- Default to enabled when in singleplayer | ||
local enable_tnt = minetest.setting_getbool("enable_tnt") or minetest.is_singleplayer() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You actually need to move that out into an extra if-clause checking for nil
(see my other comment).
Otherwise you won't be able to disable tnt in singleplayer since it also falls back for false
.
or
-ing for fallback doesn't work well with boolean settings (but is great for anything else)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
t4im: setting_getbool can and does return 'nil' if setting isn't seen in minetest.conf and if it does minetest.is_singleplayer() will be checked instead of using separate IF.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You missunderstood me: When you set it to false
, it will still fall back to true
in singleplayer. That's why you have to check it extra.
@t4im better? |
@tenplus1 yea this works |
return | ||
-- Default to enabled when in singleplayer | ||
local enable_tnt = minetest.setting_getbool("enable_tnt") | ||
if enable_tnt == nil and minetest.is_singleplayer() == true then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minetest.is_singleplayer() == true
is redundant, just use minetest.is_singleplayer()
However if getbool returns nil in mulitiplayer then enable_tnt remains nil, t4im's suggestion works better:
local enable_tnt = minetest.setting_getbool("enable_tnt")
if enable_tnt == nil then
enable_tnt = minetest.is_singleplayer()
end
+1 with that done.
Added line comment. |
@sofar what do you think? |
Looking at this i'm considering if it would be better to just disable this (as sofar suggested):
Instead of disabling code inside So what i'm thinking is, for tidyness, have just one |
If you disable tnt.register_tnt then the tnt:tnt_burning node will never be defined which is needed for my lucky_blocks mod; something that cannot be crafted and does not appear inside creative inventory. |
Okay that's fine. Please can you group ABM and crafting recipe together within a single 'if then end' block? Then +1 and i'll merge it since it sort of has approval from sofar. |
Disabling TNT shouldn't remove it altogether - Remove the TNT craft recipe, tnt:tnt node and the abm - Leave tnt:tnt_burning available for explosions in 3rd party mods - Set defaults: enabled in singleplayer, disabled in multiplayer
@paramat done. |
👍 |
And i'm assuming +1 from @sofar based on previous comments. |
Yeah, I'm sure we'll run into a corner case here or there afterwards, but I'm fine with merging this as is and fixing up any remaining issues later. We're early enough in the release cycle anyway. 👍 |
Disabling TNT shouldn't remove it altogether, removing the TNT craft recipe and the tnt:tnt node is enough, leaving tnt:tnt_burning available for 3rd party mods like lucky blocks to use for explosions.