(cef39af84) Fixed server creating "attempted to create a network event for an item that hasn't been fully initialized yet" console errors when spawning LightComponents mid-round. + Simplified ragdoll collider null check
This commit is contained in:
@@ -110,7 +110,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return collider == null ? null : collider[colliderIndex];
|
return collider?[colliderIndex];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,10 @@ namespace Barotrauma.Items.Components
|
|||||||
|
|
||||||
private float blinkTimer;
|
private float blinkTimer;
|
||||||
|
|
||||||
|
private bool itemLoaded;
|
||||||
|
|
||||||
|
private float blinkTimer;
|
||||||
|
|
||||||
public PhysicsBody ParentBody;
|
public PhysicsBody ParentBody;
|
||||||
|
|
||||||
[Editable(MinValueFloat = 0.0f, MaxValueFloat = 2048.0f), Serialize(100.0f, true)]
|
[Editable(MinValueFloat = 0.0f, MaxValueFloat = 2048.0f), Serialize(100.0f, true)]
|
||||||
@@ -77,7 +81,7 @@ namespace Barotrauma.Items.Components
|
|||||||
|
|
||||||
IsActive = value;
|
IsActive = value;
|
||||||
#if SERVER
|
#if SERVER
|
||||||
if (GameMain.Server != null && GameMain.Server.GameStarted) { item.CreateServerEvent(this); }
|
if (GameMain.Server != null && itemLoaded) { item.CreateServerEvent(this); }
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -157,6 +161,12 @@ namespace Barotrauma.Items.Components
|
|||||||
item.AddTag("light");
|
item.AddTag("light");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void OnItemLoaded()
|
||||||
|
{
|
||||||
|
base.OnItemLoaded();
|
||||||
|
itemLoaded = true;
|
||||||
|
}
|
||||||
|
|
||||||
public override void Update(float deltaTime, Camera cam)
|
public override void Update(float deltaTime, Camera cam)
|
||||||
{
|
{
|
||||||
UpdateOnActiveEffects(deltaTime);
|
UpdateOnActiveEffects(deltaTime);
|
||||||
|
|||||||
Reference in New Issue
Block a user