summaryrefslogtreecommitdiffstats
path: root/cwd/assets/altcraft/scripts/init.lua
diff options
context:
space:
mode:
authorLaG1924 <lag1924@gmail.com>2021-06-22 00:38:08 +0200
committerLaG1924 <lag1924@gmail.com>2021-06-22 00:46:59 +0200
commit14939a87010ab17425d73b53829aa22c17c96d79 (patch)
tree1b388f1121040f862d4f9aee7845b2705d09df4a /cwd/assets/altcraft/scripts/init.lua
parentAdded game menus (diff)
downloadAltCraft-14939a87010ab17425d73b53829aa22c17c96d79.tar
AltCraft-14939a87010ab17425d73b53829aa22c17c96d79.tar.gz
AltCraft-14939a87010ab17425d73b53829aa22c17c96d79.tar.bz2
AltCraft-14939a87010ab17425d73b53829aa22c17c96d79.tar.lz
AltCraft-14939a87010ab17425d73b53829aa22c17c96d79.tar.xz
AltCraft-14939a87010ab17425d73b53829aa22c17c96d79.tar.zst
AltCraft-14939a87010ab17425d73b53829aa22c17c96d79.zip
Diffstat (limited to 'cwd/assets/altcraft/scripts/init.lua')
-rw-r--r--cwd/assets/altcraft/scripts/init.lua27
1 files changed, 3 insertions, 24 deletions
diff --git a/cwd/assets/altcraft/scripts/init.lua b/cwd/assets/altcraft/scripts/init.lua
index bf7739e..c626375 100644
--- a/cwd/assets/altcraft/scripts/init.lua
+++ b/cwd/assets/altcraft/scripts/init.lua
@@ -14,6 +14,7 @@ function plugin.onLoad ()
con:LoadDocument("altcraft/ui/main-menu"):Show()
con:LoadDocument("altcraft/ui/hud")
con:LoadDocument("altcraft/ui/pause")
+ con:LoadDocument("altcraft/ui/options")
end
function plugin.onChangeState (newState)
@@ -41,33 +42,11 @@ function plugin.onUnload ()
AC.LogInfo("AC Core unloaded")
end
-local function UpdateHud()
- local doc = {}
- for i,d in ipairs(rmlui.contexts["default"].documents) do
- if d.title == "Playing" then
- doc = d
- end
- end
-
- local playerEnt = AC.GetGameState():GetPlayer()
- doc:GetElementById('dbg-pos').inner_rml = string.format("%.1f %.1f %.1f", playerEnt.pos.x, playerEnt.pos.y, playerEnt.pos.z)
-
- local selection = AC.GetGameState():GetSelectionStatus()
- if selection.isBlockSelected then
- doc:GetElementById('dbg-select-pos').inner_rml = tostring(selection.selectedBlock)
- else
- doc:GetElementById('dbg-select-pos').inner_rml = ""
- end
-
- local player = AC.GetGameState():GetPlayerStatus()
- local playerHp = string.format("%.0f", player.health)
- doc:GetElementById('status-hp').inner_rml = playerHp
- doc:GetElementById('status-hp-bar'):SetAttribute("value", playerHp)
-end
+require("altcraft/ui")
function plugin.onTick (deltaTime)
+ UpdateUi()
if AC.GetGameState() and AC.GetGameState():GetPlayer() and AC.GetGameState():GetTimeStatus().worldAge > 0 then
- UpdateHud()
-- local player = AC.GetGameState():GetPlayer()
-- player.pos.x = player.pos.x + deltaTime * 0.5