aboutsummaryrefslogtreecommitdiff
path: root/activeobject.go
diff options
context:
space:
mode:
authorHimbeerserverDE <himbeerserverde@gmail.com>2021-08-30 18:25:15 +0200
committerHimbeerserverDE <himbeerserverde@gmail.com>2021-08-30 18:25:15 +0200
commite45f61fce14b1a45bc9adf4a39446618e9751d5d (patch)
tree9479792b1357139ff2f1b3a7f9eff664ae828ef6 /activeobject.go
parent6a5ed858ebce9ad5b0f143ae03d06ca701c9fa9f (diff)
AORmAdd + AOMsgs forwarding + Preserve complex textures
Diffstat (limited to 'activeobject.go')
-rw-r--r--activeobject.go31
1 files changed, 31 insertions, 0 deletions
diff --git a/activeobject.go b/activeobject.go
new file mode 100644
index 0000000..7bba616
--- /dev/null
+++ b/activeobject.go
@@ -0,0 +1,31 @@
+package main
+
+import "github.com/anon55555/mt"
+
+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
+ }
+ }
+}
+
+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 {
+ prependTexture(sc.name, &msg.Props.Textures[j])
+ }
+ prepend(sc.name, &msg.Props.Mesh)
+ prepend(sc.name, &msg.Props.Itemstring)
+ prependTexture(sc.name, &msg.Props.DmgTextureMod)
+ case *mt.AOCmdSpawnInfant:
+ sc.swapAOID(&msg.ID)
+ case *mt.AOCmdTextureMod:
+ prependTexture(sc.name, &msg.Mod)
+ }
+}