Skip to content

Commit

Permalink
More localisation mess and other code cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
MustaphaTR committed Nov 5, 2023
1 parent d454bbc commit eeafa2b
Show file tree
Hide file tree
Showing 27 changed files with 43 additions and 60 deletions.
4 changes: 0 additions & 4 deletions OpenRA.Mods.SS/Scripting/Global/LobbyGlobal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@
*/
#endregion

using System.Linq;
using Eluant;
using OpenRA.Mods.Common.Scripting;
using OpenRA.Mods.Common.Traits;
using OpenRA.Mods.SS.Traits;
using OpenRA.Scripting;
using OpenRA.Traits;
Expand Down
3 changes: 1 addition & 2 deletions OpenRA.Mods.SS/Scripting/Global/SSUserInterfaceGlobal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
*/
#endregion

using OpenRA.Graphics;
using OpenRA.Mods.Common.Widgets;
using OpenRA.Primitives;
using OpenRA.Scripting;
Expand All @@ -29,7 +28,7 @@ public void SetCenteralText(string text, Color? color = null)
var luaLabel = Ui.Root.Get("INGAME_ROOT").Get<LabelWidget>("MISSION_CENTER_TEXT");
luaLabel.GetText = () => text;

var c = color.HasValue ? color.Value : Color.White;
var c = color ?? Color.White;
luaLabel.GetColor = () => c;
}
}
Expand Down
6 changes: 1 addition & 5 deletions OpenRA.Mods.SS/Traits/AutoSell.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@
*/
#endregion

using System.Collections.Generic;
using System.Linq;
using OpenRA.Graphics;
using OpenRA.Mods.Common.Traits;
using OpenRA.Primitives;
using OpenRA.Traits;

namespace OpenRA.Mods.SS.Traits
Expand All @@ -26,7 +22,7 @@ public class AutoSellInfo : ConditionalTraitInfo, Requires<SellableInfo>

public class AutoSell : ConditionalTrait<AutoSellInfo>
{
Sellable sellable;
readonly Sellable sellable;

public AutoSell(Actor self, AutoSellInfo info)
: base(info)
Expand Down
1 change: 0 additions & 1 deletion OpenRA.Mods.SS/Traits/Conditions/SwitchCondition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
*/
#endregion

using OpenRA.Mods.Common;
using OpenRA.Traits;

namespace OpenRA.Mods.SS.Traits
Expand Down
2 changes: 1 addition & 1 deletion OpenRA.Mods.SS/Traits/Crates/ArmageddonCrateAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace OpenRA.Mods.SS.Traits
class ArmageddonCrateActionInfo : CrateActionInfo
{
[Desc("The deathtypes used to kill the units.")]
public readonly BitSet<DamageType> DeathTypes = default(BitSet<DamageType>);
public readonly BitSet<DamageType> DeathTypes = default;

public override object Create(ActorInitializer init) { return new ArmageddonCrateAction(init.Self, this); }
}
Expand Down
4 changes: 0 additions & 4 deletions OpenRA.Mods.SS/Traits/Crates/PlayerExperienceCrateAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@
*/
#endregion

using System.Linq;
using OpenRA.Mods.Common.Effects;
using OpenRA.Traits;

namespace OpenRA.Mods.Common.Traits
{
[Desc("Gives collector's owner experience.")]
Expand Down
8 changes: 3 additions & 5 deletions OpenRA.Mods.SS/Traits/Crates/SSCrate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class SSCrateInfo : TraitInfo, IPositionableInfo, Requires<RenderSpritesI
public readonly int Duration = 0;

[Desc("Allowed to land on.")]
public readonly HashSet<string> TerrainTypes = new HashSet<string>();
public readonly HashSet<string> TerrainTypes = new();

[Desc("Define actors that can collect crates by setting this into the Crushes field from the Mobile trait.")]
public readonly string CrushClass = "crate";
Expand Down Expand Up @@ -237,16 +237,14 @@ void INotifyAddedToWorld.AddedToWorld(Actor self)
{
self.World.AddToMaps(self, this);

if (spawner != null)
spawner.IncrementCrates();
spawner?.IncrementCrates();
}

void INotifyRemovedFromWorld.RemovedFromWorld(Actor self)
{
self.World.RemoveFromMaps(self, this);

if (spawner != null)
spawner.DecrementCrates();
spawner?.DecrementCrates();
}
}
}
1 change: 1 addition & 0 deletions OpenRA.Mods.SS/Traits/Crates/SSHealCrateAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class SSHealCrateActionInfo : CrateActionInfo
[Desc("Notification to play when the crate is collected and weapon fires.")]
public readonly string WeaponNotification = null;

[TranslationReference]
[Desc("Text notification to display when the crate is collected and weapon fires.")]
public readonly string WeaponTextNotification = null;

Expand Down
8 changes: 4 additions & 4 deletions OpenRA.Mods.SS/Traits/Crates/SSMultiplierCrateAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ public class SSMultiplierCrateActionInfo : CrateActionInfo

