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

Post Reply
User avatar
davedevils
Member
Posts: 52
Joined: Thu Sep 25, 2014 01:13
GitHub: davedevils
IRC: davedevils
In-game: davedevils
Location: France
Contact:

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

by davedevils » Post

(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

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

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

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

User avatar
Minetestforfun
Member
Posts: 940
Joined: Tue Aug 05, 2014 14:09
GitHub: MinetestForFun
IRC: MinetestForFun
In-game: MinetestForFun
Location: On earth
Contact:

Re: [FIX/MOD]Protect falling nodes

by Minetestforfun » Post

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
Location: Periodic Table

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

by Mg » Post

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
Moderator
Posts: 6276
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy
Location: United Kingdom
Contact:

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

by rubenwardy » Post

A better way:

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: 52
Joined: Thu Sep 25, 2014 01:13
GitHub: davedevils
IRC: davedevils
In-game: davedevils
Location: France
Contact:

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

by davedevils » Post

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

User avatar
davedevils
Member
Posts: 52
Joined: Thu Sep 25, 2014 01:13
GitHub: davedevils
IRC: davedevils
In-game: davedevils
Location: France
Contact:

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

by davedevils » Post

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

Post Reply

Who is online

Users browsing this forum: Bastrabun and 5 guests