summaryrefslogtreecommitdiff
path: root/lib/PacketManager/packets
diff options
context:
space:
mode:
authorRitabrata Das <[email protected]>2025-02-11 08:12:05 +0530
committerGitHub <[email protected]>2025-02-11 08:12:05 +0530
commitde594e15c4a2abbdbd76a27d735dc71611d71666 (patch)
treed2875bb6b155e28e8b6ac147877d1565a29a4673 /lib/PacketManager/packets
parent3d29b59dae6b93c28c321c2df3cbc49d20d5661c (diff)
parent67ccf67b206873f8a8d099af5def66d7f3ff22d2 (diff)
Merge pull request #2 from Skipper-is/recovered-branch
Added afterburner toggle on damage
Diffstat (limited to 'lib/PacketManager/packets')
-rw-r--r--lib/PacketManager/packets/FSNETCMD_AIRCMD.py27
1 files changed, 25 insertions, 2 deletions
diff --git a/lib/PacketManager/packets/FSNETCMD_AIRCMD.py b/lib/PacketManager/packets/FSNETCMD_AIRCMD.py
index 094da7d..50a9228 100644
--- a/lib/PacketManager/packets/FSNETCMD_AIRCMD.py
+++ b/lib/PacketManager/packets/FSNETCMD_AIRCMD.py
@@ -42,7 +42,7 @@ class FSNETCMD_AIRCMD: #30
return buffer
@staticmethod
- def setPayload(aircraft_id:int, payload:int, units:str='kg', with_size:bool=False):
+ def set_payload(aircraft_id:int, payload:int, units:str='kg', with_size:bool=False):
"""
This will set the payload of the aircraft, useful if you want to
load or unload passengers/cargo - for YSRP I use this to load and unload
@@ -52,5 +52,28 @@ class FSNETCMD_AIRCMD: #30
message = f"INITLOAD {payload} {units}"
return FSNETCMD_AIRCMD.encode(aircraft_id, message, with_size)
+ @staticmethod
+ def set_command(aircraft_id:int, command:str, value:int, with_size:bool=False):
+ """
+ This will set the command of the aircraft, useful if you want to
+ set the engine power, fuel, etc.
+ """
+ if command in AIRCMD_KEYWORDS:
+ command = AIRCMD_KEYWORDS.index(command)
+
+ message = f"*{command} {value}"
+ return FSNETCMD_AIRCMD.encode(aircraft_id, message, with_size)
+
+ @staticmethod
+ def set_afterburner(aircarft_id:int, enabled:int, with_size:bool=False):
+ """
+ This will set the afterburner of the aircraft, useful if you want to
+ enable or disable the afterburner.
+ """
+
+ command = "AFTBURNR"
+ value = str(enabled).upper()
+ return FSNETCMD_AIRCMD.set_command(aircarft_id, command, value, with_size)
+
def __str__(self):
- return "Aircraft ID : {self.aircraft_id}; Message : {self.message}; Command : {self.command}"
+ return f"Aircraft ID : {self.aircraft_id}; Message : {self.message}; Command : {self.command}"