(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
|
||||
{
|
||||
return collider == null ? null : collider[colliderIndex];
|
||||
return collider?[colliderIndex];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,10 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
private float blinkTimer;
|
||||
|
||||
private bool itemLoaded;
|
||||
|
||||
private float blinkTimer;
|
||||
|
||||
public PhysicsBody ParentBody;
|
||||
|
||||
[Editable(MinValueFloat = 0.0f, MaxValueFloat = 2048.0f), Serialize(100.0f, true)]
|
||||
@@ -77,7 +81,7 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
IsActive = value;
|
||||
#if SERVER
|
||||
if (GameMain.Server != null && GameMain.Server.GameStarted) { item.CreateServerEvent(this); }
|
||||
if (GameMain.Server != null && itemLoaded) { item.CreateServerEvent(this); }
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -156,7 +160,13 @@ namespace Barotrauma.Items.Components
|
||||
IsActive = IsOn;
|
||||
item.AddTag("light");
|
||||
}
|
||||
|
||||
|
||||
public override void OnItemLoaded()
|
||||
{
|
||||
base.OnItemLoaded();
|
||||
itemLoaded = true;
|
||||
}
|
||||
|
||||
public override void Update(float deltaTime, Camera cam)
|
||||
{
|
||||
UpdateOnActiveEffects(deltaTime);
|
||||
|
||||
Reference in New Issue
Block a user