From 1111bdb09769e851da939dd467d72850f01873ce Mon Sep 17 00:00:00 2001 From: dutchie032 Date: Tue, 5 Nov 2024 00:11:36 +0100 Subject: [PATCH] Added RunwayTouch and RunwayTakeoff for more accurate TakeOff and Land events --- CHANGELOG.md | 3 +++ STATUS.md | 2 ++ lua/DCS-gRPC/methods/mission.lua | 20 ++++++++++++++++++++ protos/dcs/mission/v0/mission.proto | 19 +++++++++++++++++++ 4 files changed, 44 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index db3e5862..39201d38 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Added +- Events `OnRunwayTouch` and `RunwayTakeoff` for "changed" TakeOff and Landing logic in DCS. + ## [0.8.0] ### Breaking Changes diff --git a/STATUS.md b/STATUS.md index 2a57cd3d..f13ea0b8 100644 --- a/STATUS.md +++ b/STATUS.md @@ -203,6 +203,8 @@ should use their independent logging and tracing functions. - [x] `S_EVENT_HIT` - [x] `S_EVENT_TAKEOFF` - [x] `S_EVENT_LAND` +- [x] `S_EVENT_RUNWAY_TAKEOFF` +- [x] `S_EVENT_RUNWAY_TOUCH` - [x] `S_EVENT_CRASH` - [x] `S_EVENT_EJECTION` - [x] `S_EVENT_REFUELING` diff --git a/lua/DCS-gRPC/methods/mission.lua b/lua/DCS-gRPC/methods/mission.lua index db3fce29..9551d044 100644 --- a/lua/DCS-gRPC/methods/mission.lua +++ b/lua/DCS-gRPC/methods/mission.lua @@ -96,6 +96,16 @@ GRPC.onDcsEvent = function(event) }, } + elseif event.id == world.event.S_EVENT_RUNWAY_TAKEOFF then + return { + time = event.time, + event = { + type = "runwayTakeoff", + initiator = {initiator = typed_exporter(event.initiator)}, + place = exporter(event.place), + }, + } + elseif event.id == world.event.S_EVENT_LAND then return { time = event.time, @@ -106,6 +116,16 @@ GRPC.onDcsEvent = function(event) }, } + elseif event.id == world.event.S_EVENT_RUNWAY_TOUCH then + return { + time = event.time, + event = { + type = "runwayTouch", + initiator = {initiator = typed_exporter(event.initiator)}, + place = exporter(event.place), + }, + } + elseif event.id == world.event.S_EVENT_CRASH then return { time = event.time, diff --git a/protos/dcs/mission/v0/mission.proto b/protos/dcs/mission/v0/mission.proto index d4385417..11ed8909 100644 --- a/protos/dcs/mission/v0/mission.proto +++ b/protos/dcs/mission/v0/mission.proto @@ -119,6 +119,14 @@ message StreamEventsResponse { dcs.common.v0.Airbase place = 2; } + // Occurs when an aircraft takes off from an airbase, farp, or ship. + message RunwayTakeoffEvent { + // The object that took off. + dcs.common.v0.Initiator initiator = 1; + // The airbase, farp or ship the unit took off from. + dcs.common.v0.Airbase place = 2; + } + // Occurs when an aircraft lands at an airbase, farp or ship. message LandEvent { // The object that landed. @@ -127,6 +135,14 @@ message StreamEventsResponse { dcs.common.v0.Airbase place = 2; } + // Occurs when an aircraft lands at an airbase, farp or ship. + message RunwayTouchEvent { + // The object that landed. + dcs.common.v0.Initiator initiator = 1; + // The airbase, farp or ship the unit landed at. + dcs.common.v0.Airbase place = 2; + } + // Occurs when an aircraft crashes into the ground and is completely // destroyed. message CrashEvent { @@ -539,6 +555,9 @@ message StreamEventsResponse { LandingQualityMarkEvent landing_quality_mark = 39; // @exclude 40 reserved for S_EVENT_BDA + RunwayTakeoffEvent runway_takeoff = 54; + RunwayTouchEvent runway_touch = 55; + // The following events are additions on top of DCS's own event enum, // which is why they start at 8192 to give DCS plenty of space for // new built-in events.