Move to event loop, prettify warps, add delay to warp with damage counter
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@ -3,6 +3,7 @@ package commands
|
||||
import (
|
||||
lua "github.com/yuin/gopher-lua"
|
||||
"meow.tf/residentsleeper/commands"
|
||||
"meow.tf/residentsleeper/scripting/eventloop"
|
||||
)
|
||||
|
||||
func Loader(L *lua.LState) int {
|
||||
@ -20,15 +21,19 @@ func commandRegister(L *lua.LState) int {
|
||||
|
||||
handler := L.CheckFunction(2)
|
||||
|
||||
loop := eventloop.FromState(L)
|
||||
|
||||
cb := func(ctx *commands.CommandContext) {
|
||||
L.Push(handler)
|
||||
L.Push(lua.LString(ctx.User))
|
||||
loop.RunOnLoop(func(L *lua.LState) {
|
||||
L.Push(handler)
|
||||
L.Push(lua.LString(ctx.User))
|
||||
|
||||
for _, v := range ctx.Arguments {
|
||||
L.Push(lua.LString(v))
|
||||
}
|
||||
for _, v := range ctx.Arguments {
|
||||
L.Push(lua.LString(v))
|
||||
}
|
||||
|
||||
L.PCall(1+ctx.ArgumentCount, 0, nil)
|
||||
L.PCall(1+ctx.ArgumentCount, 0, nil)
|
||||
})
|
||||
}
|
||||
|
||||
commands.Register(name, cb)
|
||||
|
Reference in New Issue
Block a user