Skip to content

Commit 18d0b00

Browse files
committed
Allow map loading screen to overwrite itself
1 parent a62c3aa commit 18d0b00

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

mods/ctf/ctf_modebase/features.lua

+8-6
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ ctf_core.testing = {
2222
end
2323
}
2424

25-
local hud = mhud.init()
25+
local mapload_huds = mhud.init()
2626
local LOADING_SCREEN_TARGET_TIME = 7
2727
local loading_screen_time
2828

@@ -121,25 +121,27 @@ local old_announce = ctf_modebase.map_chosen
121121
function ctf_modebase.map_chosen(map, ...)
122122
set_playertags_state(PLAYERTAGS_OFF)
123123

124+
mapload_huds:clear_all()
125+
124126
for _, p in pairs(minetest.get_connected_players()) do
125127
if ctf_teams.get(p) then
126-
hud:add(p, "loading_screen", {
128+
mapload_huds:add(p, "loading_screen", {
127129
hud_elem_type = "image",
128130
position = {x = 0.5, y = 0.5},
129131
image_scale = -100,
130132
z_index = 1000,
131133
texture = "[combine:1x1^[invert:rgba^[opacity:1^[colorize:#141523:255"
132134
})
133135

134-
hud:add(p, "map_image", {
136+
mapload_huds:add(p, "map_image", {
135137
hud_elem_type = "image",
136138
position = {x = 0.5, y = 0.5},
137139
image_scale = -100,
138140
z_index = 1001,
139141
texture = map.dirname.."_screenshot.png^[opacity:30",
140142
})
141143

142-
hud:add(p, "loading_text", {
144+
mapload_huds:add(p, "loading_text", {
143145
hud_elem_type = "text",
144146
position = {x = 0.5, y = 0.5},
145147
alignment = {x = "center", y = "up"},
@@ -148,7 +150,7 @@ function ctf_modebase.map_chosen(map, ...)
148150
color = 0x7ec5ff,
149151
z_index = 1002,
150152
})
151-
hud:add(p, {
153+
mapload_huds:add(p, {
152154
hud_elem_type = "text",
153155
position = {x = 0.5, y = 0.75},
154156
alignment = {x = "center", y = "center"},
@@ -477,7 +479,7 @@ return {
477479
local total_time = (minetest.get_us_time() - loading_screen_time) / 1e6
478480

479481
minetest.after(math.max(0, LOADING_SCREEN_TARGET_TIME - total_time), function()
480-
hud:clear_all()
482+
mapload_huds:clear_all()
481483
set_playertags_state(PLAYERTAGS_ON)
482484

483485
ctf_modebase.build_timer.start()

0 commit comments

Comments
 (0)