From 9c9984a40a3335d2ce98281482a2ba643822e6c1 Mon Sep 17 00:00:00 2001 From: Acruid Date: Sun, 8 Dec 2019 19:52:29 -0800 Subject: [PATCH] EventBus Refactor (#490) * API changes for the new EventBus. * Update Engine Module. --- .../Components/IconSmoothing/IconSmoothComponent.cs | 6 +++--- .../GameObjects/Components/SubFloorHideComponent.cs | 6 +++--- Content.Client/GameObjects/Components/WindowComponent.cs | 4 ++-- Content.Server/GameTicking/GameRules/RuleDeathMatch.cs | 6 +++--- RobustToolbox | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Content.Client/GameObjects/Components/IconSmoothing/IconSmoothComponent.cs b/Content.Client/GameObjects/Components/IconSmoothing/IconSmoothComponent.cs index 3eced3afde..8a8670d0b6 100644 --- a/Content.Client/GameObjects/Components/IconSmoothing/IconSmoothComponent.cs +++ b/Content.Client/GameObjects/Components/IconSmoothing/IconSmoothComponent.cs @@ -81,7 +81,7 @@ namespace Content.Client.GameObjects.Components.IconSmoothing base.Startup(); SnapGrid.OnPositionChanged += SnapGridOnPositionChanged; - Owner.EntityManager.RaiseEvent(Owner, new IconSmoothDirtyEvent(null, SnapGrid.Offset, Mode)); + Owner.EntityManager.EventBus.RaiseEvent(Owner, new IconSmoothDirtyEvent(null, SnapGrid.Offset, Mode)); if (Mode == IconSmoothingMode.Corners) { var state0 = $"{StateBase}0"; @@ -203,12 +203,12 @@ namespace Content.Client.GameObjects.Components.IconSmoothing base.Shutdown(); SnapGrid.OnPositionChanged -= SnapGridOnPositionChanged; - Owner.EntityManager.RaiseEvent(Owner, new IconSmoothDirtyEvent(_lastPosition, SnapGrid.Offset, Mode)); + Owner.EntityManager.EventBus.RaiseEvent(Owner, new IconSmoothDirtyEvent(_lastPosition, SnapGrid.Offset, Mode)); } private void SnapGridOnPositionChanged() { - Owner.EntityManager.RaiseEvent(Owner, new IconSmoothDirtyEvent(_lastPosition, SnapGrid.Offset, Mode)); + Owner.EntityManager.EventBus.RaiseEvent(Owner, new IconSmoothDirtyEvent(_lastPosition, SnapGrid.Offset, Mode)); _lastPosition = (Owner.Transform.GridID, SnapGrid.Position); } diff --git a/Content.Client/GameObjects/Components/SubFloorHideComponent.cs b/Content.Client/GameObjects/Components/SubFloorHideComponent.cs index 6b9ec1c228..c99f90ae27 100644 --- a/Content.Client/GameObjects/Components/SubFloorHideComponent.cs +++ b/Content.Client/GameObjects/Components/SubFloorHideComponent.cs @@ -32,7 +32,7 @@ namespace Content.Client.GameObjects.Components base.Startup(); _snapGridComponent.OnPositionChanged += SnapGridOnPositionChanged; - Owner.EntityManager.RaiseEvent(Owner, new SubFloorHideDirtyEvent()); + Owner.EntityManager.EventBus.RaiseEvent(Owner, new SubFloorHideDirtyEvent()); } /// @@ -41,12 +41,12 @@ namespace Content.Client.GameObjects.Components base.Shutdown(); _snapGridComponent.OnPositionChanged -= SnapGridOnPositionChanged; - Owner.EntityManager.RaiseEvent(Owner, new SubFloorHideDirtyEvent()); + Owner.EntityManager.EventBus.RaiseEvent(Owner, new SubFloorHideDirtyEvent()); } private void SnapGridOnPositionChanged() { - Owner.EntityManager.RaiseEvent(Owner, new SubFloorHideDirtyEvent()); + Owner.EntityManager.EventBus.RaiseEvent(Owner, new SubFloorHideDirtyEvent()); } } diff --git a/Content.Client/GameObjects/Components/WindowComponent.cs b/Content.Client/GameObjects/Components/WindowComponent.cs index 387493d3a6..3aec3f09a9 100644 --- a/Content.Client/GameObjects/Components/WindowComponent.cs +++ b/Content.Client/GameObjects/Components/WindowComponent.cs @@ -31,7 +31,7 @@ namespace Content.Client.GameObjects.Components base.Startup(); _snapGrid.OnPositionChanged += SnapGridOnPositionChanged; - Owner.EntityManager.RaiseEvent(Owner, new WindowSmoothDirtyEvent()); + Owner.EntityManager.EventBus.RaiseEvent(Owner, new WindowSmoothDirtyEvent()); var state0 = $"{_stateBase}0"; _sprite.LayerMapSet(CornerLayers.SE, _sprite.AddLayerState(state0)); @@ -54,7 +54,7 @@ namespace Content.Client.GameObjects.Components private void SnapGridOnPositionChanged() { - Owner.EntityManager.RaiseEvent(Owner, new WindowSmoothDirtyEvent()); + Owner.EntityManager.EventBus.RaiseEvent(Owner, new WindowSmoothDirtyEvent()); } public void UpdateSprite() diff --git a/Content.Server/GameTicking/GameRules/RuleDeathMatch.cs b/Content.Server/GameTicking/GameRules/RuleDeathMatch.cs index cdc9e41d62..524183fc98 100644 --- a/Content.Server/GameTicking/GameRules/RuleDeathMatch.cs +++ b/Content.Server/GameTicking/GameRules/RuleDeathMatch.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Threading; using Content.Server.GameObjects; using Content.Server.Interfaces.Chat; @@ -34,7 +34,7 @@ namespace Content.Server.GameTicking.GameRules { _chatManager.DispatchServerAnnouncement("The game is now a death match. Kill everybody else to win!"); - _entityManager.SubscribeEvent(_onMobDamageStateChanged, this); + _entityManager.EventBus.SubscribeEvent(_onMobDamageStateChanged, this); _playerManager.PlayerStatusChanged += PlayerManagerOnPlayerStatusChanged; } @@ -42,7 +42,7 @@ namespace Content.Server.GameTicking.GameRules { base.Removed(); - _entityManager.UnsubscribeEvent(this); + _entityManager.EventBus.UnsubscribeEvent(this); _playerManager.PlayerStatusChanged -= PlayerManagerOnPlayerStatusChanged; } diff --git a/RobustToolbox b/RobustToolbox index 31fb926127..ea8e5e9fe7 160000 --- a/RobustToolbox +++ b/RobustToolbox @@ -1 +1 @@ -Subproject commit 31fb92612731276351a6cc33388b7fb7f040e7f8 +Subproject commit ea8e5e9fe7babeadf41bf7333307303225b89567