Merge pull request #7937 from pchote/some-editor-prereqs
A collection of ActorPreview improvements.
This commit is contained in:
@@ -15,6 +15,8 @@ using OpenRA.Primitives;
|
|||||||
|
|
||||||
namespace OpenRA
|
namespace OpenRA
|
||||||
{
|
{
|
||||||
|
public interface ISuppressInitExport { }
|
||||||
|
|
||||||
public class ActorReference : IEnumerable
|
public class ActorReference : IEnumerable
|
||||||
{
|
{
|
||||||
public string Type;
|
public string Type;
|
||||||
@@ -51,6 +53,9 @@ namespace OpenRA
|
|||||||
var ret = new MiniYaml(Type);
|
var ret = new MiniYaml(Type);
|
||||||
foreach (var init in InitDict)
|
foreach (var init in InitDict)
|
||||||
{
|
{
|
||||||
|
if (init is ISuppressInitExport)
|
||||||
|
continue;
|
||||||
|
|
||||||
var initName = init.GetType().Name;
|
var initName = init.GetType().Name;
|
||||||
ret.Nodes.Add(new MiniYamlNode(initName.Substring(0, initName.Length - 4), FieldSaver.Save(init)));
|
ret.Nodes.Add(new MiniYamlNode(initName.Substring(0, initName.Length - 4), FieldSaver.Save(init)));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using OpenRA.Graphics;
|
using OpenRA.Graphics;
|
||||||
using OpenRA.Primitives;
|
using OpenRA.Primitives;
|
||||||
|
using OpenRA.Traits;
|
||||||
|
|
||||||
namespace OpenRA.Mods.Common.Graphics
|
namespace OpenRA.Mods.Common.Graphics
|
||||||
{
|
{
|
||||||
@@ -41,5 +42,32 @@ namespace OpenRA.Mods.Common.Graphics
|
|||||||
public T Get<T>() where T : IActorInit { return dict.Get<T>(); }
|
public T Get<T>() where T : IActorInit { return dict.Get<T>(); }
|
||||||
public U Get<T, U>() where T : IActorInit<U> { return dict.Get<T>().Value(World); }
|
public U Get<T, U>() where T : IActorInit<U> { return dict.Get<T>().Value(World); }
|
||||||
public bool Contains<T>() where T : IActorInit { return dict.Contains<T>(); }
|
public bool Contains<T>() where T : IActorInit { return dict.Contains<T>(); }
|
||||||
|
|
||||||
|
public DamageState GetDamageState()
|
||||||
|
{
|
||||||
|
var health = dict.GetOrDefault<HealthInit>();
|
||||||
|
|
||||||
|
if (health == null)
|
||||||
|
return DamageState.Undamaged;
|
||||||
|
|
||||||
|
var hf = health.Value(null);
|
||||||
|
|
||||||
|
if (hf <= 0)
|
||||||
|
return DamageState.Dead;
|
||||||
|
|
||||||
|
if (hf < 0.25f)
|
||||||
|
return DamageState.Critical;
|
||||||
|
|
||||||
|
if (hf < 0.5f)
|
||||||
|
return DamageState.Heavy;
|
||||||
|
|
||||||
|
if (hf < 0.75f)
|
||||||
|
return DamageState.Medium;
|
||||||
|
|
||||||
|
if (hf < 1.0f)
|
||||||
|
return DamageState.Light;
|
||||||
|
|
||||||
|
return DamageState.Undamaged;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -169,7 +169,8 @@ namespace OpenRA.Mods.Common.Orders
|
|||||||
{
|
{
|
||||||
var td = new TypeDictionary()
|
var td = new TypeDictionary()
|
||||||
{
|
{
|
||||||
new RaceInit(race)
|
new RaceInit(race),
|
||||||
|
new HideBibPreviewInit()
|
||||||
};
|
};
|
||||||
|
|
||||||
var init = new ActorPreviewInitializer(rules.Actors[building], producer.Owner, wr, td);
|
var init = new ActorPreviewInitializer(rules.Actors[building], producer.Owner, wr, td);
|
||||||
|
|||||||
@@ -8,18 +8,60 @@
|
|||||||
*/
|
*/
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
using OpenRA.Graphics;
|
using OpenRA.Graphics;
|
||||||
|
using OpenRA.Mods.Common.Graphics;
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
|
|
||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
public class BibInfo : ITraitInfo, Requires<BuildingInfo>, Requires<RenderSpritesInfo>
|
public class BibInfo : ITraitInfo, Requires<BuildingInfo>, IRenderActorPreviewSpritesInfo, Requires<RenderSpritesInfo>
|
||||||
{
|
{
|
||||||
public readonly string Sequence = "bib";
|
public readonly string Sequence = "bib";
|
||||||
public readonly string Palette = "terrain";
|
public readonly string Palette = "terrain";
|
||||||
public readonly bool HasMinibib = false;
|
public readonly bool HasMinibib = false;
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new Bib(init.Self, this); }
|
public object Create(ActorInitializer init) { return new Bib(init.Self, this); }
|
||||||
|
|
||||||
|
public IEnumerable<IActorPreview> RenderPreviewSprites(ActorPreviewInitializer init, RenderSpritesInfo rs, string image, int facings, PaletteReference p)
|
||||||
|
{
|
||||||
|
if (init.Contains<HideBibPreviewInit>() && init.Get<HideBibPreviewInit, bool>())
|
||||||
|
yield break;
|
||||||
|
|
||||||
|
if (Palette != null)
|
||||||
|
p = init.WorldRenderer.Palette(Palette);
|
||||||
|
|
||||||
|
var bi = init.Actor.Traits.Get<BuildingInfo>();
|
||||||
|
|
||||||
|
var width = bi.Dimensions.X;
|
||||||
|
var bibOffset = bi.Dimensions.Y - 1;
|
||||||
|
var centerOffset = FootprintUtils.CenterOffset(init.World, bi);
|
||||||
|
var rows = HasMinibib ? 1 : 2;
|
||||||
|
var map = init.World.Map;
|
||||||
|
var location = CPos.Zero;
|
||||||
|
|
||||||
|
if (init.Contains<LocationInit>())
|
||||||
|
location = init.Get<LocationInit, CPos>();
|
||||||
|
|
||||||
|
for (var i = 0; i < rows * width; i++)
|
||||||
|
{
|
||||||
|
var index = i;
|
||||||
|
var anim = new Animation(init.World, image);
|
||||||
|
var cellOffset = new CVec(i % width, i / width + bibOffset);
|
||||||
|
var cell = location + cellOffset;
|
||||||
|
|
||||||
|
// Some mods may define terrain-specific bibs
|
||||||
|
var terrain = map.GetTerrainInfo(cell).Type;
|
||||||
|
var testSequence = Sequence + "-" + terrain;
|
||||||
|
var sequence = anim.HasSequence(testSequence) ? testSequence : Sequence;
|
||||||
|
anim.PlayFetchIndex(sequence, () => index);
|
||||||
|
anim.IsDecoration = true;
|
||||||
|
|
||||||
|
// Z-order is one set to the top of the footprint
|
||||||
|
var offset = map.CenterOfCell(cell) - map.CenterOfCell(location) - centerOffset;
|
||||||
|
yield return new SpriteActorPreview(anim, offset, -(offset.Y + centerOffset.Y + 512), p, rs.Scale);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Bib : INotifyAddedToWorld, INotifyRemovedFromWorld
|
public class Bib : INotifyAddedToWorld, INotifyRemovedFromWorld
|
||||||
@@ -74,4 +116,12 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
rs.Remove("bib_{0}".F(i));
|
rs.Remove("bib_{0}".F(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class HideBibPreviewInit : IActorInit<bool>, ISuppressInitExport
|
||||||
|
{
|
||||||
|
[FieldFromYamlKey] readonly bool value = true;
|
||||||
|
public HideBibPreviewInit() { }
|
||||||
|
public HideBibPreviewInit(bool init) { value = init; }
|
||||||
|
public bool Value(World world) { return value; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -349,7 +349,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
public interface INotifyPassengerEntered { void PassengerEntered(Actor self, Actor passenger); }
|
public interface INotifyPassengerEntered { void PassengerEntered(Actor self, Actor passenger); }
|
||||||
public interface INotifyPassengerExited { void PassengerExited(Actor self, Actor passenger); }
|
public interface INotifyPassengerExited { void PassengerExited(Actor self, Actor passenger); }
|
||||||
|
|
||||||
public class RuntimeCargoInit : IActorInit<Actor[]>
|
public class RuntimeCargoInit : IActorInit<Actor[]>, ISuppressInitExport
|
||||||
{
|
{
|
||||||
[FieldFromYamlKey]
|
[FieldFromYamlKey]
|
||||||
readonly Actor[] value = { };
|
readonly Actor[] value = { };
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
{
|
{
|
||||||
// Show a static frame instead of animating all of the fullness states
|
// Show a static frame instead of animating all of the fullness states
|
||||||
var anim = new Animation(init.World, image, () => 0);
|
var anim = new Animation(init.World, image, () => 0);
|
||||||
anim.PlayFetchIndex(Sequence, () => 0);
|
anim.PlayFetchIndex(RenderSprites.NormalizeSequence(anim, init.GetDamageState(), Sequence), () => 0);
|
||||||
|
|
||||||
yield return new SpriteActorPreview(anim, WVec.Zero, 0, p, rs.Scale);
|
yield return new SpriteActorPreview(anim, WVec.Zero, 0, p, rs.Scale);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
// Show the correct turret facing
|
// Show the correct turret facing
|
||||||
var anim = new Animation(init.World, image, () => t.InitialFacing);
|
var anim = new Animation(init.World, image, () => t.InitialFacing);
|
||||||
anim.PlayRepeating(Sequence);
|
anim.PlayRepeating(RenderSprites.NormalizeSequence(anim, init.GetDamageState(), Sequence));
|
||||||
|
|
||||||
yield return new SpriteActorPreview(anim, WVec.Zero, 0, p, rs.Scale);
|
yield return new SpriteActorPreview(anim, WVec.Zero, 0, p, rs.Scale);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,9 +24,44 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
public override IEnumerable<IActorPreview> RenderPreviewSprites(ActorPreviewInitializer init, RenderSpritesInfo rs, string image, int facings, PaletteReference p)
|
public override IEnumerable<IActorPreview> RenderPreviewSprites(ActorPreviewInitializer init, RenderSpritesInfo rs, string image, int facings, PaletteReference p)
|
||||||
{
|
{
|
||||||
// Show a static frame instead of animating all of the wall states
|
var adjacent = 0;
|
||||||
|
|
||||||
|
if (init.Contains<RuntimeNeighbourInit>())
|
||||||
|
{
|
||||||
|
var location = CPos.Zero;
|
||||||
|
if (init.Contains<LocationInit>())
|
||||||
|
location = init.Get<LocationInit, CPos>();
|
||||||
|
|
||||||
|
var neighbours = init.Get<RuntimeNeighbourInit, Dictionary<CPos, string[]>>();
|
||||||
|
foreach (var kv in neighbours)
|
||||||
|
{
|
||||||
|
var haveNeighbour = false;
|
||||||
|
foreach (var n in kv.Value)
|
||||||
|
{
|
||||||
|
var rb = init.World.Map.Rules.Actors[n].Traits.GetOrDefault<RenderBuildingWallInfo>();
|
||||||
|
if (rb != null && rb.Type == Type)
|
||||||
|
{
|
||||||
|
haveNeighbour = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!haveNeighbour)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (kv.Key == location + new CVec(0, -1))
|
||||||
|
adjacent |= 1;
|
||||||
|
else if (kv.Key == location + new CVec(+1, 0))
|
||||||
|
adjacent |= 2;
|
||||||
|
else if (kv.Key == location + new CVec(0, +1))
|
||||||
|
adjacent |= 4;
|
||||||
|
else if (kv.Key == location + new CVec(-1, 0))
|
||||||
|
adjacent |= 8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var anim = new Animation(init.World, image, () => 0);
|
var anim = new Animation(init.World, image, () => 0);
|
||||||
anim.PlayFetchIndex(Sequence, () => 0);
|
anim.PlayFetchIndex(RenderSprites.NormalizeSequence(anim, init.GetDamageState(), Sequence), () => adjacent);
|
||||||
|
|
||||||
yield return new SpriteActorPreview(anim, WVec.Zero, 0, p, rs.Scale);
|
yield return new SpriteActorPreview(anim, WVec.Zero, 0, p, rs.Scale);
|
||||||
}
|
}
|
||||||
@@ -110,4 +145,12 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
UpdateNeighbours(self);
|
UpdateNeighbours(self);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class RuntimeNeighbourInit : IActorInit<Dictionary<CPos, string[]>>, ISuppressInitExport
|
||||||
|
{
|
||||||
|
[FieldFromYamlKey] readonly Dictionary<CPos, string[]> value = null;
|
||||||
|
public RuntimeNeighbourInit() { }
|
||||||
|
public RuntimeNeighbourInit(Dictionary<CPos, string[]> init) { value = init; }
|
||||||
|
public Dictionary<CPos, string[]> Value(World world) { return value; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,8 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
var facing = ifacing != null ? init.Contains<FacingInit>() ? init.Get<FacingInit, int>() : ifacing.GetInitialFacing() : 0;
|
var facing = ifacing != null ? init.Contains<FacingInit>() ? init.Get<FacingInit, int>() : ifacing.GetInitialFacing() : 0;
|
||||||
|
|
||||||
var anim = new Animation(init.World, image, () => facing);
|
var anim = new Animation(init.World, image, () => facing);
|
||||||
anim.PlayRepeating(Sequence);
|
anim.PlayRepeating(RenderSprites.NormalizeSequence(anim, init.GetDamageState(), Sequence));
|
||||||
|
|
||||||
yield return new SpriteActorPreview(anim, WVec.Zero, 0, p, rs.Scale);
|
yield return new SpriteActorPreview(anim, WVec.Zero, 0, p, rs.Scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
.First(tt => tt.Turret == armament.Turret);
|
.First(tt => tt.Turret == armament.Turret);
|
||||||
|
|
||||||
var anim = new Animation(init.World, image, () => t.InitialFacing);
|
var anim = new Animation(init.World, image, () => t.InitialFacing);
|
||||||
anim.Play(Sequence);
|
anim.Play(RenderSprites.NormalizeSequence(anim, init.GetDamageState(), Sequence));
|
||||||
|
|
||||||
var turretOrientation = body.QuantizeOrientation(new WRot(WAngle.Zero, WAngle.Zero, WAngle.FromFacing(t.InitialFacing)), facings);
|
var turretOrientation = body.QuantizeOrientation(new WRot(WAngle.Zero, WAngle.Zero, WAngle.FromFacing(t.InitialFacing)), facings);
|
||||||
var turretOffset = body.LocalToWorld(t.Offset.Rotate(turretOrientation));
|
var turretOffset = body.LocalToWorld(t.Offset.Rotate(turretOrientation));
|
||||||
|
|||||||
@@ -9,14 +9,16 @@
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using OpenRA.Graphics;
|
using OpenRA.Graphics;
|
||||||
|
using OpenRA.Mods.Common.Graphics;
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
|
|
||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
[Desc("Renders crates with both water and land variants.")]
|
[Desc("Renders crates with both water and land variants.")]
|
||||||
class WithCrateBodyInfo : ITraitInfo, Requires<RenderSpritesInfo>
|
class WithCrateBodyInfo : ITraitInfo, Requires<RenderSpritesInfo>, IQuantizeBodyOrientationInfo, IRenderActorPreviewSpritesInfo
|
||||||
{
|
{
|
||||||
public readonly string[] Images = { "crate" };
|
public readonly string[] Images = { "crate" };
|
||||||
|
|
||||||
@@ -24,6 +26,15 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
public readonly string[] XmasImages = { };
|
public readonly string[] XmasImages = { };
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new WithCrateBody(init.Self, this); }
|
public object Create(ActorInitializer init) { return new WithCrateBody(init.Self, this); }
|
||||||
|
|
||||||
|
public IEnumerable<IActorPreview> RenderPreviewSprites(ActorPreviewInitializer init, RenderSpritesInfo rs, string image, int facings, PaletteReference p)
|
||||||
|
{
|
||||||
|
var anim = new Animation(init.World, Images.First(), () => 0);
|
||||||
|
anim.PlayRepeating(RenderSprites.NormalizeSequence(anim, init.GetDamageState(), "idle"));
|
||||||
|
yield return new SpriteActorPreview(anim, WVec.Zero, 0, p, rs.Scale);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int QuantizedBodyFacings(ActorInfo ai, SequenceProvider sequenceProvider, string race) { return 1; }
|
||||||
}
|
}
|
||||||
|
|
||||||
class WithCrateBody : INotifyParachuteLanded
|
class WithCrateBody : INotifyParachuteLanded
|
||||||
|
|||||||
@@ -40,10 +40,13 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
if (UpgradeMinEnabledLevel > 0)
|
if (UpgradeMinEnabledLevel > 0)
|
||||||
yield break;
|
yield break;
|
||||||
|
|
||||||
|
if (Palette != null)
|
||||||
|
p = init.WorldRenderer.Palette(Palette);
|
||||||
|
|
||||||
var body = init.Actor.Traits.Get<BodyOrientationInfo>();
|
var body = init.Actor.Traits.Get<BodyOrientationInfo>();
|
||||||
var facing = init.Contains<FacingInit>() ? init.Get<FacingInit, int>() : 0;
|
var facing = init.Contains<FacingInit>() ? init.Get<FacingInit, int>() : 0;
|
||||||
var anim = new Animation(init.World, image, () => facing);
|
var anim = new Animation(init.World, image, () => facing);
|
||||||
anim.PlayRepeating(Sequence);
|
anim.PlayRepeating(RenderSprites.NormalizeSequence(anim, init.GetDamageState(), Sequence));
|
||||||
|
|
||||||
var orientation = body.QuantizeOrientation(new WRot(WAngle.Zero, WAngle.Zero, WAngle.FromFacing(facing)), facings);
|
var orientation = body.QuantizeOrientation(new WRot(WAngle.Zero, WAngle.Zero, WAngle.FromFacing(facing)), facings);
|
||||||
var offset = body.LocalToWorld(Offset.Rotate(orientation));
|
var offset = body.LocalToWorld(Offset.Rotate(orientation));
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
facing = init.Contains<FacingInit>() ? init.Get<FacingInit, int>() : ifacing.GetInitialFacing();
|
facing = init.Contains<FacingInit>() ? init.Get<FacingInit, int>() : ifacing.GetInitialFacing();
|
||||||
|
|
||||||
var anim = new Animation(init.World, image, () => facing);
|
var anim = new Animation(init.World, image, () => facing);
|
||||||
anim.PlayRepeating(StandSequences.First());
|
anim.PlayRepeating(RenderSprites.NormalizeSequence(anim, init.GetDamageState(), StandSequences.First()));
|
||||||
yield return new SpriteActorPreview(anim, WVec.Zero, 0, p, rs.Scale);
|
yield return new SpriteActorPreview(anim, WVec.Zero, 0, p, rs.Scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ namespace OpenRA.Mods.TS.Traits
|
|||||||
public IEnumerable<IActorPreview> RenderPreviewSprites(ActorPreviewInitializer init, RenderSpritesInfo rs, string image, int facings, PaletteReference p)
|
public IEnumerable<IActorPreview> RenderPreviewSprites(ActorPreviewInitializer init, RenderSpritesInfo rs, string image, int facings, PaletteReference p)
|
||||||
{
|
{
|
||||||
var anim = new Animation(init.World, image, () => 0);
|
var anim = new Animation(init.World, image, () => 0);
|
||||||
anim.PlayFetchIndex(Sequence, () => 0);
|
anim.PlayFetchIndex(RenderSprites.NormalizeSequence(anim, init.GetDamageState(), Sequence), () => 0);
|
||||||
|
|
||||||
var bi = init.Actor.Traits.Get<BuildingInfo>();
|
var bi = init.Actor.Traits.Get<BuildingInfo>();
|
||||||
var offset = FootprintUtils.CenterOffset(init.World, bi).Y + 512; // Additional 512 units move from center -> top of cell
|
var offset = FootprintUtils.CenterOffset(init.World, bi).Y + 512; // Additional 512 units move from center -> top of cell
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
var body = init.Actor.Traits.Get<BodyOrientationInfo>();
|
var body = init.Actor.Traits.Get<BodyOrientationInfo>();
|
||||||
var facing = init.Contains<FacingInit>() ? init.Get<FacingInit, int>() : 0;
|
var facing = init.Contains<FacingInit>() ? init.Get<FacingInit, int>() : 0;
|
||||||
var anim = new Animation(init.World, image, () => facing);
|
var anim = new Animation(init.World, image, () => facing);
|
||||||
anim.PlayRepeating(Sequence);
|
anim.PlayRepeating(RenderSprites.NormalizeSequence(anim, init.GetDamageState(), Sequence));
|
||||||
|
|
||||||
var orientation = body.QuantizeOrientation(new WRot(WAngle.Zero, WAngle.Zero, WAngle.FromFacing(facing)), facings);
|
var orientation = body.QuantizeOrientation(new WRot(WAngle.Zero, WAngle.Zero, WAngle.FromFacing(facing)), facings);
|
||||||
var offset = body.LocalToWorld(Offset.Rotate(orientation));
|
var offset = body.LocalToWorld(Offset.Rotate(orientation));
|
||||||
|
|||||||
@@ -48,11 +48,11 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
var turretFacing = init.Contains<TurretFacingInit>() ? init.Get<TurretFacingInit, int>() : t.InitialFacing;
|
var turretFacing = init.Contains<TurretFacingInit>() ? init.Get<TurretFacingInit, int>() : t.InitialFacing;
|
||||||
|
|
||||||
var anim = new Animation(init.World, image, () => turretFacing);
|
var anim = new Animation(init.World, image, () => turretFacing);
|
||||||
anim.Play(Sequence);
|
anim.Play(RenderSprites.NormalizeSequence(anim, init.GetDamageState(), Sequence));
|
||||||
|
|
||||||
var orientation = body.QuantizeOrientation(new WRot(WAngle.Zero, WAngle.Zero, WAngle.FromFacing(bodyFacing)), facings);
|
var orientation = body.QuantizeOrientation(new WRot(WAngle.Zero, WAngle.Zero, WAngle.FromFacing(bodyFacing)), facings);
|
||||||
var offset = body.LocalToWorld(t.Offset.Rotate(orientation));
|
var offset = body.LocalToWorld(t.Offset.Rotate(orientation));
|
||||||
yield return new SpriteActorPreview(anim, offset, offset.Y + offset.Z + 1, p, rs.Scale);
|
yield return new SpriteActorPreview(anim, offset, -(offset.Y + offset.Z) + 1, p, rs.Scale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -41,5 +41,5 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class SkipMakeAnimsInit : IActorInit { }
|
public class SkipMakeAnimsInit : IActorInit, ISuppressInitExport { }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using OpenRA.Graphics;
|
using OpenRA.Graphics;
|
||||||
|
using OpenRA.Mods.Common.Traits;
|
||||||
using OpenRA.Primitives;
|
using OpenRA.Primitives;
|
||||||
using OpenRA.Widgets;
|
using OpenRA.Widgets;
|
||||||
|
|
||||||
@@ -26,7 +27,11 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
|
|
||||||
var preview = widget.GetOrNull<ActorPreviewWidget>("PREVIEW");
|
var preview = widget.GetOrNull<ActorPreviewWidget>("PREVIEW");
|
||||||
var actor = world.Map.Rules.Actors[actorType];
|
var actor = world.Map.Rules.Actors[actorType];
|
||||||
preview.SetPreview(actor, world.WorldActor.Owner, new TypeDictionary());
|
|
||||||
|
var td = new TypeDictionary();
|
||||||
|
td.Add(new HideBibPreviewInit());
|
||||||
|
|
||||||
|
preview.SetPreview(actor, world.WorldActor.Owner, td);
|
||||||
|
|
||||||
var hueSlider = widget.Get<SliderWidget>("HUE");
|
var hueSlider = widget.Get<SliderWidget>("HUE");
|
||||||
var mixer = widget.Get<ColorMixerWidget>("MIXER");
|
var mixer = widget.Get<ColorMixerWidget>("MIXER");
|
||||||
|
|||||||
@@ -34,12 +34,14 @@ mpspawn:
|
|||||||
Immobile:
|
Immobile:
|
||||||
OccupiesSpace: false
|
OccupiesSpace: false
|
||||||
RenderEditorOnly:
|
RenderEditorOnly:
|
||||||
|
Palette: chrome
|
||||||
BodyOrientation:
|
BodyOrientation:
|
||||||
|
|
||||||
waypoint:
|
waypoint:
|
||||||
Immobile:
|
Immobile:
|
||||||
OccupiesSpace: false
|
OccupiesSpace: false
|
||||||
RenderEditorOnly:
|
RenderEditorOnly:
|
||||||
|
Palette: chrome
|
||||||
BodyOrientation:
|
BodyOrientation:
|
||||||
|
|
||||||
^fact.colorpicker:
|
^fact.colorpicker:
|
||||||
|
|||||||
Reference in New Issue
Block a user