From cac6aebb6cd8c6eae9a2cd8e0417cd5d4f78ae69 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Mon, 30 Dec 2024 19:41:54 +0000 Subject: [PATCH] Only expose Location and CenterPosition for actors that occupy space. --- .../Scripting/Properties/GeneralProperties.cs | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/OpenRA.Mods.Common/Scripting/Properties/GeneralProperties.cs b/OpenRA.Mods.Common/Scripting/Properties/GeneralProperties.cs index a7e4b2f55c..702ec3bf2f 100644 --- a/OpenRA.Mods.Common/Scripting/Properties/GeneralProperties.cs +++ b/OpenRA.Mods.Common/Scripting/Properties/GeneralProperties.cs @@ -110,12 +110,6 @@ namespace OpenRA.Mods.Common.Scripting tooltips = self.TraitsImplementing().ToArray(); } - [Desc("The actor position in cell coordinates.")] - public CPos Location => Self.Location; - - [Desc("The actor position in world coordinates.")] - public WPos CenterPosition => Self.CenterPosition; - [Desc("The direction that the actor is facing.")] public WAngle Facing { @@ -213,4 +207,17 @@ namespace OpenRA.Mods.Common.Scripting return IsTaggable && scriptTags.HasTag(tag); } } + + [ScriptPropertyGroup("General")] + public class LocationProperties : ScriptActorProperties, Requires + { + public LocationProperties(ScriptContext context, Actor self) + : base(context, self) { } + + [Desc("The actor position in cell coordinates.")] + public CPos Location => Self.Location; + + [Desc("The actor position in world coordinates.")] + public WPos CenterPosition => Self.CenterPosition; + } }