mirror of
https://codeberg.org/usrib/emeraldbank.git
synced 2024-12-22 22:22:25 +01:00
remove hud stuff
This commit is contained in:
parent
d7bf927a6d
commit
cc80001245
80
hud.lua
80
hud.lua
@ -1,80 +0,0 @@
|
|||||||
|
|
||||||
|
|
||||||
-- Copyright (C) 2021, 2024 Sandro del Toro
|
|
||||||
|
|
||||||
-- This file is part of Emeraldbank Minetest Mod.
|
|
||||||
|
|
||||||
-- Emeraldbank is free software: you can redistribute it and/or modify
|
|
||||||
-- it under the terms of the GNU Affero General Public License as
|
|
||||||
-- published by the Free Software Foundation, either version 3 of the
|
|
||||||
-- License, or (at your option) any later version.
|
|
||||||
|
|
||||||
-- Emeraldbank is distributed in the hope that it will be useful,
|
|
||||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
-- GNU Affero General Public License for more details.
|
|
||||||
|
|
||||||
-- You should have received a copy of the GNU Affero General Public License
|
|
||||||
-- along with Emeraldbank. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
|
|
||||||
local modname = core.get_current_modname()
|
|
||||||
local S = core.get_translator(modname)
|
|
||||||
|
|
||||||
local HUD_TIME = tonumber(core.settings:get("emeraldbank.hud_time")) or 3
|
|
||||||
|
|
||||||
--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==
|
|
||||||
|
|
||||||
local ad_huds = {}
|
|
||||||
|
|
||||||
local function print_emeralds()
|
|
||||||
for _, player in ipairs(core.get_connected_players()) do
|
|
||||||
local nm = player:get_player_name()
|
|
||||||
local emeralds = emeraldbank.get_emeralds(nm)
|
|
||||||
|
|
||||||
-- Already have a HUD, get rid of it
|
|
||||||
if ad_huds[nm] and ad_huds[nm].header and ad_huds[nm].sub then
|
|
||||||
player:hud_remove(ad_huds[nm].header)
|
|
||||||
player:hud_remove(ad_huds[nm].sub)
|
|
||||||
end
|
|
||||||
|
|
||||||
ad_huds[nm] = {}
|
|
||||||
|
|
||||||
if not emeralds then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
-- build tables
|
|
||||||
local hud_table_header = {
|
|
||||||
hud_elem_type = "image",
|
|
||||||
position = {x = 0.5, y = 0.5},
|
|
||||||
offset = {x = -300, y = 450},
|
|
||||||
text = "mcl_core_emerald.png",
|
|
||||||
alignment = {x = -1, y = 1},
|
|
||||||
scale = { x = 3, y = 3},
|
|
||||||
}
|
|
||||||
|
|
||||||
local hud_table_sub = table.copy(hud_table_header)
|
|
||||||
hud_table_sub.hud_elem_type = "text"
|
|
||||||
hud_table_sub.offset = {
|
|
||||||
x = hud_table_header.offset.x+30,
|
|
||||||
y = hud_table_header.offset.y+20
|
|
||||||
}
|
|
||||||
hud_table_sub.scale = {x=300, y=30}
|
|
||||||
hud_table_sub.text = "x "..emeralds
|
|
||||||
hud_table_sub.number = 0xFFFF00
|
|
||||||
|
|
||||||
-- show tables
|
|
||||||
ad_huds[nm].header = player:hud_add(hud_table_header)
|
|
||||||
ad_huds[nm].sub = player:hud_add(hud_table_sub)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local ad_tick = 0.0
|
|
||||||
core.register_globalstep(function(dt)
|
|
||||||
ad_tick = ad_tick + dt
|
|
||||||
if ad_tick >= HUD_TIME then
|
|
||||||
print_emeralds()
|
|
||||||
ad_tick = 0.0
|
|
||||||
end
|
|
||||||
end)
|
|
1
init.lua
1
init.lua
@ -42,7 +42,6 @@ dofile(modpath .. "/receive_fields.lua") -- file adapted from atm mod
|
|||||||
dofile(modpath .. "/receive_fields_wt.lua") -- file from atm mod
|
dofile(modpath .. "/receive_fields_wt.lua") -- file from atm mod
|
||||||
dofile(modpath .. "/bank.lua")
|
dofile(modpath .. "/bank.lua")
|
||||||
dofile(modpath .. "/commands.lua")
|
dofile(modpath .. "/commands.lua")
|
||||||
dofile(modpath .. "/hud.lua")
|
|
||||||
|
|
||||||
if income_enabled then
|
if income_enabled then
|
||||||
dofile(modpath .. "/income.lua")
|
dofile(modpath .. "/income.lua")
|
||||||
|
@ -18,6 +18,3 @@ emeraldbank.income_count (number of emeralds) int 1
|
|||||||
|
|
||||||
# Length of time (in seconds) between checking if a player should get income
|
# Length of time (in seconds) between checking if a player should get income
|
||||||
emeraldbank.income_period (time between income) int 1800
|
emeraldbank.income_period (time between income) int 1800
|
||||||
|
|
||||||
# Length of time (in seconds) between updating emeralds player HUD
|
|
||||||
emeraldbank.hud_time (HUD update time) int 3
|
|
||||||
|
Loading…
Reference in New Issue
Block a user