Page 1 of 1

[Mod] Lava Restrictions [lavamod]

PostPosted: Mon Oct 29, 2012 22:16
by LandMine
Info
This is a simple mod made by PilzAdam, i asked him if he was going to release it, he said i can do it so i will. Anyhow this mod is only useful for servers.

What this mod does is, it doesnt allow lava to be placed above sea level, that means no one will be able to place lava above 0 on the Y axis. This mod came in handy on my creative server, and i think it will help others as well.

Download
http://planetminetest.com/downloads/lavamod.zip

GitHub (PilzAdam)
https://gist.github.com/3927808

Licence
WTFPL

PostPosted: Mon Oct 29, 2012 23:13
by cornernote
+1, awesome idea. I am going to remove my lava protection logic from skyblock in favor of this.

please include license, and pretty please host code on github...

Also, please consider when you override nodes, you should do it like this:
https://gist.github.com/3815683

The reason is that other mods may also override this same node, this will allow both changes without conflict, and is also a lot less code. Here is how I think the mod should look:

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
local lava = {}
for k,v in pairs(minetest.registered_nodes["default:lava_source"]) do lava[k] = v end
lava.on_construct = function(pos) if pos.y >= 0 then minetest.env:remove_node(pos) end end
minetest.register_node(":default:lava_source", lava)


Neat, right?

PostPosted: Mon Oct 29, 2012 23:23
by LandMine
Ok added licence and added the git page PilzAdam provided me. Fork it and make the changes if you wish :)

Re: [Mod] Lava Restrictions [lavamod]

PostPosted: Wed Nov 26, 2014 17:53
by vktRus
Link to the mod not working.

Re: [Mod] Lava Restrictions [lavamod]

PostPosted: Wed Nov 26, 2014 18:32
by Krock
vktRus wrote:Link to the mod not working.

Updated the mod.
https://gist.github.com/SmallJoker/545225c71f85f8117599
Create a new mod folder and write those codes into a new init.lua file.

Re: [Mod] Lava Restrictions [lavamod]

PostPosted: Thu Nov 27, 2014 16:37
by vktRus
ERROR[main]: ========== ERROR FROM LUA ===========
ERROR[main]: Failed to load and run script from
ERROR[main]: /home/v/.minetest/mods/lava_restriction/init.lua:
ERROR[main]: /home/v/.minetest/mods/lava_restriction/init.lua:1: Attempt to override non-existent item default:lava_source
ERROR[main]: stack traceback:
ERROR[main]: [C]: in function 'error'
ERROR[main]: /usr/share/minetest/builtin/game/register.lua:327: in function 'override_item'
ERROR[main]: /home/v/.minetest/mods/lava_restriction/init.lua:1: in main chunk

Need to add to the mod folder this file depends.txt:
default


Ups.
To place lava_source block — works.
Pour the lava from a bucket — is not working.

Re: [Mod] Lava Restrictions [lavamod]

PostPosted: Thu Nov 27, 2014 19:04
by Krock
vktRus wrote:To place lava_source block — works.

Because you can place it in singleplayer, but not in multiplayer. Just remove the 'if minetest.is_singleplayer() then' from the codes.

Re: [Mod] Lava Restrictions [lavamod]

PostPosted: Thu Nov 27, 2014 20:43
by vktRus
No. I've checked the mod in multiplayer. If you do better, then it will be fine. Video http://youtu.be/hHalR9sMp-w

I did this::
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
minetest.override_item("default:lava_source", {
   on_construct = function(pos)
      if pos.y >= 0 then
         minetest.env:remove_node(pos)
      end
   end
})

Re: [Mod] Lava Restrictions [lavamod]

PostPosted: Fri Nov 28, 2014 16:49
by Krock
vktRus wrote:No. I've checked the mod in multiplayer. If you do better, then it will be fine. Video http://youtu.be/hHalR9sMp-w

I did this::
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
minetest.override_item("default:lava_source", {
   on_construct = function(pos)
      if pos.y >= 0 then
         minetest.env:remove_node(pos)
      end
   end
})


Oh yes. I totally forgot about the buckets. Thanks for sharing your codes.

Re: [Mod] Lava Restrictions [lavamod]

PostPosted: Fri Nov 28, 2014 17:03
by vktRus
[Mod] Lava Restrictions [lavamod]