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

@@ -20,11 +20,15 @@ namespace OpenRA.Mods.Common.Scripting
public class DateGlobal : ScriptGlobal
{
readonly TimeLimitManager tlm;
readonly int ticksPerSecond;
public DateGlobal(ScriptContext context)
: base(context)
{
tlm = context.World.WorldActor.TraitOrDefault<TimeLimitManager>();
var gameSpeeds = Game.ModData.Manifest.Get<GameSpeeds>();
var defaultGameSpeed = gameSpeeds.Speeds[gameSpeeds.DefaultSpeed];
ticksPerSecond = 1000 / defaultGameSpeed.Timestep;
}
[Desc("True on the 31st of October.")]
@@ -36,7 +40,7 @@ namespace OpenRA.Mods.Common.Scripting
[Desc("Converts the number of seconds into game time (ticks).")]
public int Seconds(int seconds)
{
return seconds * 25;
return seconds * ticksPerSecond;
}
[Desc("Converts the number of minutes into game time (ticks).")]