Exemple #1
0
 def cmd_move(self, sub):
     q = sub.split(",")
     if len(q) < 3:
         print("short move command from " + self.name)
         return
     self.desiredpos = (float(encoding.dequote(q[0])), \
         float(encoding.dequote(q[1])), float(encoding.dequote(q[2])))
     self.notifylisteners("mov " + str(self.id) + "," + \
         ",".join(map(str, self.desiredpos)) + "\n")
Exemple #2
0
 def unpack(self, rep):
     q = rep.split(',', 4)
     if (len(q) < 4):
         raise BadDataFormat()
     self.type = encoding.dequote(q[0])
     self.pos = (float(encoding.dequote(q[1])), float(encoding.dequote(q[2])), float(encoding.dequote(q[3])))
     if (len(q) > 4):
         return q[4]
     return ""
Exemple #3
0
 def unpack(self, rep):
     rep = world.Entity.unpack(self, rep)
     q = rep.split(",", 4)
     if len(q) < 4:
         print("Player rep: " + rep)
         raise world.BadDataFormat()
     self.name = encoding.dequote(q[0])
     self.desiredpos = (float(encoding.dequote(q[1])), \
         float(encoding.dequote(q[2])), float(encoding.dequote(q[3])))
     if (len(q) > 4):
         return q[4]
     return ""