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.
This commit is contained in:
@@ -46,13 +46,6 @@ namespace Content.Client.GameObjects.EntitySystems
|
||||
inputSys.BindMap.BindFunction(ContentKeyFunctions.ExamineEntity, new PointerInputCmdHandler(HandleExamine));
|
||||
}
|
||||
|
||||
public override void RegisterMessageTypes()
|
||||
{
|
||||
base.RegisterMessageTypes();
|
||||
|
||||
RegisterMessageType<ExamineSystemMessages.ExamineInfoResponseMessage>();
|
||||
}
|
||||
|
||||
private bool HandleExamine(ICommonSession session, GridCoordinates coords, EntityUid uid)
|
||||
{
|
||||
if (!uid.IsValid() || !_entityManager.TryGetEntity(uid, out var examined))
|
||||
|
||||
@@ -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<IconSmoothDirtyEvent>(HandleDirtyEvent);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
SubscribeEvent<IconSmoothDirtyEvent>(HandleDirtyEvent);
|
||||
|
||||
IoCManager.InjectDependencies(this);
|
||||
}
|
||||
|
||||
@@ -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<PlayMeleeWeaponAnimationMessage>(PlayWeaponArc);
|
||||
EntityQuery = new TypeEntityQuery(typeof(MeleeWeaponArcAnimationComponent));
|
||||
}
|
||||
|
||||
public override void RegisterMessageTypes()
|
||||
{
|
||||
base.RegisterMessageTypes();
|
||||
|
||||
RegisterMessageType<PlayMeleeWeaponAnimationMessage>();
|
||||
}
|
||||
|
||||
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))
|
||||
{
|
||||
|
||||
@@ -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<VerbSystemMessages.VerbsResponseMessage>(FillEntityPopup);
|
||||
|
||||
IoCManager.InjectDependencies(this);
|
||||
|
||||
var input = EntitySystemManager.GetEntitySystem<InputSystem>();
|
||||
@@ -50,24 +49,17 @@ namespace Content.Client.GameObjects.EntitySystems
|
||||
new PointerInputCmdHandler(OnOpenContextMenu));
|
||||
}
|
||||
|
||||
public override void RegisterMessageTypes()
|
||||
{
|
||||
base.RegisterMessageTypes();
|
||||
|
||||
RegisterMessageType<VerbSystemMessages.VerbsResponseMessage>();
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
@@ -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<ExamineSystemMessages.RequestExamineInfoMessage>((sender, ev) => ExamineInfoRequest(ev));
|
||||
|
||||
IoCManager.InjectDependencies(this);
|
||||
}
|
||||
|
||||
public override void RegisterMessageTypes()
|
||||
{
|
||||
base.RegisterMessageTypes();
|
||||
|
||||
RegisterMessageType<ExamineSystemMessages.RequestExamineInfoMessage>();
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
@@ -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<SetTargetZoneMessage>(SetTargetZoneHandler);
|
||||
SubscribeEvent<SetCombatModeActiveMessage>(SetCombatModeActiveHandler);
|
||||
|
||||
var inputSystem = EntitySystemManager.GetEntitySystem<InputSystem>();
|
||||
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<SetTargetZoneMessage>();
|
||||
RegisterMessageType<SetCombatModeActiveMessage>();
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,6 +41,9 @@ namespace Content.Server.GameObjects.EntitySystems
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeEvent<EntRemovedFromContainerMessage>(HandleContainerModified);
|
||||
SubscribeEvent<EntInsertedIntoContainerMessage>(HandleContainerModified);
|
||||
|
||||
var input = EntitySystemManager.GetEntitySystem<InputSystem>();
|
||||
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();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void SubscribeEvents()
|
||||
{
|
||||
SubscribeEvent<EntRemovedFromContainerMessage>(HandleContainerModified);
|
||||
SubscribeEvent<EntInsertedIntoContainerMessage>(HandleContainerModified);
|
||||
}
|
||||
|
||||
private static void HandleContainerModified(object sender, ContainerModifiedMessage args)
|
||||
{
|
||||
if (args.Container.Owner.TryGetComponent(out IHandsComponent handsComponent))
|
||||
|
||||
@@ -14,16 +14,10 @@ namespace Content.Server.GameObjects.EntitySystems
|
||||
/// <inheritdoc />
|
||||
public override void Initialize()
|
||||
{
|
||||
EntityQuery = new TypeEntityQuery(typeof(ServerStorageComponent));
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void SubscribeEvents()
|
||||
{
|
||||
base.SubscribeEvents();
|
||||
|
||||
SubscribeEvent<EntRemovedFromContainerMessage>(HandleEntityRemovedFromContainer);
|
||||
SubscribeEvent<EntInsertedIntoContainerMessage>(HandleEntityInsertedIntoContainer);
|
||||
|
||||
EntityQuery = new TypeEntityQuery(typeof(ServerStorageComponent));
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -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<RequestVerbsMessage>((sender, ev) => RequestVerbs(ev));
|
||||
SubscribeEvent<UseVerbMessage>((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<RequestVerbsMessage>();
|
||||
RegisterMessageType<UseVerbMessage>();
|
||||
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<VerbsResponseMessage.VerbData>();
|
||||
//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<VerbsResponseMessage.VerbData>();
|
||||
//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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user