fix issue where upgrade modules are not working properly
This commit is contained in:
@@ -210,7 +210,8 @@ entt::entity ShipSystem::spawn(const std::string& schematicId, int level,
|
||||
}
|
||||
|
||||
// Range stat additive modifiers are expressed in metres in config; convert to tiles.
|
||||
const double tileSizeD = static_cast<double>(m_config.world.tileSize_m);
|
||||
const double tileSizeD = static_cast<double>(m_config.world.tileSize_m);
|
||||
const double tickRateD = static_cast<double>(kTickRateHz);
|
||||
const char* const kRangeStats[] = {
|
||||
"sensor_range", "attack_range", "collection_range", "repair_range"
|
||||
};
|
||||
@@ -229,6 +230,23 @@ entt::entity ShipSystem::spawn(const std::string& schematicId, int level,
|
||||
}
|
||||
}
|
||||
|
||||
// Acceleration additive modifiers are in m/s² in config; convert to tiles/tick
|
||||
// (same as the base spawn conversion: / tileSize / tickRate).
|
||||
const char* const kAccelerationStats[] = {
|
||||
"main_acceleration", "maneuvering_acceleration"
|
||||
};
|
||||
for (const char* stat : kAccelerationStats)
|
||||
{
|
||||
for (std::map<std::string, std::pair<double, double>>* mods : allModMaps)
|
||||
{
|
||||
std::map<std::string, std::pair<double, double>>::iterator it = mods->find(stat);
|
||||
if (it != mods->end())
|
||||
{
|
||||
it->second.second /= tileSizeD * tickRateD;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Helper: apply a modifier map to a float stat.
|
||||
auto applyMod = [](float& stat, const std::string& name,
|
||||
const std::map<std::string, std::pair<double, double>>& mods)
|
||||
|
||||
Reference in New Issue
Block a user