Skip to content

Commit

Permalink
warning when jumpdrive is placed in atmosphere
Browse files Browse the repository at this point in the history
send player chat warning when jumpdrive is placed in atmosphere and player does not have landing priv
  • Loading branch information
SwissalpS authored and BuckarooBanzay committed Jan 17, 2022
1 parent 3093825 commit 5e8c513
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions travel/jumpdrive.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
local default_after_place = minetest.registered_nodes["jumpdrive:engine"].after_place_node
local function custom_after_place(pos, placer)
default_after_place(pos, placer)
local playername = placer:get_player_name()
local has_landing_priv = minetest.check_player_privs(playername, { jumpdrive_land = true })
if not has_landing_priv and -20 < pos.y and 100 > pos.y then
minetest.chat_send_player(playername, "You won't be able to jump away from here until you have jumpdrive_land priv!")
end
end
minetest.override_item("jumpdrive:engine", { after_place_node = custom_after_place })

jumpdrive.preflight_check = function(source, destination, radius, playername)
local has_landing_priv = minetest.check_player_privs(playername, {jumpdrive_land=true})

Expand Down

0 comments on commit 5e8c513

Please sign in to comment.