diff --git a/CHANGELOG.md b/CHANGELOG.md
index 58bcf6354..a4ee88f03 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- New `DataModule` INI property `SupportedGameVersion` to define what version of the game a mod supports. This must be specified, and must match the current game version, in order for the mod to load succesfully.
- New `Actor` INI properties `Organic = 0/1` and `Robotic = 0/1` and supporting Lua functions `Actor:IsOrganic()` and `Actor:IsRobotic()`. These have no direct gameplay effect (and default to false), but will be very useful for inter-mod compatibility, as they allow scripts to know if an `Actor` is organic or robotic, and treat them accordingly.
+
+- New INI and Lua (R/W) `ACDropShip` property `HoverHeightModifier`. This allows for modification of the height at which an `ACDropShip` will hover when unloading cargo, or staying at a location.
diff --git a/Entities/ACDropShip.cpp b/Entities/ACDropShip.cpp
index fe8255180..a44eaa6ed 100644
--- a/Entities/ACDropShip.cpp
+++ b/Entities/ACDropShip.cpp
@@ -44,6 +44,7 @@ void ACDropShip::Clear()
m_LateralControlSpeed = 6.0f;
m_AutoStabilize = 1;
m_MaxEngineAngle = 20.0f;
+ m_HoverHeightModifier = 0;
}
@@ -98,6 +99,8 @@ int ACDropShip::Create(const ACDropShip &reference) {
m_MaxEngineAngle = reference.m_MaxEngineAngle;
+ m_HoverHeightModifier = reference.m_HoverHeightModifier;
+
return 0;
}
@@ -129,8 +132,10 @@ int ACDropShip::ReadProperty(const std::string_view &propName, Reader &reader) {
reader >> m_AutoStabilize;
} else if (propName == "MaxEngineAngle") {
reader >> m_MaxEngineAngle;
- } else if (propName == "LateralControlSpeed") {
- reader >> m_LateralControlSpeed;
+ } else if (propName == "LateralControlSpeed") {
+ reader >> m_LateralControlSpeed;
+ } else if (propName == "HoverHeightModifier") {
+ reader >> m_HoverHeightModifier;
} else {
return ACraft::ReadProperty(propName, reader);
}
@@ -169,6 +174,7 @@ int ACDropShip::Save(Writer &writer) const
writer << m_MaxEngineAngle;
writer.NewProperty("LateralControlSpeed");
writer << m_LateralControlSpeed;
+ writer.NewPropertyWithValue("HoverHeightModifier", m_HoverHeightModifier);
return 0;
}
@@ -313,7 +319,7 @@ void ACDropShip::UpdateAI()
float angle = m_Rotation.GetRadAngle();
// This is the altitude at which the craft will hover and unload its cargo
- float hoverAltitude = m_CharHeight * 2;
+ float hoverAltitude = m_CharHeight * 2 + m_HoverHeightModifier;
// The gutter range threshold for how much above and below the hovering altitude is ok to stay in
float hoverRange = m_CharHeight / 4;
// Get the altitude reading, within 25 pixels precision
diff --git a/Entities/ACDropShip.h b/Entities/ACDropShip.h
index e99fcf6dd..439459e18 100644
--- a/Entities/ACDropShip.h
+++ b/Entities/ACDropShip.h
@@ -296,6 +296,18 @@ ClassInfoGetters;
float GetLateralControl() const { return m_LateralControl; }
+ ///
+ /// Gets the modifier for height at which this ACDropship should hover above terrain.
+ ///
+ /// The modifier for height at which this ACDropship should hover above terrain.
+ float GetHoverHeightModifier() const { return m_HoverHeightModifier; }
+
+ ///
+ /// Sets the modifier for height at which this ACDropship should hover above terrain.
+ ///
+ /// The new modifier for height at which this ACDropship should hover above terrain.
+ void SetHoverHeightModifier(float newHoverHeightModifier) { m_HoverHeightModifier = newHoverHeightModifier; }
+
//////////////////////////////////////////////////////////////////////////////////////////
// Protected member variable and method declarations
@@ -333,6 +345,8 @@ ClassInfoGetters;
// Maximum engine rotation in degrees
float m_MaxEngineAngle;
+ float m_HoverHeightModifier; //!< The modifier for the height at which this ACDropShip should hover above terrain when releasing its cargo. Used in cpp and Lua AI.
+
//////////////////////////////////////////////////////////////////////////////////////////
// Private member variable and method declarations
diff --git a/Lua/LuaBindingsEntities.cpp b/Lua/LuaBindingsEntities.cpp
index eb376b8c4..87fd92673 100644
--- a/Lua/LuaBindingsEntities.cpp
+++ b/Lua/LuaBindingsEntities.cpp
@@ -40,6 +40,7 @@ namespace RTE {
.property("MaxEngineAngle", &ACDropShip::GetMaxEngineAngle, &ACDropShip::SetMaxEngineAngle)
.property("LateralControlSpeed", &ACDropShip::GetLateralControlSpeed, &ACDropShip::SetLateralControlSpeed)
.property("LateralControl", &ACDropShip::GetLateralControl)
+ .property("HoverHeightModifier", &ACDropShip::GetHoverHeightModifier, &ACDropShip::SetHoverHeightModifier)
.def("DetectObstacle", &ACDropShip::DetectObstacle)
.def("GetAltitude", &ACDropShip::GetAltitude);