Page 1 of 1

[FIX/MOD]Protect falling nodes / Protect lava&water grief

PostPosted: Sun Nov 02, 2014 23:05
by davedevils
(If it's allready posted , delete this post)
Hi all

i have make a little mod for MinetestForFun , maybe they can help you !


For protect Falling Nodes :
All falling node can be falling in protected zone ... I have fix it with rewirte __builtin:falling_node and some node :)

Image

HOW IT'S WORK ?
Open the init.lua and edit the list of node
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
add_falling_protect_item("default:sand")
add_falling_protect_item("default:redsand")
add_falling_protect_item("default:gravel")


Exemple:
i want add my node for make it protect "jambon:avil" but i not have "default:redsand" , i edit by
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
add_falling_protect_item("default:sand")
add_falling_protect_item("default:gravel")
add_falling_protect_item("jambon:avil")


Now add the mod to your server and now falling block can only falling if it's your zone ! (if not you can get the drop)



For Protect Lava/Water (v0.2/v0.3 ) :
Tired about people place water or lava in your house ?

Open the init.lua and edit
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
-- Protect in realtime the lava flowing (can be slow)
PROTECT_LAVA_REALTIME = 1 -- 0 for OFF , 1 for ON
-- Protect in realtime the water flowing (can be very slow, because some water in this world :p)
PROTECT_WATER_REALTIME = 0 -- 0 for OFF , 1 for ON



Changelog:
v 0.3
- Remake of protect lava/water ... with config ! More fast :)
- Add protected zone (7block) for bukket

v 0.2
- Begin of protect lava/water ... Very slow at the moment ... use 0.1 if too slow for you !

V 0.1
- Protect about falling ( if you not have set the owner value in your node ... they turn to drop in falling)


If you have problem with this , say it :)

Re: [FIX/MOD]Protect falling nodes

PostPosted: Sun Nov 02, 2014 23:56
by Minetestforfun
Hi,

Thank you for this awesome bugfix ! :)

Re: [FIX/MOD]Protect falling nodes / Protect lava&water grie

PostPosted: Mon Nov 03, 2014 17:50
by Mg
It can be a good things for the servers using area protection mods, but you could create an overwrite function instead of placing code in the node register function. Still good work.

Re: [FIX/MOD]Protect falling nodes / Protect lava&water grie

PostPosted: Mon Nov 03, 2014 17:59
by rubenwardy
A better way:

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:sand", {
   on_place = function(itemstack, placer, pointed_thing)
      if not pointed_thing.type == "node" then
         return itemstack
      end
      local pn = placer:get_player_name()
      if minetest.is_protected(pointed_thing.above, pn) then
         return itemstack
      end
      minetest.env:add_node(pointed_thing.above, {name=itemstack:get_name()})
      local meta = minetest.env:get_meta(pointed_thing.above)
      meta:set_string("owner", pn)
      nodeupdate(pointed_thing.above)
      if not minetest.setting_getbool("creative_mode") then
         itemstack:take_item()
      end
      return itemstack
   end
})


You can also override the falling entity in the same way.

Re: [FIX/MOD]Protect falling nodes / Protect lava&water grie

PostPosted: Mon Nov 03, 2014 18:57
by davedevils
yeah, i optimise for the next update :) (i'm tired when i have make it)

Re: [FIX/MOD]Protect falling nodes / Protect lava&water grie

PostPosted: Thu Nov 06, 2014 13:26
by davedevils
okey , my v0.2 method for stop lava grief is very dangerous and slow ... (delete natural water and natural lava)

The only "good" way to protect it fast and good , is rewirte lava flowing by lua (and stop using core flowing) or remake core flowing ...

So i have make a edit with a ABM all 1s for remplace node in protected zone.. it's fat but this protect good

For the item in v0.3 i think i make a little code to change , because using minetest.override_item

--> You can also override the falling entity in the same way.
Not working i have allready try