diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/PacketManager/packets/FSNETCMD_ADDOBJECT.py | 27 | ||||
| -rw-r--r-- | lib/plugin_manager.py | 6 |
2 files changed, 30 insertions, 3 deletions
diff --git a/lib/PacketManager/packets/FSNETCMD_ADDOBJECT.py b/lib/PacketManager/packets/FSNETCMD_ADDOBJECT.py index ef7f785..61e2b3f 100644 --- a/lib/PacketManager/packets/FSNETCMD_ADDOBJECT.py +++ b/lib/PacketManager/packets/FSNETCMD_ADDOBJECT.py @@ -46,7 +46,34 @@ class FSNETCMD_ADDOBJECT: #5 #There is an extra short, but it's just set to 0 if len(self.buffer) >= 176: self.pilot = unpack("32s", self.buffer[124:156])[0].decode().strip('\x00') + + def to_dict(self): + return { + "object_type": self.object_type, + "net_type": self.net_type, + "object_id": self.object_id, + "iff": self.iff, + "pos": self.pos, + "atti": self.atti, + "identifier": self.identifier, + "substrname": self.substrname, + "ysfid": self.ysfid, + "flags": self.flags, + "flags0": self.flags0, + "outside_radius": self.outsideRadius, + "aircraft_class": self.aircraft_class, + "aircraft_category": self.aircraft_category, + "pilot": self.pilot + } + def to_packet(self, with_size:bool=True): + return FSNETCMD_ADDOBJECT.encode(self.object_type, self.net_type, + self.object_id, self.iff, self.pos, + self.atti, self.identifier, self.substrname, + self.ysfid, self.flags, self.flags0, + self.outsideRadius, self.aircraft_class, + self.aircraft_category, self.pilot, with_size) + @staticmethod def encode(object_type, net_type, object_id, iff, pos, atti, identifier, substrname, ysfid, flags, flags0, outside_radius, aircraft_class=None, aircraft_category=None, diff --git a/lib/plugin_manager.py b/lib/plugin_manager.py index 07e28e6..52fb1f7 100644 --- a/lib/plugin_manager.py +++ b/lib/plugin_manager.py @@ -58,16 +58,16 @@ class PluginManager: If a callback returns False, then the original data is set to None and not forwarded to the destination. This is useful for modifying packets.""" - keep_orignal = True + keep_original = True if hook_name in self.hooks: for callback in self.hooks[hook_name]: keep = callback(data, *args, **kwargs) if type(keep) == bool: if keep == False: - keep_orignal = False + keep_original = False else: warning(f"Return value of {callback} is not a boolean") - return keep_orignal + return keep_original def trigger_command(self, command:str, player, full_message:str, message_to_client:list, message_to_server:list): """Triggers the command""" |
