Convert (Dynamic)FacingInit, (Dynamic)TurretFacingInit to WAngle.

This commit is contained in:
Paul Chote
2020-06-26 00:33:08 +01:00
committed by abcdefg30
parent e8f443f4a9
commit a2269e7ee7
36 changed files with 133 additions and 155 deletions

View File

@@ -141,8 +141,8 @@ namespace OpenRA.Mods.Common.Traits
if (info.DeliveryAircraft != null)
{
var crate = w.CreateActor(false, crateActor, new TypeDictionary { new OwnerInit(w.WorldActor.Owner) });
var dropFacing = 256 * self.World.SharedRandom.Next(info.QuantizedFacings) / info.QuantizedFacings;
var delta = new WVec(0, -1024, 0).Rotate(WRot.FromFacing(dropFacing));
var dropFacing = WAngle.FromFacing(256 * self.World.SharedRandom.Next(info.QuantizedFacings) / info.QuantizedFacings);
var delta = new WVec(0, -1024, 0).Rotate(WRot.FromYaw(dropFacing));
var altitude = self.World.Map.Rules.Actors[info.DeliveryAircraft].TraitInfo<AircraftInfo>().CruiseAltitude.Length;
var target = self.World.Map.CenterOfCell(p) + new WVec(0, 0, altitude);

View File

@@ -194,10 +194,7 @@ namespace OpenRA.Mods.Common.Traits
}
if (actor.HasTraitInfo<IFacingInfo>())
reference.Add(new FacingInit(info.PreviewFacing));
if (actor.HasTraitInfo<TurretedInfo>())
reference.Add(new TurretFacingInit(info.PreviewFacing));
reference.Add(new FacingInit(WAngle.FromFacing(info.PreviewFacing)));
Type = EditorCursorType.Actor;
Actor = new EditorActorPreview(wr, null, reference, owner);

View File

@@ -85,12 +85,13 @@ namespace OpenRA.Mods.Common.Traits
if (unitGroup.BaseActor != null)
{
var facing = unitGroup.BaseActorFacing < 0 ? new WAngle(w.SharedRandom.Next(1024)) : WAngle.FromFacing(unitGroup.BaseActorFacing);
w.CreateActor(unitGroup.BaseActor.ToLowerInvariant(), new TypeDictionary
{
new LocationInit(sp + unitGroup.BaseActorOffset),
new OwnerInit(p),
new SkipMakeAnimsInit(),
new FacingInit(unitGroup.BaseActorFacing < 0 ? w.SharedRandom.Next(256) : unitGroup.BaseActorFacing),
new FacingInit(facing),
});
}
@@ -112,13 +113,14 @@ namespace OpenRA.Mods.Common.Traits
}
var subCell = ip.SharesCell ? w.ActorMap.FreeSubCell(validCell) : 0;
var facing = unitGroup.SupportActorsFacing < 0 ? new WAngle(w.SharedRandom.Next(1024)) : WAngle.FromFacing(unitGroup.SupportActorsFacing);
w.CreateActor(s.ToLowerInvariant(), new TypeDictionary
{
new OwnerInit(p),
new LocationInit(validCell),
new SubCellInit(subCell),
new FacingInit(unitGroup.SupportActorsFacing < 0 ? w.SharedRandom.Next(256) : unitGroup.SupportActorsFacing)
new FacingInit(facing),
});
}
}