diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7f7ee5dd4b..8df89cd351 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -79,6 +79,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- New `Attachable` INI and Lua (R/W) properties `InheritsVelWhenDetached` and `InheritsAngularVelWhenDetached`, which determine how much of these velocities an attachable inherits from its parent when detached. Defaults to 1.
+- New `ACraft` INI and Lua (R/W) property `CanEnterOrbit`, which determines whether a craft can enter orbit (and refund gold appropriately) or not. If false, default out-of-bounds deletion logic applies.
+
Changed
@@ -113,7 +115,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Internal GUI element `ComboBox` no longer displays dropdown combobutton when disabled, to communicate visually that it's setting is not modifiable.
-- Almost all ctrl+* special inputs functionality (i.e restarting activity, world dumps, showing performance stats) are now mapped to right alt, to not interfere with default crouching inputs. The only exception is ctrl+arrow keys for changing console size.
+- Almost all ctrl+\* special inputs functionality (i.e restarting activity, world dumps, showing performance stats) are now mapped to right alt, to not interfere with default crouching inputs. The only exception is ctrl+arrow keys for changing console size.
- `Gib`s and detached `Attachable`s now inherit the parent's angular velocity by default.
@@ -121,6 +123,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- `InheritsVel` and its ilk have been uncapped, allowing users to set them outside of 0-1.
+- `Scene` Lua functions `AddNavigatableArea(areaName)` and `ClearNavigatableAreas()` have been renamed/corrected to `AddNavigableArea(areaName)` and `ClearNavigableAreas()`, respectively.
+
Fixed
diff --git a/Data/Base.rte/AI/SharedBehaviors.lua b/Data/Base.rte/AI/SharedBehaviors.lua
index 7834b2ac94..e0ea9058a9 100644
--- a/Data/Base.rte/AI/SharedBehaviors.lua
+++ b/Data/Base.rte/AI/SharedBehaviors.lua
@@ -864,7 +864,7 @@ function SharedBehaviors.GoToWpt(AI, Owner, Abort)
-- test jumping
local JetAccel = Accel + Vector(-jetStrength, 0):RadRotate(Owner.RotAngle+1.375*math.pi+Owner:GetAimAngle(false)*0.25);
- local JumpPos = Owner.Head.Pos + PixelVel + JetAccel * (t*t*0.5);
+ local JumpPos = (Owner.Head and Owner.Head.Pos or Owner.Pos) + PixelVel + JetAccel * (t*t*0.5);
-- a burst add a one time boost to acceleration
if Owner.Jetpack:CanTriggerBurst() then
@@ -872,8 +872,8 @@ function SharedBehaviors.GoToWpt(AI, Owner, Abort)
end
-- check for obstacles from the head
- Trace = SceneMan:ShortestDistance(Owner.Head.Pos, JumpPos, false);
- local jumpScore = SceneMan:CastObstacleRay(Owner.Head.Pos, Trace, JumpPos, Vector(), Owner.ID, Owner.IgnoresWhichTeam, rte.grassID, 3);
+ Trace = SceneMan:ShortestDistance((Owner.Head and Owner.Head.Pos or Owner.Pos), JumpPos, false);
+ local jumpScore = SceneMan:CastObstacleRay((Owner.Head and Owner.Head.Pos or Owner.Pos), Trace, JumpPos, Vector(), Owner.ID, Owner.IgnoresWhichTeam, rte.grassID, 3);
if jumpScore < 0 then -- no obstacles: calculate the distance from the future pos to the wpt
jumpScore = SceneMan:ShortestDistance(Waypoint.Pos, JumpPos, false).Magnitude;
else -- the ray hit terrain or start inside terrain: avoid
@@ -881,11 +881,11 @@ function SharedBehaviors.GoToWpt(AI, Owner, Abort)
end
-- test falling
- local FallPos = Owner.Head.Pos + PixelVel + Accel * (t*t*0.5);
+ local FallPos = (Owner.Head and Owner.Head.Pos or Owner.Pos) + PixelVel + Accel * (t*t*0.5);
-- check for obstacles when falling/walking
- local Trace = SceneMan:ShortestDistance(Owner.Head.Pos, FallPos, false);
- SceneMan:CastObstacleRay(Owner.Head.Pos, Trace, FallPos, Vector(), Owner.ID, Owner.IgnoresWhichTeam, rte.grassID, 3);
+ local Trace = SceneMan:ShortestDistance((Owner.Head and Owner.Head.Pos or Owner.Pos), FallPos, false);
+ SceneMan:CastObstacleRay((Owner.Head and Owner.Head.Pos or Owner.Pos), Trace, FallPos, Vector(), Owner.ID, Owner.IgnoresWhichTeam, rte.grassID, 3);
if SceneMan:ShortestDistance(Waypoint.Pos, FallPos, false):MagnitudeIsLessThan(jumpScore) then
AI.jump = false;
diff --git a/Data/Browncoats.rte/Activities.ini b/Data/Browncoats.rte/Activities.ini
index ae2a995ce4..002e99179c 100644
--- a/Data/Browncoats.rte/Activities.ini
+++ b/Data/Browncoats.rte/Activities.ini
@@ -3,7 +3,7 @@
AddActivity = GAScripted
PresetName = Refinery Assault
- Description = Test your arsenal in peace and quiet witout any enemies.
+ Description = Test your arsenal in war and chaos with a lot of enemies.
SceneName = Yskely Refinery
TeamOfPlayer1 = 0
TeamOfPlayer2 = 0
@@ -15,6 +15,7 @@ AddActivity = GAScripted
Team2Funds = 100
DeployUnitsSwitchEnabled = 0
ScriptPath = Browncoats.rte/Activities/RefineryAssault.lua
+ AddRequiredArea = CaptureArea_RefineryLCHackConsole1 // a little arbitrary, but it works.
LuaClassName = RefineryAssault
DefaultDeployUnits = 1
DefaultFogOfWar = 1
diff --git a/Data/Browncoats.rte/Activities/RefineryAssault.lua b/Data/Browncoats.rte/Activities/RefineryAssault.lua
index 899b8a9589..b9453c1b26 100644
--- a/Data/Browncoats.rte/Activities/RefineryAssault.lua
+++ b/Data/Browncoats.rte/Activities/RefineryAssault.lua
@@ -178,10 +178,10 @@ function RefineryAssault:StartActivity(newGame)
end
end
- SceneMan.Scene:AddNavigatableArea("Mission Stage Area 1");
- SceneMan.Scene:AddNavigatableArea("Mission Stage Area 2");
- SceneMan.Scene:AddNavigatableArea("Mission Stage Area 3");
- SceneMan.Scene:AddNavigatableArea("Mission Stage Area 4");
+ SceneMan.Scene:AddNavigableArea("Mission Stage Area 1");
+ SceneMan.Scene:AddNavigableArea("Mission Stage Area 2");
+ SceneMan.Scene:AddNavigableArea("Mission Stage Area 3");
+ SceneMan.Scene:AddNavigableArea("Mission Stage Area 4");
self.musicGraceTimer = Timer();
self.musicGraceTime = 4000;
diff --git a/Source/Entities/ACraft.cpp b/Source/Entities/ACraft.cpp
index 78144515be..f43c42db59 100644
--- a/Source/Entities/ACraft.cpp
+++ b/Source/Entities/ACraft.cpp
@@ -201,6 +201,7 @@ void ACraft::Clear() {
m_DeliveryState = FALL;
m_AltitudeMoveState = HOVER;
m_AltitudeControl = 0;
+ m_CanEnterOrbit = true;
m_MaxPassengers = -1;
m_DeliveryDelayMultiplier = 1.0;
@@ -251,6 +252,7 @@ int ACraft::Create(const ACraft& reference) {
m_DeliveryState = reference.m_DeliveryState;
m_AltitudeMoveState = reference.m_AltitudeMoveState;
m_AltitudeControl = reference.m_AltitudeControl;
+ m_CanEnterOrbit = reference.m_CanEnterOrbit;
m_MaxPassengers = reference.m_MaxPassengers;
m_DeliveryDelayMultiplier = reference.m_DeliveryDelayMultiplier;
@@ -285,6 +287,7 @@ int ACraft::ReadProperty(const std::string_view& propName, Reader& reader) {
MatchProperty("DeliveryDelayMultiplier", { reader >> m_DeliveryDelayMultiplier; });
MatchProperty("ExitInterval", { reader >> m_ExitInterval; });
MatchProperty("CanLand", { reader >> m_LandingCraft; });
+ MatchProperty("CanEnterOrbit", { reader >> m_CanEnterOrbit; });
MatchProperty("MaxPassengers", { reader >> m_MaxPassengers; });
MatchProperty("ScuttleIfFlippedTime", { reader >> m_ScuttleIfFlippedTime; });
MatchProperty("ScuttleOnDeath", { reader >> m_ScuttleOnDeath; });
@@ -314,7 +317,10 @@ int ACraft::Save(Writer& writer) const {
writer.NewProperty("CrashSound");
writer << m_CrashSound;
-
+
+ writer.NewProperty("CanEnterOrbit");
+ writer << m_CanEnterOrbit;
+
writer.NewProperty("MaxPassengers");
writer << m_MaxPassengers;
writer.NewProperty("ScuttleIfFlippedTime");
@@ -698,23 +704,26 @@ void ACraft::Update() {
/////////////////////////////////////////
// Check for having gone into orbit
- if (m_Pos.m_Y < -m_CharHeight || m_Pos.m_Y > g_SceneMan.GetSceneHeight() + m_CharHeight) {
- g_ActivityMan.GetActivity()->HandleCraftEnteringOrbit(this);
- // Play fading away thruster sound
- // if (m_pMThruster && m_pMThruster->IsEmitting())
- // m_pMThruster->(pTargetBitmap, targetPos, mode, onlyPhysical);
- m_ToDelete = true;
- }
+ if (m_CanEnterOrbit) {
+ if (m_Pos.m_Y < -m_CharHeight || m_Pos.m_Y > g_SceneMan.GetSceneHeight() + m_CharHeight) {
+ g_ActivityMan.GetActivity()->HandleCraftEnteringOrbit(this);
+ // Play fading away thruster sound
+ // if (m_pMThruster && m_pMThruster->IsEmitting())
+ // m_pMThruster->(pTargetBitmap, targetPos, mode, onlyPhysical);
+ m_ToDelete = true;
+ }
- if (g_ActivityMan.GetActivity()->GetCraftOrbitAtTheEdge()) {
- if (g_SceneMan.GetScene() && !g_SceneMan.GetScene()->WrapsX()) {
- if (m_Pos.m_X < -GetSpriteWidth() || m_Pos.m_X > g_SceneMan.GetSceneWidth() + GetSpriteWidth()) {
- g_ActivityMan.GetActivity()->HandleCraftEnteringOrbit(this);
- m_ToDelete = true;
+ // Horizontal orbiting, if scene doesn't wrap
+ if (g_ActivityMan.GetActivity()->GetCraftOrbitAtTheEdge()) {
+ if (g_SceneMan.GetScene() && !g_SceneMan.GetScene()->WrapsX()) {
+ if (m_Pos.m_X < -GetSpriteWidth() || m_Pos.m_X > g_SceneMan.GetSceneWidth() + GetSpriteWidth()) {
+ g_ActivityMan.GetActivity()->HandleCraftEnteringOrbit(this);
+ m_ToDelete = true;
+ }
}
- }
+ }
}
-
+
if (m_Status == DEAD) {
if (m_ScuttleOnDeath || m_AIMode == AIMODE_SCUTTLE) {
GibThis();
diff --git a/Source/Entities/ACraft.h b/Source/Entities/ACraft.h
index 4007e2db23..b276a13bee 100644
--- a/Source/Entities/ACraft.h
+++ b/Source/Entities/ACraft.h
@@ -254,6 +254,16 @@ namespace RTE {
/// get drawn etc.
void DrawHUD(BITMAP* pTargetBitmap, const Vector& targetPos = Vector(), int whichScreen = 0, bool playerControlled = false) override;
+ /// Gets whether this craft can enter orbit and refund the owning team when out of the map. If false,
+ /// only default out-of-bounds deletion logic applies.
+ /// @return Whether this craft can enter orbit or not.
+ bool GetCanEnterOrbit() const { return m_CanEnterOrbit; }
+
+ /// Sets whether this craft can enter orbit and refund the owning team when out of the map. If false,
+ /// only default out-of-bounds deletion logic applies.
+ /// @param canEnterOrbit Whether this craft can enter orbit or not.
+ void SetCanEnterOrbit(bool canEnterOrbit) { m_CanEnterOrbit = canEnterOrbit; }
+
/// The recomended, not absolute, maximum number of actors that fit in the
/// invetory. Used by the activity AI.
/// @return An integer with the recomended number of actors that fit in the craft.
@@ -354,6 +364,8 @@ namespace RTE {
Timer m_CrashTimer;
// Crash sound
SoundContainer* m_CrashSound;
+ // Whether this can enter orbit and refund the owning team. If false, will use default out-of-bounds deletion behavior.
+ bool m_CanEnterOrbit;
// The maximum number of actors that fit in the inventory
int m_MaxPassengers;
int m_ScuttleIfFlippedTime; //!< The time after which the craft will scuttle automatically, if tipped over.
diff --git a/Source/Entities/Actor.cpp b/Source/Entities/Actor.cpp
index 1a937c7ac2..d80548f00a 100644
--- a/Source/Entities/Actor.cpp
+++ b/Source/Entities/Actor.cpp
@@ -335,6 +335,7 @@ int Actor::ReadProperty(const std::string_view& propName, Reader& reader) {
MatchProperty("StableRecoveryDelay", { reader >> m_StableRecoverDelay; });
MatchProperty("CanRun", { reader >> m_CanRun; });
MatchProperty("CrouchWalkSpeedMultiplier", { reader >> m_CrouchWalkSpeedMultiplier; });
+ MatchProperty("GoldCarried", { reader >> m_GoldCarried; });
MatchProperty("AimAngle", { reader >> m_AimAngle; });
MatchProperty("AimRange", { reader >> m_AimRange; });
MatchProperty("AimDistance", { reader >> m_AimDistance; });
@@ -413,6 +414,8 @@ int Actor::Save(Writer& writer) const {
writer << m_CanRun;
writer.NewProperty("CrouchWalkSpeedMultiplier");
writer << m_CrouchWalkSpeedMultiplier;
+ writer.NewProperty("GoldCarried");
+ writer << m_GoldCarried;
writer.NewProperty("AimAngle");
writer << m_AimAngle;
writer.NewProperty("AimRange");
diff --git a/Source/Entities/Scene.cpp b/Source/Entities/Scene.cpp
index 2216c5586f..e7c4f7daf3 100644
--- a/Source/Entities/Scene.cpp
+++ b/Source/Entities/Scene.cpp
@@ -356,8 +356,8 @@ void Scene::Clear() {
m_ScanScheduled[team] = false;
}
m_AreaList.clear();
- m_NavigatableAreas.clear();
- m_NavigatableAreasUpToDate = false;
+ m_NavigableAreas.clear();
+ m_NavigableAreasUpToDate = false;
m_GlobalAcc.Reset();
m_SelectedAssemblies.clear();
m_AssembliesCounts.clear();
@@ -1848,7 +1848,7 @@ bool Scene::SetArea(Area& newArea) {
return false;
}
-bool Scene::HasArea(std::string areaName) {
+bool Scene::HasArea(const std::string& areaName) {
for (std::list::iterator aItr = m_AreaList.begin(); aItr != m_AreaList.end(); ++aItr) {
if ((*aItr).GetName() == areaName)
return true;
@@ -1856,21 +1856,17 @@ bool Scene::HasArea(std::string areaName) {
return false;
}
-Scene::Area* Scene::GetArea(const std::string_view& areaName, bool required) {
+Scene::Area* Scene::GetArea(const std::string& areaName) {
for (Scene::Area& area: m_AreaList) {
if (area.GetName() == areaName) {
return &area;
}
}
- if (required) {
- g_ConsoleMan.PrintString("WARNING: Could not find the requested Scene Area named : " + std::string(areaName));
- }
-
return nullptr;
}
-bool Scene::RemoveArea(std::string areaName) {
+bool Scene::RemoveArea(const std::string& areaName) {
for (std::list::iterator aItr = m_AreaList.begin(); aItr != m_AreaList.end(); ++aItr) {
if ((*aItr).GetName() == areaName) {
m_AreaList.erase(aItr);
@@ -1880,7 +1876,7 @@ bool Scene::RemoveArea(std::string areaName) {
return false;
}
-bool Scene::WithinArea(std::string areaName, const Vector& point) const {
+bool Scene::WithinArea(const std::string& areaName, const Vector& point) const {
if (areaName.empty())
return false;
@@ -2438,21 +2434,21 @@ void Scene::Update() {
}
}
- if (m_NavigatableAreasUpToDate == false) {
+ if (m_NavigableAreasUpToDate == false) {
// Need to block until all current pathfinding requests are finished. Ugh, if only we had a better way (interrupt/cancel a path request to start a new one?)
// TODO: Make the PathRequest struct more capable and maybe we can delay starting or cancel mid-request?
BlockUntilAllPathingRequestsComplete();
- m_NavigatableAreasUpToDate = true;
+ m_NavigableAreasUpToDate = true;
for (int team = Activity::Teams::NoTeam; team < Activity::Teams::MaxTeamCount; ++team) {
PathFinder& pathFinder = GetPathFinder(static_cast(team));
- pathFinder.MarkAllNodesNavigatable(m_NavigatableAreas.empty());
+ pathFinder.MarkAllNodesNavigable(m_NavigableAreas.empty());
- for (const std::string& navigatableArea: m_NavigatableAreas) {
- if (HasArea(navigatableArea)) {
- for (const Box& navigatableBox: GetArea(navigatableArea)->GetBoxes()) {
- pathFinder.MarkBoxNavigatable(navigatableBox, true);
+ for (const std::string& navigableArea: m_NavigableAreas) {
+ if (HasArea(navigableArea)) {
+ for (const Box& navigableBox: GetArea(navigableArea)->GetBoxes()) {
+ pathFinder.MarkBoxNavigable(navigableBox, true);
}
}
}
diff --git a/Source/Entities/Scene.h b/Source/Entities/Scene.h
index 8942c8b1b6..60ee11a627 100644
--- a/Source/Entities/Scene.h
+++ b/Source/Entities/Scene.h
@@ -501,39 +501,33 @@ namespace RTE {
/// This won't throw any errors to the console if the Area isn't found.
/// @param areaName The name of the Area to try to find in this Scene.
/// @return Whether the specified area is defined in this Scene.
- bool HasArea(std::string areaName);
+ bool HasArea(const std::string& areaName);
/// Gets a specified Area identified by name. Ownership is NOT transferred!
/// @param areaName The name of the Area to try to get.
- /// @param required Whether the area is required, and should throw an error if not found.
/// @return A pointer to the Area asked for, or nullptr if no Area of that name was found.
- Area* GetArea(const std::string_view& areaName, bool required);
+ Area* GetArea(const std::string& areaName);
- /// Gets a specified Area identified by name. Ownership is NOT transferred!
- /// @param areaName The name of the Area to try to get.
- /// @return A pointer to the Area asked for, or nullptr if no Area of that name was found.
- Area* GetArea(const std::string& areaName) { return GetArea(areaName, true); }
-
- void AddNavigatableArea(const std::string& areaName) {
- m_NavigatableAreas.push_back(areaName);
- m_NavigatableAreasUpToDate = false;
+ void AddNavigableArea(const std::string& areaName) {
+ m_NavigableAreas.push_back(areaName);
+ m_NavigableAreasUpToDate = false;
}
- void ClearNavigatableAreas(const std::string& areaName) {
- m_NavigatableAreas.clear();
- m_NavigatableAreasUpToDate = false;
+ void ClearNavigableAreas() {
+ m_NavigableAreas.clear();
+ m_NavigableAreasUpToDate = false;
}
/// Removes a specific Area identified by a name.
/// @param areaName The name of the Area to try to remove.
/// @return Whether an Area of that name was found, and subsequently removed.
- bool RemoveArea(std::string areaName);
+ bool RemoveArea(const std::string& areaName);
/// Checks if a point is within a specific named Area of this Scene. If
/// no Area of the name is found, this just returns false without error.
/// @param areaName The name of the Area to try to check against.
/// @param point The point to see if it's within the specified Area.
/// @return Whether any Area of that name was found, AND the point falls within it.
- bool WithinArea(std::string areaName, const Vector& point) const;
+ bool WithinArea(const std::string& areaName, const Vector& point) const;
/// Gets the global acceleration (in m/s^2) that is applied to all movable
/// objects' velocities during every frame. Typically models gravity.
@@ -765,9 +759,9 @@ namespace RTE {
// List of all the specified Area's of the scene
std::list m_AreaList;
- // List of navigatable areas in the scene. If this list is empty, the entire scene is assumed to be navigatable
- std::vector m_NavigatableAreas;
- bool m_NavigatableAreasUpToDate;
+ // List of navigable areas in the scene. If this list is empty, the entire scene is assumed to be navigable
+ std::vector m_NavigableAreas;
+ bool m_NavigableAreasUpToDate;
// The global acceleration vector in m/s^2. (think gravity/wind)
Vector m_GlobalAcc;
diff --git a/Source/Lua/LuaBindingsEntities.cpp b/Source/Lua/LuaBindingsEntities.cpp
index 39d7999af3..c709dba604 100644
--- a/Source/Lua/LuaBindingsEntities.cpp
+++ b/Source/Lua/LuaBindingsEntities.cpp
@@ -117,6 +117,7 @@ LuaBindingRegisterFunctionDefinitionForType(EntityLuaBindings, ACraft) {
.property("HatchOpenSound", &ACraft::GetHatchOpenSound, &LuaAdaptersPropertyOwnershipSafetyFaker::ACraftSetHatchOpenSound)
.property("HatchCloseSound", &ACraft::GetHatchCloseSound, &LuaAdaptersPropertyOwnershipSafetyFaker::ACraftSetHatchCloseSound)
.property("CrashSound", &ACraft::GetCrashSound, &LuaAdaptersPropertyOwnershipSafetyFaker::ACraftSetCrashSound)
+ .property("CanEnterOrbit", &ACraft::GetCanEnterOrbit, &ACraft::SetCanEnterOrbit)
.property("MaxPassengers", &ACraft::GetMaxPassengers)
.property("DeliveryDelayMultiplier", &ACraft::GetDeliveryDelayMultiplier)
.property("ScuttleOnDeath", &ACraft::GetScuttleOnDeath, &ACraft::SetScuttleOnDeath)
@@ -1196,10 +1197,10 @@ LuaBindingRegisterFunctionDefinitionForType(EntityLuaBindings, Scene) {
.def_readwrite("Areas", &Scene::m_AreaList, luabind::return_stl_iterator)
.def("SetArea", &Scene::SetArea)
.def("HasArea", &Scene::HasArea)
- .def("GetArea", (Scene::Area * (Scene::*)(const std::string& areaName)) & Scene::GetArea)
+ .def("GetArea", &Scene::GetArea)
.def("WithinArea", &Scene::WithinArea)
- .def("AddNavigatableArea", &Scene::AddNavigatableArea)
- .def("ClearNavigatableAreas", &Scene::ClearNavigatableAreas)
+ .def("AddNavigableArea", &Scene::AddNavigableArea)
+ .def("ClearNavigableAreas", &Scene::ClearNavigableAreas)
.def("ResetPathFinding", &Scene::ResetPathFinding)
.def("UpdatePathFinding", &Scene::UpdatePathFinding)
.def("PathFindingUpdated", &Scene::PathFindingUpdated)
diff --git a/Source/System/PathFinder.cpp b/Source/System/PathFinder.cpp
index 94953d3200..32844d0970 100644
--- a/Source/System/PathFinder.cpp
+++ b/Source/System/PathFinder.cpp
@@ -185,7 +185,7 @@ int PathFinder::CalculatePath(Vector start, Vector end, std::list& pathR
// If end node is invalid, there's no path
PathNode* endNode = GetPathNodeAtGridCoords(endNodeX, endNodeY);
- if (endNode && endNode->m_Navigatable) {
+ if (endNode && endNode->m_Navigable) {
result = GetPather()->Solve(static_cast(GetPathNodeAtGridCoords(startNodeX, startNodeY)), static_cast(endNode), &statePath, &totalCostResult);
}
@@ -315,19 +315,19 @@ void PathFinder::AdjacentCost(void* state, std::vector*
bool isInNoGrav = g_SceneMan.IsPointInNoGravArea(node->Pos);
bool allowDiagonal = !isInNoGrav; // We don't allow diagonals in nograv to improve automover behaviour
- if (node->Down && node->Down->m_Navigatable) {
+ if (node->Down && node->Down->m_Navigable) {
adjCost.cost = 1.0F + GetMaterialTransitionCost(*node->DownMaterial) + radiatedCost;
adjCost.state = static_cast(node->Down);
adjacentList->push_back(adjCost);
}
- if (node->RightDown && node->RightDown->m_Navigatable && allowDiagonal) {
+ if (node->RightDown && node->RightDown->m_Navigable && allowDiagonal) {
adjCost.cost = 1.4F + (GetMaterialTransitionCost(*node->RightDownMaterial) * 1.4F) + radiatedCost;
adjCost.state = static_cast(node->RightDown);
adjacentList->push_back(adjCost);
}
- if (node->DownLeft && node->DownLeft->m_Navigatable && allowDiagonal) {
+ if (node->DownLeft && node->DownLeft->m_Navigable && allowDiagonal) {
adjCost.cost = 1.4F + (GetMaterialTransitionCost(*node->DownLeftMaterial) * 1.4F) + radiatedCost;
adjCost.state = static_cast(node->DownLeft);
adjacentList->push_back(adjCost);
@@ -338,13 +338,13 @@ void PathFinder::AdjacentCost(void* state, std::vector*
const float extraUpCost = 3.0F;
// We can only go straight left or right if we're on solid ground, otherwise we need to go downwards
- if (node->Left && node->Left->m_Navigatable) {
+ if (node->Left && node->Left->m_Navigable) {
adjCost.cost = 1.0F + GetMaterialTransitionCost(*node->LeftMaterial) + radiatedCost;
adjCost.state = static_cast(node->Left);
adjacentList->push_back(adjCost);
}
- if (node->Right && node->Right->m_Navigatable) {
+ if (node->Right && node->Right->m_Navigable) {
adjCost.cost = 1.0F + GetMaterialTransitionCost(*node->RightMaterial) + radiatedCost;
adjCost.state = static_cast(node->Right);
adjacentList->push_back(adjCost);
@@ -356,7 +356,7 @@ void PathFinder::AdjacentCost(void* state, std::vector*
const PathNode* currentNode = node;
float totalMaterialCost = 0.0F;
for (int i = 0; i < s_JumpHeightVertical; ++i) {
- if (currentNode->Up == nullptr || !currentNode->Up->m_Navigatable || currentNode->UpMaterial->GetIntegrity() > c_PathFindingDefaultDigStrength) {
+ if (currentNode->Up == nullptr || !currentNode->Up->m_Navigable || currentNode->UpMaterial->GetIntegrity() > c_PathFindingDefaultDigStrength) {
// solid ceiling, stop
break;
}
@@ -369,7 +369,7 @@ void PathFinder::AdjacentCost(void* state, std::vector*
currentNode = currentNode->Up;
}
- } else if (node->Up && node->Up->m_Navigatable) {
+ } else if (node->Up && node->Up->m_Navigable) {
adjCost.cost = 1.0F + (extraUpCost) + (GetMaterialTransitionCost(*node->UpRightMaterial) * 3.0F) + radiatedCost; // Three times more expensive when digging.
adjCost.state = static_cast(node->Up);
adjacentList->push_back(adjCost);
@@ -380,7 +380,7 @@ void PathFinder::AdjacentCost(void* state, std::vector*
const PathNode* currentNode = node->UpRight;
float totalMaterialCost = 1.4F + (extraUpCost * 1.4F) + (GetMaterialTransitionCost(*node->UpRightMaterial) * 1.4F * 3.0F) + radiatedCost;
for (int i = 0; i < s_JumpHeightDiagonal; ++i) {
- if (currentNode->UpRight == nullptr || !currentNode->UpRight->m_Navigatable || currentNode->UpRightMaterial->GetIntegrity() > c_PathFindingDefaultDigStrength) {
+ if (currentNode->UpRight == nullptr || !currentNode->UpRight->m_Navigable || currentNode->UpRightMaterial->GetIntegrity() > c_PathFindingDefaultDigStrength) {
// solid ceiling, stop
break;
}
@@ -399,7 +399,7 @@ void PathFinder::AdjacentCost(void* state, std::vector*
const PathNode* currentNode = node->LeftUp;
float totalMaterialCost = 1.4F + (extraUpCost * 1.4F) + (GetMaterialTransitionCost(*node->LeftUpMaterial) * 1.4F * 3.0F) + radiatedCost;
for (int i = 0; i < s_JumpHeightDiagonal; ++i) {
- if (currentNode->LeftUp == nullptr || !currentNode->LeftUp->m_Navigatable || currentNode->LeftUpMaterial->GetIntegrity() > c_PathFindingDefaultDigStrength) {
+ if (currentNode->LeftUp == nullptr || !currentNode->LeftUp->m_Navigable || currentNode->LeftUpMaterial->GetIntegrity() > c_PathFindingDefaultDigStrength) {
// solid ceiling, stop
break;
}
@@ -415,13 +415,13 @@ void PathFinder::AdjacentCost(void* state, std::vector*
}
// Add cost for digging at 45 degrees and for digging upwards.
- if (node->UpRight && node->UpRight->m_Navigatable && allowDiagonal) {
+ if (node->UpRight && node->UpRight->m_Navigable && allowDiagonal) {
adjCost.cost = 1.4F + (extraUpCost * 1.4F) + (GetMaterialTransitionCost(*node->UpRightMaterial) * 1.4F * 3.0F) + radiatedCost; // Three times more expensive when digging.
adjCost.state = static_cast(node->UpRight);
adjacentList->push_back(adjCost);
}
- if (node->LeftUp && node->LeftUp->m_Navigatable && allowDiagonal) {
+ if (node->LeftUp && node->LeftUp->m_Navigable && allowDiagonal) {
adjCost.cost = 1.4F + (extraUpCost * 1.4F) + (GetMaterialTransitionCost(*node->LeftUpMaterial) * 1.4F * 3.0F) + radiatedCost; // Three times more expensive when digging.
adjCost.state = static_cast(node->LeftUp);
adjacentList->push_back(adjCost);
@@ -588,19 +588,19 @@ bool PathFinder::UpdateNodeList(const std::vector& nodeVec) {
return anyChange;
}
-void PathFinder::MarkBoxNavigatable(Box box, bool navigatable) {
+void PathFinder::MarkBoxNavigable(Box box, bool navigable) {
std::vector pathNodesInBox = GetNodeIdsInBox(box);
std::for_each(
std::execution::par_unseq,
pathNodesInBox.begin(),
pathNodesInBox.end(),
- [this, navigatable](int nodeId) {
+ [this, navigable](int nodeId) {
PathNode* node = &m_NodeGrid[nodeId];
- node->m_Navigatable = navigatable;
+ node->m_Navigable = navigable;
});
}
-void PathFinder::MarkAllNodesNavigatable(bool navigatable) {
+void PathFinder::MarkAllNodesNavigable(bool navigable) {
std::vector pathNodesIdsVec;
pathNodesIdsVec.reserve(m_NodeGrid.size());
for (int i = 0; i < m_NodeGrid.size(); ++i) {
@@ -611,9 +611,9 @@ void PathFinder::MarkAllNodesNavigatable(bool navigatable) {
std::execution::par_unseq,
pathNodesIdsVec.begin(),
pathNodesIdsVec.end(),
- [this, navigatable](int nodeId) {
+ [this, navigable](int nodeId) {
PathNode* node = &m_NodeGrid[nodeId];
- node->m_Navigatable = navigatable;
+ node->m_Navigable = navigable;
});
}
diff --git a/Source/System/PathFinder.h b/Source/System/PathFinder.h
index 46fd2f2085..d6c448a77c 100644
--- a/Source/System/PathFinder.h
+++ b/Source/System/PathFinder.h
@@ -36,7 +36,7 @@ namespace RTE {
Vector Pos; //!< Absolute position of the center of this PathNode in the scene.
- bool m_Navigatable; //!< Whether this node can be navigated through.
+ bool m_Navigable; //!< Whether this node can be navigated through.
/// Pointers to all adjacent PathNodes, in clockwise order with top first. These are not owned, and may be 0 if adjacent to non-wrapping scene border.
std::array AdjacentNodes;
@@ -153,15 +153,15 @@ namespace RTE {
/// @return Whether both coordinates represent the same path node.
bool PositionsAreTheSamePathNode(const Vector& pos1, const Vector& pos2) const;
- /// Marks a box as being navigatable or not.
- /// @param box The Box of which all PathNodes that should have their navigatable status changed.
- /// @param navigatable Whether or not the nodes in this box should be navigatable.
- void MarkBoxNavigatable(Box box, bool navigatable);
+ /// Marks a box as being navigable or not.
+ /// @param box The Box of which all PathNodes that should have their navigable status changed.
+ /// @param navigable Whether or not the nodes in this box should be navigable.
+ void MarkBoxNavigable(Box box, bool navigable);
- /// Marks a box as being navigatable or not.
- /// @param box The Box of which all PathNodes that should have their navigatable status changed.
- /// @param navigatable Whether or not the nodes in this box should be navigatable.
- void MarkAllNodesNavigatable(bool navigatable);
+ /// Marks a box as being navigable or not.
+ /// @param box The Box of which all PathNodes that should have their navigable status changed.
+ /// @param navigable Whether or not the nodes in this box should be navigable.
+ void MarkAllNodesNavigable(bool navigable);
#pragma endregion
#pragma region Misc