diff --git a/src/TSMapEditor/CCEngine/BuildingWithPropertyType.cs b/src/TSMapEditor/CCEngine/BuildingWithPropertyType.cs index 704cfbb14..a1c564766 100644 --- a/src/TSMapEditor/CCEngine/BuildingWithPropertyType.cs +++ b/src/TSMapEditor/CCEngine/BuildingWithPropertyType.cs @@ -15,10 +15,10 @@ public static string ToDescription(this BuildingWithPropertyType value) { return value switch { - BuildingWithPropertyType.LeastThreat => "Least threat", - BuildingWithPropertyType.HighestThreat => "Highest threat", - BuildingWithPropertyType.Nearest => "Nearest", - BuildingWithPropertyType.Farthest => "Farthest", + BuildingWithPropertyType.LeastThreat => Translate("BuildingWithPropertyTypeExtension.LeastThreat", "Least threat"), + BuildingWithPropertyType.HighestThreat => Translate("BuildingWithPropertyTypeExtension.HighestThreat", "Highest threat"), + BuildingWithPropertyType.Nearest => Translate("BuildingWithPropertyTypeExtension.Nearest", "Nearest"), + BuildingWithPropertyType.Farthest => Translate("BuildingWithPropertyTypeExtension.Farthest", "Farthest"), _ => string.Empty, }; } diff --git a/src/TSMapEditor/CCEngine/ScriptAction.cs b/src/TSMapEditor/CCEngine/ScriptAction.cs index 067f578ad..df7f03669 100644 --- a/src/TSMapEditor/CCEngine/ScriptAction.cs +++ b/src/TSMapEditor/CCEngine/ScriptAction.cs @@ -35,9 +35,9 @@ public ScriptAction(int id) } public int ID { get; set; } - public string Name { get; set; } = "Unknown action"; - public string Description { get; set; } = "No description"; - public string ParamDescription { get; set; } = "Use 0"; + public string Name { get; set; } = Translate("ScriptAction.UnknownAction", "Unknown action"); + public string Description { get; set; } = Translate("ScriptAction.NoDescription", "No description"); + public string ParamDescription { get; set; } = Translate("ScriptAction.Use0", "Use 0"); public string OptionsSectionName { get; set; } = string.Empty; public TriggerParamType ParamType { get; set; } = TriggerParamType.Unknown; public List PresetOptions { get; } = new List(0); diff --git a/src/TSMapEditor/Config/Default/UI/EditorControlsPanel.ini b/src/TSMapEditor/Config/Default/UI/EditorControlsPanel.ini index d3cec37e1..47313c317 100644 --- a/src/TSMapEditor/Config/Default/UI/EditorControlsPanel.ini +++ b/src/TSMapEditor/Config/Default/UI/EditorControlsPanel.ini @@ -23,7 +23,7 @@ $Height=getBottom(btnPlaceWaypoint) + EMPTY_SPACE_BOTTOM [lblBrushSize] $X=EMPTY_SPACE_SIDES $Y=VERTICAL_SPACING -Text=Brush size: +$Text=translate(Brush size:) [ddBrushSize] $X=getRight(lblBrushSize) + (HORIZONTAL_SPACING * 2) @@ -40,7 +40,7 @@ DrawBorders=no [chkAutoLAT] $X=getRight(LATPanel) + EMPTY_SPACE_SIDES $Y=VERTICAL_SPACING -Text=Auto-LAT +$Text=translate(Auto-LAT) [chkOnlyPaintOnClearGround] $X=getX(chkAutoLAT) diff --git a/src/TSMapEditor/Config/Default/UI/Windows/TeamTypesWindow.ini b/src/TSMapEditor/Config/Default/UI/Windows/TeamTypesWindow.ini index afd6dfaae..d44569950 100644 --- a/src/TSMapEditor/Config/Default/UI/Windows/TeamTypesWindow.ini +++ b/src/TSMapEditor/Config/Default/UI/Windows/TeamTypesWindow.ini @@ -49,38 +49,38 @@ HasCloseButton=true [lblDescription] $X=EMPTY_SPACE_SIDES $Y=EMPTY_SPACE_TOP -Text=TeamTypes connect a Trigger with a TaskForce and Script and define how the units behave. +$Text=translate(TeamTypes connect a Trigger with a TaskForce and Script and define how the units behave.) [lblTeamTypes] $X=EMPTY_SPACE_SIDES $Y=getBottom(lblDescription) + EMPTY_SPACE_TOP FontIndex=1 -Text=TeamTypes: +$Text=translate(TeamTypes:) [btnNewTeamType] $X=getX(lblTeamTypes) $Y=getBottom(lblTeamTypes) + VERTICAL_SPACING $Width=200 -Text=New +$Text=translate(New) [btnDeleteTeamType] $X=getX(lblTeamTypes) $Y=getBottom(btnNewTeamType) + VERTICAL_SPACING $Width=getWidth(btnNewTeamType) -Text=Delete +$Text=translate(Delete) [btnCloneTeamType] $X=getX(lblTeamTypes) $Y=getBottom(btnDeleteTeamType) + VERTICAL_SPACING $Width=getWidth(btnNewTeamType) -Text=Clone +$Text=translate(Clone) [tbFilter] $X=getX(lblTeamTypes) $Y=getBottom(btnCloneTeamType) + VERTICAL_SPACING $Width=getWidth(btnCloneTeamType) - BUTTON_HEIGHT $Height=BUTTON_HEIGHT -Suggestion=Search team types... +$Suggestion=translate(Search team types...) [btnSortOptions] $X=getRight(tbFilter) @@ -96,7 +96,7 @@ $Height=getHeight(TeamTypesWindow) - getY(lbTeamTypes) - EMPTY_SPACE_BOTTOM $X=getRight(btnNewTeamType) + (HORIZONTAL_SPACING * 2) $Y=getY(lblTeamTypes) FontIndex=1 -Text=Selected TeamType: +$Text=translate(Selected TeamType:) [tbName] $X=getX(lblSelectedTeamType) + 100 @@ -106,7 +106,7 @@ $Width=150 [lblName] $X=getX(lblSelectedTeamType) $Y=getY(tbName) + 1 -Text=Name: +$Text=translate(Name:) [ddVeteranLevel] $X=getX(tbName) @@ -119,7 +119,7 @@ Option2=Elite [lblVeteranLevel] $X=getX(lblName) $Y=getY(ddVeteranLevel) + 1 -Text=Veteran Level: +$Text=translate(Veteran Level:) [ddHouse] $X=getX(tbName) @@ -129,7 +129,7 @@ $Y=getBottom(ddVeteranLevel) + VERTICAL_SPACING [lblHouse] $X=getX(lblName) $Y=getY(ddHouse) + 1 -Text=House: +$Text=translate(House:) [tbPriority] $X=getX(tbName) @@ -139,7 +139,7 @@ $Y=getBottom(ddHouse) + VERTICAL_SPACING [lblPriority] $X=getX(lblName) $Y=getY(tbPriority) + 1 -Text=Priority: +$Text=translate(Priority:) [tbMax] $X=getX(tbName) @@ -149,7 +149,7 @@ $Y=getBottom(tbPriority) + VERTICAL_SPACING [lblMax] $X=getX(lblName) $Y=getY(tbMax) + 1 -Text=Max: +$Text=translate(Max:) [tbTechLevel] $X=getX(tbName) @@ -159,7 +159,7 @@ $Y=getBottom(tbMax) + VERTICAL_SPACING [lblTechLevel] $X=getX(lblName) $Y=getY(tbTechLevel) + 1 -Text=Tech Level: +$Text=translate(Tech Level:) [ddMindControlDecision] $X=getX(tbName) @@ -176,7 +176,7 @@ Option5=Do Nothing [lblMindControlDecision] $X=getX(lblName) $Y=getY(ddMindControlDecision) + 1 -Text=On Mind Control: +$Text=translate(On Mind Control:) $Enabled=IS_RA2YR ; ************* @@ -191,7 +191,7 @@ $Y=getY(tbName) [lblTeamTypeColor] $X=getX(ddTeamTypeColor) - 100 $Y=getY(lblName) -Text=Color: +$Text=translate(Color:) [tbGroup] $X=getX(ddTeamTypeColor) @@ -201,7 +201,7 @@ $Y=getY(ddVeteranLevel) [lblGroup] $X=getX(lblTeamTypeColor) $Y=getY(lblVeteranLevel) -Text=Group: +$Text=translate(Group:) [tbWaypoint] $X=getX(ddTeamTypeColor) @@ -211,7 +211,7 @@ $Y=getY(ddHouse) [lblWaypoint] $X=getX(lblTeamTypeColor) $Y=getY(lblHouse) -Text=Waypoint: +$Text=translate(Waypoint:) [selTaskForce] $X=getX(ddTeamTypeColor) @@ -228,7 +228,7 @@ Text=-> [lblTaskForce] $X=getX(lblTeamTypeColor) $Y=getY(lblPriority) -Text=TaskForce: +$Text=translate(TaskForce:) [selScript] $X=getX(ddTeamTypeColor) @@ -245,7 +245,7 @@ Text=-> [lblScript] $X=getX(lblTeamTypeColor) $Y=getY(lblMax) -Text=Script: +$Text=translate(Script:) [selTag] $X=getX(ddTeamTypeColor) @@ -262,7 +262,7 @@ Text=-> [lblTag] $X=getX(lblTeamTypeColor) $Y=getY(lblTechLevel) -Text=Tag: +$Text=translate(Tag:) [tbTransportWaypoint] $X=getX(ddTeamTypeColor) @@ -273,7 +273,7 @@ $Enabled=IS_RA2YR [lblTransportWaypoint] $X=getX(lblTeamTypeColor) $Y=getY(lblMindControlDecision) -Text=Transport Wpt: +$Text=translate(Transport Wpt:) $Enabled=IS_RA2YR ; ************** diff --git a/src/TSMapEditor/Config/Scripts/Add Map Reveal Trigger.cs b/src/TSMapEditor/Config/Scripts/Add Map Reveal Trigger.cs index ed124a5d1..2afc849bc 100644 --- a/src/TSMapEditor/Config/Scripts/Add Map Reveal Trigger.cs +++ b/src/TSMapEditor/Config/Scripts/Add Map Reveal Trigger.cs @@ -10,6 +10,7 @@ using TSMapEditor.Rendering; using TSMapEditor.GameMath; using TSMapEditor.UI.Windows; +using TSMapEditor.Misc; namespace WAEScript { @@ -19,7 +20,7 @@ public class AddMapRevealTrigger /// Returns the description of this script. /// All scripts must contain this function. /// - public string GetDescription() => "This script will create a new map reveal trigger. Continue?"; + public string GetDescription() => Translator.Translate("MapScripts.AddMapRevealTrigger.Description", "This script will create a new map reveal trigger. Continue?"); /// /// Returns the message that is presented to the user if running this script succeeded. @@ -28,14 +29,16 @@ public class AddMapRevealTrigger public string GetSuccessMessage() { if (error == null) - return $"Successfully created a map reveal trigger with name \"{mapRevealTriggerName}\". You can locate it in the Triggers window."; + return string.Format(Translator.Translate("MapScripts.AddMapRevealTrigger.SuccessMessage", + "Successfully created a map reveal trigger with name \"{0}\". You can locate it in the Triggers window."), + mapRevealTriggerName); return error; } private string error; - private const string mapRevealTriggerName = "Map Reveal Trigger"; + private string mapRevealTriggerName = Translator.Translate("MapScripts.AddMapRevealTrigger.TriggerName", "Map Reveal Trigger"); /// /// The function that actually does the magic. @@ -62,7 +65,7 @@ public void Perform(Map map) map.AddTag(new Tag() { ID = map.GetNewUniqueInternalId(), - Name = trigger.Name + " (tag)", + Name = trigger.Name + Translator.Translate("MapScripts.AddMapRevealTrigger.Tag", " (tag)"), Trigger = trigger, Repeating = 0 }); diff --git a/src/TSMapEditor/Config/Scripts/Apply Animated Water.cs b/src/TSMapEditor/Config/Scripts/Apply Animated Water.cs index 4cdbcde03..3337ad6f9 100644 --- a/src/TSMapEditor/Config/Scripts/Apply Animated Water.cs +++ b/src/TSMapEditor/Config/Scripts/Apply Animated Water.cs @@ -10,6 +10,7 @@ using TSMapEditor.CCEngine; using TSMapEditor.Rendering; using TSMapEditor.GameMath; +using TSMapEditor.Misc; namespace WAEScript { @@ -19,7 +20,7 @@ public class ApplyAnimatedWaterScript /// Returns the description of this script. /// All scripts must contain this function. /// - public string GetDescription() => "This script will replace all water on the map with animated water. Continue?"; + public string GetDescription() => Translator.Translate("MapScripts.ApplyAnimatedWater.Description", "This script will replace all water on the map with animated water. Continue?"); /// /// Returns the message that is presented to the user if running this script succeeded. @@ -28,7 +29,7 @@ public class ApplyAnimatedWaterScript public string GetSuccessMessage() { if (error == null) - return "Successfully replaced water with animated water."; + return Translator.Translate("MapScripts.ApplyAnimatedWater.SuccessMessage", "Successfully replaced water with animated water."); return error; } @@ -49,14 +50,14 @@ public void Perform(Map map) var animatedWaterTileSet = map.TheaterInstance.Theater.FindTileSet(AnimatedWaterTileSetName); if (animatedWaterTileSet == null) { - error = "TileSet for animated water not found!"; + error = Translator.Translate("MapScripts.ApplyAnimatedWater.Errors.AnimatedWaterTileSetNotFound", "TileSet for animated water not found!"); return; } waterTileSet = map.TheaterInstance.Theater.FindTileSet(WaterTileSetName); if (waterTileSet == null) { - error = "TileSet for regular (non-animated) water not found!"; + error = Translator.Translate("MapScripts.ApplyAnimatedWater.Errors.RegularWaterTileSetNotFound", "TileSet for regular (non-animated) water not found!"); return; } diff --git a/src/TSMapEditor/Config/Scripts/Area Guard Mission Assignment Cursor Action.cs b/src/TSMapEditor/Config/Scripts/Area Guard Mission Assignment Cursor Action.cs index 0354dda3c..38e97f045 100644 --- a/src/TSMapEditor/Config/Scripts/Area Guard Mission Assignment Cursor Action.cs +++ b/src/TSMapEditor/Config/Scripts/Area Guard Mission Assignment Cursor Action.cs @@ -14,6 +14,7 @@ using TSMapEditor.Scripts; using TSMapEditor.UI; using TSMapEditor.UI.Windows; +using TSMapEditor.Misc; namespace WAEScript { @@ -37,7 +38,7 @@ public AssignMissionCursorAction(ICursorActionTarget cursorActionTarget) : base( /// private string missionName = "Area Guard"; - public override string GetName() => $"Apply '{missionName}' Mission To Units"; + public override string GetName() => Translator.Translate("MapScripts.AreaGuardMissionCursorAction.Name", "Apply Area Guard Mission To Units"); public override void LeftClick(Point2D cellCoords) { @@ -89,7 +90,7 @@ public override void DrawPreview(Point2D cellCoords, Point2D cameraTopLeftPoint) cellCenterPoint = cellCenterPoint.ScaleBy(CursorActionTarget.Camera.ZoomLevel); - const string text = "Assign Mission"; + string text = Translator.Translate("MapScripts.AreaGuardMissionCursorAction.CursorActionText", "Assign Mission"); var textDimensions = Renderer.GetTextDimensions(text, Constants.UIBoldFont); int x = cellCenterPoint.X - (int)(textDimensions.X / 2); int y = cellCenterPoint.Y - (int)(textDimensions.Y / 2); diff --git a/src/TSMapEditor/Config/Scripts/Count Credits On Map.cs b/src/TSMapEditor/Config/Scripts/Count Credits On Map.cs index cb6cc5981..24e9348a9 100644 --- a/src/TSMapEditor/Config/Scripts/Count Credits On Map.cs +++ b/src/TSMapEditor/Config/Scripts/Count Credits On Map.cs @@ -9,6 +9,7 @@ using TSMapEditor.CCEngine; using TSMapEditor.Rendering; using TSMapEditor.GameMath; +using TSMapEditor.Misc; namespace WAEScript { @@ -18,7 +19,7 @@ public class CountCreditsOnMapScript /// Returns the description of this script. /// All scripts must contain this function. /// - public string GetDescription() => "This script will count credit value of all Tiberium and ore overlays. Continue?"; + public string GetDescription() => Translator.Translate("MapScripts.CountCreditsOnMap.Description", "This script will count credit value of all Tiberium and ore overlays. Continue?"); /// /// Returns the message that is presented to the user if running this script succeeded. @@ -26,7 +27,8 @@ public class CountCreditsOnMapScript /// public string GetSuccessMessage() { - return $"There are {count} credits' worth of resources present."; + return string.Format(Translator.Translate("MapScripts.CountCreditsOnMap.SuccessMessage", + "There are {0} credits' worth of resources present."), count); } int count = 0; diff --git a/src/TSMapEditor/Config/Scripts/Disable All Debug Triggers.cs b/src/TSMapEditor/Config/Scripts/Disable All Debug Triggers.cs index 218a2b150..fcec41170 100644 --- a/src/TSMapEditor/Config/Scripts/Disable All Debug Triggers.cs +++ b/src/TSMapEditor/Config/Scripts/Disable All Debug Triggers.cs @@ -11,6 +11,7 @@ using TSMapEditor.GameMath; using TSMapEditor.UI.Windows; using Rampastring.XNAUI; +using TSMapEditor.Misc; namespace WAEScript { @@ -20,7 +21,7 @@ public class DisableAllDebugTriggersScript /// Returns the description of this script. /// All scripts must contain this function. /// - public string GetDescription() => "This script will disable all triggers with 'debug' in their name (case insensitive). Continue?"; + public string GetDescription() => Translator.Translate("MapScripts.DisableDebugTriggers.Description", "This script will disable all triggers with 'debug' in their name (case insensitive). Continue?"); /// /// Returns the message that is presented to the user if running this script succeeded. @@ -29,7 +30,8 @@ public class DisableAllDebugTriggersScript public string GetSuccessMessage() { if (error == null) - return $"Successfully disabled all {debugTriggerCount} debug triggers."; + return string.Format(Translator.Translate("MapScripts.DisableDebugTriggers.SuccessMessage", + "Successfully disabled all {0} debug triggers."), debugTriggerCount); return error; } @@ -48,7 +50,7 @@ public void Perform(Map map) var debugTriggers = map.Triggers.FindAll(trigger => trigger.Name.Contains(debugString, StringComparison.CurrentCultureIgnoreCase)); if (debugTriggers.Count == 0) { - error = "No debug triggers found!"; + error = Translator.Translate("MapScripts.DisableDebugTriggers.Errors.NoDebugTriggers", "No debug triggers found!"); return; } diff --git a/src/TSMapEditor/Config/Scripts/Make Civilian Vehicles Sleep.cs b/src/TSMapEditor/Config/Scripts/Make Civilian Vehicles Sleep.cs index 6947b085a..62f275ff0 100644 --- a/src/TSMapEditor/Config/Scripts/Make Civilian Vehicles Sleep.cs +++ b/src/TSMapEditor/Config/Scripts/Make Civilian Vehicles Sleep.cs @@ -10,50 +10,52 @@ using TSMapEditor.CCEngine; using TSMapEditor.Rendering; using TSMapEditor.GameMath; +using TSMapEditor.Misc; namespace WAEScript { - public class MakeAllCivilianVehiclesSleepScript - { - /// - /// Returns the description of this script. - /// All scripts must contain this function. - /// - public string GetDescription() => "This script will make change the mission of all vehicles belonging to the \"Civilians\" house to \"Sleep\". Continue?"; + public class MakeAllCivilianVehiclesSleepScript + { + /// + /// Returns the description of this script. + /// All scripts must contain this function. + /// + public string GetDescription() => Translator.Translate("MapScripts.CivilianVehiclesSleep.Description", "This script will make change the mission of all vehicles belonging to the \"Civilians\" house to \"Sleep\". Continue?"); - /// - /// Returns the message that is presented to the user if running this script succeeded. - /// All scripts must contain this function. - /// - public string GetSuccessMessage() - { - return $"Successfully changed the mission of {count} vehicles to Sleep."; - } + /// + /// Returns the message that is presented to the user if running this script succeeded. + /// All scripts must contain this function. + /// + public string GetSuccessMessage() + { + return string.Format(Translator.Translate("MapScripts.CivilianVehiclesSleep.SuccessMessage", + "Successfully changed the mission of {0} vehicles to Sleep."), count); + } - int count = 0; + int count = 0; - /// - /// The function that actually does the magic. - /// - /// Map argument that allows us to access map data. - public void Perform(Map map) - { - map.DoForAllTechnos(techno => - { - // If this techno is a Unit (aka vehicle) and its owner is called "Civilians", - // then change its mission to sleep. + /// + /// The function that actually does the magic. + /// + /// Map argument that allows us to access map data. + public void Perform(Map map) + { + map.DoForAllTechnos(techno => + { + // If this techno is a Unit (aka vehicle) and its owner is called "Civilians", + // then change its mission to sleep. - if (techno.WhatAmI() == RTTIType.Unit && techno.Owner.ININame == "Civilians") - { - // The Techno base class has no Mission field, so we need to cast it - // as a Unit here. This is safe because we already know that the - // techno is a Unit (due to the techno.WhatAmI() == RTTIType.Unit check). + if (techno.WhatAmI() == RTTIType.Unit && techno.Owner.ININame == "Civilians") + { + // The Techno base class has no Mission field, so we need to cast it + // as a Unit here. This is safe because we already know that the + // techno is a Unit (due to the techno.WhatAmI() == RTTIType.Unit check). - var unit = (Unit)techno; - unit.Mission = "Sleep"; - count++; - } - }); - } - } + var unit = (Unit)techno; + unit.Mission = "Sleep"; + count++; + } + }); + } + } } \ No newline at end of file diff --git a/src/TSMapEditor/Config/Scripts/Randomize Interior Walls.cs b/src/TSMapEditor/Config/Scripts/Randomize Interior Walls.cs new file mode 100644 index 000000000..d4d1270c8 --- /dev/null +++ b/src/TSMapEditor/Config/Scripts/Randomize Interior Walls.cs @@ -0,0 +1,91 @@ +// Script for randomizing interior walls +// in Dawn of the Tiberium Age maps. + +// Using clauses. +// Unless you know what's in the WAE code-base, you want to always include +// these "standard usings". +using System; +using TSMapEditor; +using TSMapEditor.Models; +using TSMapEditor.CCEngine; +using TSMapEditor.Rendering; +using TSMapEditor.GameMath; +using System.Collections.Generic; +using TSMapEditor.Misc; + +namespace WAEScript +{ + public class RandomizeInteriorWallsScript + { + /// + /// Returns the description of this script. + /// All scripts must contain this function. + /// + public string GetDescription() => Translator.Translate("MapScripts.RandomizeInteriorWalls.Description", "This script will randomize all interior walls on the map with random variants of interior walls to reduce repetition. Continue?"); + + /// + /// Returns the message that is presented to the user if running this script succeeded. + /// All scripts must contain this function. + /// + public string GetSuccessMessage() + { + if (error == null) + return string.Format(Translator.Translate("MapScripts.RandomizeInteriorWalls.SuccessMessage", + "Successfully randomized {0} interior walls in the map."), modifiedWallsCount); + + return error; + } + + private string error; + + private int modifiedWallsCount = 0; + private const string interiorWallOverlayTypeName = "INTWALL1"; + private readonly List frontInteriorWallFrames = new List { 21, 22, 23 }; + private readonly List backInteriorWallFrames = new List { 27, 28, 29 }; + + /// + /// The function that actually does the magic. + /// + /// Map argument that allows us to access map data. + public void Perform(Map map) + { + var interiorWallOverlayType = map.Rules.OverlayTypes.Find(overlayType => overlayType.ININame == interiorWallOverlayTypeName); + if (interiorWallOverlayType == null) + { + error = Translator.Translate("MapScripts.RandomizeInteriorWalls.Errors.NoInteriorWallOverlay", "Interior wall overlay collection was not found"); + } + + map.DoForAllValidTiles(mapCell => + { + if (mapCell.Overlay == null) + return; + + if (mapCell.Overlay.OverlayType == null) + return; + + if (mapCell.Overlay.OverlayType.ININame != interiorWallOverlayType.ININame) + return; + + int overlayTypeFrameIndex = mapCell.Overlay.FrameIndex; + + if (!frontInteriorWallFrames.Contains(overlayTypeFrameIndex) && !backInteriorWallFrames.Contains(overlayTypeFrameIndex)) + return; + + var random = new Random(); + bool isFrontInteriorWallFrame = frontInteriorWallFrames.Contains(overlayTypeFrameIndex); + int overlayTypeFrameLength = isFrontInteriorWallFrame ? frontInteriorWallFrames.Count : backInteriorWallFrames.Count; + + int chosenElementIndex = random.Next(overlayTypeFrameLength); + + mapCell.Overlay = new Overlay() + { + Position = mapCell.CoordsToPoint(), + OverlayType = interiorWallOverlayType, + FrameIndex = isFrontInteriorWallFrame ? frontInteriorWallFrames[chosenElementIndex] : backInteriorWallFrames[chosenElementIndex] + }; + + modifiedWallsCount++; + }); + } + } +} \ No newline at end of file diff --git a/src/TSMapEditor/Config/Scripts/Remove All Terrain Objects.cs b/src/TSMapEditor/Config/Scripts/Remove All Terrain Objects.cs index 0a8c175c2..f12db29d7 100644 --- a/src/TSMapEditor/Config/Scripts/Remove All Terrain Objects.cs +++ b/src/TSMapEditor/Config/Scripts/Remove All Terrain Objects.cs @@ -7,6 +7,7 @@ using TSMapEditor.CCEngine; using TSMapEditor.Rendering; using TSMapEditor.GameMath; +using TSMapEditor.Misc; namespace WAEScript { @@ -16,7 +17,7 @@ public class RemoveAllTerrainObjectsScript /// Returns the description of this script. /// All scripts must contain this function. /// - public string GetDescription() => "This script remove all terrain objects (trees etc.) from the map. Continue?"; + public string GetDescription() => Translator.Translate("MapScripts.RemoveTerrainObjects.Description", "This script remove all terrain objects (trees etc.) from the map. Continue?"); /// /// Returns the message that is presented to the user if running this script succeeded. @@ -24,7 +25,7 @@ public class RemoveAllTerrainObjectsScript /// public string GetSuccessMessage() { - return "Successfully removed all terrain objects from the map."; + return Translator.Translate("MapScripts.RemoveTerrainObjects.Description", "Successfully removed all terrain objects from the map."); } /// diff --git a/src/TSMapEditor/Config/Scripts/Replace Autumn Grass With Tall Grass.cs b/src/TSMapEditor/Config/Scripts/Replace Autumn Grass With Tall Grass.cs index 57bfa02cf..b1a35776f 100644 --- a/src/TSMapEditor/Config/Scripts/Replace Autumn Grass With Tall Grass.cs +++ b/src/TSMapEditor/Config/Scripts/Replace Autumn Grass With Tall Grass.cs @@ -7,6 +7,7 @@ using TSMapEditor.CCEngine; using TSMapEditor.Rendering; using TSMapEditor.GameMath; +using TSMapEditor.Misc; namespace WAEScript { @@ -16,7 +17,7 @@ public class ReplaceAutumnGrassWithTallGrass /// Returns the description of this script. /// All scripts must contain this function. /// - public string GetDescription() => "This script replaces all autumn grass terrain with summer tall grass terrain. Continue?"; + public string GetDescription() => Translator.Translate("MapScripts.ReplaceAutumnGrassTallGrass.Description", "This script replaces all autumn grass terrain with summer tall grass terrain. Continue?"); /// /// Returns the message that is presented to the user if running this script succeeded. @@ -24,7 +25,8 @@ public class ReplaceAutumnGrassWithTallGrass /// public string GetSuccessMessage() { - return error ?? "Successfully replaced the terrain of " + count + " cells."; + return error ?? string.Format(Translator.Translate("MapScripts.ReplaceAutumnGrassTallGrass.SuccessMessage", + "Successfully replaced the terrain of {0} cells."), count); } int count = 0; @@ -44,25 +46,25 @@ public void Perform(Map map) if (tallGrassTileSet == null) { - error = "Failed to find tall grass TileSet!"; + error = Translator.Translate("MapScripts.ReplaceAutumnGrassTallGrass.Errors.TallGrassTileSet", "Failed to find tall grass TileSet!"); return; } if (tallGrassLATTileSet == null) { - error = "Failed to find tall grass LAT transition TileSet!"; + error = Translator.Translate("MapScripts.ReplaceAutumnGrassTallGrass.Errors.TallGrassTileSetLAT", "Failed to find tall grass LAT transition TileSet!"); return; } if (autumnGrassTileSet == null) { - error = "Failed to find autumn grass TileSet!"; + error = Translator.Translate("MapScripts.ReplaceAutumnGrassTallGrass.Errors.AutumnGrassTileSet", "Failed to find autumn grass TileSet!"); return; } if (autumnGrassLATTileSet == null) { - error = "Failed to find autumn grass LAT transition TileSet!"; + error = Translator.Translate("MapScripts.ReplaceAutumnGrassTallGrass.Errors.AutumnGrassTileSetLAT", "Failed to find autumn grass LAT transition TileSet!"); return; } diff --git a/src/TSMapEditor/Config/Scripts/Replace Autumn Jungle Grass With Summer Grass.cs b/src/TSMapEditor/Config/Scripts/Replace Autumn Jungle Grass With Summer Grass.cs index 3f224aec7..489983331 100644 --- a/src/TSMapEditor/Config/Scripts/Replace Autumn Jungle Grass With Summer Grass.cs +++ b/src/TSMapEditor/Config/Scripts/Replace Autumn Jungle Grass With Summer Grass.cs @@ -7,6 +7,7 @@ using TSMapEditor.CCEngine; using TSMapEditor.Rendering; using TSMapEditor.GameMath; +using TSMapEditor.Misc; namespace WAEScript { @@ -16,7 +17,7 @@ public class ReplaceAutumnJungleGrassWithSummerGrass /// Returns the description of this script. /// All scripts must contain this function. /// - public string GetDescription() => "This script replaces all autumn grass overlay (AJGRASS) with summer jungle grass overlay (JGRASS). Continue?"; + public string GetDescription() => Translator.Translate("MapScripts.ReplaceAutumnGrassSummerGrass.Description", "This script replaces all autumn grass overlay (AJGRASS) with summer jungle grass overlay (JGRASS). Continue?"); /// /// Returns the message that is presented to the user if running this script succeeded. @@ -24,7 +25,8 @@ public class ReplaceAutumnJungleGrassWithSummerGrass /// public string GetSuccessMessage() { - return error ?? "Successfully replaced " + count + " AJGRASS overlay with JGRASS overlay."; + return error ?? string.Format(Translator.Translate("MapScripts.ReplaceAutumnGrassSummerGrass.Description", + "Successfully replaced {0} AJGRASS overlay with JGRASS overlay."), count); } int count = 0; @@ -41,7 +43,7 @@ public void Perform(Map map) if (jungleGrassOverlayType == null) { - error = "Failed to find jungle grass overlay type (JGRASS)!"; + error = Translator.Translate("MapScripts.ReplaceAutumnGrassSummerGrass.Errors.JungleGrassOverlay", "Failed to find jungle grass overlay type (JGRASS)!"); return; } diff --git a/src/TSMapEditor/Config/Scripts/Replace Autumn Trees With Summer Trees.cs b/src/TSMapEditor/Config/Scripts/Replace Autumn Trees With Summer Trees.cs index d7bced609..2c146b376 100644 --- a/src/TSMapEditor/Config/Scripts/Replace Autumn Trees With Summer Trees.cs +++ b/src/TSMapEditor/Config/Scripts/Replace Autumn Trees With Summer Trees.cs @@ -7,6 +7,7 @@ using TSMapEditor.CCEngine; using TSMapEditor.Rendering; using TSMapEditor.GameMath; +using TSMapEditor.Misc; namespace WAEScript { @@ -16,7 +17,7 @@ public class ReplaceAutumnTreesWithSummerTrees /// Returns the description of this script. /// All scripts must contain this function. /// - public string GetDescription() => "This script replaces all autumn trees with regular trees. Continue?"; + public string GetDescription() => Translator.Translate("MapScripts.ReplaceAutumnTreesSummerTrees.Description", "This script replaces all autumn trees with regular trees. Continue?"); /// /// Returns the message that is presented to the user if running this script succeeded. @@ -24,7 +25,8 @@ public class ReplaceAutumnTreesWithSummerTrees /// public string GetSuccessMessage() { - return "Replaced " + count + " terrain objects."; + return string.Format(Translator.Translate("MapScripts.ReplaceAutumnTreesSummerTrees.SuccessMessage", + "Replaced {0} terrain objects."), count); } int count = 0; diff --git a/src/TSMapEditor/Config/Scripts/Replace Frost With Clear.cs b/src/TSMapEditor/Config/Scripts/Replace Frost With Clear.cs index c537f91df..3b51aee53 100644 --- a/src/TSMapEditor/Config/Scripts/Replace Frost With Clear.cs +++ b/src/TSMapEditor/Config/Scripts/Replace Frost With Clear.cs @@ -7,6 +7,7 @@ using TSMapEditor.CCEngine; using TSMapEditor.Rendering; using TSMapEditor.GameMath; +using TSMapEditor.Misc; namespace WAEScript { @@ -16,7 +17,7 @@ public class ReplaceFrostWithClearScript /// Returns the description of this script. /// All scripts must contain this function. /// - public string GetDescription() => "This script replaces all '---Frost' terrain tiles with clear terrain. Continue?"; + public string GetDescription() => Translator.Translate("MapScripts.ReplaceFrostWithClear.Description", "This script replaces all '---Frost' terrain tiles with clear terrain. Continue?"); /// /// Returns the message that is presented to the user if running this script succeeded. @@ -24,7 +25,8 @@ public class ReplaceFrostWithClearScript /// public string GetSuccessMessage() { - return error ?? "Successfully replaced the terrain of " + count + " cells."; + return error ?? string.Format(Translator.Translate("MapScripts.ReplaceFrostWithClear.SuccessMessage", + "Successfully replaced the terrain of {0} cells."), count); } int count = 0; @@ -41,7 +43,7 @@ public void Perform(Map map) if (frostTileSet == null) { - error = "Failed to find '---Frost' TileSet!"; + error = Translator.Translate("MapScripts.ReplaceFrostWithClear.Errors.FrostTileSet", "Failed to find '---Frost' TileSet!"); return; } diff --git a/src/TSMapEditor/Extensions/ListExtensions.cs b/src/TSMapEditor/Extensions/ListExtensions.cs index 0796262f5..9caef808f 100644 --- a/src/TSMapEditor/Extensions/ListExtensions.cs +++ b/src/TSMapEditor/Extensions/ListExtensions.cs @@ -21,7 +21,8 @@ public static void ReadTaskForces(this List taskForceList, IniFile in var taskForce = TaskForce.ParseTaskForce(rules, iniFile.GetSection(kvp.Value)); if (taskForce == null) { - errorLogger($"Failed to load TaskForce {kvp.Value}. It might be missing a section or be otherwise invalid."); + errorLogger(string.Format(Translate("ListExtensions.TaskForceParseError", + "Failed to load TaskForce {0}. It might be missing a section or be otherwise invalid."), kvp.Value)); continue; } @@ -52,7 +53,8 @@ public static void ReadScripts(this List