Simplify the ant

This commit is contained in:
Pascal Serrarens 2024-12-22 10:31:56 +01:00
parent 1eb71a21c0
commit 134bb7c332
2 changed files with 7 additions and 4 deletions

View File

@ -94,7 +94,7 @@ class NameMsg(IMessage):
self.thing = thing
def Serialize(self, buffer_ref):
if self.network_id is None or self.thing is None:
if self.network_id is None or self.thing is None or self.thing.name is None:
return 0
buffer: bytearray = buffer_ref[0]
@ -124,7 +124,7 @@ class ModelUrlMsg(IMessage):
self.thing = thing
def Serialize(self, buffer_ref):
if self.network_id is None or self.thing is None:
if self.network_id is None or self.thing is None or self.thing.model_url is None:
return 0
buffer: bytearray = buffer_ref[0]

View File

@ -9,11 +9,14 @@ class Thing:
LinearVelocity = 0x04
AngularVelocity = 0x08
def __init__(self):
def __init__(self, parent=None):
self.networkId = 0
self.id = 0
self.type = 0
self.parent_id = 0
if parent is None:
self.parent_id = 0
else:
self.parent_id = parent.id
self.name = None
self.model_url = None