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

User avatar
davedevils
Member
 
Posts: 51
Joined: Thu Sep 25, 2014 01:13
GitHub: davedevils
IRC: davedevils
In-game: davedevils

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

by davedevils » Sun Nov 02, 2014 23:05

(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 :)
Attachments
builtin_falling-v0.3.zip
v0.3
(4.56 KiB) Downloaded 86 times
builtin_falling-v0.2.zip
v0.2 (SLOW at the moment use only at your risk)
(2.51 KiB) Downloaded 63 times
builtin_falling-v0.1.zip
v0.1
(2.24 KiB) Downloaded 72 times
Last edited by davedevils on Thu Nov 06, 2014 18:43, edited 7 times in total.
 

User avatar
Minetestforfun
Member
 
Posts: 936
Joined: Tue Aug 05, 2014 14:09
GitHub: Darcidride
IRC: Darcidride + MinetestForFun
In-game: Darcidride + MinetestForFun

Re: [FIX/MOD]Protect falling nodes

by Minetestforfun » Sun Nov 02, 2014 23:56

Hi,

Thank you for this awesome bugfix ! :)
 

User avatar
Mg
Member
 
Posts: 86
Joined: Sun Mar 02, 2014 20:49
GitHub: LeMagnesium
IRC: ElectronLibre Mg
In-game: Mg

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

by Mg » Mon Nov 03, 2014 17:50

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.
 

User avatar
rubenwardy
Member
 
Posts: 4500
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

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

by rubenwardy » Mon Nov 03, 2014 17:59

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.
 

User avatar
davedevils
Member
 
Posts: 51
Joined: Thu Sep 25, 2014 01:13
GitHub: davedevils
IRC: davedevils
In-game: davedevils

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

by davedevils » Mon Nov 03, 2014 18:57

yeah, i optimise for the next update :) (i'm tired when i have make it)
 

User avatar
davedevils
Member
 
Posts: 51
Joined: Thu Sep 25, 2014 01:13
GitHub: davedevils
IRC: davedevils
In-game: davedevils

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

by davedevils » Thu Nov 06, 2014 13:26

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
 


Return to WIP Mods

Who is online

Users browsing this forum: No registered users and 33 guests

cron