From c51533686b805a511f9f0b1af901f7e99000275a Mon Sep 17 00:00:00 2001 From: Acruid Date: Tue, 18 Feb 2020 19:43:54 -0800 Subject: [PATCH 1/4] Updates the Content EntitySystems with the changes to the event API. Visual Studio wants to update the version of the solution, and change some GUIDs around. --- .../EntitySystems/ExamineSystem.cs | 7 - .../EntitySystems/IconSmoothSystem.cs | 12 +- .../EntitySystems/MeleeWeaponSystem.cs | 25 +-- .../GameObjects/EntitySystems/VerbSystem.cs | 40 +--- .../EntitySystems/Click/ExamineSystem.cs | 20 +- .../EntitySystems/CombatModeSystem.cs | 62 +++--- .../GameObjects/EntitySystems/HandsSystem.cs | 10 +- .../EntitySystems/StorageSystem.cs | 10 +- .../GameObjects/EntitySystems/VerbSystem.cs | 200 +++++++++--------- SpaceStation14.sln | 90 ++++---- 10 files changed, 199 insertions(+), 277 deletions(-) diff --git a/Content.Client/GameObjects/EntitySystems/ExamineSystem.cs b/Content.Client/GameObjects/EntitySystems/ExamineSystem.cs index c29f08d96f..6b5792b6fc 100644 --- a/Content.Client/GameObjects/EntitySystems/ExamineSystem.cs +++ b/Content.Client/GameObjects/EntitySystems/ExamineSystem.cs @@ -46,13 +46,6 @@ namespace Content.Client.GameObjects.EntitySystems inputSys.BindMap.BindFunction(ContentKeyFunctions.ExamineEntity, new PointerInputCmdHandler(HandleExamine)); } - public override void RegisterMessageTypes() - { - base.RegisterMessageTypes(); - - RegisterMessageType(); - } - private bool HandleExamine(ICommonSession session, GridCoordinates coords, EntityUid uid) { if (!uid.IsValid() || !_entityManager.TryGetEntity(uid, out var examined)) diff --git a/Content.Client/GameObjects/EntitySystems/IconSmoothSystem.cs b/Content.Client/GameObjects/EntitySystems/IconSmoothSystem.cs index 09152b5c66..dc1c04d870 100644 --- a/Content.Client/GameObjects/EntitySystems/IconSmoothSystem.cs +++ b/Content.Client/GameObjects/EntitySystems/IconSmoothSystem.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using Content.Client.GameObjects.Components.IconSmoothing; using JetBrains.Annotations; @@ -27,16 +27,10 @@ namespace Content.Client.GameObjects.EntitySystems private int _generation; - public override void SubscribeEvents() - { - base.SubscribeEvents(); - - SubscribeEvent(HandleDirtyEvent); - } - + /// public override void Initialize() { - base.Initialize(); + SubscribeEvent(HandleDirtyEvent); IoCManager.InjectDependencies(this); } diff --git a/Content.Client/GameObjects/EntitySystems/MeleeWeaponSystem.cs b/Content.Client/GameObjects/EntitySystems/MeleeWeaponSystem.cs index ae7b1d2ea9..9800018f6c 100644 --- a/Content.Client/GameObjects/EntitySystems/MeleeWeaponSystem.cs +++ b/Content.Client/GameObjects/EntitySystems/MeleeWeaponSystem.cs @@ -5,7 +5,6 @@ using JetBrains.Annotations; using Robust.Client.Interfaces.GameObjects.Components; using Robust.Shared.GameObjects; using Robust.Shared.GameObjects.Systems; -using Robust.Shared.Interfaces.Network; using Robust.Shared.IoC; using Robust.Shared.Log; using Robust.Shared.Maths; @@ -24,30 +23,10 @@ namespace Content.Client.GameObjects.EntitySystems public override void Initialize() { - base.Initialize(); - + SubscribeEvent(PlayWeaponArc); EntityQuery = new TypeEntityQuery(typeof(MeleeWeaponArcAnimationComponent)); } - public override void RegisterMessageTypes() - { - base.RegisterMessageTypes(); - - RegisterMessageType(); - } - - public override void HandleNetMessage(INetChannel channel, EntitySystemMessage message) - { - base.HandleNetMessage(channel, message); - - switch (message) - { - case PlayMeleeWeaponAnimationMessage playMsg: - PlayWeaponArc(playMsg); - break; - } - } - public override void FrameUpdate(float frameTime) { base.FrameUpdate(frameTime); @@ -58,7 +37,7 @@ namespace Content.Client.GameObjects.EntitySystems } } - private void PlayWeaponArc(PlayMeleeWeaponAnimationMessage msg) + private void PlayWeaponArc(object sender, PlayMeleeWeaponAnimationMessage msg) { if (!_prototypeManager.TryIndex(msg.ArcPrototype, out MeleeWeaponAnimationPrototype weaponArc)) { diff --git a/Content.Client/GameObjects/EntitySystems/VerbSystem.cs b/Content.Client/GameObjects/EntitySystems/VerbSystem.cs index 6054f450d3..ec9d8dd3c2 100644 --- a/Content.Client/GameObjects/EntitySystems/VerbSystem.cs +++ b/Content.Client/GameObjects/EntitySystems/VerbSystem.cs @@ -9,15 +9,12 @@ using JetBrains.Annotations; using Robust.Client.GameObjects.EntitySystems; using Robust.Client.Interfaces.Input; using Robust.Client.Interfaces.State; -using Robust.Client.Interfaces.UserInterface; using Robust.Client.Player; -using Robust.Client.State.States; using Robust.Client.UserInterface.Controls; using Robust.Shared.GameObjects; using Robust.Shared.GameObjects.Systems; using Robust.Shared.Input; using Robust.Shared.Interfaces.GameObjects; -using Robust.Shared.Interfaces.Network; using Robust.Shared.IoC; using Robust.Shared.Log; using Robust.Shared.Map; @@ -43,6 +40,8 @@ namespace Content.Client.GameObjects.EntitySystems { base.Initialize(); + SubscribeEvent(FillEntityPopup); + IoCManager.InjectDependencies(this); var input = EntitySystemManager.GetEntitySystem(); @@ -50,24 +49,17 @@ namespace Content.Client.GameObjects.EntitySystems new PointerInputCmdHandler(OnOpenContextMenu)); } - public override void RegisterMessageTypes() - { - base.RegisterMessageTypes(); - - RegisterMessageType(); - } - public void OpenContextMenu(IEntity entity, ScreenCoordinates screenCoordinates) { if (_currentPopup != null) { - _closeContextMenu(); + CloseContextMenu(); } _currentEntity = entity.Uid; _currentPopup = new VerbPopup(); _currentPopup.UserInterfaceManager.ModalRoot.AddChild(_currentPopup); - _currentPopup.OnPopupHide += _closeContextMenu; + _currentPopup.OnPopupHide += CloseContextMenu; _currentPopup.List.AddChild(new Label {Text = "Waiting on Server..."}); RaiseNetworkEvent(new VerbSystemMessages.RequestVerbsMessage(_currentEntity)); @@ -81,7 +73,7 @@ namespace Content.Client.GameObjects.EntitySystems { if (_currentPopup != null) { - _closeContextMenu(); + CloseContextMenu(); return true; } @@ -98,7 +90,7 @@ namespace Content.Client.GameObjects.EntitySystems } _currentPopup = new VerbPopup(); - _currentPopup.OnPopupHide += _closeContextMenu; + _currentPopup.OnPopupHide += CloseContextMenu; foreach (var entity in entities) { var button = new Button {Text = entity.Name}; @@ -120,19 +112,7 @@ namespace Content.Client.GameObjects.EntitySystems OpenContextMenu(entity, new ScreenCoordinates(_inputManager.MouseScreenPosition)); } - public override void HandleNetMessage(INetChannel channel, EntitySystemMessage message) - { - base.HandleNetMessage(channel, message); - - switch (message) - { - case VerbSystemMessages.VerbsResponseMessage resp: - _fillEntityPopup(resp); - break; - } - } - - private void _fillEntityPopup(VerbSystemMessages.VerbsResponseMessage msg) + private void FillEntityPopup(object sender, VerbSystemMessages.VerbsResponseMessage msg) { if (_currentEntity != msg.Entity || !_entityManager.TryGetEntity(_currentEntity, out var entity)) { @@ -153,7 +133,7 @@ namespace Content.Client.GameObjects.EntitySystems button.OnPressed += _ => { RaiseNetworkEvent(new VerbSystemMessages.UseVerbMessage(_currentEntity, data.Key)); - _closeContextMenu(); + CloseContextMenu(); }; } @@ -210,7 +190,7 @@ namespace Content.Client.GameObjects.EntitySystems { button.OnPressed += _ => { - _closeContextMenu(); + CloseContextMenu(); try { action.Invoke(); @@ -224,7 +204,7 @@ namespace Content.Client.GameObjects.EntitySystems return button; } - private void _closeContextMenu() + private void CloseContextMenu() { _currentPopup?.Dispose(); _currentPopup = null; diff --git a/Content.Server/GameObjects/EntitySystems/Click/ExamineSystem.cs b/Content.Server/GameObjects/EntitySystems/Click/ExamineSystem.cs index 7b0cfd0696..55ce7e3d3e 100644 --- a/Content.Server/GameObjects/EntitySystems/Click/ExamineSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/Click/ExamineSystem.cs @@ -1,9 +1,7 @@ using Content.Shared.GameObjects.EntitySystemMessages; using Content.Shared.GameObjects.EntitySystems; using Robust.Server.Interfaces.Player; -using Robust.Shared.GameObjects; using Robust.Shared.Interfaces.GameObjects; -using Robust.Shared.Interfaces.Network; using Robust.Shared.IoC; using Robust.Shared.Maths; using Robust.Shared.Utility; @@ -37,17 +35,12 @@ namespace Content.Server.GameObjects.EntitySystems { base.Initialize(); + SubscribeEvent((sender, ev) => ExamineInfoRequest(ev)); + IoCManager.InjectDependencies(this); } - public override void RegisterMessageTypes() - { - base.RegisterMessageTypes(); - - RegisterMessageType(); - } - - private FormattedMessage GetExamineText(IEntity entity) + private static FormattedMessage GetExamineText(IEntity entity) { var message = new FormattedMessage(); @@ -82,11 +75,10 @@ namespace Content.Server.GameObjects.EntitySystems return message; } - public override void HandleNetMessage(INetChannel channel, EntitySystemMessage message) + private void ExamineInfoRequest(ExamineSystemMessages.RequestExamineInfoMessage request) { - base.HandleNetMessage(channel, message); - - if (!(message is ExamineSystemMessages.RequestExamineInfoMessage request)) + var channel = request.NetChannel; + if(channel == null) return; var session = _playerManager.GetSessionByChannel(channel); diff --git a/Content.Server/GameObjects/EntitySystems/CombatModeSystem.cs b/Content.Server/GameObjects/EntitySystems/CombatModeSystem.cs index cf1c98670c..e78ec6fbcf 100644 --- a/Content.Server/GameObjects/EntitySystems/CombatModeSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/CombatModeSystem.cs @@ -1,4 +1,4 @@ -using Content.Server.GameObjects.Components.Mobs; +using Content.Server.GameObjects.Components.Mobs; using Content.Shared.Input; using JetBrains.Annotations; using Robust.Server.GameObjects.EntitySystems; @@ -6,7 +6,6 @@ using Robust.Server.Interfaces.Player; using Robust.Shared.GameObjects; using Robust.Shared.GameObjects.Systems; using Robust.Shared.Input; -using Robust.Shared.Interfaces.Network; using Robust.Shared.IoC; using Robust.Shared.Players; using static Content.Shared.GameObjects.EntitySystemMessages.CombatModeSystemMessages; @@ -24,17 +23,45 @@ namespace Content.Server.GameObjects.EntitySystems { base.Initialize(); + SubscribeEvent(SetTargetZoneHandler); + SubscribeEvent(SetCombatModeActiveHandler); + var inputSystem = EntitySystemManager.GetEntitySystem(); inputSystem.BindMap.BindFunction(ContentKeyFunctions.ToggleCombatMode, InputCmdHandler.FromDelegate(CombatModeToggled)); } - public override void RegisterMessageTypes() + private void SetCombatModeActiveHandler(object sender, SetCombatModeActiveMessage ev) { - base.RegisterMessageTypes(); + if (!TryGetCombatComponent(ev, out var combatModeComponent)) + return; + + combatModeComponent.IsInCombatMode = ev.Active; + } + + private void SetTargetZoneHandler(object sender, SetTargetZoneMessage ev) + { + if (!TryGetCombatComponent(ev, out var combatModeComponent)) + return; + + combatModeComponent.ActiveZone = ev.TargetZone; + } + + private bool TryGetCombatComponent(EntitySystemMessage ev, out CombatModeComponent combatModeComponent) + { + if (ev.NetChannel == null) + { + combatModeComponent = default; + return false; + } + + var player = _playerManager.GetSessionByChannel(ev.NetChannel); + if (player.AttachedEntity != null && player.AttachedEntity.TryGetComponent(out combatModeComponent)) + return true; + + combatModeComponent = default; + return false; - RegisterMessageType(); - RegisterMessageType(); } private static void CombatModeToggled(ICommonSession session) @@ -49,28 +76,5 @@ namespace Content.Server.GameObjects.EntitySystems combatModeComponent.IsInCombatMode = !combatModeComponent.IsInCombatMode; } - - public override void HandleNetMessage(INetChannel channel, EntitySystemMessage message) - { - base.HandleNetMessage(channel, message); - - var player = _playerManager.GetSessionByChannel(channel); - if (player.AttachedEntity == null - || !player.AttachedEntity.TryGetComponent(out CombatModeComponent combatModeComponent)) - { - return; - } - - switch (message) - { - case SetTargetZoneMessage setTargetZone: - combatModeComponent.ActiveZone = setTargetZone.TargetZone; - break; - - case SetCombatModeActiveMessage setActive: - combatModeComponent.IsInCombatMode = setActive.Active; - break; - } - } } } diff --git a/Content.Server/GameObjects/EntitySystems/HandsSystem.cs b/Content.Server/GameObjects/EntitySystems/HandsSystem.cs index 617047cbed..3bbf6ec7f1 100644 --- a/Content.Server/GameObjects/EntitySystems/HandsSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/HandsSystem.cs @@ -41,6 +41,9 @@ namespace Content.Server.GameObjects.EntitySystems { base.Initialize(); + SubscribeEvent(HandleContainerModified); + SubscribeEvent(HandleContainerModified); + var input = EntitySystemManager.GetEntitySystem(); input.BindMap.BindFunction(ContentKeyFunctions.SwapHands, InputCmdHandler.FromDelegate(HandleSwapHands)); input.BindMap.BindFunction(ContentKeyFunctions.Drop, new PointerInputCmdHandler(HandleDrop)); @@ -62,13 +65,6 @@ namespace Content.Server.GameObjects.EntitySystems base.Shutdown(); } - /// - public override void SubscribeEvents() - { - SubscribeEvent(HandleContainerModified); - SubscribeEvent(HandleContainerModified); - } - private static void HandleContainerModified(object sender, ContainerModifiedMessage args) { if (args.Container.Owner.TryGetComponent(out IHandsComponent handsComponent)) diff --git a/Content.Server/GameObjects/EntitySystems/StorageSystem.cs b/Content.Server/GameObjects/EntitySystems/StorageSystem.cs index cc54bf3d46..6a325ed387 100644 --- a/Content.Server/GameObjects/EntitySystems/StorageSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/StorageSystem.cs @@ -14,16 +14,10 @@ namespace Content.Server.GameObjects.EntitySystems /// public override void Initialize() { - EntityQuery = new TypeEntityQuery(typeof(ServerStorageComponent)); - } - - /// - public override void SubscribeEvents() - { - base.SubscribeEvents(); - SubscribeEvent(HandleEntityRemovedFromContainer); SubscribeEvent(HandleEntityInsertedIntoContainer); + + EntityQuery = new TypeEntityQuery(typeof(ServerStorageComponent)); } /// diff --git a/Content.Server/GameObjects/EntitySystems/VerbSystem.cs b/Content.Server/GameObjects/EntitySystems/VerbSystem.cs index 97feeb17dc..754cfe11c9 100644 --- a/Content.Server/GameObjects/EntitySystems/VerbSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/VerbSystem.cs @@ -2,10 +2,8 @@ using System.Reflection; using Content.Shared.GameObjects; using Robust.Server.Interfaces.Player; -using Robust.Shared.GameObjects; using Robust.Shared.GameObjects.Systems; using Robust.Shared.Interfaces.GameObjects; -using Robust.Shared.Interfaces.Network; using Robust.Shared.IoC; using static Content.Shared.GameObjects.EntitySystemMessages.VerbSystemMessages; @@ -22,120 +20,112 @@ namespace Content.Server.GameObjects.EntitySystems { base.Initialize(); + SubscribeEvent((sender, ev) => RequestVerbs(ev)); + SubscribeEvent((sender, ev) => UseVerb(ev)); + IoCManager.InjectDependencies(this); } - public override void RegisterMessageTypes() + private void UseVerb(UseVerbMessage use) { - base.RegisterMessageTypes(); + var channel = use.NetChannel; + if(channel == null) + return; - RegisterMessageType(); - RegisterMessageType(); + if (!_entityManager.TryGetEntity(use.EntityUid, out var entity)) + { + return; + } + + var session = _playerManager.GetSessionByChannel(channel); + var userEntity = session.AttachedEntity; + + foreach (var (component, verb) in VerbUtility.GetVerbs(entity)) + { + if ($"{component.GetType()}:{verb.GetType()}" != use.VerbKey) + { + continue; + } + + if (verb.RequireInteractionRange) + { + var distanceSquared = (userEntity.Transform.WorldPosition - entity.Transform.WorldPosition) + .LengthSquared; + if (distanceSquared > VerbUtility.InteractionRangeSquared) + { + break; + } + } + + verb.Activate(userEntity, component); + break; + } + + foreach (var globalVerb in VerbUtility.GetGlobalVerbs(Assembly.GetExecutingAssembly())) + { + if (globalVerb.GetType().ToString() != use.VerbKey) + { + continue; + } + + if (globalVerb.RequireInteractionRange) + { + var distanceSquared = (userEntity.Transform.WorldPosition - entity.Transform.WorldPosition) + .LengthSquared; + if (distanceSquared > VerbUtility.InteractionRangeSquared) + { + break; + } + } + + globalVerb.Activate(userEntity, entity); + break; + } } - public override void HandleNetMessage(INetChannel channel, EntitySystemMessage message) + private void RequestVerbs(RequestVerbsMessage req) { - base.HandleNetMessage(channel, message); + var channel = req.NetChannel; + if (channel == null) + return; - switch (message) + if (!_entityManager.TryGetEntity(req.EntityUid, out var entity)) { - case RequestVerbsMessage req: - { - if (!_entityManager.TryGetEntity(req.EntityUid, out var entity)) - { - return; - } - - var session = _playerManager.GetSessionByChannel(channel); - var userEntity = session.AttachedEntity; - - var data = new List(); - //Get verbs, component dependent. - foreach (var (component, verb) in VerbUtility.GetVerbs(entity)) - { - if (verb.RequireInteractionRange && !VerbUtility.InVerbUseRange(userEntity, entity)) - continue; - if(VerbUtility.IsVerbInvisible(verb, userEntity, component, out var vis)) - continue; - - // TODO: These keys being giant strings is inefficient as hell. - data.Add(new VerbsResponseMessage.VerbData(verb.GetText(userEntity, component), - $"{component.GetType()}:{verb.GetType()}", - vis == VerbVisibility.Visible)); - } - //Get global verbs. Visible for all entities regardless of their components. - foreach (var globalVerb in VerbUtility.GetGlobalVerbs(Assembly.GetExecutingAssembly())) - { - if (globalVerb.RequireInteractionRange && !VerbUtility.InVerbUseRange(userEntity, entity)) - continue; - if(VerbUtility.IsVerbInvisible(globalVerb, userEntity, entity, out var vis)) - continue; - - data.Add(new VerbsResponseMessage.VerbData(globalVerb.GetText(userEntity, entity), - globalVerb.GetType().ToString(), vis == VerbVisibility.Visible)); - } - - var response = new VerbsResponseMessage(data, req.EntityUid); - RaiseNetworkEvent(response, channel); - break; - } - - - case UseVerbMessage use: - { - if (!_entityManager.TryGetEntity(use.EntityUid, out var entity)) - { - return; - } - - var session = _playerManager.GetSessionByChannel(channel); - var userEntity = session.AttachedEntity; - - foreach (var (component, verb) in VerbUtility.GetVerbs(entity)) - { - if ($"{component.GetType()}:{verb.GetType()}" != use.VerbKey) - { - continue; - } - - if (verb.RequireInteractionRange) - { - var distanceSquared = (userEntity.Transform.WorldPosition - entity.Transform.WorldPosition) - .LengthSquared; - if (distanceSquared > VerbUtility.InteractionRangeSquared) - { - break; - } - } - - verb.Activate(userEntity, component); - break; - } - - foreach (var globalVerb in VerbUtility.GetGlobalVerbs(Assembly.GetExecutingAssembly())) - { - if (globalVerb.GetType().ToString() != use.VerbKey) - { - continue; - } - - if (globalVerb.RequireInteractionRange) - { - var distanceSquared = (userEntity.Transform.WorldPosition - entity.Transform.WorldPosition) - .LengthSquared; - if (distanceSquared > VerbUtility.InteractionRangeSquared) - { - break; - } - } - - globalVerb.Activate(userEntity, entity); - break; - } - - break; - } + return; } + + var session = _playerManager.GetSessionByChannel(channel); + var userEntity = session.AttachedEntity; + + var data = new List(); + //Get verbs, component dependent. + foreach (var (component, verb) in VerbUtility.GetVerbs(entity)) + { + if (verb.RequireInteractionRange && !VerbUtility.InVerbUseRange(userEntity, entity)) + continue; + if (VerbUtility.IsVerbInvisible(verb, userEntity, component, out var vis)) + continue; + + // TODO: These keys being giant strings is inefficient as hell. + data.Add(new VerbsResponseMessage.VerbData(verb.GetText(userEntity, component), + $"{component.GetType()}:{verb.GetType()}", + vis == VerbVisibility.Visible)); + } + + //Get global verbs. Visible for all entities regardless of their components. + foreach (var globalVerb in VerbUtility.GetGlobalVerbs(Assembly.GetExecutingAssembly())) + { + if (globalVerb.RequireInteractionRange && !VerbUtility.InVerbUseRange(userEntity, entity)) + continue; + if (VerbUtility.IsVerbInvisible(globalVerb, userEntity, entity, out var vis)) + continue; + + data.Add(new VerbsResponseMessage.VerbData(globalVerb.GetText(userEntity, entity), + globalVerb.GetType().ToString(), vis == VerbVisibility.Visible)); + } + + var response = new VerbsResponseMessage(data, req.EntityUid); + RaiseNetworkEvent(response, channel); } } } diff --git a/SpaceStation14.sln b/SpaceStation14.sln index 7491a95f7a..827298e3ed 100644 --- a/SpaceStation14.sln +++ b/SpaceStation14.sln @@ -1,17 +1,17 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.26730.16 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29709.97 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Content.Shared", "Content.Shared\Content.Shared.csproj", "{26AEEBB3-DDE7-443A-9F43-7BC7F4ACF6B5}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Content.Shared", "Content.Shared\Content.Shared.csproj", "{26AEEBB3-DDE7-443A-9F43-7BC7F4ACF6B5}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Content.Server", "Content.Server\Content.Server.csproj", "{B38DBBD0-04C2-4D1A-84E2-B3446F6ADF2A}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Content.Server", "Content.Server\Content.Server.csproj", "{B38DBBD0-04C2-4D1A-84E2-B3446F6ADF2A}" ProjectSection(ProjectDependencies) = postProject {59250BAF-0000-0000-0000-000000000000} = {59250BAF-0000-0000-0000-000000000000} {26AEEBB3-DDE7-443A-9F43-7BC7F4ACF6B5} = {26AEEBB3-DDE7-443A-9F43-7BC7F4ACF6B5} EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Content.Client", "Content.Client\Content.Client.csproj", "{A2E5F175-78AF-4DDD-8F97-E2D2552372ED}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Content.Client", "Content.Client\Content.Client.csproj", "{A2E5F175-78AF-4DDD-8F97-E2D2552372ED}" ProjectSection(ProjectDependencies) = postProject {59250BAF-0000-0000-0000-000000000000} = {59250BAF-0000-0000-0000-000000000000} EndProjectSection @@ -20,36 +20,36 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build Checker", "Build Chec EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BuildChecker", "BuildChecker\BuildChecker.csproj", "{C899FCA4-7037-4E49-ABC2-44DE72487110}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Content.Tests", "Content.Tests\Content.Tests.csproj", "{8EDF4429-251A-416D-BB68-93F227191BCF}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Content.Tests", "Content.Tests\Content.Tests.csproj", "{8EDF4429-251A-416D-BB68-93F227191BCF}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "RobustToolbox", "RobustToolbox", "{83B4CBBA-547A-42F0-A7CD-8A67D93196CE}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lidgren.Network", "RobustToolbox\Lidgren.Network\Lidgren.Network.csproj", "{59250BAF-0000-0000-0000-000000000000}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Lidgren.Network", "RobustToolbox\Lidgren.Network\Lidgren.Network.csproj", "{59250BAF-0000-0000-0000-000000000000}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Robust.Client", "RobustToolbox\Robust.Client\Robust.Client.csproj", "{83429BD6-6358-4B18-BE51-401DF8EA2673}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Robust.Client", "RobustToolbox\Robust.Client\Robust.Client.csproj", "{83429BD6-6358-4B18-BE51-401DF8EA2673}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Robust.Server", "RobustToolbox\Robust.Server\Robust.Server.csproj", "{B04AAE71-0000-0000-0000-000000000000}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Robust.Server", "RobustToolbox\Robust.Server\Robust.Server.csproj", "{B04AAE71-0000-0000-0000-000000000000}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Robust.Shared.Maths", "RobustToolbox\Robust.Shared.Maths\Robust.Shared.Maths.csproj", "{93F23A82-00C5-4572-964E-E7C9457726D4}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Robust.Shared.Maths", "RobustToolbox\Robust.Shared.Maths\Robust.Shared.Maths.csproj", "{93F23A82-00C5-4572-964E-E7C9457726D4}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Robust.UnitTesting", "RobustToolbox\Robust.UnitTesting\Robust.UnitTesting.csproj", "{F0ADA779-40B8-4F7E-BA6C-CDB19F3065D9}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Robust.UnitTesting", "RobustToolbox\Robust.UnitTesting\Robust.UnitTesting.csproj", "{F0ADA779-40B8-4F7E-BA6C-CDB19F3065D9}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Robust.Shared", "RobustToolbox\Robust.Shared\Robust.Shared.csproj", "{0529F740-0000-0000-0000-000000000000}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Robust.Shared", "RobustToolbox\Robust.Shared\Robust.Shared.csproj", "{0529F740-0000-0000-0000-000000000000}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Content.IntegrationTests", "Content.IntegrationTests\Content.IntegrationTests.csproj", "{AB7AF1C8-30FF-4436-9DF0-179BE5B0C132}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Content.Benchmarks", "Content.Benchmarks\Content.Benchmarks.csproj", "{7AC832A1-2461-4EB5-AC26-26F6AFFA9E46}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Content.Benchmarks", "Content.Benchmarks\Content.Benchmarks.csproj", "{7AC832A1-2461-4EB5-AC26-26F6AFFA9E46}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenToolkit.GraphicsLibraryFramework", "RobustToolbox\OpenToolkit.GraphicsLibraryFramework\OpenToolkit.GraphicsLibraryFramework.csproj", "{4809F412-3132-419E-BF9D-CCF7593C3533}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenToolkit.GraphicsLibraryFramework", "RobustToolbox\OpenToolkit.GraphicsLibraryFramework\OpenToolkit.GraphicsLibraryFramework.csproj", "{4809F412-3132-419E-BF9D-CCF7593C3533}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Content.Server.Database", "Content.Server.Database\Content.Server.Database.csproj", "{45C9B43F-305D-4651-9863-F6384CBC847F}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Content.Server.Database", "Content.Server.Database\Content.Server.Database.csproj", "{45C9B43F-305D-4651-9863-F6384CBC847F}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "MSBuild", "MSBuild", "{50404922-9637-4394-BF59-165D0850ADC8}" -ProjectSection(SolutionItems) = preProject - RobustToolbox\MSBuild\Robust.DefineConstants.targets = RobustToolbox\MSBuild\Robust.DefineConstants.targets - RobustToolbox\MSBuild\Robust.Engine.targets = RobustToolbox\MSBuild\Robust.Engine.targets - RobustToolbox\MSBuild\Robust.Properties.targets = RobustToolbox\MSBuild\Robust.Properties.targets -EndProjectSection + ProjectSection(SolutionItems) = preProject + RobustToolbox\MSBuild\Robust.DefineConstants.targets = RobustToolbox\MSBuild\Robust.DefineConstants.targets + RobustToolbox\MSBuild\Robust.Engine.targets = RobustToolbox\MSBuild\Robust.Engine.targets + RobustToolbox\MSBuild\Robust.Properties.targets = RobustToolbox\MSBuild\Robust.Properties.targets + EndProjectSection EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -70,41 +70,41 @@ Global {A2E5F175-78AF-4DDD-8F97-E2D2552372ED}.Release|x64.ActiveCfg = Release|x64 {A2E5F175-78AF-4DDD-8F97-E2D2552372ED}.Release|x64.Build.0 = Release|x64 {C899FCA4-7037-4E49-ABC2-44DE72487110}.Debug|x64.ActiveCfg = Debug|Any CPU + {C899FCA4-7037-4E49-ABC2-44DE72487110}.Debug|x64.Build.0 = Debug|Any CPU {C899FCA4-7037-4E49-ABC2-44DE72487110}.Release|x64.ActiveCfg = Debug|Any CPU {C899FCA4-7037-4E49-ABC2-44DE72487110}.Release|x64.Build.0 = Debug|Any CPU - {C899FCA4-7037-4E49-ABC2-44DE72487110}.Debug|x64.Build.0 = Debug|Any CPU {8EDF4429-251A-416D-BB68-93F227191BCF}.Debug|x64.ActiveCfg = Debug|x64 {8EDF4429-251A-416D-BB68-93F227191BCF}.Debug|x64.Build.0 = Debug|x64 {8EDF4429-251A-416D-BB68-93F227191BCF}.Release|x64.ActiveCfg = Release|x64 {8EDF4429-251A-416D-BB68-93F227191BCF}.Release|x64.Build.0 = Release|x64 - {AB7AF1C8-30FF-4436-9DF0-179BE5B0C132}.Debug|x64.ActiveCfg = Debug|x64 - {AB7AF1C8-30FF-4436-9DF0-179BE5B0C132}.Debug|x64.Build.0 = Debug|x64 - {AB7AF1C8-30FF-4436-9DF0-179BE5B0C132}.Release|x64.ActiveCfg = Release|x64 - {AB7AF1C8-30FF-4436-9DF0-179BE5B0C132}.Release|x64.Build.0 = Release|x64 - {93F23A82-00C5-4572-964E-E7C9457726D4}.Debug|x64.ActiveCfg = Debug|x64 - {93F23A82-00C5-4572-964E-E7C9457726D4}.Debug|x64.Build.0 = Debug|x64 - {93F23A82-00C5-4572-964E-E7C9457726D4}.Release|x64.ActiveCfg = Release|x64 - {93F23A82-00C5-4572-964E-E7C9457726D4}.Release|x64.Build.0 = Release|x64 - {0529F740-0000-0000-0000-000000000000}.Debug|x64.ActiveCfg = Debug|x64 - {0529F740-0000-0000-0000-000000000000}.Debug|x64.Build.0 = Debug|x64 - {0529F740-0000-0000-0000-000000000000}.Release|x64.ActiveCfg = Release|x64 - {0529F740-0000-0000-0000-000000000000}.Release|x64.Build.0 = Release|x64 - {B04AAE71-0000-0000-0000-000000000000}.Debug|x64.ActiveCfg = Debug|x64 - {B04AAE71-0000-0000-0000-000000000000}.Debug|x64.Build.0 = Debug|x64 - {B04AAE71-0000-0000-0000-000000000000}.Release|x64.ActiveCfg = Release|x64 - {B04AAE71-0000-0000-0000-000000000000}.Release|x64.Build.0 = Release|x64 + {59250BAF-0000-0000-0000-000000000000}.Debug|x64.ActiveCfg = Debug|Any CPU + {59250BAF-0000-0000-0000-000000000000}.Debug|x64.Build.0 = Debug|Any CPU + {59250BAF-0000-0000-0000-000000000000}.Release|x64.ActiveCfg = Release|Any CPU + {59250BAF-0000-0000-0000-000000000000}.Release|x64.Build.0 = Release|Any CPU {83429BD6-6358-4B18-BE51-401DF8EA2673}.Debug|x64.ActiveCfg = Debug|x64 {83429BD6-6358-4B18-BE51-401DF8EA2673}.Debug|x64.Build.0 = Debug|x64 {83429BD6-6358-4B18-BE51-401DF8EA2673}.Release|x64.ActiveCfg = Release|x64 {83429BD6-6358-4B18-BE51-401DF8EA2673}.Release|x64.Build.0 = Release|x64 - {59250BAF-0000-0000-0000-000000000000}.Release|x64.ActiveCfg = Release|Any CPU - {59250BAF-0000-0000-0000-000000000000}.Release|x64.Build.0 = Release|Any CPU - {59250BAF-0000-0000-0000-000000000000}.Debug|x64.ActiveCfg = Debug|Any CPU - {59250BAF-0000-0000-0000-000000000000}.Debug|x64.Build.0 = Debug|Any CPU + {B04AAE71-0000-0000-0000-000000000000}.Debug|x64.ActiveCfg = Debug|x64 + {B04AAE71-0000-0000-0000-000000000000}.Debug|x64.Build.0 = Debug|x64 + {B04AAE71-0000-0000-0000-000000000000}.Release|x64.ActiveCfg = Release|x64 + {B04AAE71-0000-0000-0000-000000000000}.Release|x64.Build.0 = Release|x64 + {93F23A82-00C5-4572-964E-E7C9457726D4}.Debug|x64.ActiveCfg = Debug|x64 + {93F23A82-00C5-4572-964E-E7C9457726D4}.Debug|x64.Build.0 = Debug|x64 + {93F23A82-00C5-4572-964E-E7C9457726D4}.Release|x64.ActiveCfg = Release|x64 + {93F23A82-00C5-4572-964E-E7C9457726D4}.Release|x64.Build.0 = Release|x64 {F0ADA779-40B8-4F7E-BA6C-CDB19F3065D9}.Debug|x64.ActiveCfg = Debug|x64 {F0ADA779-40B8-4F7E-BA6C-CDB19F3065D9}.Debug|x64.Build.0 = Debug|x64 {F0ADA779-40B8-4F7E-BA6C-CDB19F3065D9}.Release|x64.ActiveCfg = Release|x64 {F0ADA779-40B8-4F7E-BA6C-CDB19F3065D9}.Release|x64.Build.0 = Release|x64 + {0529F740-0000-0000-0000-000000000000}.Debug|x64.ActiveCfg = Debug|x64 + {0529F740-0000-0000-0000-000000000000}.Debug|x64.Build.0 = Debug|x64 + {0529F740-0000-0000-0000-000000000000}.Release|x64.ActiveCfg = Release|x64 + {0529F740-0000-0000-0000-000000000000}.Release|x64.Build.0 = Release|x64 + {AB7AF1C8-30FF-4436-9DF0-179BE5B0C132}.Debug|x64.ActiveCfg = Debug|x64 + {AB7AF1C8-30FF-4436-9DF0-179BE5B0C132}.Debug|x64.Build.0 = Debug|x64 + {AB7AF1C8-30FF-4436-9DF0-179BE5B0C132}.Release|x64.ActiveCfg = Release|x64 + {AB7AF1C8-30FF-4436-9DF0-179BE5B0C132}.Release|x64.Build.0 = Release|x64 {7AC832A1-2461-4EB5-AC26-26F6AFFA9E46}.Debug|x64.ActiveCfg = Debug|x64 {7AC832A1-2461-4EB5-AC26-26F6AFFA9E46}.Debug|x64.Build.0 = Debug|x64 {7AC832A1-2461-4EB5-AC26-26F6AFFA9E46}.Release|x64.ActiveCfg = Release|x64 @@ -113,10 +113,10 @@ Global {4809F412-3132-419E-BF9D-CCF7593C3533}.Debug|x64.Build.0 = Debug|x64 {4809F412-3132-419E-BF9D-CCF7593C3533}.Release|x64.ActiveCfg = Release|x64 {4809F412-3132-419E-BF9D-CCF7593C3533}.Release|x64.Build.0 = Release|x64 - {45C9B43F-305D-4651-9863-F6384CBC847F}.Debug|x64.ActiveCfg = Debug|Any CPU - {45C9B43F-305D-4651-9863-F6384CBC847F}.Debug|x64.Build.0 = Debug|Any CPU - {45C9B43F-305D-4651-9863-F6384CBC847F}.Release|x64.ActiveCfg = Release|Any CPU - {45C9B43F-305D-4651-9863-F6384CBC847F}.Release|x64.Build.0 = Release|Any CPU + {45C9B43F-305D-4651-9863-F6384CBC847F}.Debug|x64.ActiveCfg = Debug|x64 + {45C9B43F-305D-4651-9863-F6384CBC847F}.Debug|x64.Build.0 = Debug|x64 + {45C9B43F-305D-4651-9863-F6384CBC847F}.Release|x64.ActiveCfg = Release|x64 + {45C9B43F-305D-4651-9863-F6384CBC847F}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE From e719745b10b06d866fdcb4dff47854e46d807be7 Mon Sep 17 00:00:00 2001 From: Acruid Date: Wed, 19 Feb 2020 14:39:00 -0800 Subject: [PATCH 2/4] Removed the Sender object from events. If you needed this field, add it to the event class. --- .../IconSmoothing/IconSmoothComponent.cs | 6 +++--- .../Components/SubFloorHideComponent.cs | 17 +++++++++++++---- .../GameObjects/Components/WindowComponent.cs | 4 ++-- .../EntitySystems/IconSmoothSystem.cs | 9 ++++++--- .../EntitySystems/MeleeWeaponSystem.cs | 2 +- .../EntitySystems/SubFloorHideSystem.cs | 12 +++--------- .../GameObjects/EntitySystems/VerbSystem.cs | 2 +- .../GameObjects/EntitySystems/WindowSystem.cs | 14 ++++++++++---- .../EntitySystems/Click/ExamineSystem.cs | 2 +- .../EntitySystems/CombatModeSystem.cs | 4 ++-- .../GameObjects/EntitySystems/HandsSystem.cs | 2 +- .../GameObjects/EntitySystems/MoverSystem.cs | 4 ++-- .../GameObjects/EntitySystems/StorageSystem.cs | 4 ++-- .../GameObjects/EntitySystems/VerbSystem.cs | 4 ++-- .../GameTicking/GameRules/RuleDeathMatch.cs | 2 +- 15 files changed, 50 insertions(+), 38 deletions(-) diff --git a/Content.Client/GameObjects/Components/IconSmoothing/IconSmoothComponent.cs b/Content.Client/GameObjects/Components/IconSmoothing/IconSmoothComponent.cs index 8a8670d0b6..039eba03f9 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.EventBus.RaiseEvent(Owner, new IconSmoothDirtyEvent(null, SnapGrid.Offset, Mode)); + Owner.EntityManager.EventBus.RaiseEvent(new IconSmoothDirtyEvent(Owner,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.EventBus.RaiseEvent(Owner, new IconSmoothDirtyEvent(_lastPosition, SnapGrid.Offset, Mode)); + Owner.EntityManager.EventBus.RaiseEvent(new IconSmoothDirtyEvent(Owner, _lastPosition, SnapGrid.Offset, Mode)); } private void SnapGridOnPositionChanged() { - Owner.EntityManager.EventBus.RaiseEvent(Owner, new IconSmoothDirtyEvent(_lastPosition, SnapGrid.Offset, Mode)); + Owner.EntityManager.EventBus.RaiseEvent(new IconSmoothDirtyEvent(Owner, _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 a9b2aa3424..cf8d72f286 100644 --- a/Content.Client/GameObjects/Components/SubFloorHideComponent.cs +++ b/Content.Client/GameObjects/Components/SubFloorHideComponent.cs @@ -1,6 +1,7 @@ using Robust.Client.Interfaces.GameObjects.Components; using Robust.Shared.GameObjects; using Robust.Shared.GameObjects.Components.Transform; +using Robust.Shared.Interfaces.GameObjects; namespace Content.Client.GameObjects.Components { @@ -32,7 +33,7 @@ namespace Content.Client.GameObjects.Components base.Startup(); _snapGridComponent.OnPositionChanged += SnapGridOnPositionChanged; - Owner.EntityManager.EventBus.RaiseEvent(Owner, new SubFloorHideDirtyEvent()); + Owner.EntityManager.EventBus.RaiseEvent(new SubFloorHideDirtyEvent(Owner)); } /// @@ -44,14 +45,22 @@ namespace Content.Client.GameObjects.Components return; _snapGridComponent.OnPositionChanged -= SnapGridOnPositionChanged; - Owner.EntityManager.EventBus.RaiseEvent(Owner, new SubFloorHideDirtyEvent()); + Owner.EntityManager.EventBus.RaiseEvent(new SubFloorHideDirtyEvent(Owner)); } private void SnapGridOnPositionChanged() { - Owner.EntityManager.EventBus.RaiseEvent(Owner, new SubFloorHideDirtyEvent()); + Owner.EntityManager.EventBus.RaiseEvent(new SubFloorHideDirtyEvent(Owner)); } } - internal sealed class SubFloorHideDirtyEvent : EntitySystemMessage { } + internal sealed class SubFloorHideDirtyEvent : EntitySystemMessage + { + public IEntity Sender { get; } + + public SubFloorHideDirtyEvent(IEntity sender) + { + Sender = sender; + } + } } diff --git a/Content.Client/GameObjects/Components/WindowComponent.cs b/Content.Client/GameObjects/Components/WindowComponent.cs index 3aec3f09a9..f3f807c75d 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.EventBus.RaiseEvent(Owner, new WindowSmoothDirtyEvent()); + Owner.EntityManager.EventBus.RaiseEvent(new WindowSmoothDirtyEvent(Owner)); 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.EventBus.RaiseEvent(Owner, new WindowSmoothDirtyEvent()); + Owner.EntityManager.EventBus.RaiseEvent(new WindowSmoothDirtyEvent(Owner)); } public void UpdateSprite() diff --git a/Content.Client/GameObjects/EntitySystems/IconSmoothSystem.cs b/Content.Client/GameObjects/EntitySystems/IconSmoothSystem.cs index dc1c04d870..3b6aece8be 100644 --- a/Content.Client/GameObjects/EntitySystems/IconSmoothSystem.cs +++ b/Content.Client/GameObjects/EntitySystems/IconSmoothSystem.cs @@ -53,11 +53,12 @@ namespace Content.Client.GameObjects.EntitySystems } } - private void HandleDirtyEvent(object sender, IconSmoothDirtyEvent ev) + private void HandleDirtyEvent(IconSmoothDirtyEvent ev) { // Yes, we updates ALL smoothing entities surrounding us even if they would never smooth with us. // This is simpler to implement. If you want to optimize it be my guest. - if (sender is IEntity senderEnt && senderEnt.IsValid() && + var senderEnt = ev.Sender; + if (senderEnt.IsValid() && senderEnt.TryGetComponent(out IconSmoothComponent iconSmooth) && iconSmooth.Running) { @@ -137,15 +138,17 @@ namespace Content.Client.GameObjects.EntitySystems /// public sealed class IconSmoothDirtyEvent : EntitySystemMessage { - public IconSmoothDirtyEvent((GridId grid, MapIndices pos)? lastPosition, SnapGridOffset offset, IconSmoothingMode mode) + public IconSmoothDirtyEvent(IEntity sender, (GridId grid, MapIndices pos)? lastPosition, SnapGridOffset offset, IconSmoothingMode mode) { LastPosition = lastPosition; Offset = offset; Mode = mode; + Sender = sender; } public (GridId grid, MapIndices pos)? LastPosition { get; } public SnapGridOffset Offset { get; } public IconSmoothingMode Mode { get; } + public IEntity Sender { get; } } } diff --git a/Content.Client/GameObjects/EntitySystems/MeleeWeaponSystem.cs b/Content.Client/GameObjects/EntitySystems/MeleeWeaponSystem.cs index 9800018f6c..2f3c04e7a7 100644 --- a/Content.Client/GameObjects/EntitySystems/MeleeWeaponSystem.cs +++ b/Content.Client/GameObjects/EntitySystems/MeleeWeaponSystem.cs @@ -37,7 +37,7 @@ namespace Content.Client.GameObjects.EntitySystems } } - private void PlayWeaponArc(object sender, PlayMeleeWeaponAnimationMessage msg) + private void PlayWeaponArc(PlayMeleeWeaponAnimationMessage msg) { if (!_prototypeManager.TryIndex(msg.ArcPrototype, out MeleeWeaponAnimationPrototype weaponArc)) { diff --git a/Content.Client/GameObjects/EntitySystems/SubFloorHideSystem.cs b/Content.Client/GameObjects/EntitySystems/SubFloorHideSystem.cs index a373cf1ad9..b15e887080 100644 --- a/Content.Client/GameObjects/EntitySystems/SubFloorHideSystem.cs +++ b/Content.Client/GameObjects/EntitySystems/SubFloorHideSystem.cs @@ -3,7 +3,6 @@ using Content.Shared.Maps; using Robust.Client.Interfaces.GameObjects.Components; using Robust.Shared.GameObjects.Components.Transform; using Robust.Shared.GameObjects.Systems; -using Robust.Shared.Interfaces.GameObjects; using Robust.Shared.Interfaces.Map; using Robust.Shared.IoC; using Robust.Shared.Map; @@ -32,15 +31,10 @@ namespace Content.Client.GameObjects.EntitySystems SubscribeEvent(HandleDirtyEvent); } - private void HandleDirtyEvent(object sender, SubFloorHideDirtyEvent ev) + private void HandleDirtyEvent(SubFloorHideDirtyEvent ev) { - if (!(sender is IEntity senderEnt)) - { - return; - } - - var grid = _mapManager.GetGrid(senderEnt.Transform.GridID); - var indices = grid.WorldToTile(senderEnt.Transform.WorldPosition); + var grid = _mapManager.GetGrid(ev.Sender.Transform.GridID); + var indices = grid.WorldToTile(ev.Sender.Transform.WorldPosition); UpdateTile(grid, indices); } diff --git a/Content.Client/GameObjects/EntitySystems/VerbSystem.cs b/Content.Client/GameObjects/EntitySystems/VerbSystem.cs index ec9d8dd3c2..155a3900cc 100644 --- a/Content.Client/GameObjects/EntitySystems/VerbSystem.cs +++ b/Content.Client/GameObjects/EntitySystems/VerbSystem.cs @@ -112,7 +112,7 @@ namespace Content.Client.GameObjects.EntitySystems OpenContextMenu(entity, new ScreenCoordinates(_inputManager.MouseScreenPosition)); } - private void FillEntityPopup(object sender, VerbSystemMessages.VerbsResponseMessage msg) + private void FillEntityPopup(VerbSystemMessages.VerbsResponseMessage msg) { if (_currentEntity != msg.Entity || !_entityManager.TryGetEntity(_currentEntity, out var entity)) { diff --git a/Content.Client/GameObjects/EntitySystems/WindowSystem.cs b/Content.Client/GameObjects/EntitySystems/WindowSystem.cs index ae8e4c43b6..4e0ee313f5 100644 --- a/Content.Client/GameObjects/EntitySystems/WindowSystem.cs +++ b/Content.Client/GameObjects/EntitySystems/WindowSystem.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using Content.Client.GameObjects.Components; using JetBrains.Annotations; using Robust.Shared.GameObjects; @@ -19,11 +19,11 @@ namespace Content.Client.GameObjects.EntitySystems SubscribeEvent(HandleDirtyEvent); } - private void HandleDirtyEvent(object sender, WindowSmoothDirtyEvent ev) + private void HandleDirtyEvent(WindowSmoothDirtyEvent ev) { - if (sender is IEntity senderEnt && senderEnt.HasComponent()) + if (ev.Sender.HasComponent()) { - _dirtyEntities.Enqueue(senderEnt); + _dirtyEntities.Enqueue(ev.Sender); } } @@ -50,5 +50,11 @@ namespace Content.Client.GameObjects.EntitySystems /// public sealed class WindowSmoothDirtyEvent : EntitySystemMessage { + public IEntity Sender { get; } + + public WindowSmoothDirtyEvent(IEntity sender) + { + Sender = sender; + } } } diff --git a/Content.Server/GameObjects/EntitySystems/Click/ExamineSystem.cs b/Content.Server/GameObjects/EntitySystems/Click/ExamineSystem.cs index 55ce7e3d3e..2164cf3357 100644 --- a/Content.Server/GameObjects/EntitySystems/Click/ExamineSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/Click/ExamineSystem.cs @@ -35,7 +35,7 @@ namespace Content.Server.GameObjects.EntitySystems { base.Initialize(); - SubscribeEvent((sender, ev) => ExamineInfoRequest(ev)); + SubscribeEvent(ExamineInfoRequest); IoCManager.InjectDependencies(this); } diff --git a/Content.Server/GameObjects/EntitySystems/CombatModeSystem.cs b/Content.Server/GameObjects/EntitySystems/CombatModeSystem.cs index e78ec6fbcf..e81509a53c 100644 --- a/Content.Server/GameObjects/EntitySystems/CombatModeSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/CombatModeSystem.cs @@ -31,7 +31,7 @@ namespace Content.Server.GameObjects.EntitySystems InputCmdHandler.FromDelegate(CombatModeToggled)); } - private void SetCombatModeActiveHandler(object sender, SetCombatModeActiveMessage ev) + private void SetCombatModeActiveHandler(SetCombatModeActiveMessage ev) { if (!TryGetCombatComponent(ev, out var combatModeComponent)) return; @@ -39,7 +39,7 @@ namespace Content.Server.GameObjects.EntitySystems combatModeComponent.IsInCombatMode = ev.Active; } - private void SetTargetZoneHandler(object sender, SetTargetZoneMessage ev) + private void SetTargetZoneHandler(SetTargetZoneMessage ev) { if (!TryGetCombatComponent(ev, out var combatModeComponent)) return; diff --git a/Content.Server/GameObjects/EntitySystems/HandsSystem.cs b/Content.Server/GameObjects/EntitySystems/HandsSystem.cs index 3bbf6ec7f1..2bf290a69a 100644 --- a/Content.Server/GameObjects/EntitySystems/HandsSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/HandsSystem.cs @@ -65,7 +65,7 @@ namespace Content.Server.GameObjects.EntitySystems base.Shutdown(); } - private static void HandleContainerModified(object sender, ContainerModifiedMessage args) + private static void HandleContainerModified(ContainerModifiedMessage args) { if (args.Container.Owner.TryGetComponent(out IHandsComponent handsComponent)) { diff --git a/Content.Server/GameObjects/EntitySystems/MoverSystem.cs b/Content.Server/GameObjects/EntitySystems/MoverSystem.cs index 1c3b608770..b6310d8f86 100644 --- a/Content.Server/GameObjects/EntitySystems/MoverSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/MoverSystem.cs @@ -80,7 +80,7 @@ namespace Content.Server.GameObjects.EntitySystems _audioSystem = EntitySystemManager.GetEntitySystem(); } - private static void PlayerAttached(object sender, PlayerAttachSystemMessage ev) + private static void PlayerAttached(PlayerAttachSystemMessage ev) { if (!ev.Entity.HasComponent()) { @@ -88,7 +88,7 @@ namespace Content.Server.GameObjects.EntitySystems } } - private static void PlayerDetached(object sender, PlayerDetachedSystemMessage ev) + private static void PlayerDetached(PlayerDetachedSystemMessage ev) { if(ev.Entity.HasComponent()) { diff --git a/Content.Server/GameObjects/EntitySystems/StorageSystem.cs b/Content.Server/GameObjects/EntitySystems/StorageSystem.cs index 6a325ed387..98a84aab51 100644 --- a/Content.Server/GameObjects/EntitySystems/StorageSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/StorageSystem.cs @@ -29,7 +29,7 @@ namespace Content.Server.GameObjects.EntitySystems } } - private static void HandleEntityRemovedFromContainer(object sender, EntRemovedFromContainerMessage message) + private static void HandleEntityRemovedFromContainer(EntRemovedFromContainerMessage message) { var oldParentEntity = message.Container.Owner; @@ -39,7 +39,7 @@ namespace Content.Server.GameObjects.EntitySystems } } - private static void HandleEntityInsertedIntoContainer(object sender, EntInsertedIntoContainerMessage message) + private static void HandleEntityInsertedIntoContainer(EntInsertedIntoContainerMessage message) { var oldParentEntity = message.Container.Owner; diff --git a/Content.Server/GameObjects/EntitySystems/VerbSystem.cs b/Content.Server/GameObjects/EntitySystems/VerbSystem.cs index 754cfe11c9..778a8c35d8 100644 --- a/Content.Server/GameObjects/EntitySystems/VerbSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/VerbSystem.cs @@ -20,8 +20,8 @@ namespace Content.Server.GameObjects.EntitySystems { base.Initialize(); - SubscribeEvent((sender, ev) => RequestVerbs(ev)); - SubscribeEvent((sender, ev) => UseVerb(ev)); + SubscribeEvent(RequestVerbs); + SubscribeEvent(UseVerb); IoCManager.InjectDependencies(this); } diff --git a/Content.Server/GameTicking/GameRules/RuleDeathMatch.cs b/Content.Server/GameTicking/GameRules/RuleDeathMatch.cs index 524183fc98..f27ad9e793 100644 --- a/Content.Server/GameTicking/GameRules/RuleDeathMatch.cs +++ b/Content.Server/GameTicking/GameRules/RuleDeathMatch.cs @@ -46,7 +46,7 @@ namespace Content.Server.GameTicking.GameRules _playerManager.PlayerStatusChanged -= PlayerManagerOnPlayerStatusChanged; } - private void _onMobDamageStateChanged(object sender, MobDamageStateChangedMessage message) + private void _onMobDamageStateChanged(MobDamageStateChangedMessage message) { _runDelayedCheck(); } From ee6eec9c40237d04303f9727e8382637c9fb301e Mon Sep 17 00:00:00 2001 From: Acruid Date: Wed, 19 Feb 2020 17:08:59 -0800 Subject: [PATCH 3/4] SubscribeEvent() has been split into SubscribeNetworkEvent() and SubscribeLocalEvent() methods on EntitySystem. Most methods on EntityEventBus now require callers to specify the source (Local or Network) of the events. --- .../IconSmoothing/IconSmoothComponent.cs | 6 ++--- .../Components/SubFloorHideComponent.cs | 6 ++--- .../GameObjects/Components/WindowComponent.cs | 4 +-- .../EntitySystems/ExamineSystem.cs | 2 +- .../EntitySystems/IconSmoothSystem.cs | 2 +- .../EntitySystems/MeleeWeaponSystem.cs | 2 +- .../EntitySystems/SubFloorHideSystem.cs | 2 +- .../GameObjects/EntitySystems/VerbSystem.cs | 2 +- .../GameObjects/EntitySystems/WindowSystem.cs | 2 +- .../Components/Mobs/SpeciesComponent.cs | 3 ++- .../EntitySystems/Click/ExamineSystem.cs | 2 +- .../EntitySystems/Click/InteractionSystem.cs | 26 +++++++++---------- .../EntitySystems/CombatModeSystem.cs | 4 +-- .../GameObjects/EntitySystems/HandsSystem.cs | 4 +-- .../GameObjects/EntitySystems/MoverSystem.cs | 4 +-- .../EntitySystems/StorageSystem.cs | 4 +-- .../GameObjects/EntitySystems/VerbSystem.cs | 4 +-- .../GameTicking/GameRules/RuleDeathMatch.cs | 4 +-- 18 files changed, 42 insertions(+), 41 deletions(-) diff --git a/Content.Client/GameObjects/Components/IconSmoothing/IconSmoothComponent.cs b/Content.Client/GameObjects/Components/IconSmoothing/IconSmoothComponent.cs index 039eba03f9..7adc08b7af 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.EventBus.RaiseEvent(new IconSmoothDirtyEvent(Owner,null, SnapGrid.Offset, Mode)); + Owner.EntityManager.EventBus.RaiseEvent(EventSource.Local, new IconSmoothDirtyEvent(Owner,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.EventBus.RaiseEvent(new IconSmoothDirtyEvent(Owner, _lastPosition, SnapGrid.Offset, Mode)); + Owner.EntityManager.EventBus.RaiseEvent(EventSource.Local, new IconSmoothDirtyEvent(Owner, _lastPosition, SnapGrid.Offset, Mode)); } private void SnapGridOnPositionChanged() { - Owner.EntityManager.EventBus.RaiseEvent(new IconSmoothDirtyEvent(Owner, _lastPosition, SnapGrid.Offset, Mode)); + Owner.EntityManager.EventBus.RaiseEvent(EventSource.Local, new IconSmoothDirtyEvent(Owner, _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 cf8d72f286..bed55a84be 100644 --- a/Content.Client/GameObjects/Components/SubFloorHideComponent.cs +++ b/Content.Client/GameObjects/Components/SubFloorHideComponent.cs @@ -33,7 +33,7 @@ namespace Content.Client.GameObjects.Components base.Startup(); _snapGridComponent.OnPositionChanged += SnapGridOnPositionChanged; - Owner.EntityManager.EventBus.RaiseEvent(new SubFloorHideDirtyEvent(Owner)); + Owner.EntityManager.EventBus.RaiseEvent(EventSource.Local, new SubFloorHideDirtyEvent(Owner)); } /// @@ -45,12 +45,12 @@ namespace Content.Client.GameObjects.Components return; _snapGridComponent.OnPositionChanged -= SnapGridOnPositionChanged; - Owner.EntityManager.EventBus.RaiseEvent(new SubFloorHideDirtyEvent(Owner)); + Owner.EntityManager.EventBus.RaiseEvent(EventSource.Local, new SubFloorHideDirtyEvent(Owner)); } private void SnapGridOnPositionChanged() { - Owner.EntityManager.EventBus.RaiseEvent(new SubFloorHideDirtyEvent(Owner)); + Owner.EntityManager.EventBus.RaiseEvent(EventSource.Local, new SubFloorHideDirtyEvent(Owner)); } } diff --git a/Content.Client/GameObjects/Components/WindowComponent.cs b/Content.Client/GameObjects/Components/WindowComponent.cs index f3f807c75d..b06ae08028 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.EventBus.RaiseEvent(new WindowSmoothDirtyEvent(Owner)); + Owner.EntityManager.EventBus.RaiseEvent(EventSource.Local, new WindowSmoothDirtyEvent(Owner)); 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.EventBus.RaiseEvent(new WindowSmoothDirtyEvent(Owner)); + Owner.EntityManager.EventBus.RaiseEvent(EventSource.Local, new WindowSmoothDirtyEvent(Owner)); } public void UpdateSprite() diff --git a/Content.Client/GameObjects/EntitySystems/ExamineSystem.cs b/Content.Client/GameObjects/EntitySystems/ExamineSystem.cs index 6b5792b6fc..ab07851402 100644 --- a/Content.Client/GameObjects/EntitySystems/ExamineSystem.cs +++ b/Content.Client/GameObjects/EntitySystems/ExamineSystem.cs @@ -111,7 +111,7 @@ namespace Content.Client.GameObjects.EntitySystems { _requestCancelTokenSource = new CancellationTokenSource(); response = - await AwaitNetMessage(_requestCancelTokenSource + await AwaitNetworkEvent(_requestCancelTokenSource .Token); } catch (TaskCanceledException) diff --git a/Content.Client/GameObjects/EntitySystems/IconSmoothSystem.cs b/Content.Client/GameObjects/EntitySystems/IconSmoothSystem.cs index 3b6aece8be..9cd35a72f4 100644 --- a/Content.Client/GameObjects/EntitySystems/IconSmoothSystem.cs +++ b/Content.Client/GameObjects/EntitySystems/IconSmoothSystem.cs @@ -30,7 +30,7 @@ namespace Content.Client.GameObjects.EntitySystems /// public override void Initialize() { - SubscribeEvent(HandleDirtyEvent); + SubscribeLocalEvent(HandleDirtyEvent); IoCManager.InjectDependencies(this); } diff --git a/Content.Client/GameObjects/EntitySystems/MeleeWeaponSystem.cs b/Content.Client/GameObjects/EntitySystems/MeleeWeaponSystem.cs index 2f3c04e7a7..9691ecafb3 100644 --- a/Content.Client/GameObjects/EntitySystems/MeleeWeaponSystem.cs +++ b/Content.Client/GameObjects/EntitySystems/MeleeWeaponSystem.cs @@ -23,7 +23,7 @@ namespace Content.Client.GameObjects.EntitySystems public override void Initialize() { - SubscribeEvent(PlayWeaponArc); + SubscribeNetworkEvent(PlayWeaponArc); EntityQuery = new TypeEntityQuery(typeof(MeleeWeaponArcAnimationComponent)); } diff --git a/Content.Client/GameObjects/EntitySystems/SubFloorHideSystem.cs b/Content.Client/GameObjects/EntitySystems/SubFloorHideSystem.cs index b15e887080..ebcd847818 100644 --- a/Content.Client/GameObjects/EntitySystems/SubFloorHideSystem.cs +++ b/Content.Client/GameObjects/EntitySystems/SubFloorHideSystem.cs @@ -28,7 +28,7 @@ namespace Content.Client.GameObjects.EntitySystems _mapManager.GridChanged += MapManagerOnGridChanged; _mapManager.TileChanged += MapManagerOnTileChanged; - SubscribeEvent(HandleDirtyEvent); + SubscribeLocalEvent(HandleDirtyEvent); } private void HandleDirtyEvent(SubFloorHideDirtyEvent ev) diff --git a/Content.Client/GameObjects/EntitySystems/VerbSystem.cs b/Content.Client/GameObjects/EntitySystems/VerbSystem.cs index 155a3900cc..c6f5ae5d36 100644 --- a/Content.Client/GameObjects/EntitySystems/VerbSystem.cs +++ b/Content.Client/GameObjects/EntitySystems/VerbSystem.cs @@ -40,7 +40,7 @@ namespace Content.Client.GameObjects.EntitySystems { base.Initialize(); - SubscribeEvent(FillEntityPopup); + SubscribeNetworkEvent(FillEntityPopup); IoCManager.InjectDependencies(this); diff --git a/Content.Client/GameObjects/EntitySystems/WindowSystem.cs b/Content.Client/GameObjects/EntitySystems/WindowSystem.cs index 4e0ee313f5..bf4a7c4819 100644 --- a/Content.Client/GameObjects/EntitySystems/WindowSystem.cs +++ b/Content.Client/GameObjects/EntitySystems/WindowSystem.cs @@ -16,7 +16,7 @@ namespace Content.Client.GameObjects.EntitySystems { base.Initialize(); - SubscribeEvent(HandleDirtyEvent); + SubscribeLocalEvent(HandleDirtyEvent); } private void HandleDirtyEvent(WindowSmoothDirtyEvent ev) diff --git a/Content.Server/GameObjects/Components/Mobs/SpeciesComponent.cs b/Content.Server/GameObjects/Components/Mobs/SpeciesComponent.cs index bf9bdfc413..9fbc10f84c 100644 --- a/Content.Server/GameObjects/Components/Mobs/SpeciesComponent.cs +++ b/Content.Server/GameObjects/Components/Mobs/SpeciesComponent.cs @@ -168,7 +168,8 @@ namespace Content.Server.GameObjects currentstate = threshold; - Owner.RaiseEvent(new MobDamageStateChangedMessage(this)); + EntityEventArgs toRaise = new MobDamageStateChangedMessage(this); + Owner.EntityManager.EventBus.RaiseEvent(EventSource.Local, toRaise); } void IExAct.OnExplosion(ExplosionEventArgs eventArgs) diff --git a/Content.Server/GameObjects/EntitySystems/Click/ExamineSystem.cs b/Content.Server/GameObjects/EntitySystems/Click/ExamineSystem.cs index 2164cf3357..2f67454a90 100644 --- a/Content.Server/GameObjects/EntitySystems/Click/ExamineSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/Click/ExamineSystem.cs @@ -35,7 +35,7 @@ namespace Content.Server.GameObjects.EntitySystems { base.Initialize(); - SubscribeEvent(ExamineInfoRequest); + SubscribeNetworkEvent(ExamineInfoRequest); IoCManager.InjectDependencies(this); } diff --git a/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs b/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs index 0b3ead0a58..e8297572f2 100644 --- a/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs @@ -333,7 +333,7 @@ namespace Content.Server.GameObjects.EntitySystems private void InteractionActivate(IEntity user, IEntity used) { var activateMsg = new ActivateInWorldMessage(user, used); - RaiseEvent(activateMsg); + RaiseLocalEvent(activateMsg); if (activateMsg.Handled) { return; @@ -509,7 +509,7 @@ namespace Content.Server.GameObjects.EntitySystems private void InteractAfterAttack(IEntity user, IEntity weapon, GridCoordinates clickLocation) { var message = new AfterAttackMessage(user, weapon, null, clickLocation); - RaiseEvent(message); + RaiseLocalEvent(message); if (message.Handled) { return; @@ -531,7 +531,7 @@ namespace Content.Server.GameObjects.EntitySystems public void Interaction(IEntity user, IEntity weapon, IEntity attacked, GridCoordinates clickLocation) { var attackMsg = new AttackByMessage(user, weapon, attacked, clickLocation); - RaiseEvent(attackMsg); + RaiseLocalEvent(attackMsg); if (attackMsg.Handled) { return; @@ -553,7 +553,7 @@ namespace Content.Server.GameObjects.EntitySystems } var afterAtkMsg = new AfterAttackMessage(user, weapon, attacked, clickLocation); - RaiseEvent(afterAtkMsg); + RaiseLocalEvent(afterAtkMsg); if (afterAtkMsg.Handled) { return; @@ -579,7 +579,7 @@ namespace Content.Server.GameObjects.EntitySystems public void Interaction(IEntity user, IEntity attacked) { var message = new AttackHandMessage(user, attacked); - RaiseEvent(message); + RaiseLocalEvent(message); if (message.Handled) { return; @@ -630,7 +630,7 @@ namespace Content.Server.GameObjects.EntitySystems } var useMsg = new UseInHandMessage(user, used); - RaiseEvent(useMsg); + RaiseLocalEvent(useMsg); if (useMsg.Handled) { return; @@ -668,7 +668,7 @@ namespace Content.Server.GameObjects.EntitySystems public void ThrownInteraction(IEntity user, IEntity thrown) { var throwMsg = new ThrownMessage(user, thrown); - RaiseEvent(throwMsg); + RaiseLocalEvent(throwMsg); if (throwMsg.Handled) { return; @@ -690,7 +690,7 @@ namespace Content.Server.GameObjects.EntitySystems public void LandInteraction(IEntity user, IEntity landing, GridCoordinates landLocation) { var landMsg = new LandMessage(user, landing, landLocation); - RaiseEvent(landMsg); + RaiseLocalEvent(landMsg); if (landMsg.Handled) { return; @@ -724,7 +724,7 @@ namespace Content.Server.GameObjects.EntitySystems public void DroppedInteraction(IEntity user, IEntity item) { var dropMsg = new DroppedMessage(user, item); - RaiseEvent(dropMsg); + RaiseLocalEvent(dropMsg); if (dropMsg.Handled) { return; @@ -746,7 +746,7 @@ namespace Content.Server.GameObjects.EntitySystems public void HandSelectedInteraction(IEntity user, IEntity item) { var handSelectedMsg = new HandSelectedMessage(user, item); - RaiseEvent(handSelectedMsg); + RaiseLocalEvent(handSelectedMsg); if (handSelectedMsg.Handled) { return; @@ -768,7 +768,7 @@ namespace Content.Server.GameObjects.EntitySystems public void HandDeselectedInteraction(IEntity user, IEntity item) { var handDeselectedMsg = new HandDeselectedMessage(user, item); - RaiseEvent(handDeselectedMsg); + RaiseLocalEvent(handDeselectedMsg); if (handDeselectedMsg.Handled) { return; @@ -791,7 +791,7 @@ namespace Content.Server.GameObjects.EntitySystems public void RangedInteraction(IEntity user, IEntity weapon, IEntity attacked, GridCoordinates clickLocation) { var rangedMsg = new RangedAttackMessage(user, weapon, attacked, clickLocation); - RaiseEvent(rangedMsg); + RaiseLocalEvent(rangedMsg); if (rangedMsg.Handled) return; @@ -812,7 +812,7 @@ namespace Content.Server.GameObjects.EntitySystems } var afterAtkMsg = new AfterAttackMessage(user, weapon, attacked, clickLocation); - RaiseEvent(afterAtkMsg); + RaiseLocalEvent(afterAtkMsg); if (afterAtkMsg.Handled) return; diff --git a/Content.Server/GameObjects/EntitySystems/CombatModeSystem.cs b/Content.Server/GameObjects/EntitySystems/CombatModeSystem.cs index e81509a53c..ec560d9295 100644 --- a/Content.Server/GameObjects/EntitySystems/CombatModeSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/CombatModeSystem.cs @@ -23,8 +23,8 @@ namespace Content.Server.GameObjects.EntitySystems { base.Initialize(); - SubscribeEvent(SetTargetZoneHandler); - SubscribeEvent(SetCombatModeActiveHandler); + SubscribeNetworkEvent(SetTargetZoneHandler); + SubscribeNetworkEvent(SetCombatModeActiveHandler); var inputSystem = EntitySystemManager.GetEntitySystem(); inputSystem.BindMap.BindFunction(ContentKeyFunctions.ToggleCombatMode, diff --git a/Content.Server/GameObjects/EntitySystems/HandsSystem.cs b/Content.Server/GameObjects/EntitySystems/HandsSystem.cs index 2bf290a69a..c9d27f0ce3 100644 --- a/Content.Server/GameObjects/EntitySystems/HandsSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/HandsSystem.cs @@ -41,8 +41,8 @@ namespace Content.Server.GameObjects.EntitySystems { base.Initialize(); - SubscribeEvent(HandleContainerModified); - SubscribeEvent(HandleContainerModified); + SubscribeLocalEvent(HandleContainerModified); + SubscribeLocalEvent(HandleContainerModified); var input = EntitySystemManager.GetEntitySystem(); input.BindMap.BindFunction(ContentKeyFunctions.SwapHands, InputCmdHandler.FromDelegate(HandleSwapHands)); diff --git a/Content.Server/GameObjects/EntitySystems/MoverSystem.cs b/Content.Server/GameObjects/EntitySystems/MoverSystem.cs index b6310d8f86..1530112eaf 100644 --- a/Content.Server/GameObjects/EntitySystems/MoverSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/MoverSystem.cs @@ -74,8 +74,8 @@ namespace Content.Server.GameObjects.EntitySystems input.BindMap.BindFunction(EngineKeyFunctions.MoveDown, moveDownCmdHandler); input.BindMap.BindFunction(EngineKeyFunctions.Run, runCmdHandler); - SubscribeEvent(PlayerAttached); - SubscribeEvent(PlayerDetached); + SubscribeLocalEvent(PlayerAttached); + SubscribeLocalEvent(PlayerDetached); _audioSystem = EntitySystemManager.GetEntitySystem(); } diff --git a/Content.Server/GameObjects/EntitySystems/StorageSystem.cs b/Content.Server/GameObjects/EntitySystems/StorageSystem.cs index 98a84aab51..9a57e99fe9 100644 --- a/Content.Server/GameObjects/EntitySystems/StorageSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/StorageSystem.cs @@ -14,8 +14,8 @@ namespace Content.Server.GameObjects.EntitySystems /// public override void Initialize() { - SubscribeEvent(HandleEntityRemovedFromContainer); - SubscribeEvent(HandleEntityInsertedIntoContainer); + SubscribeLocalEvent(HandleEntityRemovedFromContainer); + SubscribeLocalEvent(HandleEntityInsertedIntoContainer); EntityQuery = new TypeEntityQuery(typeof(ServerStorageComponent)); } diff --git a/Content.Server/GameObjects/EntitySystems/VerbSystem.cs b/Content.Server/GameObjects/EntitySystems/VerbSystem.cs index 778a8c35d8..d9c44a1cd6 100644 --- a/Content.Server/GameObjects/EntitySystems/VerbSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/VerbSystem.cs @@ -20,8 +20,8 @@ namespace Content.Server.GameObjects.EntitySystems { base.Initialize(); - SubscribeEvent(RequestVerbs); - SubscribeEvent(UseVerb); + SubscribeNetworkEvent(RequestVerbs); + SubscribeNetworkEvent(UseVerb); IoCManager.InjectDependencies(this); } diff --git a/Content.Server/GameTicking/GameRules/RuleDeathMatch.cs b/Content.Server/GameTicking/GameRules/RuleDeathMatch.cs index f27ad9e793..ee841b599d 100644 --- a/Content.Server/GameTicking/GameRules/RuleDeathMatch.cs +++ b/Content.Server/GameTicking/GameRules/RuleDeathMatch.cs @@ -34,7 +34,7 @@ namespace Content.Server.GameTicking.GameRules { _chatManager.DispatchServerAnnouncement("The game is now a death match. Kill everybody else to win!"); - _entityManager.EventBus.SubscribeEvent(_onMobDamageStateChanged, this); + _entityManager.EventBus.SubscribeEvent(EventSource.Local, this, _onMobDamageStateChanged); _playerManager.PlayerStatusChanged += PlayerManagerOnPlayerStatusChanged; } @@ -42,7 +42,7 @@ namespace Content.Server.GameTicking.GameRules { base.Removed(); - _entityManager.EventBus.UnsubscribeEvent(this); + _entityManager.EventBus.UnsubscribeEvent(EventSource.Local, this); _playerManager.PlayerStatusChanged -= PlayerManagerOnPlayerStatusChanged; } From 31e1721bbee6e85d4403f4599dcfa13a71b2ce9a Mon Sep 17 00:00:00 2001 From: Pieter-Jan Briers Date: Sat, 22 Feb 2020 20:03:41 +0100 Subject: [PATCH 4/4] Update submodule --- RobustToolbox | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RobustToolbox b/RobustToolbox index b282881482..728f58465d 160000 --- a/RobustToolbox +++ b/RobustToolbox @@ -1 +1 @@ -Subproject commit b282881482f837624db7dabd6a1445f50a1b9767 +Subproject commit 728f58465dfa1643e6ae74173f6265ca5e879427