diff --git a/Content.Server/Content.Server.csproj b/Content.Server/Content.Server.csproj index b8333212f9..1b6a6f545d 100644 --- a/Content.Server/Content.Server.csproj +++ b/Content.Server/Content.Server.csproj @@ -91,7 +91,8 @@ - + + @@ -137,4 +138,5 @@ - + + \ No newline at end of file diff --git a/Content.Server/GameObjects/EntitySystems/Click/ClickParser.cs b/Content.Server/GameObjects/EntitySystems/Click/ClickParser.cs new file mode 100644 index 0000000000..055af9eaa2 --- /dev/null +++ b/Content.Server/GameObjects/EntitySystems/Click/ClickParser.cs @@ -0,0 +1,70 @@ +using System; +using SS14.Server.Interfaces.Player; +using SS14.Shared.GameObjects; +using SS14.Shared.GameObjects.System; +using SS14.Shared.Input; +using SS14.Shared.Interfaces.GameObjects; +using SS14.Shared.Interfaces.Network; +using SS14.Shared.IoC; + +namespace Content.Server.GameObjects.EntitySystems +{ + /// + /// Catches clicks from the client and parses them to relevant entity systems + /// + public class ClickParserSystem : EntitySystem + { + /// + public override void RegisterMessageTypes() + { + base.RegisterMessageTypes(); + + RegisterMessageType(); + } + + /// + /// Grab click events sent from the client input system + /// + /// + /// + public override void HandleNetMessage(INetChannel channel, EntitySystemMessage message) + { + base.HandleNetMessage(channel, message); + + var playerMan = IoCManager.Resolve(); + var session = playerMan.GetSessionByChannel(channel); + var playerentity = session.AttachedEntity; + + if (playerentity == null) + return; + + switch (message) + { + case ClickEventMessage msg: + ParseClickMessage(msg, playerentity); + break; + } + } + + /// + /// Parse click to the relevant entity system + /// + /// + /// + private void ParseClickMessage(ClickEventMessage message, IEntity player) + { + switch (message.Click) + { + case ClickType.Left: + EntitySystemManager.GetEntitySystem().UserInteraction(message, player); + break; + case (ClickType.Left | ClickType.Shift): + //Examine system + break; + case ClickType.Right: + //Verb System + break; + } + } + } +} diff --git a/Content.Server/GameObjects/EntitySystems/InteractionSystem.cs b/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs similarity index 91% rename from Content.Server/GameObjects/EntitySystems/InteractionSystem.cs rename to Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs index 625bf8d307..7a0fa8b417 100644 --- a/Content.Server/GameObjects/EntitySystems/InteractionSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs @@ -6,9 +6,6 @@ using SS14.Shared.Interfaces.GameObjects; using System.Collections.Generic; using System.Linq; using SS14.Shared.Input; -using SS14.Shared.Interfaces.Network; -using SS14.Shared.IoC; -using SS14.Server.Interfaces.Player; using SS14.Shared.Log; using SS14.Shared.Map; using SS14.Server.GameObjects; @@ -92,40 +89,8 @@ namespace Content.Server.GameObjects.EntitySystems private const float INTERACTION_RANGE = 2; private const float INTERACTION_RANGE_SQUARED = INTERACTION_RANGE * INTERACTION_RANGE; - /// - public override void RegisterMessageTypes() + public void UserInteraction(ClickEventMessage msg, IEntity player) { - base.RegisterMessageTypes(); - - RegisterMessageType(); - } - - //Grab click events sent from the client input system - public override void HandleNetMessage(INetChannel channel, EntitySystemMessage message) - { - base.HandleNetMessage(channel, message); - - var playerMan = IoCManager.Resolve(); - var session = playerMan.GetSessionByChannel(channel); - var playerentity = session.AttachedEntity; - - if (playerentity == null) - return; - - switch (message) - { - case ClickEventMessage msg: - UserInteraction(msg, playerentity); - break; - } - } - - private void UserInteraction(ClickEventMessage msg, IEntity player) - { - //Verify click type - if (msg.Click != ClickType.Left) - return; - //Get entity clicked upon from UID if valid UID, if not assume no entity clicked upon and null IEntity attacked = null; if (msg.Uid.IsValid()) @@ -227,7 +192,7 @@ namespace Content.Server.GameObjects.EntitySystems /// /// /// - private void InteractAfterattack(IEntity user, IEntity weapon, LocalCoordinates clicklocation) + public static void InteractAfterattack(IEntity user, IEntity weapon, LocalCoordinates clicklocation) { List afterattacks = weapon.GetComponents().ToList(); diff --git a/engine b/engine index 3a78a26652..9aed85b4c7 160000 --- a/engine +++ b/engine @@ -1 +1 @@ -Subproject commit 3a78a26652de2aa5dde5b59f56ba1a78d23e2cd4 +Subproject commit 9aed85b4c7f91a1c72adf91a7f4928fe4b91e367