add command variant that does not require to click
This commit is contained in:
parent
b6a26a651a
commit
c57f68aee8
22
init.lua
22
init.lua
@ -1,7 +1,8 @@
|
||||
-- TODO show some text on screen for a short while?
|
||||
-- TODO "admin" command version with configurable pos, radius and timeout
|
||||
|
||||
local announce_command_name = "look"
|
||||
local announce_prepare_command_name = "look"
|
||||
local announce_command_name = "look!"
|
||||
local announce_radius = 256 -- players within this radius will see a waypoint
|
||||
local announce_icon = "exclamation_mark.png"
|
||||
local announce_timeout = 20 -- time until waypoint disappears
|
||||
@ -144,7 +145,7 @@ end
|
||||
minetest.register_globalstep(check_click_for_prepared_players)
|
||||
|
||||
|
||||
minetest.register_chatcommand(announce_command_name, {
|
||||
minetest.register_chatcommand(announce_prepare_command_name, {
|
||||
privs = {
|
||||
shout = true,
|
||||
},
|
||||
@ -160,3 +161,20 @@ minetest.register_chatcommand(announce_command_name, {
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
minetest.register_chatcommand(announce_command_name, {
|
||||
privs = {
|
||||
shout = true,
|
||||
},
|
||||
func = function(name, param)
|
||||
local player = minetest.get_player_by_name(name)
|
||||
if player then -- player is online
|
||||
local player_name = player:get_player_name()
|
||||
add_announcement(player, player_name, announce_radius, param, announce_icon, announce_timeout)
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user