warning when jumpdrive is placed in atmosphere

send player chat warning when jumpdrive is placed in atmosphere and player does not have landing priv
This commit is contained in:
Luke aka SwissalpS 2022-01-14 18:32:18 +01:00 committed by Buckaroo Banzai
parent 3093825025
commit 5e8c513fdd

View File

@ -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})