From 8c5320a94b4c91f2801c05766f6a1747de42a2e5 Mon Sep 17 00:00:00 2001 From: LaG1924 <12997935+LaG1924@users.noreply.github.com> Date: Sat, 18 May 2019 18:12:56 +0500 Subject: Implemented more scripting APIs --- cwd/assets/altcraft/scripts/init.lua | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'cwd') diff --git a/cwd/assets/altcraft/scripts/init.lua b/cwd/assets/altcraft/scripts/init.lua index 5fd9e11..2137464 100644 --- a/cwd/assets/altcraft/scripts/init.lua +++ b/cwd/assets/altcraft/scripts/init.lua @@ -4,6 +4,7 @@ local plugin = { onLoad = nil, onUnload = nil, onChangeState = nil, + onTick = nil, } function plugin.onLoad () @@ -11,7 +12,19 @@ function plugin.onLoad () end function plugin.onChangeState (newState) - AC:LogWarning("New state: "..newState) + AC.LogWarning("New state: "..newState) end -AC:RegisterPlugin(plugin) \ No newline at end of file +function plugin.onUnload () + AC.LogInfo("AC Core unloaded") +end + +function plugin.onTick (deltaTime) + if AC.GetGameState() and AC.GetGameState():GetPlayer() then + local player = AC.GetGameState():GetPlayer() + player.pos.x = player.pos.x + deltaTime * 0.5 + end +end + +AC.RegisterPlugin(plugin) +plugin = nil \ No newline at end of file -- cgit v1.2.3