From b30285e38daa255a2f29b584d3bcaf1c1a9fb2d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Fri, 19 May 2023 17:07:26 +0200 Subject: [PATCH] Officially deprecate this function. --- OpenRA.Mods.Common/Scripting/Global/MapGlobal.cs | 7 +++++-- mods/ra/maps/soviet-05/map.yaml | 5 ++++- mods/ra/maps/soviet-05/soviet05.lua | 4 ++-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/OpenRA.Mods.Common/Scripting/Global/MapGlobal.cs b/OpenRA.Mods.Common/Scripting/Global/MapGlobal.cs index f2ddbadce8..0b94d2fae0 100644 --- a/OpenRA.Mods.Common/Scripting/Global/MapGlobal.cs +++ b/OpenRA.Mods.Common/Scripting/Global/MapGlobal.cs @@ -9,6 +9,7 @@ */ #endregion +using System; using System.Linq; using Eluant; using OpenRA.Mods.Common.Traits; @@ -49,13 +50,15 @@ namespace OpenRA.Mods.Common.Scripting return FilteredObjects(actors, filter).ToArray(); } - // HACK: This api method abuses the coordinate system, and should be removed + // HACK: This API method abuses the coordinate system, and should be removed // in favour of proper actor queries. See #8549. + [Obsolete("This function will be removed in future versions. Use Map.ActorsInWorld instead.")] [Desc("Returns the location of the top-left corner of the map (assuming zero terrain height).")] public WPos TopLeft => Context.World.Map.ProjectedTopLeft; - // HACK: This api method abuses the coordinate system, and should be removed + // HACK: This API method abuses the coordinate system, and should be removed // in favour of proper actor queries. See #8549. + [Obsolete("This function will be removed in future versions. Use Map.ActorsInWorld instead.")] [Desc("Returns the location of the bottom-right corner of the map (assuming zero terrain height).")] public WPos BottomRight => Context.World.Map.ProjectedBottomRight; diff --git a/mods/ra/maps/soviet-05/map.yaml b/mods/ra/maps/soviet-05/map.yaml index a673225a2f..f628100c10 100644 --- a/mods/ra/maps/soviet-05/map.yaml +++ b/mods/ra/maps/soviet-05/map.yaml @@ -558,9 +558,12 @@ Actors: USSRlstPoint: waypoint Location: 48,83 Owner: Neutral - CFBPoint: waypoint + BaseRectBR: waypoint Location: 42,90 Owner: Neutral + BaseRectTL: waypoint + Location: 20,42 + Owner: Neutral GreeceBasePoint: waypoint Location: 69,46 Owner: Neutral diff --git a/mods/ra/maps/soviet-05/soviet05.lua b/mods/ra/maps/soviet-05/soviet05.lua index 3acf03ab5f..937480cc67 100644 --- a/mods/ra/maps/soviet-05/soviet05.lua +++ b/mods/ra/maps/soviet-05/soviet05.lua @@ -8,8 +8,8 @@ ]] CheckForBase = function() - local baseBuildings = Map.ActorsInBox(Map.TopLeft, CFBPoint.CenterPosition, function(actor) - return actor.Type == "fact" or actor.Type == "powr" + local baseBuildings = Map.ActorsInBox(BaseRectTL.CenterPosition, BaseRectBR.CenterPosition, function(actor) + return (actor.Type == "fact" or actor.Type == "powr") and actor.Owner == player end) return #baseBuildings >= 2