Skip to content

Commit

Permalink
prevent players from messing w/ unconfigured elevators in areas they …
Browse files Browse the repository at this point in the history
…don't control
  • Loading branch information
fluxionary committed Jan 28, 2020
1 parent 9d7c9c1 commit 7408ad0
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,13 @@ travelnet.update_formspec = function( pos, puncher_name, fields )


if( is_elevator == true ) then
if minetest.get_modpath("areas") and areas.canInteract then
if owner_name ~= puncher_name and not areas:canInteract(pos, puncher_name) then
minetest.chat_send_player(puncher_name, S("You cannot configure an elevator in an area you don't control"))
return
end
end

travelnet.add_target( nil, nil, pos, puncher_name, meta, owner_name );
return;
end
Expand Down Expand Up @@ -738,12 +745,14 @@ travelnet.on_receive_fields = function(pos, formname, fields, player)
return;
end




-- if the box has not been configured yet
if( meta:get_string("station_network")=="" ) then

if minetest.get_modpath("areas") and areas.canInteract then
if fields.owner ~= name and not areas:canInteract(pos, name) then
minetest.chat_send_player(name, S("You cannot configure in an area you don't control"))
return
end
end
travelnet.add_target( fields.station_name, fields.station_network, pos, name, meta, fields.owner );
return;
end
Expand Down

0 comments on commit 7408ad0

Please sign in to comment.