Printed show_level first text

master
Solebull 2018-12-30 19:29:19 +01:00
parent 441dbfaff8
commit 43c05b20b2
4 changed files with 19 additions and 18 deletions

View File

@ -226,6 +226,7 @@ It's really fast. May be used on a website, to show the actual map.
- see https://github.com/chipgw/minetest-mumble-wrapper
*** v0.0.2
**** [feature_showLevel] Our own mod
CLOCK: [2018-12-30 dim. 19:23]
CLOCK: [2018-12-30 dim. 18:06]--[2018-12-30 dim. 18:40] => 0:34
*xpro doesn't show total level ? Maybe write a show_level mod ?*
- [X] First create our own mod/nint.lua with depends description etc...

1
TODO
View File

@ -11,4 +11,5 @@ minetest-solebull - LGPL-2.1 - A PVP/faction game for minetest based on Cobalt.
* v0.0.1-4 (29 Dec. 2018 - ???) CLOC ???,???
- Printed show_level first text
- Trying an XP/level mod

View File

@ -51,13 +51,5 @@ dofile(path .. "/executable/node_registry.lua")
dofile(path .. "/occupations/occupations.lua")
-- Load random data definitions
dofile(path .. "/info/info.lua")
--dofile(path .. "/random_data.lua")
--dofile(path .. "/data/dialogues_data.lua")
--dofile(path .. "/data/gift_items_data.lua")
--dofile(path .. "/data/names_data.lua")
--dofile(path .. "/data/occupations/default.lua")
--dofile(path .. "/data/occupations/default_farmer.lua")
--dofile(path .. "/data/occupations/default_priest.lua")
--dofile(path .. "/data/occupations/default_miner.lua")
print (S("[Mod] Advanced NPC loaded"))

View File

@ -1,18 +1,25 @@
-- Permanently shows the player's level
local elemid = nil -- Needed to update existing HUD element
local update_level = function(playername)
minetest.log("error", "[show_level] Updating level for "..playername)
local player = minetest.get_player_by_name(playername)
local elemid = player:hud_add({
hud_elem_type = "text",
position = {x = 0.5, y = 0.5},
offset = {x = 0, y = 0},
text = "Hello world!",
alignment = {x = 0, y = 0}, -- center aligned
scale = {x = 100, y = 100}, -- covered later
})
if elemid == nil then
-- Create HUD element
minetest.log("error", "[show_level] Creating level HUD for "..playername)
elemid = player:hud_add({
hud_elem_type = "text",
position = {x = 0.5, y = 0.5},
offset = {x = 0, y = 0},
text = "Hello world!",
alignment = {x = 0, y = 0}, -- center aligned
scale = {x = 100, y = 30}, -- covered later
})
else
-- Update
minetest.log("error", "[show_level] Updating level for "..playername)
end
end
-- Showing level when a player join