summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSkipper <[email protected]>2025-02-13 22:14:31 +0000
committerSkipper <[email protected]>2025-02-13 22:14:31 +0000
commitef8f6310745a434317ba0f17875e1cb7db59e5a9 (patch)
tree146d130dc946ffff01b5154549f2d26f10539c79
parent1b4f3db2f32ffdef3acb7657f37bca3a51ffe467 (diff)
Updated Aircraft.py
Updated to do the prev_life/life swap in the aircraft add_state function.
-rw-r--r--lib/Aircraft.py4
-rw-r--r--plugins/smoke_on_damage/Plugin.py3
-rw-r--r--proxy.py4
3 files changed, 6 insertions, 5 deletions
diff --git a/lib/Aircraft.py b/lib/Aircraft.py
index dd2bbed..5e6e24d 100644
--- a/lib/Aircraft.py
+++ b/lib/Aircraft.py
@@ -76,7 +76,11 @@ class Aircraft:
if packet.player_id != self.id:
return None
+ if self.life == -1:
+ self.life=packet.life
+
self.prev_life = self.life
+
self.life = packet.life
self.set_position(packet.position)
self.set_attitude(packet.atti)
diff --git a/plugins/smoke_on_damage/Plugin.py b/plugins/smoke_on_damage/Plugin.py
index b3b4ccd..e6c57e2 100644
--- a/plugins/smoke_on_damage/Plugin.py
+++ b/plugins/smoke_on_damage/Plugin.py
@@ -1,5 +1,6 @@
"""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."""
+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 FSNETCMD_AIRCMD, FSNETCMD_AIRPLANESTATE, FSNETCMD_TEXTMESSAGE
from logging import debug
from config import SMOKE_LIFE, SMOKE_PLANE
diff --git a/proxy.py b/proxy.py
index 58d241f..3ca6394 100644
--- a/proxy.py
+++ b/proxy.py
@@ -137,15 +137,11 @@ async def handle_client(client_reader, client_writer):
if not keep_message:
data = None
- if player.aircraft.life == -1: #Uninitialised
- player.aircraft.prev_life = player.aircraft.life
-
elif player.aircraft.prev_life < player.aircraft.life and player.aircraft.prev_life != -1 and not player.aircraft.just_repaired:
cheatingMsg = YSchat.message(f"{HEALTH_HACK_MESSAGE} by {player.username}")
warning(f"Health hack detected for {player.username}, Connected from {player.ip}")
message_to_server.append(cheatingMsg)
- player.aircraft.prev_life = player.aircraft.life
player.aircraft.just_repaired = False
elif packet_type == "FSNETCMD_UNJOIN":