From e8a42be368aa2a15c623a3e877ec39fca33edd8e Mon Sep 17 00:00:00 2001 From: Ritabrata Das Date: Sat, 15 Feb 2025 19:17:52 +0530 Subject: Initial Commit for docs --- plugins/custom_aircraft_list/Plugin.py | 42 --------------------------- plugins/custom_aircraft_list/__init__.py | 2 -- plugins/custom_aircraft_list/custom_list.json | 14 --------- 3 files changed, 58 deletions(-) delete mode 100644 plugins/custom_aircraft_list/Plugin.py delete mode 100644 plugins/custom_aircraft_list/__init__.py delete mode 100644 plugins/custom_aircraft_list/custom_list.json (limited to 'plugins/custom_aircraft_list') diff --git a/plugins/custom_aircraft_list/Plugin.py b/plugins/custom_aircraft_list/Plugin.py deleted file mode 100644 index 0fc1bd0..0000000 --- a/plugins/custom_aircraft_list/Plugin.py +++ /dev/null @@ -1,42 +0,0 @@ -"""TThis plugin will cause the aircraft to emit smoke if it's health is below a certain threshold. -It is also an example of a plugin as a folder/module. -This can be used as a basis for more complex plugins that may need multiple files.""" -from lib.PacketManager.packets import List_Constructor -from json import load -from struct import pack -from logging import error -ENABLED = False -custom_list_file = "plugins\\custom_aircraft_list\\custom_list.json" - -class Plugin: - def __init__(self): - self.plugin_manager = None - self.aircraft_list = [] - - def register(self, plugin_manager): - self.plugin_manager = plugin_manager - with open(custom_list_file, 'r', encoding='utf-8') as f: - json_file = load(f) - if isinstance(json_file,list): - self.aircraft_list = json_file - else: - error(f"Invalid JSON file {custom_list_file}. Must be a list of aircraft.") - self.plugin_manager.register_hook('on_list', self.on_list) - self.plugin_manager.register_hook('on_list_server', self.on_list_server) - - def on_list(self, packet, player, message_to_client, message_to_server): - if ENABLED: - return False - - def on_list_server(self, packet, player, message_to_client, message_to_server): - if ENABLED: - #Send the packet straight back to the server, and prevent it being passed to the client. - packet = pack("I",len(packet)) + packet - message_to_server.append(packet) - if not hasattr(player, 'custom_packet_sent'): - player.custom_packet_sent=True - #Send the custom list packets. - lc = List_Constructor(self.aircraft_list).get_packets() - for packet in lc: - message_to_client.append(packet) - return False diff --git a/plugins/custom_aircraft_list/__init__.py b/plugins/custom_aircraft_list/__init__.py deleted file mode 100644 index 425d2ad..0000000 --- a/plugins/custom_aircraft_list/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -from .Plugin import Plugin -from .Plugin import ENABLED \ No newline at end of file diff --git a/plugins/custom_aircraft_list/custom_list.json b/plugins/custom_aircraft_list/custom_list.json deleted file mode 100644 index 987350d..0000000 --- a/plugins/custom_aircraft_list/custom_list.json +++ /dev/null @@ -1,14 +0,0 @@ -[ - "AIRBUS300", - "AIRBUS320", - "B737", - "B747", - "B767", - "B777", - "CONCORDE", - "DIAMOND_ECLIPSE", - "PIPER_ARCHER(WASHIN-AIR_MARKING)", - "T-400", - "U-125", - "U-125A" -] -- cgit v1.2.3