Move ActorMap to mod code.
This commit is contained in:
@@ -194,7 +194,6 @@
|
||||
<Compile Include="Traits\Player\PlayerColorPalette.cs" />
|
||||
<Compile Include="Traits\Player\PlayerHighlightPalette.cs" />
|
||||
<Compile Include="Traits\World\ScreenMap.cs" />
|
||||
<Compile Include="Traits\World\ActorMap.cs" />
|
||||
<Compile Include="Scripting\ScriptContext.cs" />
|
||||
<Compile Include="Scripting\ScriptActorInterface.cs" />
|
||||
<Compile Include="Scripting\ScriptObjectWrapper.cs" />
|
||||
|
||||
@@ -232,6 +232,30 @@ namespace OpenRA.Traits
|
||||
}
|
||||
}
|
||||
|
||||
public enum SubCell { Invalid = int.MinValue, Any = int.MinValue / 2, FullCell = 0, First = 1 }
|
||||
public interface IActorMap
|
||||
{
|
||||
IEnumerable<Actor> GetActorsAt(CPos a);
|
||||
IEnumerable<Actor> GetActorsAt(CPos a, SubCell sub);
|
||||
bool HasFreeSubCell(CPos cell, bool checkTransient = true);
|
||||
SubCell FreeSubCell(CPos cell, SubCell preferredSubCell = SubCell.Any, bool checkTransient = true);
|
||||
SubCell FreeSubCell(CPos cell, SubCell preferredSubCell, Func<Actor, bool> checkIfBlocker);
|
||||
bool AnyActorsAt(CPos a);
|
||||
bool AnyActorsAt(CPos a, SubCell sub, bool checkTransient = true);
|
||||
bool AnyActorsAt(CPos a, SubCell sub, Func<Actor, bool> withCondition);
|
||||
void AddInfluence(Actor self, IOccupySpace ios);
|
||||
void RemoveInfluence(Actor self, IOccupySpace ios);
|
||||
int AddCellTrigger(CPos[] cells, Action<Actor> onEntry, Action<Actor> onExit);
|
||||
void RemoveCellTrigger(int id);
|
||||
int AddProximityTrigger(WPos pos, WDist range, WDist vRange, Action<Actor> onEntry, Action<Actor> onExit);
|
||||
void RemoveProximityTrigger(int id);
|
||||
void UpdateProximityTrigger(int id, WPos newPos, WDist newRange, WDist newVRange);
|
||||
void AddPosition(Actor a, IOccupySpace ios);
|
||||
void RemovePosition(Actor a, IOccupySpace ios);
|
||||
void UpdatePosition(Actor a, IOccupySpace ios);
|
||||
IEnumerable<Actor> ActorsInBox(WPos a, WPos b);
|
||||
}
|
||||
|
||||
public interface IRenderModifier { IEnumerable<IRenderable> ModifyRender(Actor self, WorldRenderer wr, IEnumerable<IRenderable> r); }
|
||||
public interface ILoadsPalettes { void LoadPalettes(WorldRenderer wr); }
|
||||
public interface ILoadsPlayerPalettes { void LoadPlayerPalettes(WorldRenderer wr, string playerName, HSLColor playerColor, bool replaceExisting); }
|
||||
|
||||
@@ -14,7 +14,6 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.Effects;
|
||||
using OpenRA.FileFormats;
|
||||
using OpenRA.GameRules;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Network;
|
||||
using OpenRA.Orders;
|
||||
@@ -107,7 +106,7 @@ namespace OpenRA
|
||||
|
||||
public readonly Map Map;
|
||||
|
||||
public readonly ActorMap ActorMap;
|
||||
public readonly IActorMap ActorMap;
|
||||
public readonly ScreenMap ScreenMap;
|
||||
public readonly WorldType Type;
|
||||
|
||||
@@ -159,7 +158,7 @@ namespace OpenRA
|
||||
|
||||
var worldActorType = type == WorldType.Editor ? "EditorWorld" : "World";
|
||||
WorldActor = CreateActor(worldActorType, new TypeDictionary());
|
||||
ActorMap = WorldActor.Trait<ActorMap>();
|
||||
ActorMap = WorldActor.Trait<IActorMap>();
|
||||
ScreenMap = WorldActor.Trait<ScreenMap>();
|
||||
|
||||
// Add players
|
||||
|
||||
@@ -793,6 +793,7 @@
|
||||
<Compile Include="UtilityCommands\OutputResolvedWeaponsCommand.cs" />
|
||||
<Compile Include="Traits\RevealOnFire.cs" />
|
||||
<Compile Include="Traits\Conditions\GrantConditionOnDisabled.cs" />
|
||||
<Compile Include="Traits\World\ActorMap.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Target Name="AfterBuild">
|
||||
|
||||
@@ -14,11 +14,10 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Traits
|
||||
namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
public enum SubCell { Invalid = int.MinValue, Any = int.MinValue / 2, FullCell = 0, First = 1 }
|
||||
|
||||
public class ActorMapInfo : ITraitInfo
|
||||
{
|
||||
[Desc("Size of partition bins (cells)")]
|
||||
@@ -27,7 +26,7 @@ namespace OpenRA.Traits
|
||||
public object Create(ActorInitializer init) { return new ActorMap(init.World, this); }
|
||||
}
|
||||
|
||||
public class ActorMap : ITick
|
||||
public class ActorMap : IActorMap, ITick
|
||||
{
|
||||
class InfluenceNode
|
||||
{
|
||||
Reference in New Issue
Block a user