Merge pull request #9193 from Mailaender/quanbo-fixup

Fixed BodyOrientation refactor regressions
This commit is contained in:
reaperrr
2015-08-31 20:12:53 +02:00
4 changed files with 12 additions and 5 deletions

View File

@@ -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."
+ " Either add the QuantizeFacingsFromSequence trait or set custom QuantizedFacings on BodyOrientation.");
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);
});

View File

@@ -691,6 +691,7 @@
DamagedSounds: xplos.aud
DestroyedSounds: xplobig4.aud
BodyOrientation:
QuantizedFacings: 1
ScriptTriggers:
^Crate:

View File

@@ -636,6 +636,7 @@
Type: Concrete
AutoTargetIgnore:
BodyOrientation:
QuantizedFacings: 1
ScriptTriggers:
^Rock:

View File

@@ -200,6 +200,7 @@ camera.paradrop:
ProximityCaptor:
Types: Camera
BodyOrientation:
QuantizedFacings: 1
SONAR:
AlwaysVisible: