aboutsummaryrefslogtreecommitdiff
path: root/clientmods/preview/init.lua
diff options
context:
space:
mode:
Diffstat (limited to 'clientmods/preview/init.lua')
-rw-r--r--clientmods/preview/init.lua22
1 files changed, 20 insertions, 2 deletions
diff --git a/clientmods/preview/init.lua b/clientmods/preview/init.lua
index 288b1b16c..a384fd6bf 100644
--- a/clientmods/preview/init.lua
+++ b/clientmods/preview/init.lua
@@ -7,7 +7,7 @@ dofile("preview:example.lua")
core.register_on_shutdown(function()
print("[PREVIEW] shutdown client")
end)
-
+local id = 0
core.register_on_connect(function()
print("[PREVIEW] Player connection completed")
local server_info = core.get_server_info()
@@ -15,7 +15,6 @@ core.register_on_connect(function()
print("Server ip: " .. server_info.ip)
print("Server address: " .. server_info.address)
print("Server port: " .. server_info.port)
-
mod_channel = core.mod_channel_join("experimental_preview")
core.after(4, function()
@@ -25,6 +24,19 @@ core.register_on_connect(function()
end)
end)
+core.after(1, function()
+ id = core.localplayer:hud_add({
+ hud_elem_type = "text",
+ name = "example",
+ number = 0xff0000,
+ position = {x=0, y=1},
+ offset = {x=8, y=-8},
+ text = "You are using the preview mod",
+ scale = {x=200, y=60},
+ alignment = {x=1, y=-1},
+ })
+end)
+
core.register_on_modchannel_message(function(channel, sender, message)
print("[PREVIEW][modchannels] Received message `" .. message .. "` on channel `"
.. channel .. "` from sender `" .. sender .. "`")
@@ -184,3 +196,9 @@ core.register_chatcommand("privs", {
return true, core.privs_to_string(minetest.get_privilege_list())
end,
})
+
+core.register_chatcommand("text", {
+ func = function(param)
+ return core.localplayer:hud_change(id, "text", param)
+ end,
+})