Control / disable lava

Post Reply
User avatar
thminer
Member
Posts: 83
Joined: Sat Aug 12, 2017 16:24
GitHub: TEbinger
In-game: thomas or thomas321
Contact:

Control / disable lava

by thminer » Post

On my public server I have big problems with lava.
lavaverwuestung.jpg
lavaverwuestung.jpg (465.28 KiB) Viewed 363 times
Image
What can I do to solve the problem in a creative world? Which solution do You recommend?
I read some stuff in the forum, but I'm not sure, which solution is really the best.
Any hint is welcome!
Find my minetest stuff in my blog: http://thomas-ebinger.de/?s=minetest

User avatar
sorcerykid
Member
Posts: 1847
Joined: Fri Aug 26, 2016 15:36
GitHub: sorcerykid
In-game: Nemo
Location: Illinois, USA

Re: Control / disable lava

by sorcerykid » Post

Add the following global function overrides to the end of default/functions.lua:

viewtopic.php?p=299612#p299612

Then, instead of the example for TNT provided, you can limit placement of lava in this way:

Code: Select all

local LAVA_PLACE_DEPTH = -50

function allow_place_lava( pos, player )
        if pos.y > LAVA_PLACE_DEPTH and not minetest.check_player_privs( player, "lava" ) then
                minetest.chat_send_player( player:get_player_name( ), "You are not allowed to place lava above " .. LAVA_PLACE_DEPTH .. "!" )
                minetest.log( "action", player:get_player_name( ) .. " tried to place default:lava_source above " .. LAVA_PLACE_DEPTH )
                return false
        end
        return true
end

minetest.override_item( "bucket:bucket_lava", {
        allow_place = allow_place_lava
} )

minetest.override_item( "default:lava_source", {
        allow_place = allow_place_lava
} )
I would recommend creating a new mod for this purpose, something like "antigrief", and then simply adding the above code to the init.lua. Be sure to include a depends.txt file in that same directory with the following dependencies:

Code: Select all

default
bucket
Later on, should you decide, you can easily add antigrief hooks for anything else you choose to restrict. Just remember to update the dependencies as necessary.

User avatar
thminer
Member
Posts: 83
Joined: Sat Aug 12, 2017 16:24
GitHub: TEbinger
In-game: thomas or thomas321
Contact:

Re: Control / disable lava

by thminer » Post

Sounds good. thank you very much. I will try this later
Find my minetest stuff in my blog: http://thomas-ebinger.de/?s=minetest

User avatar
thminer
Member
Posts: 83
Joined: Sat Aug 12, 2017 16:24
GitHub: TEbinger
In-game: thomas or thomas321
Contact:

Re: Control / disable lava

by thminer » Post

This solution unfortunately did not work for me. Made a mod with github (https://github.com/TEbinger/lavacontrol).
You can try the mod on the server, maybe You find the reason why it's not working.
Server: minetest.rpi-virtuell.de:30001
Find my minetest stuff in my blog: http://thomas-ebinger.de/?s=minetest

User avatar
sorcerykid
Member
Posts: 1847
Joined: Fri Aug 26, 2016 15:36
GitHub: sorcerykid
In-game: Nemo
Location: Illinois, USA

Re: Control / disable lava

by sorcerykid » Post

I forgot to mention that you will need to register a privilege called "lava".

Code: Select all

minetest.register_privilege( "lava", "Can place lava at any depth.")
The rest of the code was pretty much copied verbatim from my city_block mod fork, so it's baffling why it wouldn't work. I will check out your server soon to see what's happening. Most likely it's something very simple that I overlooked :)

User avatar
thminer
Member
Posts: 83
Joined: Sat Aug 12, 2017 16:24
GitHub: TEbinger
In-game: thomas or thomas321
Contact:

Re: Control / disable lava

by thminer » Post

Thank You very much in advance!
Find my minetest stuff in my blog: http://thomas-ebinger.de/?s=minetest

User avatar
thminer
Member
Posts: 83
Joined: Sat Aug 12, 2017 16:24
GitHub: TEbinger
In-game: thomas or thomas321
Contact:

Re: Control / disable lava

by thminer » Post

I think this mod will do it: https://github.com/Cat5TV/tps_spill
Find my minetest stuff in my blog: http://thomas-ebinger.de/?s=minetest

Post Reply

Who is online

Users browsing this forum: Amazon [Bot] and 43 guests