Merge pull request #9193 from Mailaender/quanbo-fixup
Fixed BodyOrientation refactor regressions
This commit is contained in:
@@ -53,7 +53,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public object Create(ActorInitializer init) { return new BodyOrientation(init, this); }
|
||||
}
|
||||
|
||||
public class BodyOrientation : IBodyOrientation
|
||||
public class BodyOrientation : IBodyOrientation, ISync
|
||||
{
|
||||
readonly BodyOrientationInfo info;
|
||||
readonly Lazy<int> quantizedFacings;
|
||||
@@ -73,12 +73,16 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return info.QuantizedFacings;
|
||||
|
||||
var qboi = self.Info.Traits.GetOrDefault<IQuantizeBodyOrientationInfo>();
|
||||
var isb = self.HasTrait<ISpriteBody>();
|
||||
|
||||
// If a sprite actor has neither custom QuantizedFacings nor a trait implementing IQuantizeBodyOrientationInfo, throw
|
||||
if (qboi == null && isb)
|
||||
throw new InvalidOperationException("Actor" + self.Info.Name + "has a sprite body but no facing quantization."
|
||||
if (qboi == null)
|
||||
{
|
||||
if (self.HasTrait<ISpriteBody>())
|
||||
throw new InvalidOperationException("Actor '" + self.Info.Name + "' has a sprite body but no facing quantization."
|
||||
+ " Either add the QuantizeFacingsFromSequence trait or set custom QuantizedFacings on BodyOrientation.");
|
||||
else
|
||||
throw new InvalidOperationException("Actor type '" + self.Info.Name + "' does not define a quantized body orientation.");
|
||||
}
|
||||
|
||||
return qboi.QuantizedBodyFacings(self.Info, self.World.Map.SequenceProvider, faction);
|
||||
});
|
||||
|
||||
@@ -691,6 +691,7 @@
|
||||
DamagedSounds: xplos.aud
|
||||
DestroyedSounds: xplobig4.aud
|
||||
BodyOrientation:
|
||||
QuantizedFacings: 1
|
||||
ScriptTriggers:
|
||||
|
||||
^Crate:
|
||||
|
||||
@@ -636,6 +636,7 @@
|
||||
Type: Concrete
|
||||
AutoTargetIgnore:
|
||||
BodyOrientation:
|
||||
QuantizedFacings: 1
|
||||
ScriptTriggers:
|
||||
|
||||
^Rock:
|
||||
|
||||
@@ -200,6 +200,7 @@ camera.paradrop:
|
||||
ProximityCaptor:
|
||||
Types: Camera
|
||||
BodyOrientation:
|
||||
QuantizedFacings: 1
|
||||
|
||||
SONAR:
|
||||
AlwaysVisible:
|
||||
|
||||
Reference in New Issue
Block a user