Skip to content
This repository was archived by the owner on Jan 5, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

</details>

Expand Down
12 changes: 9 additions & 3 deletions Entities/ACDropShip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ void ACDropShip::Clear()
m_LateralControlSpeed = 6.0f;
m_AutoStabilize = 1;
m_MaxEngineAngle = 20.0f;
m_HoverHeightModifier = 0;
}


Expand Down Expand Up @@ -98,6 +99,8 @@ int ACDropShip::Create(const ACDropShip &reference) {

m_MaxEngineAngle = reference.m_MaxEngineAngle;

m_HoverHeightModifier = reference.m_HoverHeightModifier;

return 0;
}

Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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
Expand Down
14 changes: 14 additions & 0 deletions Entities/ACDropShip.h
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,18 @@ ClassInfoGetters;

float GetLateralControl() const { return m_LateralControl; }

/// <summary>
/// Gets the modifier for height at which this ACDropship should hover above terrain.
/// </summary>
/// <returns>The modifier for height at which this ACDropship should hover above terrain.</returns>
float GetHoverHeightModifier() const { return m_HoverHeightModifier; }

/// <summary>
/// Sets the modifier for height at which this ACDropship should hover above terrain.
/// </summary>
/// <param name="newHoverHeightModifier">The new modifier for height at which this ACDropship should hover above terrain.</param>
void SetHoverHeightModifier(float newHoverHeightModifier) { m_HoverHeightModifier = newHoverHeightModifier; }


//////////////////////////////////////////////////////////////////////////////////////////
// Protected member variable and method declarations
Expand Down Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions Lua/LuaBindingsEntities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down