Refactor GameSpeed setting

*Remove internal GameSpeed defaults
 Enforce setting values explicitly all the time
 Require definition of a DefaultSpeed

*Remove Global.Timestep default

*Remove the hacky Timestep/OrderLatency setting via LobbyInfo

*Fix shellmaps ignoring mod-defined gamespeeds

*Make DateTimeGlobal use the MapOptions gamespeed
This commit is contained in:
reaperrr
2021-04-02 14:11:45 +02:00
committed by Paul Chote
parent fe129956bb
commit 1a9dfc0893
22 changed files with 214 additions and 205 deletions

View File

@@ -25,7 +25,6 @@ namespace OpenRA.Mods.Common.Widgets
public readonly TextAlign Align = TextAlign.Left;
public readonly TimerOrder Order = TimerOrder.Descending;
readonly int timestep;
readonly IEnumerable<SupportPowerInstance> powers;
readonly Color bgDark, bgLight;
(string Text, Color Color)[] texts;
@@ -38,11 +37,6 @@ namespace OpenRA.Mods.Common.Widgets
.SelectMany(s => s.Trait.Powers.Values)
.Where(p => p.Instances.Any() && p.Info.DisplayTimerRelationships != PlayerRelationship.None && !p.Disabled);
// Timers in replays should be synced to the effective game time, not the playback time.
timestep = world.Timestep;
if (world.IsReplay)
timestep = world.WorldActor.Trait<MapOptions>().GameSpeed.Timestep;
bgDark = ChromeMetrics.Get<Color>("TextContrastColorDark");
bgLight = ChromeMetrics.Get<Color>("TextContrastColorLight");
}
@@ -58,9 +52,9 @@ namespace OpenRA.Mods.Common.Widgets
texts = displayedPowers.Select(p =>
{
var time = WidgetUtils.FormatTime(p.RemainingTicks, false, timestep);
var text = Format.F(p.Info.Description, time);
var self = p.Instances[0].Self;
var time = WidgetUtils.FormatTime(p.RemainingTicks, false, self.World.Timestep);
var text = Format.F(p.Info.Description, time);
var playerColor = self.Owner.Color;
if (Game.Settings.Game.UsePlayerStanceColors)