KiloCow wrote: ↑Mon Nov 28, 2022 19:04
Hi there, how do I deactivate certain items like TNT or lava in creative mode? I've tried both
enable_tnt = false and
enable_fire = false in minetest.conf but with no effect.
There are two relevant settings for this,
enable_fire, which will still not remove it from the creative inventory, just make it not burn stuff (but still do damage to entities):
Code: Select all
# Fire spreads and flammable blocks might be destroyed by nearby fire.
# Destructive fire may cause severe destruction.
# Fire blocks will be non-destructive and stops spreading when this
# setting is disabled, but they still deal damage to creatures.
enable_fire (Destructive and spreading fire) bool true
and
mcl_tnt_griefing, which will also not remove tnt from the creative inventory, but will make it so TNT doesn't destroy blocks:
Code: Select all
# If enabled, TNT explosions destroy blocks.
mcl_tnt_griefing (TNT destroys blocks) bool true
If neither of those are sufficient, you will have to write a mod. Mineclone is a very modular game, and Minetest lets you replace game mods with custom mods installed in the mods directory. So you can make a copy of the files in
mineclone2/mods/ITEMS/mcl_tnt/ and change the item groups of TNT to hide it from the creative inventory if you really need (add the group
not_in_creative_inventory). You can do the same with
mods/ITEMS/mcl_fire. You can also remove those nodes entirely, basically whatever you want once you have an 'override' copy of the mod installed.
Another approach is to use overrides, so you can make a mod that depends on the base mod and overrides item definitions, and keep the main mcl mods so you don't have to update them to match what's in the game when the game updates. So the
mod.conf would look like this:
Code: Select all
name = mcl_items_hide
depends = mcl_tnt, mcl_fire
and the code would be like this:
Code: Select all
local tntdef = minetest.registered_nodes["mcl_tnt:tnt"]
local groups = tntdef.groups
groups.not_in_creative_inventory = 1
minetest.override_item("mcl_tnt:tnt", {
groups = groups
})
... -- Similarly for mcl_fire:fire
Actually I could make a mod where you can configure it to hide any node/item/tool from the creative inventory, and it would be game-agnostic too. Let me know if you want that.
To delete an item you can use
minetest.unregister_item instead of the override. I could make both the hiding and deletion features of the same mod..