Unstable v0.1300.0.0 (February 19th 2021)
This commit is contained in:
@@ -52,7 +52,11 @@ namespace Barotrauma
|
||||
|
||||
public Sprite Sprite
|
||||
{
|
||||
get { return spriteIndex < 0 || Prefab.Sprites.Count == 0 ? null : Prefab.Sprites[spriteIndex % Prefab.Sprites.Count]; }
|
||||
get
|
||||
{
|
||||
var prefab = ActivePrefab?.Sprites.Count > 0 ? ActivePrefab : Prefab;
|
||||
return spriteIndex < 0 || prefab.Sprites.Count == 0 ? null : prefab.Sprites[spriteIndex % prefab.Sprites.Count];
|
||||
}
|
||||
}
|
||||
|
||||
Vector2 ISpatialEntity.Position => new Vector2(Position.X, Position.Y);
|
||||
@@ -63,6 +67,8 @@ namespace Barotrauma
|
||||
|
||||
public Submarine Submarine => null;
|
||||
|
||||
public Level.Cave ParentCave;
|
||||
|
||||
public LevelObject(LevelObjectPrefab prefab, Vector3 position, float scale, float rotation = 0.0f)
|
||||
{
|
||||
ActivePrefab = Prefab = prefab;
|
||||
@@ -110,6 +116,19 @@ namespace Barotrauma
|
||||
Triggers.Add(newTrigger);
|
||||
}
|
||||
|
||||
if (spriteIndex == -1)
|
||||
{
|
||||
foreach (var overrideProperties in prefab.OverrideProperties)
|
||||
{
|
||||
if (overrideProperties == null) { continue; }
|
||||
if (overrideProperties.Sprites.Count > 0)
|
||||
{
|
||||
spriteIndex = Rand.Int(overrideProperties.Sprites.Count, Rand.RandSync.Server);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NeedsUpdate = NeedsNetworkSyncing || (Triggers != null && Triggers.Any()) || Prefab.PhysicsBodyTriggerIndex > -1;
|
||||
|
||||
InitProjSpecific();
|
||||
|
||||
Reference in New Issue
Block a user