Add ISingleInstanceInit interface.

Inits that are logically singletons (e.g. actor
location or owner) should implement this interface
to avoid runtime inconsistencies.

Duplicate instances are rejected at init-time,
allowing simpler queries when they are used.
This commit is contained in:
Paul Chote
2020-05-30 16:48:35 +01:00
committed by reaperrr
parent 86305879cb
commit b856613194
45 changed files with 169 additions and 95 deletions

View File

@@ -49,7 +49,7 @@ namespace OpenRA.Mods.Common.Traits.Render
p = init.WorldRenderer.Palette(Palette);
Func<WAngle> facing;
var dynamicfacingInit = init.GetOrDefault<DynamicFacingInit>(this);
var dynamicfacingInit = init.GetOrDefault<DynamicFacingInit>();
if (dynamicfacingInit != null)
{
var getFacing = dynamicfacingInit.Value;
@@ -57,7 +57,7 @@ namespace OpenRA.Mods.Common.Traits.Render
}
else
{
var f = WAngle.FromFacing(init.GetValue<FacingInit, int>(this, 0));
var f = WAngle.FromFacing(init.GetValue<FacingInit, int>(0));
facing = () => f;
}