Goes in-game now
This commit is contained in:
@@ -74,7 +74,8 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs
|
|||||||
|
|
||||||
await server.WaitAssertion(() =>
|
await server.WaitAssertion(() =>
|
||||||
{
|
{
|
||||||
var playerEnt = serverPlayerManager.Sessions.Single().AttachedEntity;
|
var playerEnt = serverPlayerManager.Sessions.Single().AttachedEntity.GetValueOrDefault();
|
||||||
|
Assert.That(playerEnt, Is.Not.EqualTo(default));
|
||||||
var actionsComponent = sEntities.GetComponent<ServerActionsComponent>(playerEnt);
|
var actionsComponent = sEntities.GetComponent<ServerActionsComponent>(playerEnt);
|
||||||
|
|
||||||
// player should begin with their innate actions granted
|
// player should begin with their innate actions granted
|
||||||
@@ -102,7 +103,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs
|
|||||||
{
|
{
|
||||||
var local = clientPlayerMgr.LocalPlayer;
|
var local = clientPlayerMgr.LocalPlayer;
|
||||||
var controlled = local!.ControlledEntity;
|
var controlled = local!.ControlledEntity;
|
||||||
var actionsComponent = cEntities.GetComponent<ClientActionsComponent>(controlled!);
|
var actionsComponent = cEntities.GetComponent<ClientActionsComponent>(controlled!.Value);
|
||||||
|
|
||||||
// we should have our innate actions and debug1.
|
// we should have our innate actions and debug1.
|
||||||
foreach (var innateAction in innateActions)
|
foreach (var innateAction in innateActions)
|
||||||
@@ -156,7 +157,8 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs
|
|||||||
// now revoke the action and check that the client sees it as revoked
|
// now revoke the action and check that the client sees it as revoked
|
||||||
await server.WaitAssertion(() =>
|
await server.WaitAssertion(() =>
|
||||||
{
|
{
|
||||||
var playerEnt = serverPlayerManager.Sessions.Single().AttachedEntity;
|
var playerEnt = serverPlayerManager.Sessions.Single().AttachedEntity.GetValueOrDefault();
|
||||||
|
Assert.That(playerEnt, Is.Not.EqualTo(default));
|
||||||
var actionsComponent = IoCManager.Resolve<IEntityManager>().GetComponent<ServerActionsComponent>(playerEnt);
|
var actionsComponent = IoCManager.Resolve<IEntityManager>().GetComponent<ServerActionsComponent>(playerEnt);
|
||||||
actionsComponent.Revoke(ActionType.DebugInstant);
|
actionsComponent.Revoke(ActionType.DebugInstant);
|
||||||
});
|
});
|
||||||
@@ -168,7 +170,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs
|
|||||||
{
|
{
|
||||||
var local = clientPlayerMgr.LocalPlayer;
|
var local = clientPlayerMgr.LocalPlayer;
|
||||||
var controlled = local!.ControlledEntity;
|
var controlled = local!.ControlledEntity;
|
||||||
var actionsComponent = IoCManager.Resolve<IEntityManager>().GetComponent<ClientActionsComponent>(controlled!);
|
var actionsComponent = IoCManager.Resolve<IEntityManager>().GetComponent<ClientActionsComponent>(controlled!.Value);
|
||||||
|
|
||||||
// we should have our innate actions, but debug1 should be revoked
|
// we should have our innate actions, but debug1 should be revoked
|
||||||
foreach (var innateAction in innateActions)
|
foreach (var innateAction in innateActions)
|
||||||
@@ -250,7 +252,8 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs
|
|||||||
|
|
||||||
await server.WaitAssertion(() =>
|
await server.WaitAssertion(() =>
|
||||||
{
|
{
|
||||||
serverPlayerEnt = serverPlayerManager.Sessions.Single().AttachedEntity;
|
serverPlayerEnt = serverPlayerManager.Sessions.Single().AttachedEntity.GetValueOrDefault();
|
||||||
|
Assert.That(serverPlayerEnt, Is.Not.EqualTo(default));
|
||||||
serverActionsComponent = serverEntManager.GetComponent<ServerActionsComponent>(serverPlayerEnt);
|
serverActionsComponent = serverEntManager.GetComponent<ServerActionsComponent>(serverPlayerEnt);
|
||||||
|
|
||||||
// spawn and give them an item that has actions
|
// spawn and give them an item that has actions
|
||||||
@@ -291,7 +294,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs
|
|||||||
{
|
{
|
||||||
var local = clientPlayerMgr.LocalPlayer;
|
var local = clientPlayerMgr.LocalPlayer;
|
||||||
var controlled = local!.ControlledEntity;
|
var controlled = local!.ControlledEntity;
|
||||||
clientActionsComponent = clientEntities.GetComponent<ClientActionsComponent>(controlled!);
|
clientActionsComponent = clientEntities.GetComponent<ClientActionsComponent>(controlled!.Value);
|
||||||
|
|
||||||
var lightEntry = clientActionsComponent.ItemActionStates()
|
var lightEntry = clientActionsComponent.ItemActionStates()
|
||||||
.Where(entry => entry.Value.ContainsKey(ItemActionType.ToggleLight))
|
.Where(entry => entry.Value.ContainsKey(ItemActionType.ToggleLight))
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs
|
|||||||
|
|
||||||
await server.WaitAssertion(() =>
|
await server.WaitAssertion(() =>
|
||||||
{
|
{
|
||||||
var playerEnt = serverPlayerManager.Sessions.Single().AttachedEntity;
|
var playerEnt = serverPlayerManager.Sessions.Single().AttachedEntity.GetValueOrDefault();
|
||||||
Assert.That(playerEnt != default);
|
Assert.That(playerEnt != default);
|
||||||
var alertsComponent = IoCManager.Resolve<IEntityManager>().GetComponent<ServerAlertsComponent>(playerEnt);
|
var alertsComponent = IoCManager.Resolve<IEntityManager>().GetComponent<ServerAlertsComponent>(playerEnt);
|
||||||
Assert.NotNull(alertsComponent);
|
Assert.NotNull(alertsComponent);
|
||||||
@@ -69,8 +69,8 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs
|
|||||||
|
|
||||||
await server.WaitAssertion(() =>
|
await server.WaitAssertion(() =>
|
||||||
{
|
{
|
||||||
var playerEnt = serverPlayerManager.Sessions.Single().AttachedEntity;
|
var playerEnt = serverPlayerManager.Sessions.Single().AttachedEntity.GetValueOrDefault();
|
||||||
Assert.That(playerEnt != default);
|
Assert.That(playerEnt, Is.Not.EqualTo(default));
|
||||||
var alertsComponent = IoCManager.Resolve<IEntityManager>().GetComponent<ServerAlertsComponent>(playerEnt);
|
var alertsComponent = IoCManager.Resolve<IEntityManager>().GetComponent<ServerAlertsComponent>(playerEnt);
|
||||||
Assert.NotNull(alertsComponent);
|
Assert.NotNull(alertsComponent);
|
||||||
|
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ namespace Content.IntegrationTests.Tests.PDA
|
|||||||
|
|
||||||
await server.WaitAssertion(() =>
|
await server.WaitAssertion(() =>
|
||||||
{
|
{
|
||||||
var player = sPlayerManager.Sessions.Single().AttachedEntity;
|
var player = sPlayerManager.Sessions.Single().AttachedEntity.GetValueOrDefault();
|
||||||
|
|
||||||
Assert.That(player != default);
|
Assert.That(player != default);
|
||||||
|
|
||||||
|
|||||||
@@ -17,15 +17,16 @@ namespace Content.Server.AI.Utility.Considerations.Containers
|
|||||||
{
|
{
|
||||||
protected override float GetScore(Blackboard context)
|
protected override float GetScore(Blackboard context)
|
||||||
{
|
{
|
||||||
|
var entMan = IoCManager.Resolve<IEntityManager>();
|
||||||
var target = context.GetState<TargetEntityState>().GetValue();
|
var target = context.GetState<TargetEntityState>().GetValue();
|
||||||
if (target == null)
|
if (!entMan.EntityExists(target))
|
||||||
{
|
{
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target.TryGetContainer(out var container))
|
if (target.TryGetContainer(out var container))
|
||||||
{
|
{
|
||||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(container.Owner, out EntityStorageComponent? storageComponent))
|
if (entMan.TryGetComponent(container.Owner, out EntityStorageComponent? storageComponent))
|
||||||
{
|
{
|
||||||
if (storageComponent.IsWeldedShut && !storageComponent.Open)
|
if (storageComponent.IsWeldedShut && !storageComponent.Open)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -21,15 +21,13 @@ namespace Content.Server.Actions.Commands
|
|||||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||||
{
|
{
|
||||||
var player = shell.Player as IPlayerSession;
|
var player = shell.Player as IPlayerSession;
|
||||||
if (player == null) return;
|
if (player?.AttachedEntity is not {} attachedEntity) return;
|
||||||
var attachedEntity = player.AttachedEntity;
|
|
||||||
if (args.Length > 2)
|
if (args.Length > 2)
|
||||||
{
|
{
|
||||||
var target = args[2];
|
var target = args[2];
|
||||||
if (!CommandUtils.TryGetAttachedEntityByUsernameOrId(shell, target, player, out attachedEntity)) return;
|
if (!CommandUtils.TryGetAttachedEntityByUsernameOrId(shell, target, player, out attachedEntity)) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (attachedEntity == default) return;
|
|
||||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(attachedEntity, out ServerActionsComponent? actionsComponent))
|
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(attachedEntity, out ServerActionsComponent? actionsComponent))
|
||||||
{
|
{
|
||||||
shell.WriteError("user has no actions component");
|
shell.WriteError("user has no actions component");
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ namespace Content.Server.Actions.Commands
|
|||||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||||
{
|
{
|
||||||
var player = shell.Player as IPlayerSession;
|
var player = shell.Player as IPlayerSession;
|
||||||
if (player == null) return;
|
if (player?.AttachedEntity == null) return;
|
||||||
var attachedEntity = player.AttachedEntity;
|
var attachedEntity = player.AttachedEntity.Value;
|
||||||
if (args.Length > 1)
|
if (args.Length > 1)
|
||||||
{
|
{
|
||||||
var target = args[1];
|
var target = args[1];
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ namespace Content.Server.Actions.Commands
|
|||||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||||
{
|
{
|
||||||
var player = shell.Player as IPlayerSession;
|
var player = shell.Player as IPlayerSession;
|
||||||
if (player == null) return;
|
if (player?.AttachedEntity == null) return;
|
||||||
var attachedEntity = player.AttachedEntity;
|
var attachedEntity = player.AttachedEntity.Value;
|
||||||
if (args.Length > 1)
|
if (args.Length > 1)
|
||||||
{
|
{
|
||||||
var target = args[1];
|
var target = args[1];
|
||||||
|
|||||||
@@ -125,12 +125,12 @@ namespace Content.Server.Administration
|
|||||||
var name = session.Name;
|
var name = session.Name;
|
||||||
var username = string.Empty;
|
var username = string.Empty;
|
||||||
|
|
||||||
if (session.AttachedEntity != default)
|
if (session.AttachedEntity != null)
|
||||||
username = EntityManager.GetComponent<MetaDataComponent>(session.AttachedEntity).EntityName;
|
username = EntityManager.GetComponent<MetaDataComponent>(session.AttachedEntity.Value).EntityName;
|
||||||
|
|
||||||
var antag = session.ContentData()?.Mind?.AllRoles.Any(r => r.Antagonist) ?? false;
|
var antag = session.ContentData()?.Mind?.AllRoles.Any(r => r.Antagonist) ?? false;
|
||||||
|
|
||||||
return new PlayerInfo(name, username, antag, session.AttachedEntity, session.UserId);
|
return new PlayerInfo(name, username, antag, session.AttachedEntity.GetValueOrDefault(), session.UserId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,9 +42,9 @@ namespace Content.Server.Administration.Commands
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var canReturn = mind.CurrentEntity != default;
|
var canReturn = mind.CurrentEntity != null;
|
||||||
var coordinates = player.AttachedEntity != default
|
var coordinates = player.AttachedEntity != null
|
||||||
? _entities.GetComponent<TransformComponent>(player.AttachedEntity).Coordinates
|
? _entities.GetComponent<TransformComponent>(player.AttachedEntity.Value).Coordinates
|
||||||
: EntitySystem.Get<GameTicker>().GetObserverSpawnPoint();
|
: EntitySystem.Get<GameTicker>().GetObserverSpawnPoint();
|
||||||
var ghost = _entities.SpawnEntity("AdminObserver", coordinates);
|
var ghost = _entities.SpawnEntity("AdminObserver", coordinates);
|
||||||
|
|
||||||
|
|||||||
@@ -30,12 +30,12 @@ namespace Content.Server.Administration.Commands
|
|||||||
if (args.Length < 1 && shell.Player is IPlayerSession player) //Try to heal the users mob if applicable
|
if (args.Length < 1 && shell.Player is IPlayerSession player) //Try to heal the users mob if applicable
|
||||||
{
|
{
|
||||||
shell.WriteLine(Loc.GetString("rejuvenate-command-self-heal-message"));
|
shell.WriteLine(Loc.GetString("rejuvenate-command-self-heal-message"));
|
||||||
if (player.AttachedEntity == default)
|
if (player.AttachedEntity == null)
|
||||||
{
|
{
|
||||||
shell.WriteLine(Loc.GetString("rejuvenate-command-no-entity-attached-message"));
|
shell.WriteLine(Loc.GetString("rejuvenate-command-no-entity-attached-message"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PerformRejuvenate(player.AttachedEntity);
|
PerformRejuvenate(player.AttachedEntity.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
var entityManager = IoCManager.Resolve<IEntityManager>();
|
var entityManager = IoCManager.Resolve<IEntityManager>();
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ namespace Content.Server.Alert.Commands
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var attachedEntity = player.AttachedEntity;
|
var attachedEntity = player.AttachedEntity.Value;
|
||||||
|
|
||||||
if (args.Length > 1)
|
if (args.Length > 1)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -20,19 +20,13 @@ namespace Content.Server.Alert.Commands
|
|||||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||||
{
|
{
|
||||||
var player = shell.Player as IPlayerSession;
|
var player = shell.Player as IPlayerSession;
|
||||||
if (player == null)
|
if (player?.AttachedEntity == null)
|
||||||
{
|
{
|
||||||
shell.WriteLine("You cannot run this command from the server.");
|
shell.WriteLine("You cannot run this from the server or without an attached entity.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var attachedEntity = player.AttachedEntity;
|
var attachedEntity = player.AttachedEntity.Value;
|
||||||
|
|
||||||
if (attachedEntity == null)
|
|
||||||
{
|
|
||||||
shell.WriteLine("You don't have an entity.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args.Length > 2)
|
if (args.Length > 2)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ namespace Content.Server.Alert
|
|||||||
{
|
{
|
||||||
case ClickAlertMessage msg:
|
case ClickAlertMessage msg:
|
||||||
{
|
{
|
||||||
var player = session.AttachedEntity;
|
var player = session.AttachedEntity.GetValueOrDefault();
|
||||||
|
|
||||||
if (player != Owner)
|
if (player != Owner)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -235,7 +235,7 @@ namespace Content.Server.Atmos.Components
|
|||||||
if (handsComponent.GetActiveHand?.Owner is not {Valid: true} activeHandEntity ||
|
if (handsComponent.GetActiveHand?.Owner is not {Valid: true} activeHandEntity ||
|
||||||
!_entities.TryGetComponent(activeHandEntity, out GasAnalyzerComponent? gasAnalyzer))
|
!_entities.TryGetComponent(activeHandEntity, out GasAnalyzerComponent? gasAnalyzer))
|
||||||
{
|
{
|
||||||
serverMsg.Session.AttachedEntity.PopupMessage(Loc.GetString("gas-analyzer-component-need-gas-analyzer-in-hand-message"));
|
serverMsg.Session.AttachedEntity.Value.PopupMessage(Loc.GetString("gas-analyzer-component-need-gas-analyzer-in-hand-message"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -44,13 +44,13 @@ namespace Content.Server.Body.Commands
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player.AttachedEntity == default)
|
if (player.AttachedEntity == null)
|
||||||
{
|
{
|
||||||
shell.WriteLine("You don't have an entity to add a hand to.");
|
shell.WriteLine("You don't have an entity to add a hand to.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
entity = player.AttachedEntity;
|
entity = player.AttachedEntity.Value;
|
||||||
hand = entityManager.SpawnEntity(DefaultHandPrototype, entityManager.GetComponent<TransformComponent>(entity).Coordinates);
|
hand = entityManager.SpawnEntity(DefaultHandPrototype, entityManager.GetComponent<TransformComponent>(entity).Coordinates);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -75,13 +75,13 @@ namespace Content.Server.Body.Commands
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player.AttachedEntity == default)
|
if (player.AttachedEntity == null)
|
||||||
{
|
{
|
||||||
shell.WriteLine("You don't have an entity to add a hand to.");
|
shell.WriteLine("You don't have an entity to add a hand to.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
entity = player.AttachedEntity;
|
entity = player.AttachedEntity.Value;
|
||||||
hand = entityManager.SpawnEntity(args[0], entityManager.GetComponent<TransformComponent>(entity).Coordinates);
|
hand = entityManager.SpawnEntity(args[0], entityManager.GetComponent<TransformComponent>(entity).Coordinates);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ namespace Content.Server.Body.Commands
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
entity = player.AttachedEntity;
|
entity = player.AttachedEntity.Value;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
|
|||||||
@@ -31,13 +31,13 @@ namespace Content.Server.Body.Commands
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player.AttachedEntity == default)
|
if (player.AttachedEntity is not {} attached)
|
||||||
{
|
{
|
||||||
shell.WriteLine("You have no entity.");
|
shell.WriteLine("You have no entity.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(player.AttachedEntity, out SharedBodyComponent? body))
|
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(attached, out SharedBodyComponent? body))
|
||||||
{
|
{
|
||||||
var random = IoCManager.Resolve<IRobustRandom>();
|
var random = IoCManager.Resolve<IRobustRandom>();
|
||||||
var text = $"You have no body{(random.Prob(0.2f) ? " and you must scream." : ".")}";
|
var text = $"You have no body{(random.Prob(0.2f) ? " and you must scream." : ".")}";
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace Content.Server.Chat.Commands
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player.Status != SessionStatus.InGame || player.AttachedEntity == default)
|
if (player.Status != SessionStatus.InGame || player.AttachedEntity == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (args.Length < 1)
|
if (args.Length < 1)
|
||||||
|
|||||||
@@ -25,9 +25,15 @@ namespace Content.Server.Chat.Commands
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player.Status != SessionStatus.InGame || player.AttachedEntity == default)
|
if (player.Status != SessionStatus.InGame)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (player.AttachedEntity is not {} playerEntity)
|
||||||
|
{
|
||||||
|
shell.WriteLine("You don't have an entity!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (args.Length < 1)
|
if (args.Length < 1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -38,12 +44,6 @@ namespace Content.Server.Chat.Commands
|
|||||||
var chat = IoCManager.Resolve<IChatManager>();
|
var chat = IoCManager.Resolve<IChatManager>();
|
||||||
var chatSanitizer = IoCManager.Resolve<IChatSanitizationManager>();
|
var chatSanitizer = IoCManager.Resolve<IChatSanitizationManager>();
|
||||||
|
|
||||||
if (player.AttachedEntity is not {Valid: true} playerEntity)
|
|
||||||
{
|
|
||||||
shell.WriteLine("You don't have an entity!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (IoCManager.Resolve<IEntityManager>().HasComponent<GhostComponent>(playerEntity))
|
if (IoCManager.Resolve<IEntityManager>().HasComponent<GhostComponent>(playerEntity))
|
||||||
chat.SendDeadChat(player, message);
|
chat.SendDeadChat(player, message);
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -306,7 +306,7 @@ namespace Content.Server.Chat.Managers
|
|||||||
msg.MessageWrap = Loc.GetString("chat-manager-send-dead-chat-wrap-message",
|
msg.MessageWrap = Loc.GetString("chat-manager-send-dead-chat-wrap-message",
|
||||||
("deadChannelName", Loc.GetString("chat-manager-dead-channel-name")),
|
("deadChannelName", Loc.GetString("chat-manager-dead-channel-name")),
|
||||||
("playerName", (playerName)));
|
("playerName", (playerName)));
|
||||||
msg.SenderEntity = player.AttachedEntity;
|
msg.SenderEntity = player.AttachedEntity.GetValueOrDefault();
|
||||||
_netManager.ServerSendToMany(msg, clients.ToList());
|
_netManager.ServerSendToMany(msg, clients.ToList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -89,6 +89,9 @@ namespace Content.Server.Chemistry.Components
|
|||||||
|
|
||||||
public void UserInterfaceOnReceiveMessage(ServerBoundUserInterfaceMessage serverMsg)
|
public void UserInterfaceOnReceiveMessage(ServerBoundUserInterfaceMessage serverMsg)
|
||||||
{
|
{
|
||||||
|
if (serverMsg.Session.AttachedEntity == null)
|
||||||
|
return;
|
||||||
|
|
||||||
switch (serverMsg.Message)
|
switch (serverMsg.Message)
|
||||||
{
|
{
|
||||||
case TransferAmountSetValueMessage svm:
|
case TransferAmountSetValueMessage svm:
|
||||||
@@ -96,7 +99,7 @@ namespace Content.Server.Chemistry.Components
|
|||||||
var amount = Math.Clamp(sval, MinimumTransferAmount.Float(),
|
var amount = Math.Clamp(sval, MinimumTransferAmount.Float(),
|
||||||
MaximumTransferAmount.Float());
|
MaximumTransferAmount.Float());
|
||||||
|
|
||||||
serverMsg.Session.AttachedEntity.PopupMessage(Loc.GetString("comp-solution-transfer-set-amount",
|
serverMsg.Session.AttachedEntity.Value.PopupMessage(Loc.GetString("comp-solution-transfer-set-amount",
|
||||||
("amount", amount)));
|
("amount", amount)));
|
||||||
SetTransferAmount(FixedPoint2.New(amount));
|
SetTransferAmount(FixedPoint2.New(amount));
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -80,20 +80,21 @@ namespace Content.Server.Cloning.Components
|
|||||||
|
|
||||||
private void OnUiReceiveMessage(ServerBoundUserInterfaceMessage obj)
|
private void OnUiReceiveMessage(ServerBoundUserInterfaceMessage obj)
|
||||||
{
|
{
|
||||||
if (obj.Message is not CloningPodUiButtonPressedMessage message) return;
|
if (obj.Message is not CloningPodUiButtonPressedMessage message || obj.Session.AttachedEntity == null)
|
||||||
|
return;
|
||||||
|
|
||||||
switch (message.Button)
|
switch (message.Button)
|
||||||
{
|
{
|
||||||
case UiButton.Clone:
|
case UiButton.Clone:
|
||||||
if (BodyContainer.ContainedEntity != null)
|
if (BodyContainer.ContainedEntity != null)
|
||||||
{
|
{
|
||||||
obj.Session.AttachedEntity.PopupMessageCursor(Loc.GetString("cloning-pod-component-msg-occupied"));
|
obj.Session.AttachedEntity.Value.PopupMessageCursor(Loc.GetString("cloning-pod-component-msg-occupied"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (message.ScanId == null)
|
if (message.ScanId == null)
|
||||||
{
|
{
|
||||||
obj.Session.AttachedEntity.PopupMessageCursor(Loc.GetString("cloning-pod-component-msg-no-selection"));
|
obj.Session.AttachedEntity.Value.PopupMessageCursor(Loc.GetString("cloning-pod-component-msg-no-selection"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -101,7 +102,7 @@ namespace Content.Server.Cloning.Components
|
|||||||
|
|
||||||
if (!cloningSystem.IdToDNA.TryGetValue(message.ScanId.Value, out var dna))
|
if (!cloningSystem.IdToDNA.TryGetValue(message.ScanId.Value, out var dna))
|
||||||
{
|
{
|
||||||
obj.Session.AttachedEntity.PopupMessageCursor(Loc.GetString("cloning-pod-component-msg-bad-selection"));
|
obj.Session.AttachedEntity.Value.PopupMessageCursor(Loc.GetString("cloning-pod-component-msg-bad-selection"));
|
||||||
return; // ScanId is not in database
|
return; // ScanId is not in database
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -115,7 +116,7 @@ namespace Content.Server.Cloning.Components
|
|||||||
_entities.TryGetComponent(clone, out MindComponent? cloneMindComp) &&
|
_entities.TryGetComponent(clone, out MindComponent? cloneMindComp) &&
|
||||||
(cloneMindComp.Mind == null || cloneMindComp.Mind == mind))
|
(cloneMindComp.Mind == null || cloneMindComp.Mind == mind))
|
||||||
{
|
{
|
||||||
obj.Session.AttachedEntity.PopupMessageCursor(Loc.GetString("cloning-pod-component-msg-already-cloning"));
|
obj.Session.AttachedEntity.Value.PopupMessageCursor(Loc.GetString("cloning-pod-component-msg-already-cloning"));
|
||||||
return; // Mind already has clone
|
return; // Mind already has clone
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -126,14 +127,14 @@ namespace Content.Server.Cloning.Components
|
|||||||
_entities.TryGetComponent<MobStateComponent?>(mind.OwnedEntity.Value, out var state) &&
|
_entities.TryGetComponent<MobStateComponent?>(mind.OwnedEntity.Value, out var state) &&
|
||||||
!state.IsDead())
|
!state.IsDead())
|
||||||
{
|
{
|
||||||
obj.Session.AttachedEntity.PopupMessageCursor(Loc.GetString("cloning-pod-component-msg-already-alive"));
|
obj.Session.AttachedEntity.Value.PopupMessageCursor(Loc.GetString("cloning-pod-component-msg-already-alive"));
|
||||||
return; // Body controlled by mind is not dead
|
return; // Body controlled by mind is not dead
|
||||||
}
|
}
|
||||||
|
|
||||||
// Yes, we still need to track down the client because we need to open the Eui
|
// Yes, we still need to track down the client because we need to open the Eui
|
||||||
if (mind.UserId == null || !_playerManager.TryGetSessionById(mind.UserId.Value, out var client))
|
if (mind.UserId == null || !_playerManager.TryGetSessionById(mind.UserId.Value, out var client))
|
||||||
{
|
{
|
||||||
obj.Session.AttachedEntity.PopupMessageCursor(Loc.GetString("cloning-pod-component-msg-user-offline"));
|
obj.Session.AttachedEntity.Value.PopupMessageCursor(Loc.GetString("cloning-pod-component-msg-user-offline"));
|
||||||
return; // If we can't track down the client, we can't offer transfer. That'd be quite bad.
|
return; // If we can't track down the client, we can't offer transfer. That'd be quite bad.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -43,13 +43,13 @@ namespace Content.Server.Commands
|
|||||||
{
|
{
|
||||||
attachedEntity = default;
|
attachedEntity = default;
|
||||||
if (!TryGetSessionByUsernameOrId(shell, usernameOrId, performer, out var session)) return false;
|
if (!TryGetSessionByUsernameOrId(shell, usernameOrId, performer, out var session)) return false;
|
||||||
if (session.AttachedEntity == default)
|
if (session.AttachedEntity == null)
|
||||||
{
|
{
|
||||||
shell.WriteLine("User has no attached entity.");
|
shell.WriteLine("User has no attached entity.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
attachedEntity = session.AttachedEntity;
|
attachedEntity = session.AttachedEntity.Value;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,13 +31,13 @@ namespace Content.Server.Damage.Commands
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player.AttachedEntity == default)
|
if (player.AttachedEntity == null)
|
||||||
{
|
{
|
||||||
shell.WriteLine("An entity needs to be specified when you aren't attached to an entity.");
|
shell.WriteLine("An entity needs to be specified when you aren't attached to an entity.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
entity = player.AttachedEntity;
|
entity = player.AttachedEntity.Value;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
if (!EntityUid.TryParse(args[0], out var id))
|
if (!EntityUid.TryParse(args[0], out var id))
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ namespace Content.Server.Disposal.Tube.Components
|
|||||||
private bool PlayerCanUseDisposalTagger(IPlayerSession session)
|
private bool PlayerCanUseDisposalTagger(IPlayerSession session)
|
||||||
{
|
{
|
||||||
//Need player entity to check if they are still able to use the configuration interface
|
//Need player entity to check if they are still able to use the configuration interface
|
||||||
if (session.AttachedEntity == null)
|
if (session.AttachedEntity is not {} attached)
|
||||||
return false;
|
return false;
|
||||||
if (!Anchored)
|
if (!Anchored)
|
||||||
return false;
|
return false;
|
||||||
@@ -112,7 +112,7 @@ namespace Content.Server.Disposal.Tube.Components
|
|||||||
var actionBlocker = EntitySystem.Get<ActionBlockerSystem>();
|
var actionBlocker = EntitySystem.Get<ActionBlockerSystem>();
|
||||||
var groupController = IoCManager.Resolve<IConGroupController>();
|
var groupController = IoCManager.Resolve<IConGroupController>();
|
||||||
//Check if player can interact in their current state
|
//Check if player can interact in their current state
|
||||||
if (!groupController.CanAdminMenu(session) && (!actionBlocker.CanInteract(session.AttachedEntity) || !actionBlocker.CanUse(session.AttachedEntity)))
|
if (!groupController.CanAdminMenu(session) && (!actionBlocker.CanInteract(attached) || !actionBlocker.CanUse(attached)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ namespace Content.Server.Disposal.Tube.Components
|
|||||||
private bool PlayerCanUseDisposalTagger(IPlayerSession session)
|
private bool PlayerCanUseDisposalTagger(IPlayerSession session)
|
||||||
{
|
{
|
||||||
//Need player entity to check if they are still able to use the configuration interface
|
//Need player entity to check if they are still able to use the configuration interface
|
||||||
if (session.AttachedEntity == null)
|
if (session.AttachedEntity is not {} attached)
|
||||||
return false;
|
return false;
|
||||||
if (!Anchored)
|
if (!Anchored)
|
||||||
return false;
|
return false;
|
||||||
@@ -94,7 +94,7 @@ namespace Content.Server.Disposal.Tube.Components
|
|||||||
var actionBlocker = EntitySystem.Get<ActionBlockerSystem>();
|
var actionBlocker = EntitySystem.Get<ActionBlockerSystem>();
|
||||||
var groupController = IoCManager.Resolve<IConGroupController>();
|
var groupController = IoCManager.Resolve<IConGroupController>();
|
||||||
//Check if player can interact in their current state
|
//Check if player can interact in their current state
|
||||||
if (!groupController.CanAdminMenu(session) && (!actionBlocker.CanInteract(session.AttachedEntity) || !actionBlocker.CanUse(session.AttachedEntity)))
|
if (!groupController.CanAdminMenu(session) && (!actionBlocker.CanInteract(attached) || !actionBlocker.CanUse(attached)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ namespace Content.Server.Disposal
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
tube.PopupDirections(player.AttachedEntity);
|
tube.PopupDirections(player.AttachedEntity.Value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ namespace Content.Server.EntityList
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player.AttachedEntity == null)
|
if (player.AttachedEntity is not {} attached)
|
||||||
{
|
{
|
||||||
shell.WriteError("You must have an entity to run this command.");
|
shell.WriteError("You must have an entity to run this command.");
|
||||||
return;
|
return;
|
||||||
@@ -49,7 +49,7 @@ namespace Content.Server.EntityList
|
|||||||
|
|
||||||
foreach (var entity in prototype.Entities(prototypeManager))
|
foreach (var entity in prototype.Entities(prototypeManager))
|
||||||
{
|
{
|
||||||
entityManager.SpawnEntity(entity.ID, entityManager.GetComponent<TransformComponent>(player.AttachedEntity).Coordinates);
|
entityManager.SpawnEntity(entity.ID, entityManager.GetComponent<TransformComponent>(attached).Coordinates);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -66,13 +66,13 @@ namespace Content.Server.GameTicking.Presets
|
|||||||
|
|
||||||
foreach (var player in list)
|
foreach (var player in list)
|
||||||
{
|
{
|
||||||
if (!ReadyProfiles.ContainsKey(player.UserId))
|
if (!ReadyProfiles.ContainsKey(player.UserId) || player.AttachedEntity is not {} attached)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
prefList.Add(player);
|
prefList.Add(player);
|
||||||
|
|
||||||
player.AttachedEntity.EnsureComponent<SuspicionRoleComponent>();
|
attached.EnsureComponent<SuspicionRoleComponent>();
|
||||||
}
|
}
|
||||||
|
|
||||||
var numTraitors = MathHelper.Clamp(readyPlayers.Count / PlayersPerTraitor,
|
var numTraitors = MathHelper.Clamp(readyPlayers.Count / PlayersPerTraitor,
|
||||||
|
|||||||
@@ -94,7 +94,10 @@ public sealed partial class InstrumentSystem : SharedInstrumentSystem
|
|||||||
if (!EntityManager.TryGetComponent(uid, out InstrumentComponent? instrument))
|
if (!EntityManager.TryGetComponent(uid, out InstrumentComponent? instrument))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!instrument.Playing || args.SenderSession != instrument.InstrumentPlayer || instrument.InstrumentPlayer == null)
|
if (!instrument.Playing
|
||||||
|
|| args.SenderSession != instrument.InstrumentPlayer
|
||||||
|
|| instrument.InstrumentPlayer == null
|
||||||
|
|| args.SenderSession.AttachedEntity is not {} attached)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var send = true;
|
var send = true;
|
||||||
@@ -108,11 +111,11 @@ public sealed partial class InstrumentSystem : SharedInstrumentSystem
|
|||||||
{
|
{
|
||||||
if (instrument.LaggedBatches == (int) (MaxMidiLaggedBatches * (1 / 3d) + 1))
|
if (instrument.LaggedBatches == (int) (MaxMidiLaggedBatches * (1 / 3d) + 1))
|
||||||
{
|
{
|
||||||
instrument.InstrumentPlayer.AttachedEntity.PopupMessage(
|
attached.PopupMessage(
|
||||||
Loc.GetString("instrument-component-finger-cramps-light-message"));
|
Loc.GetString("instrument-component-finger-cramps-light-message"));
|
||||||
} else if (instrument.LaggedBatches == (int) (MaxMidiLaggedBatches * (2 / 3d) + 1))
|
} else if (instrument.LaggedBatches == (int) (MaxMidiLaggedBatches * (2 / 3d) + 1))
|
||||||
{
|
{
|
||||||
instrument.InstrumentPlayer.AttachedEntity.PopupMessage(
|
attached.PopupMessage(
|
||||||
Loc.GetString("instrument-component-finger-cramps-serious-message"));
|
Loc.GetString("instrument-component-finger-cramps-serious-message"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ namespace Content.Server.Interaction
|
|||||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||||
{
|
{
|
||||||
var player = shell.Player as IPlayerSession;
|
var player = shell.Player as IPlayerSession;
|
||||||
if (player?.AttachedEntity == null)
|
if (player?.AttachedEntity is not {} attached)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -49,9 +49,9 @@ namespace Content.Server.Interaction
|
|||||||
}
|
}
|
||||||
|
|
||||||
var mapManager = IoCManager.Resolve<IMapManager>();
|
var mapManager = IoCManager.Resolve<IMapManager>();
|
||||||
var playerGrid = _entities.GetComponent<TransformComponent>(player.AttachedEntity).GridID;
|
var playerGrid = _entities.GetComponent<TransformComponent>(attached).GridID;
|
||||||
var mapGrid = mapManager.GetGrid(playerGrid);
|
var mapGrid = mapManager.GetGrid(playerGrid);
|
||||||
var playerPosition = _entities.GetComponent<TransformComponent>(player.AttachedEntity).Coordinates;
|
var playerPosition = _entities.GetComponent<TransformComponent>(attached).Coordinates;
|
||||||
var tileDefinitionManager = IoCManager.Resolve<ITileDefinitionManager>();
|
var tileDefinitionManager = IoCManager.Resolve<ITileDefinitionManager>();
|
||||||
|
|
||||||
for (var i = -radius; i <= radius; i++)
|
for (var i = -radius; i <= radius; i++)
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ namespace Content.Server.Kitchen.EntitySystems
|
|||||||
private void OnUIMessageReceived(EntityUid uid, ReagentGrinderComponent component,
|
private void OnUIMessageReceived(EntityUid uid, ReagentGrinderComponent component,
|
||||||
ServerBoundUserInterfaceMessage message)
|
ServerBoundUserInterfaceMessage message)
|
||||||
{
|
{
|
||||||
if (component.Busy)
|
if (component.Busy || message.Session.AttachedEntity is not {} attached)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -163,7 +163,7 @@ namespace Content.Server.Kitchen.EntitySystems
|
|||||||
if (!EntityManager.TryGetComponent(component.Owner, out ApcPowerReceiverComponent? receiver) ||
|
if (!EntityManager.TryGetComponent(component.Owner, out ApcPowerReceiverComponent? receiver) ||
|
||||||
!receiver.Powered) break;
|
!receiver.Powered) break;
|
||||||
ClickSound(component);
|
ClickSound(component);
|
||||||
DoWork(component, message.Session.AttachedEntity,
|
DoWork(component, attached,
|
||||||
SharedReagentGrinderComponent.GrinderProgram.Grind);
|
SharedReagentGrinderComponent.GrinderProgram.Grind);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -171,7 +171,7 @@ namespace Content.Server.Kitchen.EntitySystems
|
|||||||
if (!EntityManager.TryGetComponent(component.Owner, out ApcPowerReceiverComponent? receiver2) ||
|
if (!EntityManager.TryGetComponent(component.Owner, out ApcPowerReceiverComponent? receiver2) ||
|
||||||
!receiver2.Powered) break;
|
!receiver2.Powered) break;
|
||||||
ClickSound(component);
|
ClickSound(component);
|
||||||
DoWork(component, message.Session.AttachedEntity,
|
DoWork(component, attached,
|
||||||
SharedReagentGrinderComponent.GrinderProgram.Juice);
|
SharedReagentGrinderComponent.GrinderProgram.Juice);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@@ -116,6 +116,8 @@ namespace Content.Server.MachineLinking.System
|
|||||||
private void OnReceiverUIMessage(EntityUid uid, SignalReceiverComponent component,
|
private void OnReceiverUIMessage(EntityUid uid, SignalReceiverComponent component,
|
||||||
ServerBoundUserInterfaceMessage msg)
|
ServerBoundUserInterfaceMessage msg)
|
||||||
{
|
{
|
||||||
|
if (msg.Session.AttachedEntity is not { } attached) return;
|
||||||
|
|
||||||
switch (msg.Message)
|
switch (msg.Message)
|
||||||
{
|
{
|
||||||
case SignalPortSelected portSelected:
|
case SignalPortSelected portSelected:
|
||||||
@@ -123,12 +125,12 @@ namespace Content.Server.MachineLinking.System
|
|||||||
!EntityManager.TryGetComponent(msg.Session.AttachedEntity, out HandsComponent? hands) ||
|
!EntityManager.TryGetComponent(msg.Session.AttachedEntity, out HandsComponent? hands) ||
|
||||||
!hands.TryGetActiveHeldEntity(out var heldEntity) ||
|
!hands.TryGetActiveHeldEntity(out var heldEntity) ||
|
||||||
!EntityManager.TryGetComponent(heldEntity, out SignalLinkerComponent? signalLinkerComponent) ||
|
!EntityManager.TryGetComponent(heldEntity, out SignalLinkerComponent? signalLinkerComponent) ||
|
||||||
!_interaction.InRangeUnobstructed(msg.Session.AttachedEntity, component.Owner, ignoreInsideBlocker: true) ||
|
!_interaction.InRangeUnobstructed(attached, component.Owner, ignoreInsideBlocker: true) ||
|
||||||
!signalLinkerComponent.Port.HasValue ||
|
!signalLinkerComponent.Port.HasValue ||
|
||||||
!signalLinkerComponent.Port.Value.transmitter.Outputs.ContainsPort(signalLinkerComponent.Port
|
!signalLinkerComponent.Port.Value.transmitter.Outputs.ContainsPort(signalLinkerComponent.Port
|
||||||
.Value.port) || !component.Inputs.ContainsPort(portSelected.Port))
|
.Value.port) || !component.Inputs.ContainsPort(portSelected.Port))
|
||||||
return;
|
return;
|
||||||
LinkerInteraction(msg.Session.AttachedEntity, signalLinkerComponent.Port.Value.transmitter,
|
LinkerInteraction(attached, signalLinkerComponent.Port.Value.transmitter,
|
||||||
signalLinkerComponent.Port.Value.port, component, portSelected.Port);
|
signalLinkerComponent.Port.Value.port, component, portSelected.Port);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -156,6 +158,9 @@ namespace Content.Server.MachineLinking.System
|
|||||||
private void OnTransmitterUIMessage(EntityUid uid, SignalTransmitterComponent component,
|
private void OnTransmitterUIMessage(EntityUid uid, SignalTransmitterComponent component,
|
||||||
ServerBoundUserInterfaceMessage msg)
|
ServerBoundUserInterfaceMessage msg)
|
||||||
{
|
{
|
||||||
|
if (msg.Session.AttachedEntity is not { } attached)
|
||||||
|
return;
|
||||||
|
|
||||||
switch (msg.Message)
|
switch (msg.Message)
|
||||||
{
|
{
|
||||||
case SignalPortSelected portSelected:
|
case SignalPortSelected portSelected:
|
||||||
@@ -163,9 +168,9 @@ namespace Content.Server.MachineLinking.System
|
|||||||
!EntityManager.TryGetComponent(msg.Session.AttachedEntity, out HandsComponent? hands) ||
|
!EntityManager.TryGetComponent(msg.Session.AttachedEntity, out HandsComponent? hands) ||
|
||||||
!hands.TryGetActiveHeldEntity(out var heldEntity) ||
|
!hands.TryGetActiveHeldEntity(out var heldEntity) ||
|
||||||
!EntityManager.TryGetComponent(heldEntity, out SignalLinkerComponent? signalLinkerComponent) ||
|
!EntityManager.TryGetComponent(heldEntity, out SignalLinkerComponent? signalLinkerComponent) ||
|
||||||
!_interaction.InRangeUnobstructed(msg.Session.AttachedEntity, component.Owner, ignoreInsideBlocker: true))
|
!_interaction.InRangeUnobstructed(attached, component.Owner, ignoreInsideBlocker: true))
|
||||||
return;
|
return;
|
||||||
LinkerSaveInteraction(msg.Session.AttachedEntity, signalLinkerComponent, component,
|
LinkerSaveInteraction(attached, signalLinkerComponent, component,
|
||||||
portSelected.Port);
|
portSelected.Port);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -189,7 +189,7 @@ namespace Content.Server.Medical.Components
|
|||||||
|
|
||||||
private void OnUiReceiveMessage(ServerBoundUserInterfaceMessage obj)
|
private void OnUiReceiveMessage(ServerBoundUserInterfaceMessage obj)
|
||||||
{
|
{
|
||||||
if (obj.Message is not UiButtonPressedMessage message) return;
|
if (obj.Message is not UiButtonPressedMessage message || obj.Session.AttachedEntity == null) return;
|
||||||
|
|
||||||
switch (message.Button)
|
switch (message.Button)
|
||||||
{
|
{
|
||||||
@@ -200,7 +200,7 @@ namespace Content.Server.Medical.Components
|
|||||||
|
|
||||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(_bodyContainer.ContainedEntity.Value, out MindComponent? mindComp) || mindComp.Mind == null)
|
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(_bodyContainer.ContainedEntity.Value, out MindComponent? mindComp) || mindComp.Mind == null)
|
||||||
{
|
{
|
||||||
obj.Session.AttachedEntity.PopupMessageCursor(Loc.GetString("medical-scanner-component-msg-no-soul"));
|
obj.Session.AttachedEntity.Value.PopupMessageCursor(Loc.GetString("medical-scanner-component-msg-no-soul"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -215,7 +215,7 @@ namespace Content.Server.Medical.Components
|
|||||||
if (mindUser == null)
|
if (mindUser == null)
|
||||||
{
|
{
|
||||||
// For now assume this means soul departed
|
// For now assume this means soul departed
|
||||||
obj.Session.AttachedEntity.PopupMessageCursor(Loc.GetString("medical-scanner-component-msg-soul-broken"));
|
obj.Session.AttachedEntity.Value.PopupMessageCursor(Loc.GetString("medical-scanner-component-msg-soul-broken"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -87,25 +87,21 @@ namespace Content.Server.Power.Components
|
|||||||
|
|
||||||
private void UserInterfaceOnReceiveMessage(ServerBoundUserInterfaceMessage serverMsg)
|
private void UserInterfaceOnReceiveMessage(ServerBoundUserInterfaceMessage serverMsg)
|
||||||
{
|
{
|
||||||
if (serverMsg.Message is ApcToggleMainBreakerMessage)
|
if (serverMsg.Message is not ApcToggleMainBreakerMessage || serverMsg.Session.AttachedEntity is not {} attached)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var accessSystem = EntitySystem.Get<AccessReaderSystem>();
|
||||||
|
if (_accessReader == null || accessSystem.IsAllowed(_accessReader, attached))
|
||||||
{
|
{
|
||||||
var user = serverMsg.Session.AttachedEntity;
|
MainBreakerEnabled = !MainBreakerEnabled;
|
||||||
if (user == null) return;
|
IoCManager.Resolve<IEntityManager>().GetComponent<PowerNetworkBatteryComponent>(Owner).CanDischarge = MainBreakerEnabled;
|
||||||
|
|
||||||
var accessSystem = EntitySystem.Get<AccessReaderSystem>();
|
|
||||||
if (_accessReader == null || accessSystem.IsAllowed(_accessReader, user))
|
|
||||||
{
|
|
||||||
MainBreakerEnabled = !MainBreakerEnabled;
|
|
||||||
IoCManager.Resolve<IEntityManager>().GetComponent<PowerNetworkBatteryComponent>(Owner).CanDischarge = MainBreakerEnabled;
|
|
||||||
|
|
||||||
_uiDirty = true;
|
|
||||||
SoundSystem.Play(Filter.Pvs(Owner), _onReceiveMessageSound.GetSound(), Owner, AudioParams.Default.WithVolume(-2f));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
user.PopupMessageCursor(Loc.GetString("apc-component-insufficient-access"));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
_uiDirty = true;
|
||||||
|
SoundSystem.Play(Filter.Pvs(Owner), _onReceiveMessageSound.GetSound(), Owner, AudioParams.Default.WithVolume(-2f));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
attached.PopupMessageCursor(Loc.GetString("apc-component-insufficient-access"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ namespace Content.Server.Sandbox
|
|||||||
}
|
}
|
||||||
|
|
||||||
var player = _playerManager.GetSessionByChannel(message.MsgChannel);
|
var player = _playerManager.GetSessionByChannel(message.MsgChannel);
|
||||||
if (player.AttachedEntity == default)
|
if (player.AttachedEntity is not {} attached)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -124,7 +124,7 @@ namespace Content.Server.Sandbox
|
|||||||
.EnumeratePrototypes<AccessLevelPrototype>()
|
.EnumeratePrototypes<AccessLevelPrototype>()
|
||||||
.Select(p => p.ID).ToArray();
|
.Select(p => p.ID).ToArray();
|
||||||
|
|
||||||
if (_entityManager.TryGetComponent(player.AttachedEntity, out InventoryComponent? inv)
|
if (_entityManager.TryGetComponent(attached, out InventoryComponent? inv)
|
||||||
&& inv.TryGetSlotItem(Slots.IDCARD, out ItemComponent? wornItem))
|
&& inv.TryGetSlotItem(Slots.IDCARD, out ItemComponent? wornItem))
|
||||||
{
|
{
|
||||||
if (_entityManager.HasComponent<AccessComponent>(wornItem.Owner))
|
if (_entityManager.HasComponent<AccessComponent>(wornItem.Owner))
|
||||||
@@ -148,10 +148,10 @@ namespace Content.Server.Sandbox
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (_entityManager.TryGetComponent<HandsComponent?>(player.AttachedEntity, out var hands))
|
else if (_entityManager.TryGetComponent<HandsComponent?>(attached, out var hands))
|
||||||
{
|
{
|
||||||
var card = CreateFreshId();
|
var card = CreateFreshId();
|
||||||
if (!_entityManager.TryGetComponent(player.AttachedEntity, out inv) || !inv.Equip(Slots.IDCARD, card))
|
if (!_entityManager.TryGetComponent(attached, out inv) || !inv.Equip(Slots.IDCARD, card))
|
||||||
{
|
{
|
||||||
hands.PutInHandOrDrop(_entityManager.GetComponent<ItemComponent>(card));
|
hands.PutInHandOrDrop(_entityManager.GetComponent<ItemComponent>(card));
|
||||||
}
|
}
|
||||||
@@ -170,10 +170,10 @@ namespace Content.Server.Sandbox
|
|||||||
|
|
||||||
EntityUid CreateFreshId()
|
EntityUid CreateFreshId()
|
||||||
{
|
{
|
||||||
var card = _entityManager.SpawnEntity("CaptainIDCard", _entityManager.GetComponent<TransformComponent>(player.AttachedEntity).Coordinates);
|
var card = _entityManager.SpawnEntity("CaptainIDCard", _entityManager.GetComponent<TransformComponent>(attached).Coordinates);
|
||||||
UpgradeId(card);
|
UpgradeId(card);
|
||||||
|
|
||||||
_entityManager.GetComponent<IdCardComponent>(card).FullName = _entityManager.GetComponent<MetaDataComponent>(player.AttachedEntity).EntityName;
|
_entityManager.GetComponent<IdCardComponent>(card).FullName = _entityManager.GetComponent<MetaDataComponent>(attached).EntityName;
|
||||||
return card;
|
return card;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -149,10 +149,8 @@ namespace Content.Server.Storage.EntitySystems
|
|||||||
|
|
||||||
foreach (var session in _sessionCache)
|
foreach (var session in _sessionCache)
|
||||||
{
|
{
|
||||||
var attachedEntity = session.AttachedEntity;
|
|
||||||
|
|
||||||
// The component manages the set of sessions, so this invalid session should be removed soon.
|
// The component manages the set of sessions, so this invalid session should be removed soon.
|
||||||
if (attachedEntity == default || !IoCManager.Resolve<IEntityManager>().EntityExists(attachedEntity))
|
if (session.AttachedEntity is not {} attachedEntity || !IoCManager.Resolve<IEntityManager>().EntityExists(attachedEntity))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (storageMap != IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(attachedEntity).MapID)
|
if (storageMap != IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(attachedEntity).MapID)
|
||||||
|
|||||||
@@ -35,12 +35,11 @@ namespace Content.Server.Traitor.Uplink.Commands
|
|||||||
shell.WriteLine(Loc.GetString("shell-target-player-does-not-exist"));
|
shell.WriteLine(Loc.GetString("shell-target-player-does-not-exist"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (session.AttachedEntity == null)
|
if (session.AttachedEntity is not {} user)
|
||||||
{
|
{
|
||||||
shell.WriteLine(Loc.GetString("Selected player doesn't controll any entity"));
|
shell.WriteLine(Loc.GetString("Selected player doesn't controll any entity"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var user = session.AttachedEntity;
|
|
||||||
|
|
||||||
// Get target item
|
// Get target item
|
||||||
EntityUid? uplinkEntity = null;
|
EntityUid? uplinkEntity = null;
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ namespace Content.Server.UserInterface
|
|||||||
// Must ToList in order to close things safely.
|
// Must ToList in order to close things safely.
|
||||||
foreach (var session in ui.SubscribedSessions.ToArray())
|
foreach (var session in ui.SubscribedSessions.ToArray())
|
||||||
{
|
{
|
||||||
if (session.AttachedEntity == null || !_actionBlockerSystem.CanInteract(session.AttachedEntity))
|
if (session.AttachedEntity == null || !_actionBlockerSystem.CanInteract(session.AttachedEntity.Value))
|
||||||
{
|
{
|
||||||
ui.Close(session);
|
ui.Close(session);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Content.Server.Administration;
|
using Content.Server.Administration;
|
||||||
using Content.Shared.Administration;
|
using Content.Shared.Administration;
|
||||||
@@ -34,7 +34,7 @@ namespace Content.Server.Verbs.Commands
|
|||||||
{
|
{
|
||||||
if (args[0] == "self" && shell.Player?.AttachedEntity != null)
|
if (args[0] == "self" && shell.Player?.AttachedEntity != null)
|
||||||
{
|
{
|
||||||
playerEntity = shell.Player.AttachedEntity;
|
playerEntity = shell.Player.AttachedEntity.Value;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -21,9 +21,8 @@ namespace Content.Server.Verbs
|
|||||||
public void HandleTryExecuteVerb(ExecuteVerbEvent args, EntitySessionEventArgs eventArgs)
|
public void HandleTryExecuteVerb(ExecuteVerbEvent args, EntitySessionEventArgs eventArgs)
|
||||||
{
|
{
|
||||||
var session = eventArgs.SenderSession;
|
var session = eventArgs.SenderSession;
|
||||||
var userEntity = session.AttachedEntity;
|
|
||||||
|
|
||||||
if (userEntity == null)
|
if (session.AttachedEntity is not {} userEntity)
|
||||||
{
|
{
|
||||||
Logger.Warning($"{nameof(HandleTryExecuteVerb)} called by player {session} with no attached entity.");
|
Logger.Warning($"{nameof(HandleTryExecuteVerb)} called by player {session} with no attached entity.");
|
||||||
return;
|
return;
|
||||||
@@ -61,7 +60,7 @@ namespace Content.Server.Verbs
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player.AttachedEntity == default)
|
if (player.AttachedEntity is not {} attached)
|
||||||
{
|
{
|
||||||
Logger.Warning($"{nameof(HandleVerbRequest)} called by player {player} with no attached entity.");
|
Logger.Warning($"{nameof(HandleVerbRequest)} called by player {player} with no attached entity.");
|
||||||
return;
|
return;
|
||||||
@@ -71,7 +70,7 @@ namespace Content.Server.Verbs
|
|||||||
// this, and some verbs (e.g. view variables) won't even care about whether an entity is accessible through
|
// this, and some verbs (e.g. view variables) won't even care about whether an entity is accessible through
|
||||||
// the entity menu or not.
|
// the entity menu or not.
|
||||||
|
|
||||||
var response = new VerbsResponseEvent(args.EntityUid, GetLocalVerbs(args.EntityUid, player.AttachedEntity, args.Type));
|
var response = new VerbsResponseEvent(args.EntityUid, GetLocalVerbs(args.EntityUid, attached, args.Type));
|
||||||
RaiseNetworkEvent(response, player.ConnectedClient);
|
RaiseNetworkEvent(response, player.ConnectedClient);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -407,8 +407,7 @@ namespace Content.Server.WireHacking
|
|||||||
{
|
{
|
||||||
case WiresActionMessage msg:
|
case WiresActionMessage msg:
|
||||||
var wire = WiresList.Find(x => x.Id == msg.Id);
|
var wire = WiresList.Find(x => x.Id == msg.Id);
|
||||||
var player = serverMsg.Session.AttachedEntity;
|
if (wire == null || serverMsg.Session.AttachedEntity is not {} player)
|
||||||
if (wire == null || player == default)
|
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ namespace Content.Shared.Pulling.Systems
|
|||||||
private void OnRelayMoveInput(EntityUid uid, SharedPullableComponent component, RelayMoveInputEvent args)
|
private void OnRelayMoveInput(EntityUid uid, SharedPullableComponent component, RelayMoveInputEvent args)
|
||||||
{
|
{
|
||||||
var entity = args.Session.AttachedEntity;
|
var entity = args.Session.AttachedEntity;
|
||||||
if (entity == default || !_blocker.CanMove(entity)) return;
|
if (entity == null || !_blocker.CanMove(entity.Value)) return;
|
||||||
_pullSystem.TryStopPull(component);
|
_pullSystem.TryStopPull(component);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user