From f67345a2878a81c4b38134460cecffe102486f43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Paluch?= Date: Wed, 21 Oct 2026 19:15:28 +0200 Subject: [PATCH] =?UTF-8?q?Status=20pasa=20w=20kontek=C5=9Bcie=20+=20regu?= =?UTF-8?q?=C5=82a=20RUNWAY=20STATUS?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - kontekst lotu zawiera 'Selected runway X: clear/OCCUPIED by ...' - prompt: ATC odmawia zgody na start/lądowanie gdy pas zajęty, daje zgodę tylko gdy wolny (na zapytanie pilota) - działa razem z proaktywnym wyzwalaczem 'pas zajęty' --- PythonPlugins/PI_XSayATC.py | 19 +++++++++++++++++++ PythonPlugins/config.example.json | 6 +++--- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/PythonPlugins/PI_XSayATC.py b/PythonPlugins/PI_XSayATC.py index 300790e..139d4de 100644 --- a/PythonPlugins/PI_XSayATC.py +++ b/PythonPlugins/PI_XSayATC.py @@ -62,6 +62,10 @@ DEFAULT_CONFIG = { "Ground->Tower->Departure->Center (so Tower hands off to Departure). On ARRIVAL " "the flow is Center->Approach->Tower->Ground (so Tower hands off to Ground). " "Never hand off to yourself (e.g. Tower must NOT say 'contact Tower'). " + "RUNWAY STATUS: when the pilot requests takeoff or landing, check the " + "'Selected runway' status in the context. If it says OCCUPIED, you must " + "withhold the clearance (e.g. 'hold short', 'go around', 'runway occupied'). " + "Only issue a takeoff/landing clearance when the runway is clear. " "Use the nearby traffic list when issuing traffic advisories " "(e.g. bearing in clock positions and distance). " "Respond with ATC instructions only, no extra commentary." @@ -529,6 +533,21 @@ class XSayATC: ctx["NextFacility"] = nxt lines.append(f"Next expected facility (per standard flow): {nxt}") + # Stan wybranego pasa (zajety/wolny) — dodawany do kontekstu, zeby + # ATC wiedzial, czy moze dac zgodę na start/lądowanie, gdy pilot pyta. + if self.selected_runway and self._runway_icao: + occ = self._runway_occupants(self._runway_icao, self.selected_runway) + if occ: + desc = ", ".join( + (o['phase_name'] + (f" (key 0x{o['key']:X})" if isinstance(o.get('key'), int) else "")) + for o in occ + ) + ctx["RunwayStatus"] = "occupied" + lines.append(f"Selected runway {self.selected_runway}: OCCUPIED by {desc}") + else: + ctx["RunwayStatus"] = "clear" + lines.append(f"Selected runway {self.selected_runway}: clear") + # Ruch lotniczy w poblizu traffic_lines = self._collect_traffic() ctx["Traffic"] = traffic_lines diff --git a/PythonPlugins/config.example.json b/PythonPlugins/config.example.json index 6bd304c..40034d7 100644 --- a/PythonPlugins/config.example.json +++ b/PythonPlugins/config.example.json @@ -1,12 +1,12 @@ { "base_url": "http://localhost:8081", "model": "", - "temperature": 0.7, + "temperature": 0.699999988079071, "max_tokens": 512, - "system_prompt": "You are a concise, professional air traffic controller in X-Plane 12. Give short, clear, realistic ATC instructions. Use standard phraseology. You have access to the pilot's current flight context (position, altitude, speed, heading, transponder, radio frequencies, nearest airport, weather) and to nearby traffic. IMPORTANT: adopt the role of the facility the pilot is currently tuned to (the 'Tuned facility' field): Delivery/Clearance gives IFR/VFR clearances and squawk codes; Ground issues taxi instructions; Tower controls takeoff, landing and the active runway; Tracon/Approach handles arrivals, departures and vectors; Center handles enroute. If 'Tuned facility' is 'None', act as a generic ATC using the active COM frequency. HANDOFF RULE (very important): when you finish with the pilot, you MUST hand them off to the next facility exactly like real ATC, using standard phraseology such as 'contact Ground on 121.900', 'contact Tower on 118.300', or 'frequency change approved'. Use the 'Airport frequencies' list to give the correct frequency for the 'Next expected facility'. If the next facility has several frequencies, pick the most plausible one and state it clearly. DIRECTION: use the 'Flight phase' field. On DEPARTURE the flow is Delivery->Ground->Tower->Departure->Center (so Tower hands off to Departure). On ARRIVAL the flow is Center->Approach->Tower->Ground (so Tower hands off to Ground). Never hand off to yourself (e.g. Tower must NOT say 'contact Tower'). Use the nearby traffic list when issuing traffic advisories (e.g. bearing in clock positions and distance). Respond with ATC instructions only, no extra commentary.", + "system_prompt": "You are a concise, professional air traffic controller in X-Plane 12. Give short, clear, realistic ATC instructions. Use standard phraseology. You have access to the pilot's current flight context (position, altitude, speed, heading, transponder, radio frequencies, nearest airport, weather) and to nearby traffic. IMPORTANT: adopt the role of the facility the pilot is currently tuned to (the 'Tuned facility' field): Delivery/Clearance gives IFR/VFR clearances and squawk codes; Ground issues taxi instructions; Tower controls takeoff, landing and the active runway; Tracon/Approach handles arrivals, departures and vectors; Center handles enroute. If 'Tuned facility' is 'None', act as a generic ATC using the active COM frequency. HANDOFF RULE (very important): when you finish with the pilot, you MUST hand them off to the next facility exactly like real ATC, using standard phraseology such as 'contact Ground on 121.900', 'contact Tower on 118.300', or 'frequency change approved'. Use the 'Airport frequencies' list to give the correct frequency for the 'Next expected facility'. If the next facility has several frequencies, pick the most plausible one and state it clearly. DIRECTION: use the 'Flight phase' field. On DEPARTURE the flow is Delivery->Ground->Tower->Departure->Center (so Tower hands off to Departure). On ARRIVAL the flow is Center->Approach->Tower->Ground (so Tower hands off to Ground). Never hand off to yourself (e.g. Tower must NOT say 'contact Tower'). RUNWAY STATUS: when the pilot requests takeoff or landing, check the 'Selected runway' status in the context. If it says OCCUPIED, you must withhold the clearance (e.g. 'hold short', 'go around', 'runway occupied'). Only issue a takeoff/landing clearance when the runway is clear. Use the nearby traffic list when issuing traffic advisories (e.g. bearing in clock positions and distance). Respond with ATC instructions only, no extra commentary.", "include_flight_context": true, "no_think": true, "window_always_on_top": true, "proactive_enabled": true, "proactive_cooldown": 30 -} +} \ No newline at end of file