From 98bd1552b93c00eeb80ab2b98e6e21c1333bf43e Mon Sep 17 00:00:00 2001 From: clusterfack Date: Fri, 9 Mar 2018 10:59:19 -0600 Subject: [PATCH] Fixes power components (#39) Fixes the power components not having node set if they get a node added as a component in OnAdd() --- Content.Server/GameObjects/Components/Power/PowerDevice.cs | 1 + .../GameObjects/Components/Power/PowerGeneratorComponent.cs | 1 + .../GameObjects/Components/Power/PowerStorageComponent.cs | 1 + 3 files changed, 3 insertions(+) diff --git a/Content.Server/GameObjects/Components/Power/PowerDevice.cs b/Content.Server/GameObjects/Components/Power/PowerDevice.cs index e45a8a7912..abc2936d9e 100644 --- a/Content.Server/GameObjects/Components/Power/PowerDevice.cs +++ b/Content.Server/GameObjects/Components/Power/PowerDevice.cs @@ -93,6 +93,7 @@ namespace Content.Server.GameObjects.Components.Power if (!Owner.TryGetComponent(out PowerNodeComponent node)) { Owner.AddComponent(); + node = Owner.GetComponent(); } node.OnPowernetConnect += PowernetConnect; node.OnPowernetDisconnect += PowernetDisconnect; diff --git a/Content.Server/GameObjects/Components/Power/PowerGeneratorComponent.cs b/Content.Server/GameObjects/Components/Power/PowerGeneratorComponent.cs index cb7352f207..93dc572596 100644 --- a/Content.Server/GameObjects/Components/Power/PowerGeneratorComponent.cs +++ b/Content.Server/GameObjects/Components/Power/PowerGeneratorComponent.cs @@ -40,6 +40,7 @@ namespace Content.Server.GameObjects.Components.Power if (!Owner.TryGetComponent(out PowerNodeComponent node)) { Owner.AddComponent(); + node = Owner.GetComponent(); } node.OnPowernetConnect += PowernetConnect; node.OnPowernetDisconnect += PowernetDisconnect; diff --git a/Content.Server/GameObjects/Components/Power/PowerStorageComponent.cs b/Content.Server/GameObjects/Components/Power/PowerStorageComponent.cs index 2901b9ec9d..903e3d3669 100644 --- a/Content.Server/GameObjects/Components/Power/PowerStorageComponent.cs +++ b/Content.Server/GameObjects/Components/Power/PowerStorageComponent.cs @@ -85,6 +85,7 @@ namespace Content.Server.GameObjects.Components.Power if (!Owner.TryGetComponent(out PowerNodeComponent node)) { Owner.AddComponent(); + node = Owner.GetComponent(); } node.OnPowernetConnect += PowernetConnect; node.OnPowernetDisconnect += PowernetDisconnect;