]> git.lizzy.rs Git - hydra-dragonfire.git/commitdiff
Expose supported serialize and proto versions to Lua
authorElias Fleckenstein <eliasfleckenstein@web.de>
Sun, 29 May 2022 23:03:34 +0000 (01:03 +0200)
committerElias Fleckenstein <eliasfleckenstein@web.de>
Sun, 29 May 2022 23:03:34 +0000 (01:03 +0200)
auth.go
hydra.go

diff --git a/auth.go b/auth.go
index cfac361c64387b647c15f69ca9ea0f8156925277..a58aba3fc9852540d49fa5bfb31a5edc77557aca 100644 (file)
--- a/auth.go
+++ b/auth.go
@@ -69,9 +69,9 @@ func (auth *Auth) connect() {
        go func() {
                for auth.client.state == csConnected && auth.state == asInit {
                        auth.client.conn.SendCmd(&mt.ToSrvInit{
-                               SerializeVer: 28,
-                               MinProtoVer:  39,
-                               MaxProtoVer:  39,
+                               SerializeVer: serializeVer,
+                               MinProtoVer:  protoVer,
+                               MaxProtoVer:  protoVer,
                                PlayerName:   auth.username,
                        })
                        time.Sleep(500 * time.Millisecond)
index 009731c2b001f192b167350ace86f2241ba62c33..3bc74142505f96249bdc611eef3afc930253f2cb 100644 (file)
--- a/hydra.go
+++ b/hydra.go
@@ -13,6 +13,9 @@ import (
 var lastTime = time.Now()
 var canceled = false
 
+var serializeVer uint8 = 28
+var protoVer uint16 = 39
+
 //go:embed builtin/luax/init.lua
 var builtinLuaX string
 
@@ -97,6 +100,8 @@ func main() {
 
        hydra := l.SetFuncs(l.NewTable(), hydraFuncs)
        l.SetField(hydra, "BS", lua.LNumber(10.0))
+       l.SetField(hydra, "serialize_ver", lua.LNumber(serializeVer))
+       l.SetField(hydra, "proto_ver", lua.LNumber(protoVer))
        l.SetGlobal("hydra", hydra)
 
        l.SetField(l.NewTypeMetatable("hydra.auth"), "__index", l.SetFuncs(l.NewTable(), authFuncs))