Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use hidden node to block top half #2

Merged
merged 4 commits into from
Feb 19, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions locked_travelnet.lua
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ minetest.register_node("locked_travelnet:travelnet", {
meta:set_string("owner", placer:get_player_name() );
-- request initinal data
locks:lock_set_owner( pos, placer, "Shared locked travelnet" );
local top_pos = vector.add({x=0,y=1,z=0}, pos)
minetest.set_node(top_pos, {name="travelnet:hidden_top"})
end,

on_receive_fields = function(pos, formname, fields, sender)
Expand Down Expand Up @@ -109,8 +111,7 @@ minetest.register_node("locked_travelnet:travelnet", {
local pos = pointed_thing.above;
local node = minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z})
local def = minetest.registered_nodes[node.name]
if not def or not def.buildable_to then

if (not def or not def.buildable_to) and node.name ~= "travelnet:hidden_top" then
minetest.chat_send_player( placer:get_player_name(), 'Not enough vertical space to place the travelnet box!' )
return;
end
Expand All @@ -127,4 +128,8 @@ minetest.register_craft({
},
})

if minetest.global_exists("mesecon") and mesecon.register_mvps_stopper then
mesecon.register_mvps_stopper('locked_travelnet:travelnet')
end

print( "[Mod] locked_travelnet: loading locked_travelnet:travelnet");