Speed up checks for IOccupySpace trait.
Eagerly load the trait (if it exists) in Actor, and use this reference to avoid having to perform self.Info.HasTraitInfo<IOccupySpaceInfo>() checks.
This commit is contained in:
@@ -25,7 +25,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
public AmbientSound(Actor self, AmbientSoundInfo info)
|
||||
{
|
||||
if (self.Info.HasTraitInfo<IOccupySpaceInfo>())
|
||||
if (self.OccupiesSpace != null)
|
||||
Game.Sound.PlayLooped(info.SoundFile, self.CenterPosition);
|
||||
else
|
||||
Game.Sound.PlayLooped(info.SoundFile);
|
||||
|
||||
Reference in New Issue
Block a user