Replace chat with HUD events, add BS 5 palette (#848)
* Replace chat with HUD events, add BS 5 palette * Use HUD events for paxel too * Move paxel_stop function up
This commit is contained in:
parent
e40d1e666a
commit
87f7212f43
9 changed files with 106 additions and 34 deletions
|
@ -71,8 +71,11 @@ local function stop_healing(player, interrupted)
|
|||
|
||||
players[name] = nil
|
||||
if interrupted then
|
||||
minetest.chat_send_player(name, minetest.colorize("#FF4444",
|
||||
"Your healing was interrupted"..reason_handler(interrupted)))
|
||||
hud_event.new(name, {
|
||||
name = "medkits:interrupt",
|
||||
color = 0xFF4444,
|
||||
value = "Your healing was interrupted" .. reason_handler(interrupted),
|
||||
})
|
||||
player:set_hp(info.hp)
|
||||
player:get_inventory():add_item("main", ItemStack("medkits:medkit 1"))
|
||||
end
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
local players = {}
|
||||
local blocks_per_second = 5
|
||||
local resend_notification_seconds = 10
|
||||
-- Bootstrap 4 "warning" color
|
||||
local warning_color = 0xFFC107
|
||||
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
-- player has to wait after join before they can place a node
|
||||
|
@ -22,7 +20,7 @@ minetest.register_on_placenode(function(pos, _newnode, placer, oldnode, _itemsta
|
|||
-- This should happen rarely
|
||||
hud_event.new(name, {
|
||||
name = "place_limit:unpointable",
|
||||
color = warning_color,
|
||||
color = "warning",
|
||||
value = "Block not pointable (dug/replaced)!",
|
||||
})
|
||||
minetest.set_node(pos, oldnode)
|
||||
|
@ -39,7 +37,7 @@ minetest.register_on_placenode(function(pos, _newnode, placer, oldnode, _itemsta
|
|||
if (time - placements.last_notification_sent) / 1e6 >= resend_notification_seconds then
|
||||
hud_event.new(name, {
|
||||
name = "place_limit:speed",
|
||||
color = warning_color,
|
||||
color = "warning",
|
||||
value = "Placing too fast!",
|
||||
})
|
||||
placements.last_notification_sent = time
|
||||
|
|
|
@ -163,8 +163,11 @@ function minetest.is_protected(pos, name, info, ...)
|
|||
|
||||
local flag, distSQ = ctf_flag.get_nearest(pos)
|
||||
if flag and pos.y >= flag.y - 1 and distSQ < rs then
|
||||
minetest.chat_send_player(name,
|
||||
"You can't shoot blocks within "..r.." nodes of a flag!")
|
||||
hud_event.new(name, {
|
||||
name = "sniper_rifles:hit_base",
|
||||
color = "warning",
|
||||
value = "You can't shoot blocks within " .. r .. " nodes of a flag!",
|
||||
})
|
||||
return true
|
||||
else
|
||||
return old_is_protected(pos, name, info, ...)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue