Skip to content

Commit

Permalink
prevent placing doors and hoeing dirt if the area is protected
Browse files Browse the repository at this point in the history
  • Loading branch information
wsor4035 committed May 25, 2024
1 parent 9687f08 commit bea8513
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions mods/fl_doors/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ local function make_door(file, modname, append)
local dpos = pointed_thing.above--vector.new(pos.x, pos.y+1, pos.z)
local anode = minetest.get_node(vector.new(dpos.x, dpos.y+1, dpos.z))
local adef = minetest.registered_nodes[anode.name]

if minetest.is_protected(dpos, placer:get_player_name())
or minetest.is_protected(vector.new(dpos.x, dpos.y+1, dpos.z), placer:get_player_name()) then return end

if adef and adef.drawtype == "airlike" then
local dir = placer and minetest.dir_to_facedir(placer:get_look_dir()) or 0

Expand Down
1 change: 1 addition & 0 deletions mods/fl_tools/tool_sets.lua
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ local function make_hoe(name, factor)
if pointed_thing.type ~= "node" then return end
local node = minetest.get_node_or_nil(pointed_thing.under)
if not node then return end
if minetest.is_protected(pointed_thing.under, user:get_player_name()) then return end
if minetest.get_node_group(node.name, "farm_convert") == 1 then
minetest.swap_node(pointed_thing.under, {name = "fl_topsoil:dry_farmland"})
end
Expand Down

0 comments on commit bea8513

Please sign in to comment.