public class SSMultiplierCrateAction : CrateAction
{
SSMultiplierCrateActionInfo info;
SSMultiplierOptions options;
readonly SSMultiplierCrateActionInfo info;
readonly SSMultiplierOptions options;

int max, min, standard;
readonly int max, min, standard;

public SSMultiplierCrateAction(Actor self, SSMultiplierCrateActionInfo info)
: base(self, info)
Expand Down Expand Up @@ -106,7 +106,7 @@ public override void Activate(Actor collector)

if (info.TeamBonus > 0)
{
if (info.TeamBonusPrerequisites.Any())
if (info.TeamBonusPrerequisites.Length > 0)
{
var techtree = collector.Owner.PlayerActor.TraitOrDefault<TechTree>();
if (!techtree.HasPrerequisites(info.TeamBonusPrerequisites))
Expand Down
1 change: 1 addition & 0 deletions OpenRA.Mods.SS/Traits/Crates/SwitchConditionCrateAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class SwitchConditionCrateActionInfo : CrateActionInfo
[Desc("Notification to play when the condition is revoked.")]
public readonly string RevokeNotification = null;

[TranslationReference]
[Desc("Text notification to display when the condition is revoked.")]
public readonly string RevokeTextNotification = null;

Expand Down
4 changes: 2 additions & 2 deletions OpenRA.Mods.SS/Traits/Crates/TeleportCrateAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class TeleportCrateActionInfo : CrateActionInfo
public readonly bool SetCameraPosition = false;

[Desc("The range to search for extra collectors in.", "Extra collectors will also be granted the crate action.")]
public readonly WDist Range = new WDist(1);
public readonly WDist Range = new(1);

[Desc("The maximum number of extra collectors to grant the crate action to.")]
public readonly int MaxExtraCollectors = 4;
Expand All @@ -54,7 +54,7 @@ public TeleportCrateAction(Actor self, TeleportCrateActionInfo info)

public IEnumerable<IRenderable> Render(Actor self, WorldRenderer wr)
{
return new IRenderable[] { };
return System.Array.Empty<IRenderable>();
}

IEnumerable<Rectangle> IRender.ScreenBounds(Actor self, WorldRenderer wr)
Expand Down
10 changes: 4 additions & 6 deletions OpenRA.Mods.SS/Traits/Crates/WackyCrateAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
*/
#endregion

using System.Linq;
using OpenRA.Mods.Common.Traits;
using OpenRA.Traits;

Expand All @@ -26,10 +25,10 @@ public class WackyCrateActionInfo : CrateActionInfo

public class WackyCrateAction : CrateAction
{
WackyCrateActionInfo info;
SSMultiplierOptions options;
readonly WackyCrateActionInfo info;
readonly SSMultiplierOptions options;

int max, min;
readonly int max, min;

public WackyCrateAction(Actor self, WackyCrateActionInfo info)
: base(self, info)
Expand All @@ -49,8 +48,7 @@ public override int GetSelectionShares(Actor collector)
public override void Activate(Actor collector)
{
var health = collector.TraitOrDefault<Health>();
if (health != null)
health.InflictDamage(collector, collector, new Damage(-(health.MaxHP - health.HP)), true);
health?.InflictDamage(collector, collector, new Damage(-(health.MaxHP - health.HP)), true);

var manager = collector.TraitOrDefault<SSMultiplierManager>();
if (manager != null)
Expand Down
8 changes: 3 additions & 5 deletions OpenRA.Mods.SS/Traits/Flag.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace OpenRA.Mods.SS.Traits
public class FlagInfo : TraitInfo, IPositionableInfo, Requires<RenderSpritesInfo>
{
[Desc("Allowed to land on.")]
public readonly HashSet<string> TerrainTypes = new HashSet<string>();
public readonly HashSet<string> TerrainTypes = new();

[Desc("Define actors that can collect flag by setting this into the Crushes field from the Mobile trait.")]
public readonly string CrushClass = "flag";
Expand Down Expand Up @@ -195,17 +195,15 @@ void INotifyAddedToWorld.AddedToWorld(Actor self)
self.World.AddToMaps(self, this);

var cs = self.World.WorldActor.TraitOrDefault<CrateSpawner>();
if (cs != null)
cs.IncrementCrates();
cs?.IncrementCrates();
}

void INotifyRemovedFromWorld.RemovedFromWorld(Actor self)
{
self.World.RemoveFromMaps(self, this);

var cs = self.World.WorldActor.TraitOrDefault<CrateSpawner>();
if (cs != null)
cs.DecrementCrates();
cs?.DecrementCrates();
}

static Session.Client FindPlayersClient(World w, Player p)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@
#endregion

using System.Linq;
using OpenRA.Mods.Common;
using OpenRA.Mods.Common.Traits;
using OpenRA.Primitives;
using OpenRA.Traits;

namespace OpenRA.Mods.SS.Traits
Expand Down
6 changes: 3 additions & 3 deletions OpenRA.Mods.SS/Traits/TeamLeaderColorModifier.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ public class TeamLeaderColorModifierInfo : TraitInfo

public class TeamLeaderColorModifier : IRenderModifier, IRadarColorModifier
{
TeamLeaderColorModifierInfo info;
SpawnSSUnit spawner;
Player leader;
readonly TeamLeaderColorModifierInfo info;
readonly SpawnSSUnit spawner;
readonly Player leader;

public TeamLeaderColorModifier(Actor self, TeamLeaderColorModifierInfo info)
{
Expand Down
4 changes: 4 additions & 0 deletions OpenRA.Mods.SS/Traits/World/SpawnSSUnit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@ namespace OpenRA.Mods.SS.Traits
[TraitLocation(SystemActors.World)]
public class SpawnSSUnitInfo : TraitInfo, NotBefore<LocomotorInfo>, ILobbyOptions
{
[TranslationReference]
[Desc("Descriptive label for the team spawns checkbox in the lobby.")]
public readonly string TeamSpawnsCheckboxLabel = "checkbox-team-spawns.label";

[TranslationReference]
[Desc("Tooltip description for the team spawns checkbox in the lobby.")]
public readonly string TeamSpawnsCheckboxDescription = "checkbox-team-spawns.description";

Expand All @@ -51,9 +53,11 @@ public class SpawnSSUnitInfo : TraitInfo, NotBefore<LocomotorInfo>, ILobbyOption
[Desc("Initial facing of the units.")]
public readonly WAngle? UnitFacing = null;

[TranslationReference]
[Desc("Descriptive label for the quick class change checkbox in the lobby.")]
public readonly string QuickClassChangeCheckboxLabel = "checkbox-quick-class-change.label";

[TranslationReference]
[Desc("Tooltip description for the quick class change checkbox in the lobby.")]
public readonly string QuickClassChangeCheckboxDescription = "checkbox-quick-class-change.description";

Expand Down
4 changes: 2 additions & 2 deletions mods/ss/chrome/ingame.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -947,8 +947,8 @@ Container@PLAYER_WIDGETS:
X: WINDOW_RIGHT - 203
Y: WINDOW_BOTTOM - 50
TooltipContainer: TOOLTIP_CONTAINER
ReadyText: Ready
HoldText: On Hold
ReadyText: productionpalette-player-widgets-production-palette.ready
HoldText: productionpalette-player-widgets-production-palette.hold
HotkeyPrefix: Production
HotkeyCount: 24
ProductionTabs@PRODUCTION_TABS:
Expand Down
5 changes: 2 additions & 3 deletions mods/ss/languages/rules/en.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -115,16 +115,15 @@ options-respawn-delay =
.five = 5 Seconds
.ten = 10 Seconds
.fifteen = 15 Seconds
.twenty = 20 Seconds
.thirty = 30 Seconds
.fortyfive = 45 Seconds
.sixty = 1 Minute
dropdown-time-limit =
dropdown-time-limit-ss =
.label = Time Limit
.description = Time it takes for the game to end in a score victory condition
options-time-limit =
options-time-limit-ss =
.disabled = Disabled
.two = 2 Minutes
.five = 5 Minutes
Expand Down
Binary file modified mods/ss/maps/african-gambit.oramap
Binary file not shown.
Binary file modified mods/ss/maps/anvil-of-war.oramap
Binary file not shown.
Binary file modified mods/ss/maps/armageddon.oramap
Binary file not shown.
Binary file modified mods/ss/maps/badland-ridges.oramap
Binary file not shown.
Binary file modified mods/ss/maps/desert-invasion.oramap
Binary file not shown.
Binary file modified mods/ss/maps/desert-mandarins.oramap
Binary file not shown.
Binary file modified mods/ss/maps/deserted-outpost.oramap
Binary file not shown.
Binary file modified mods/ss/maps/winters-end.oramap
Binary file not shown.
22 changes: 11 additions & 11 deletions mods/ss/rules/world.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -550,18 +550,18 @@ World:
DisplayOrder: 12
ScriptLobbyDropdown@time-limit:
ID: time-limit
Label: dropdown-time-limit.label
Description: dropdown-time-limit.description
Label: dropdown-time-limit-ss.label
Description: dropdown-time-limit-ss.description
Values:
disabled: options-time-limit.disabled
two: options-time-limit.two
five: options-time-limit.five
ten: options-time-limit.ten
fifteen: options-time-limit.fifteen
twenty: options-time-limit.twenty
thirty: options-time-limit.thirty
fortyfive: options-time-limit.fortyfive
sixty: options-time-limit.sixty
disabled: options-time-limit-ss.disabled
two: options-time-limit-ss.two
five: options-time-limit-ss.five
ten: options-time-limit-ss.ten
fifteen: options-time-limit-ss.fifteen
twenty: options-time-limit-ss.twenty
thirty: options-time-limit-ss.thirty
fortyfive: options-time-limit-ss.fortyfive
sixty: options-time-limit-ss.sixty
Default: fifteen
DisplayOrder: 13
ScriptLobbyDropdown@ctf-mode:
Expand Down

0 comments on commit eeafa2b

Please sign in to comment.