mt-multiserver-proxy/activeobject.go

32 lines
803 B
Go
Raw Permalink Normal View History

2021-09-06 02:03:27 -07:00
package proxy
import "github.com/anon55555/mt"
2021-09-06 02:03:27 -07:00
func (sc *ServerConn) swapAOID(ao *mt.AOID) {
if sc.client() != nil {
if *ao == sc.client().playerCAO {
*ao = sc.client().currentCAO
} else if *ao == sc.client().currentCAO {
*ao = sc.client().playerCAO
}
}
}
2021-09-06 02:03:27 -07:00
func (sc *ServerConn) handleAOMsg(aoMsg mt.AOMsg) {
switch msg := aoMsg.(type) {
case *mt.AOCmdAttach:
sc.swapAOID(&msg.Attach.ParentID)
case *mt.AOCmdProps:
for j := range msg.Props.Textures {
2022-05-10 09:39:43 -07:00
prependTexture(sc.mediaPool, &msg.Props.Textures[j])
}
2022-05-10 09:39:43 -07:00
prepend(sc.mediaPool, &msg.Props.Mesh)
prepend(sc.mediaPool, &msg.Props.Itemstring)
prependTexture(sc.mediaPool, &msg.Props.DmgTextureMod)
case *mt.AOCmdSpawnInfant:
sc.swapAOID(&msg.ID)
case *mt.AOCmdTextureMod:
2022-05-10 09:39:43 -07:00
prependTexture(sc.mediaPool, &msg.Mod)
}
}