Add a setting to pause the shellmap.
This commit is contained in:
@@ -253,6 +253,8 @@ namespace OpenRA
|
|||||||
public int IntroductionPromptVersion = 0;
|
public int IntroductionPromptVersion = 0;
|
||||||
|
|
||||||
public MPGameFilters MPGameFilters = MPGameFilters.Waiting | MPGameFilters.Empty | MPGameFilters.Protected | MPGameFilters.Started;
|
public MPGameFilters MPGameFilters = MPGameFilters.Waiting | MPGameFilters.Empty | MPGameFilters.Protected | MPGameFilters.Started;
|
||||||
|
|
||||||
|
public bool PauseShellmap = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Settings
|
public class Settings
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ namespace OpenRA
|
|||||||
readonly List<IEffect> effects = new List<IEffect>();
|
readonly List<IEffect> effects = new List<IEffect>();
|
||||||
readonly List<IEffect> unpartitionedEffects = new List<IEffect>();
|
readonly List<IEffect> unpartitionedEffects = new List<IEffect>();
|
||||||
readonly List<ISync> syncedEffects = new List<ISync>();
|
readonly List<ISync> syncedEffects = new List<ISync>();
|
||||||
|
readonly GameSettings gameSettings;
|
||||||
|
|
||||||
readonly Queue<Action<World>> frameEndActions = new Queue<Action<World>>();
|
readonly Queue<Action<World>> frameEndActions = new Queue<Action<World>>();
|
||||||
|
|
||||||
@@ -226,6 +227,7 @@ namespace OpenRA
|
|||||||
};
|
};
|
||||||
|
|
||||||
RulesContainTemporaryBlocker = map.Rules.Actors.Any(a => a.Value.HasTraitInfo<ITemporaryBlockerInfo>());
|
RulesContainTemporaryBlocker = map.Rules.Actors.Any(a => a.Value.HasTraitInfo<ITemporaryBlockerInfo>());
|
||||||
|
gameSettings = Game.Settings.Game;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddToMaps(Actor self, IOccupySpace ios)
|
public void AddToMaps(Actor self, IOccupySpace ios)
|
||||||
@@ -424,7 +426,9 @@ namespace OpenRA
|
|||||||
wasLoadingGameSave = false;
|
wasLoadingGameSave = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Paused)
|
// Allow users to pause the shellmap via the settings menu
|
||||||
|
// Some traits initialize important state during the first tick, so we must allow it to tick at least once
|
||||||
|
if (!Paused && (Type != WorldType.Shellmap || !gameSettings.PauseShellmap || WorldTick == 0))
|
||||||
{
|
{
|
||||||
WorldTick++;
|
WorldTick++;
|
||||||
|
|
||||||
|
|||||||
@@ -21,12 +21,14 @@ namespace OpenRA.Mods.Common.Scripting
|
|||||||
{
|
{
|
||||||
readonly SpawnMapActors sma;
|
readonly SpawnMapActors sma;
|
||||||
readonly World world;
|
readonly World world;
|
||||||
|
readonly GameSettings gameSettings;
|
||||||
|
|
||||||
public MapGlobal(ScriptContext context)
|
public MapGlobal(ScriptContext context)
|
||||||
: base(context)
|
: base(context)
|
||||||
{
|
{
|
||||||
sma = context.World.WorldActor.Trait<SpawnMapActors>();
|
sma = context.World.WorldActor.Trait<SpawnMapActors>();
|
||||||
world = context.World;
|
world = context.World;
|
||||||
|
gameSettings = Game.Settings.Game;
|
||||||
|
|
||||||
// Register map actors as globals (yuck!)
|
// Register map actors as globals (yuck!)
|
||||||
foreach (var kv in sma.Actors)
|
foreach (var kv in sma.Actors)
|
||||||
@@ -109,6 +111,9 @@ namespace OpenRA.Mods.Common.Scripting
|
|||||||
[Desc("Returns true if there is only one human player.")]
|
[Desc("Returns true if there is only one human player.")]
|
||||||
public bool IsSinglePlayer { get { return Context.World.LobbyInfo.NonBotPlayers.Count() == 1; } }
|
public bool IsSinglePlayer { get { return Context.World.LobbyInfo.NonBotPlayers.Count() == 1; } }
|
||||||
|
|
||||||
|
[Desc("Returns true if this is a shellmap and the player has paused animations.")]
|
||||||
|
public bool IsPausedShellmap { get { return Context.World.Type == WorldType.Shellmap && gameSettings.PauseShellmap; } }
|
||||||
|
|
||||||
[Desc("Returns the value of a `ScriptLobbyDropdown` selected in the game lobby.")]
|
[Desc("Returns the value of a `ScriptLobbyDropdown` selected in the game lobby.")]
|
||||||
public LuaValue LobbyOption(string id)
|
public LuaValue LobbyOption(string id)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -246,6 +246,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
BindCheckboxPref(panel, "FRAME_LIMIT_CHECKBOX", ds, "CapFramerate");
|
BindCheckboxPref(panel, "FRAME_LIMIT_CHECKBOX", ds, "CapFramerate");
|
||||||
BindIntSliderPref(panel, "FRAME_LIMIT_SLIDER", ds, "MaxFramerate");
|
BindIntSliderPref(panel, "FRAME_LIMIT_SLIDER", ds, "MaxFramerate");
|
||||||
BindCheckboxPref(panel, "PLAYER_STANCE_COLORS_CHECKBOX", gs, "UsePlayerStanceColors");
|
BindCheckboxPref(panel, "PLAYER_STANCE_COLORS_CHECKBOX", gs, "UsePlayerStanceColors");
|
||||||
|
if (panel.GetOrNull<CheckboxWidget>("PAUSE_SHELLMAP_CHECKBOX") != null)
|
||||||
|
BindCheckboxPref(panel, "PAUSE_SHELLMAP_CHECKBOX", gs, "PauseShellmap");
|
||||||
|
|
||||||
var windowModeDropdown = panel.Get<DropDownButtonWidget>("MODE_DROPDOWN");
|
var windowModeDropdown = panel.Get<DropDownButtonWidget>("MODE_DROPDOWN");
|
||||||
windowModeDropdown.OnMouseDown = _ => ShowWindowModeDropdown(windowModeDropdown, ds);
|
windowModeDropdown.OnMouseDown = _ => ShowWindowModeDropdown(windowModeDropdown, ds);
|
||||||
|
|||||||
@@ -188,12 +188,19 @@ Background@SETTINGS_PANEL:
|
|||||||
Font: Regular
|
Font: Regular
|
||||||
Text: Increase Cursor Size
|
Text: Increase Cursor Size
|
||||||
Checkbox@PLAYER_STANCE_COLORS_CHECKBOX:
|
Checkbox@PLAYER_STANCE_COLORS_CHECKBOX:
|
||||||
X: 310
|
X: 195
|
||||||
Y: 133
|
Y: 133
|
||||||
Width: 200
|
Width: 200
|
||||||
Height: 20
|
Height: 20
|
||||||
Font: Regular
|
Font: Regular
|
||||||
Text: Player Stance Colors
|
Text: Player Stance Colors
|
||||||
|
Checkbox@PAUSE_SHELLMAP_CHECKBOX:
|
||||||
|
X: 375
|
||||||
|
Y: 133
|
||||||
|
Width: 200
|
||||||
|
Height: 20
|
||||||
|
Font: Regular
|
||||||
|
Text: Pause Menu Background
|
||||||
Label@VIDEO_TITLE:
|
Label@VIDEO_TITLE:
|
||||||
Y: 190
|
Y: 190
|
||||||
Width: PARENT_RIGHT
|
Width: PARENT_RIGHT
|
||||||
|
|||||||
@@ -147,8 +147,10 @@ speed = 5
|
|||||||
Tick = function()
|
Tick = function()
|
||||||
ticks = ticks + 1
|
ticks = ticks + 1
|
||||||
|
|
||||||
local t = (ticks + 45) % (360 * speed) * (math.pi / 180) / speed;
|
if ticks > 1 or not Map.IsPausedShellmap then
|
||||||
Camera.Position = viewportOrigin + WVec.New(19200 * math.sin(t), 28800 * math.cos(t), 0)
|
local t = (ticks + 45) % (360 * speed) * (math.pi / 180) / speed;
|
||||||
|
Camera.Position = viewportOrigin + WVec.New(19200 * math.sin(t), 28800 * math.cos(t), 0)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
WorldLoaded = function()
|
WorldLoaded = function()
|
||||||
|
|||||||
Reference in New Issue
Block a user