Unstable v0.1300.0.0 (February 19th 2021)

This commit is contained in:
Joonas Rikkonen
2021-02-25 13:44:23 +02:00
parent b772654326
commit 24cbef485a
441 changed files with 21343 additions and 8562 deletions
@@ -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();