summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/allcaps.py23
-rw-r--r--plugins/discolights.py22
-rw-r--r--plugins/over_g_damage.py28
3 files changed, 73 insertions, 0 deletions
diff --git a/plugins/allcaps.py b/plugins/allcaps.py
new file mode 100644
index 0000000..83b5aec
--- /dev/null
+++ b/plugins/allcaps.py
@@ -0,0 +1,23 @@
+"""This plugin will convert all chat messages to all caps.
+It can be enabled here by changing the value of ENABLED to True."""
+from lib.PacketManager.packets import FSNETCMD_TEXTMESSAGE
+from logging import info
+ENABLED = False
+
+class Plugin:
+ def __init__(self):
+ self.plugin_manager = None
+
+ def register(self, plugin_manager):
+ self.plugin_manager = plugin_manager
+ self.plugin_manager.register_hook('on_chat', self.on_chat)
+
+ def on_chat(self, data, player,message_to_client, message_to_server):
+ if ENABLED:
+ message = FSNETCMD_TEXTMESSAGE(data, should_decode=True)
+ message.message = message.message.upper()
+ message = FSNETCMD_TEXTMESSAGE.encode(f"({message.user}){message.message}", with_size=True)
+ message_to_server.append(message)
+
+
+ return False
diff --git a/plugins/discolights.py b/plugins/discolights.py
new file mode 100644
index 0000000..db441e7
--- /dev/null
+++ b/plugins/discolights.py
@@ -0,0 +1,22 @@
+"""This plugin will flash the lights/fog colour whenever a flight status update
+is sent
+It can be enabled here by changing the value of ENABLED to True."""
+from lib.PacketManager.packets import FSNETCMD_SKYCOLOR, FSNETCMD_FOGCOLOR
+from random import randint
+ENABLED = False
+
+class Plugin:
+ def __init__(self):
+ self.plugin_manager = None
+
+ def register(self, plugin_manager):
+ self.plugin_manager = plugin_manager
+ self.plugin_manager.register_hook('on_flight_data', self.on_receive)
+
+ def on_receive(self, data, player, messages_to_client, *args):
+ if ENABLED:
+ sky_colour_packet = FSNETCMD_SKYCOLOR.encode(randint(0, 255), randint(0, 255), randint(0, 255), True)
+ fog_colour_packet = FSNETCMD_FOGCOLOR.encode(randint(0, 255), randint(0, 255), randint(0, 255), True)
+ messages_to_client.append(sky_colour_packet)
+ messages_to_client.append(fog_colour_packet)
+ return True
diff --git a/plugins/over_g_damage.py b/plugins/over_g_damage.py
new file mode 100644
index 0000000..aa44ca8
--- /dev/null
+++ b/plugins/over_g_damage.py
@@ -0,0 +1,28 @@
+"""This plugin will cause damage to the aircraft if
+it exceeds the g-force limit set in the config file."""
+from lib.PacketManager.packets import FSNETCMD_GETDAMAGE, FSNETCMD_TEXTMESSAGE
+from config import G_LIM
+import time
+ENABLED = True
+
+class Plugin:
+ def __init__(self):
+ self.plugin_manager = None
+
+ def register(self, plugin_manager):
+ self.plugin_manager = plugin_manager
+ self.plugin_manager.register_hook('on_flight_data', self.on_receive)
+
+ def on_receive(self, data, player, messages_to_client, *args):
+ if ENABLED:
+ if abs(player.aircraft.last_packet.g_value)> G_LIM:
+ if time.time() - player.aircraft.last_over_g_message > 1: # Only send every second.
+ player.aircraft.last_over_g_message = time.time()
+ damage_packet = FSNETCMD_GETDAMAGE.encode(player.aircraft.id,
+ 1, 1,
+ player.aircraft.id,
+ 1, 11,0, True)
+ warning_message = FSNETCMD_TEXTMESSAGE.encode(f"You are exceeding the G Limit for the aircraft!, gValue = {player.aircraft.last_packet.g_value}!",True)
+ messages_to_client.append(damage_packet)
+ messages_to_client.append(warning_message)
+ return True