fixes a bunch of warnings

This commit is contained in:
Paul
2021-12-20 13:58:30 +01:00
parent 21174366b7
commit d4d85b663f
68 changed files with 113 additions and 168 deletions

View File

@@ -18,7 +18,6 @@ namespace Content.Client.AI
#if DEBUG #if DEBUG
public class ClientPathfindingDebugSystem : EntitySystem public class ClientPathfindingDebugSystem : EntitySystem
{ {
[Dependency] private readonly IOverlayManager _overlayManager = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!; [Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly IEyeManager _eyeManager = default!; [Dependency] private readonly IEyeManager _eyeManager = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!; [Dependency] private readonly IPlayerManager _playerManager = default!;

View File

@@ -14,9 +14,6 @@ namespace Content.Client.Body.UI
[ViewVariables] [ViewVariables]
private BodyScannerDisplay? _display; private BodyScannerDisplay? _display;
[ViewVariables]
private EntityUid _entity;
public BodyScannerBoundUserInterface(ClientUserInterfaceComponent owner, object uiKey) : base(owner, uiKey) { } public BodyScannerBoundUserInterface(ClientUserInterfaceComponent owner, object uiKey) : base(owner, uiKey) { }
protected override void Open() protected override void Open()
@@ -43,7 +40,7 @@ namespace Content.Client.Body.UI
throw new ArgumentException($"Received an invalid entity with id {scannerState.Uid} for body scanner with id {Owner.Owner} at {entMan.GetComponent<TransformComponent>(Owner.Owner).MapPosition}"); throw new ArgumentException($"Received an invalid entity with id {scannerState.Uid} for body scanner with id {Owner.Owner} at {entMan.GetComponent<TransformComponent>(Owner.Owner).MapPosition}");
} }
_display?.UpdateDisplay(_entity); _display?.UpdateDisplay(scannerState.Uid);
} }
protected override void Dispose(bool disposing) protected override void Dispose(bool disposing)

View File

@@ -104,7 +104,7 @@ namespace Content.Client.Body.UI
public void UpdateDisplay(EntityUid entity) public void UpdateDisplay(EntityUid entity)
{ {
if(entity == null) if(!entity.Valid)
return; return;
_currentEntity = entity; _currentEntity = entity;
@@ -125,12 +125,7 @@ namespace Content.Client.Body.UI
public void BodyPartOnItemSelected(ItemListSelectedEventArgs args) public void BodyPartOnItemSelected(ItemListSelectedEventArgs args)
{ {
if (_currentEntity == null) if (IoCManager.Resolve<IEntityManager>().TryGetComponent<SharedBodyComponent>(_currentEntity, out var body))
return;
var body = IoCManager.Resolve<IEntityManager>().GetComponentOrNull<SharedBodyComponent>(_currentEntity);
if (body == null)
{ {
return; return;
} }

View File

@@ -288,7 +288,7 @@ namespace Content.Client.ContextMenu.UI
// Get the first entity in the sub-menus // Get the first entity in the sub-menus
var entity = GetFirstEntityOrNull(element.SubMenu); var entity = GetFirstEntityOrNull(element.SubMenu);
if (entity == null) if (!entity.Valid)
{ {
// This whole element has no associated entities. We should remove it // This whole element has no associated entities. We should remove it
element.Dispose(); element.Dispose();

View File

@@ -4,10 +4,8 @@ using Robust.Client.Graphics;
using Robust.Client.Utility; using Robust.Client.Utility;
using Robust.Shared.Enums; using Robust.Shared.Enums;
using Robust.Shared.Map; using Robust.Shared.Map;
using Robust.Shared.Maths;
using Robust.Shared.Prototypes; using Robust.Shared.Prototypes;
using Robust.Shared.Utility; using Robust.Shared.Utility;
using Robust.Shared.Maths;
namespace Content.Client.Decals namespace Content.Client.Decals
{ {

View File

@@ -99,8 +99,7 @@ namespace Content.Client.Hands
_itemSlotManager.SetItemSlot(newButton, hand.HeldItem); _itemSlotManager.SetItemSlot(newButton, hand.HeldItem);
// Show blocked overlay if hand is blocked. // Show blocked overlay if hand is blocked.
newButton.Blocked.Visible = newButton.Blocked.Visible = IoCManager.Resolve<IEntityManager>().HasComponent<HandVirtualItemComponent>(hand.HeldItem);
hand.HeldItem != null && IoCManager.Resolve<IEntityManager>().HasComponent<HandVirtualItemComponent>(hand.HeldItem);
} }
if (TryGetActiveHand(out var activeHand)) if (TryGetActiveHand(out var activeHand))

View File

@@ -29,7 +29,7 @@ namespace Content.Client.Inventory
{ {
base.Open(); base.Open();
_strippingMenu = new StrippingMenu($"{Loc.GetString("strippable-bound-user-interface-stripping-menu-title",("ownerName", Name: IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Owner.Owner).EntityName))}"); _strippingMenu = new StrippingMenu($"{Loc.GetString("strippable-bound-user-interface-stripping-menu-title",("ownerName", IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Owner.Owner).EntityName))}");
_strippingMenu.OnClose += Close; _strippingMenu.OnClose += Close;
_strippingMenu.OpenCentered(); _strippingMenu.OpenCentered();

View File

@@ -36,7 +36,7 @@ namespace Content.Client.MedicalScanner.UI
} }
else else
{ {
text.Append($"{Loc.GetString("medical-scanner-window-entity-health-text", ("entityName", Name: entities.GetComponent<MetaDataComponent>(state.Entity.Value).EntityName))}\n"); text.Append($"{Loc.GetString("medical-scanner-window-entity-health-text", ("entityName", entities.GetComponent<MetaDataComponent>(state.Entity.Value).EntityName))}\n");
var totalDamage = state.DamagePerType.Values.Sum(); var totalDamage = state.DamagePerType.Values.Sum();

View File

@@ -39,7 +39,7 @@ namespace Content.Server.AI.LoadBalancer
var entity = _request.Context.GetState<SelfState>().GetValue(); var entity = _request.Context.GetState<SelfState>().GetValue();
if (entity == null || !IoCManager.Resolve<IEntityManager>().HasComponent<AiControllerComponent>(entity)) if (!IoCManager.Resolve<IEntityManager>().HasComponent<AiControllerComponent>(entity))
{ {
return null; return null;
} }

View File

@@ -25,7 +25,7 @@ namespace Content.Server.AI.Utility.Actions.Idle
{ {
var lastStorage = context.GetState<LastOpenedStorageState>().GetValue(); var lastStorage = context.GetState<LastOpenedStorageState>().GetValue();
if (lastStorage == null) if (!lastStorage.Valid)
{ {
ActionOperators = new Queue<AiOperator>(new AiOperator[] ActionOperators = new Queue<AiOperator>(new AiOperator[]
{ {

View File

@@ -12,7 +12,7 @@ namespace Content.Server.AI.Utility.Considerations.ActionBlocker
{ {
var self = context.GetState<SelfState>().GetValue(); var self = context.GetState<SelfState>().GetValue();
if (self == null || !EntitySystem.Get<ActionBlockerSystem>().CanMove(self)) if (!self.Valid || !EntitySystem.Get<ActionBlockerSystem>().CanMove(self))
{ {
return 0.0f; return 0.0f;
} }

View File

@@ -12,7 +12,7 @@ namespace Content.Server.AI.Utility.Considerations.Combat.Melee
{ {
var target = context.GetState<WeaponEntityState>().GetValue(); var target = context.GetState<WeaponEntityState>().GetValue();
if (target == null || !IoCManager.Resolve<IEntityManager>().TryGetComponent(target, out MeleeWeaponComponent? meleeWeaponComponent)) if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(target, out MeleeWeaponComponent? meleeWeaponComponent))
{ {
return 0.0f; return 0.0f;
} }

View File

@@ -10,14 +10,10 @@ namespace Content.Server.AI.Utility.Considerations.Combat.Melee
{ {
protected override float GetScore(Blackboard context) protected override float GetScore(Blackboard context)
{ {
var equipped = context.GetState<EquippedEntityState>().GetValue(); return IoCManager.Resolve<IEntityManager>()
.HasComponent<MeleeWeaponComponent>(context.GetState<EquippedEntityState>().GetValue())
if (equipped == null) ? 1.0f
{ : 0.0f;
return 0.0f;
}
return IoCManager.Resolve<IEntityManager>().HasComponent<MeleeWeaponComponent>(equipped) ? 1.0f : 0.0f;
} }
} }
} }

View File

@@ -12,7 +12,7 @@ namespace Content.Server.AI.Utility.Considerations.Combat.Melee
{ {
var target = context.GetState<WeaponEntityState>().GetValue(); var target = context.GetState<WeaponEntityState>().GetValue();
if (target == null || !IoCManager.Resolve<IEntityManager>().TryGetComponent(target, out MeleeWeaponComponent? meleeWeaponComponent)) if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(target, out MeleeWeaponComponent? meleeWeaponComponent))
{ {
return 0.0f; return 0.0f;
} }

View File

@@ -12,7 +12,7 @@ namespace Content.Server.AI.Utility.Considerations.Combat
{ {
var target = context.GetState<TargetEntityState>().GetValue(); var target = context.GetState<TargetEntityState>().GetValue();
if (target == null || !IoCManager.Resolve<IEntityManager>().TryGetComponent(target, out DamageableComponent? damageableComponent)) if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(target, out DamageableComponent? damageableComponent))
{ {
return 0.0f; return 0.0f;
} }

View File

@@ -12,7 +12,7 @@ namespace Content.Server.AI.Utility.Considerations.Combat
{ {
var target = context.GetState<TargetEntityState>().GetValue(); var target = context.GetState<TargetEntityState>().GetValue();
if (target == null || !IoCManager.Resolve<IEntityManager>().TryGetComponent(target, out MobStateComponent? mobState)) if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(target, out MobStateComponent? mobState))
{ {
return 0.0f; return 0.0f;
} }

View File

@@ -12,7 +12,7 @@ namespace Content.Server.AI.Utility.Considerations.Combat
{ {
var target = context.GetState<TargetEntityState>().GetValue(); var target = context.GetState<TargetEntityState>().GetValue();
if (target == null || !IoCManager.Resolve<IEntityManager>().TryGetComponent(target, out MobStateComponent? mobState)) if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(target, out MobStateComponent? mobState))
{ {
return 0.0f; return 0.0f;
} }

View File

@@ -43,7 +43,7 @@ namespace Content.Server.AI.Utility.Considerations.Containers
var owner = context.GetState<SelfState>().GetValue(); var owner = context.GetState<SelfState>().GetValue();
if (owner == null) if (!owner.Valid)
{ {
return 0; return 0;
} }

View File

@@ -12,7 +12,7 @@ namespace Content.Server.AI.Utility.Considerations.Hands
{ {
var owner = context.GetState<SelfState>().GetValue(); var owner = context.GetState<SelfState>().GetValue();
if (owner == null || !IoCManager.Resolve<IEntityManager>().TryGetComponent(owner, out HandsComponent? handsComponent)) if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(owner, out HandsComponent? handsComponent))
{ {
return 0.0f; return 0.0f;
} }

View File

@@ -16,7 +16,7 @@ namespace Content.Server.AI.Utility.Considerations.Inventory
// If not then check if we have a free hand // If not then check if we have a free hand
var target = context.GetState<TargetEntityState>().GetValue(); var target = context.GetState<TargetEntityState>().GetValue();
if (target == null || !IoCManager.Resolve<IEntityManager>().HasComponent<ItemComponent>(target)) if (!IoCManager.Resolve<IEntityManager>().HasComponent<ItemComponent>(target))
{ {
return 0.0f; return 0.0f;
} }

View File

@@ -13,7 +13,7 @@ namespace Content.Server.AI.Utility.Considerations.Inventory
{ {
var target = context.GetState<TargetEntityState>().GetValue(); var target = context.GetState<TargetEntityState>().GetValue();
if (target == null || !IoCManager.Resolve<IEntityManager>().HasComponent<ItemComponent>(target)) if (!IoCManager.Resolve<IEntityManager>().HasComponent<ItemComponent>(target))
{ {
return 0.0f; return 0.0f;
} }

View File

@@ -13,8 +13,7 @@ namespace Content.Server.AI.Utility.Considerations.Nutrition.Drink
{ {
var target = context.GetState<TargetEntityState>().GetValue(); var target = context.GetState<TargetEntityState>().GetValue();
if (target == null if (IoCManager.Resolve<IEntityManager>().Deleted(target)
|| IoCManager.Resolve<IEntityManager>().Deleted(target)
|| !EntitySystem.Get<SolutionContainerSystem>().TryGetSolution(target, DrinkComponent.DefaultSolutionName, out var drink)) || !EntitySystem.Get<SolutionContainerSystem>().TryGetSolution(target, DrinkComponent.DefaultSolutionName, out var drink))
{ {
return 0.0f; return 0.0f;

View File

@@ -13,7 +13,7 @@ namespace Content.Server.AI.Utility.Considerations.Nutrition.Drink
{ {
var owner = context.GetState<SelfState>().GetValue(); var owner = context.GetState<SelfState>().GetValue();
if (owner == null || !IoCManager.Resolve<IEntityManager>().TryGetComponent(owner, out ThirstComponent? thirst)) if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(owner, out ThirstComponent? thirst))
{ {
return 0.0f; return 0.0f;
} }

View File

@@ -13,8 +13,9 @@ namespace Content.Server.AI.Utility.Considerations.Nutrition.Food
{ {
var target = context.GetState<TargetEntityState>().GetValue(); var target = context.GetState<TargetEntityState>().GetValue();
if (target == null || !IoCManager.Resolve<IEntityManager>().TryGetComponent<FoodComponent?>(target, out var foodComp) if (!IoCManager.Resolve<IEntityManager>().TryGetComponent<FoodComponent?>(target, out var foodComp)
|| !EntitySystem.Get<SolutionContainerSystem>().TryGetSolution(target, foodComp.SolutionName, out var food)) || !EntitySystem.Get<SolutionContainerSystem>()
.TryGetSolution(target, foodComp.SolutionName, out var food))
{ {
return 0.0f; return 0.0f;
} }

View File

@@ -14,7 +14,7 @@ namespace Content.Server.AI.Utility.Considerations.Nutrition.Food
{ {
var owner = context.GetState<SelfState>().GetValue(); var owner = context.GetState<SelfState>().GetValue();
if (owner == null || !IoCManager.Resolve<IEntityManager>().TryGetComponent(owner, out HungerComponent? hunger)) if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(owner, out HungerComponent? hunger))
{ {
return 0.0f; return 0.0f;
} }

View File

@@ -28,7 +28,7 @@ namespace Content.Server.AI.Utility.Considerations.State
} }
context.GetStoredState(stateData, out StoredStateData<EntityUid> state); context.GetStoredState(stateData, out StoredStateData<EntityUid> state);
return state.GetValue() == null ? 1.0f : 0.0f; return state.GetValue().Valid ? 0.0f : 1.0f;
} }
} }
} }

View File

@@ -28,7 +28,6 @@ namespace Content.Server.AI.Utility
internal sealed class NpcBehaviorManager : INpcBehaviorManager internal sealed class NpcBehaviorManager : INpcBehaviorManager
{ {
[Dependency] private readonly IDynamicTypeFactory _typeFactory = default!; [Dependency] private readonly IDynamicTypeFactory _typeFactory = default!;
[Dependency] private readonly IEntityManager _entityManager = default!;
private readonly NpcActionComparer _comparer = new(); private readonly NpcActionComparer _comparer = new();

View File

@@ -83,10 +83,10 @@ namespace Content.Server.Actions.Actions
SoundSystem.Play(Filter.Pvs(args.Performer), PunchMissSound.GetSound(), args.Performer, AudioHelpers.WithVariation(0.025f)); SoundSystem.Play(Filter.Pvs(args.Performer), PunchMissSound.GetSound(), args.Performer, AudioHelpers.WithVariation(0.025f));
args.Performer.PopupMessageOtherClients(Loc.GetString("disarm-action-popup-message-other-clients", args.Performer.PopupMessageOtherClients(Loc.GetString("disarm-action-popup-message-other-clients",
("performerName", Name: entMan.GetComponent<MetaDataComponent>(args.Performer).EntityName), ("performerName", entMan.GetComponent<MetaDataComponent>(args.Performer).EntityName),
("targetName", Name: entMan.GetComponent<MetaDataComponent>(args.Target).EntityName))); ("targetName", entMan.GetComponent<MetaDataComponent>(args.Target).EntityName)));
args.Performer.PopupMessageCursor(Loc.GetString("disarm-action-popup-message-cursor", args.Performer.PopupMessageCursor(Loc.GetString("disarm-action-popup-message-cursor",
("targetName", Name: entMan.GetComponent<MetaDataComponent>(args.Target).EntityName))); ("targetName", entMan.GetComponent<MetaDataComponent>(args.Target).EntityName)));
system.SendLunge(angle, args.Performer); system.SendLunge(angle, args.Performer);
return; return;
} }

View File

@@ -14,7 +14,6 @@ namespace Content.Server.Atmos.EntitySystems
{ {
[Dependency] private readonly IMapManager _mapManager = default!; [Dependency] private readonly IMapManager _mapManager = default!;
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!; [Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
[Dependency] private readonly SpreaderSystem _spreaderSystem = default!;
public override void Initialize() public override void Initialize()
{ {

View File

@@ -88,7 +88,7 @@ namespace Content.Server.Body.Components
else // If surgery cannot be performed, show message saying so. else // If surgery cannot be performed, show message saying so.
{ {
eventArgs.Target?.PopupMessage(eventArgs.User, eventArgs.Target?.PopupMessage(eventArgs.User,
Loc.GetString("mechanism-component-no-way-to-install-message", ("partName", Name: _entities.GetComponent<MetaDataComponent>(Owner).EntityName))); Loc.GetString("mechanism-component-no-way-to-install-message", ("partName", _entities.GetComponent<MetaDataComponent>(Owner).EntityName)));
} }
} }
@@ -114,7 +114,7 @@ namespace Content.Server.Body.Components
if (!OptionsCache.TryGetValue(key, out var targetObject)) if (!OptionsCache.TryGetValue(key, out var targetObject))
{ {
BodyCache.Owner.PopupMessage(PerformerCache.Value, BodyCache.Owner.PopupMessage(PerformerCache.Value,
Loc.GetString("mechanism-component-no-useful-way-to-use-message",("partName", Name: _entities.GetComponent<MetaDataComponent>(Owner).EntityName))); Loc.GetString("mechanism-component-no-useful-way-to-use-message",("partName", _entities.GetComponent<MetaDataComponent>(Owner).EntityName)));
return; return;
} }

View File

@@ -115,8 +115,6 @@ public class LungSystem : EntitySystem
// TODO Jesus Christ make this event based. // TODO Jesus Christ make this event based.
if (mech.Body != null && if (mech.Body != null &&
EntityManager.TryGetComponent((mech.Body).Owner, out InternalsComponent? internals) && EntityManager.TryGetComponent((mech.Body).Owner, out InternalsComponent? internals) &&
internals.BreathToolEntity != null &&
internals.GasTankEntity != null &&
EntityManager.TryGetComponent(internals.BreathToolEntity, out BreathToolComponent? breathTool) && EntityManager.TryGetComponent(internals.BreathToolEntity, out BreathToolComponent? breathTool) &&
breathTool.IsFunctional && breathTool.IsFunctional &&
EntityManager.TryGetComponent(internals.GasTankEntity, out GasTankComponent? gasTank)) EntityManager.TryGetComponent(internals.GasTankEntity, out GasTankComponent? gasTank))

View File

@@ -684,7 +684,7 @@ namespace Content.Server.Botany.Components
} }
user.PopupMessageCursor(Loc.GetString("plant-holder-component-already-seeded-message", user.PopupMessageCursor(Loc.GetString("plant-holder-component-already-seeded-message",
("name", Name: _entMan.GetComponent<MetaDataComponent>(Owner).EntityName))); ("name", _entMan.GetComponent<MetaDataComponent>(Owner).EntityName)));
return false; return false;
} }
@@ -693,9 +693,9 @@ namespace Content.Server.Botany.Components
if (WeedLevel > 0) if (WeedLevel > 0)
{ {
user.PopupMessageCursor(Loc.GetString("plant-holder-component-remove-weeds-message", user.PopupMessageCursor(Loc.GetString("plant-holder-component-remove-weeds-message",
("name", Name: _entMan.GetComponent<MetaDataComponent>(Owner).EntityName))); ("name", _entMan.GetComponent<MetaDataComponent>(Owner).EntityName)));
user.PopupMessageOtherClients(Loc.GetString("plant-holder-component-remove-weeds-others-message", user.PopupMessageOtherClients(Loc.GetString("plant-holder-component-remove-weeds-others-message",
("otherName", Name: _entMan.GetComponent<MetaDataComponent>(user).EntityName))); ("otherName", _entMan.GetComponent<MetaDataComponent>(user).EntityName)));
WeedLevel = 0; WeedLevel = 0;
UpdateSprite(); UpdateSprite();
} }
@@ -712,9 +712,9 @@ namespace Content.Server.Botany.Components
if (Seed != null) if (Seed != null)
{ {
user.PopupMessageCursor(Loc.GetString("plant-holder-component-remove-plant-message", user.PopupMessageCursor(Loc.GetString("plant-holder-component-remove-plant-message",
("name", Name: _entMan.GetComponent<MetaDataComponent>(Owner).EntityName))); ("name", _entMan.GetComponent<MetaDataComponent>(Owner).EntityName)));
user.PopupMessageOtherClients(Loc.GetString("plant-holder-component-remove-plant-others-message", user.PopupMessageOtherClients(Loc.GetString("plant-holder-component-remove-plant-others-message",
("name", Name: _entMan.GetComponent<MetaDataComponent>(user).EntityName))); ("name", _entMan.GetComponent<MetaDataComponent>(user).EntityName)));
RemovePlant(); RemovePlant();
} }
else else

View File

@@ -30,7 +30,7 @@ namespace Content.Server.Botany.Components
if (_entMan.TryGetComponent(eventArgs.Using, out ProduceComponent? produce) && produce.Seed != null) if (_entMan.TryGetComponent(eventArgs.Using, out ProduceComponent? produce) && produce.Seed != null)
{ {
eventArgs.User.PopupMessageCursor(Loc.GetString("seed-extractor-component-interact-message",("name", Name: _entMan.GetComponent<MetaDataComponent>(eventArgs.Using).EntityName))); eventArgs.User.PopupMessageCursor(Loc.GetString("seed-extractor-component-interact-message",("name", _entMan.GetComponent<MetaDataComponent>(eventArgs.Using).EntityName)));
_entMan.QueueDeleteEntity(eventArgs.Using); _entMan.QueueDeleteEntity(eventArgs.Using);

View File

@@ -280,8 +280,7 @@ namespace Content.Server.Botany
public IEnumerable<EntityUid> AutoHarvest(EntityCoordinates position, int yieldMod = 1) public IEnumerable<EntityUid> AutoHarvest(EntityCoordinates position, int yieldMod = 1)
{ {
if (position.IsValid(IoCManager.Resolve<IEntityManager>()) && ProductPrototypes != null && if (position.IsValid(IoCManager.Resolve<IEntityManager>()) && ProductPrototypes.Count > 0)
ProductPrototypes.Count > 0)
return GenerateProduct(position, yieldMod); return GenerateProduct(position, yieldMod);
return Enumerable.Empty<EntityUid>(); return Enumerable.Empty<EntityUid>();
@@ -291,10 +290,10 @@ namespace Content.Server.Botany
{ {
AddToDatabase(); AddToDatabase();
if (user == null) if (!user.Valid)
return Enumerable.Empty<EntityUid>(); return Enumerable.Empty<EntityUid>();
if (ProductPrototypes == null || ProductPrototypes.Count == 0 || Yield <= 0) if (ProductPrototypes.Count == 0 || Yield <= 0)
{ {
user.PopupMessageCursor(Loc.GetString("botany-harvest-fail-message")); user.PopupMessageCursor(Loc.GetString("botany-harvest-fail-message"));
return Enumerable.Empty<EntityUid>(); return Enumerable.Empty<EntityUid>();
@@ -312,14 +311,8 @@ namespace Content.Server.Botany
if (yieldMod < 0) if (yieldMod < 0)
{ {
yieldMod = 1; yieldMod = 1;
totalYield = Yield;
} }
else totalYield = Math.Max(1, Yield * yieldMod);
{
totalYield = Yield * yieldMod;
}
totalYield = Math.Max(1, totalYield);
} }
var random = IoCManager.Resolve<IRobustRandom>(); var random = IoCManager.Resolve<IRobustRandom>();

View File

@@ -197,7 +197,7 @@ namespace Content.Server.Chat.Managers
var msg = _netManager.CreateNetMessage<MsgChatMessage>(); var msg = _netManager.CreateNetMessage<MsgChatMessage>();
msg.Channel = ChatChannel.Local; msg.Channel = ChatChannel.Local;
msg.Message = message; msg.Message = message;
msg.MessageWrap = Loc.GetString("chat-manager-entity-say-wrap-message",("entityName", Name: _entManager.GetComponent<MetaDataComponent>(source).EntityName)); msg.MessageWrap = Loc.GetString("chat-manager-entity-say-wrap-message",("entityName", _entManager.GetComponent<MetaDataComponent>(source).EntityName));
msg.SenderEntity = source; msg.SenderEntity = source;
msg.HideChat = hideChat; msg.HideChat = hideChat;
_netManager.ServerSendToMany(msg, clients); _netManager.ServerSendToMany(msg, clients);
@@ -234,7 +234,7 @@ namespace Content.Server.Chat.Managers
var msg = _netManager.CreateNetMessage<MsgChatMessage>(); var msg = _netManager.CreateNetMessage<MsgChatMessage>();
msg.Channel = ChatChannel.Emotes; msg.Channel = ChatChannel.Emotes;
msg.Message = action; msg.Message = action;
msg.MessageWrap = Loc.GetString("chat-manager-entity-me-wrap-message", ("entityName",Name: _entManager.GetComponent<MetaDataComponent>(source).EntityName)); msg.MessageWrap = Loc.GetString("chat-manager-entity-me-wrap-message", ("entityName", _entManager.GetComponent<MetaDataComponent>(source).EntityName));
msg.SenderEntity = source; msg.SenderEntity = source;
_netManager.ServerSendToMany(msg, clients); _netManager.ServerSendToMany(msg, clients);
} }

View File

@@ -115,7 +115,7 @@ namespace Content.Server.Climbing.Components
return false; return false;
} }
if (target == null || !_entities.HasComponent<ClimbingComponent>(dragged)) if (!_entities.HasComponent<ClimbingComponent>(dragged))
{ {
reason = Loc.GetString("comp-climbable-cant-climb"); reason = Loc.GetString("comp-climbable-cant-climb");
return false; return false;

View File

@@ -25,7 +25,7 @@ namespace Content.Server.Clothing
private void AddToggleVerb(EntityUid uid, MagbootsComponent component, GetActivationVerbsEvent args) private void AddToggleVerb(EntityUid uid, MagbootsComponent component, GetActivationVerbsEvent args)
{ {
if (args.User == null || !args.CanAccess || !args.CanInteract) if (!args.User.Valid || !args.CanAccess || !args.CanInteract)
return; return;
Verb verb = new(); Verb verb = new();

View File

@@ -37,10 +37,10 @@ namespace Content.Server.Construction.Conditions
if (airlock.BoltsDown != Value) if (airlock.BoltsDown != Value)
{ {
if (Value == true) if (Value)
args.PushMarkup(Loc.GetString("construction-examine-condition-airlock-bolt", ("entityName", Name: entMan.GetComponent<MetaDataComponent>(entity).EntityName)) + "\n"); args.PushMarkup(Loc.GetString("construction-examine-condition-airlock-bolt", ("entityName", entMan.GetComponent<MetaDataComponent>(entity).EntityName)) + "\n");
else else
args.PushMarkup(Loc.GetString("construction-examine-condition-airlock-unbolt", ("entityName", Name: entMan.GetComponent<MetaDataComponent>(entity).EntityName)) + "\n"); args.PushMarkup(Loc.GetString("construction-examine-condition-airlock-unbolt", ("entityName", entMan.GetComponent<MetaDataComponent>(entity).EntityName)) + "\n");
return true; return true;
} }

View File

@@ -36,9 +36,9 @@ namespace Content.Server.Construction.Conditions
if (door.IsWeldedShut != Welded) if (door.IsWeldedShut != Welded)
{ {
if (Welded == true) if (Welded == true)
args.PushMarkup(Loc.GetString("construction-examine-condition-door-weld", ("entityName", Name: entMan.GetComponent<MetaDataComponent>(entity).EntityName)) + "\n"); args.PushMarkup(Loc.GetString("construction-examine-condition-door-weld", ("entityName", entMan.GetComponent<MetaDataComponent>(entity).EntityName)) + "\n");
else else
args.PushMarkup(Loc.GetString("construction-examine-condition-door-unweld", ("entityName", Name: entMan.GetComponent<MetaDataComponent>(entity).EntityName)) + "\n"); args.PushMarkup(Loc.GetString("construction-examine-condition-door-unweld", ("entityName", entMan.GetComponent<MetaDataComponent>(entity).EntityName)) + "\n");
return true; return true;
} }

View File

@@ -90,7 +90,7 @@ namespace Content.Server.Disposal.Unit.Components
private bool PlayerCanUse(EntityUid player) private bool PlayerCanUse(EntityUid player)
{ {
if (player == null) if (!player.Valid)
{ {
return false; return false;
} }

View File

@@ -39,7 +39,6 @@ namespace Content.Server.Explosion.EntitySystems
{ {
[Dependency] private readonly ExplosionSystem _explosions = default!; [Dependency] private readonly ExplosionSystem _explosions = default!;
[Dependency] private readonly FlashSystem _flashSystem = default!; [Dependency] private readonly FlashSystem _flashSystem = default!;
[Dependency] private readonly AdminLogSystem _logSystem = default!;
public override void Initialize() public override void Initialize()
{ {

View File

@@ -36,7 +36,7 @@ namespace Content.Server.Ghost.Components
msg.Channel = ChatChannel.Radio; msg.Channel = ChatChannel.Radio;
msg.Message = message; msg.Message = message;
//Square brackets are added here to avoid issues with escaping //Square brackets are added here to avoid issues with escaping
msg.MessageWrap = Loc.GetString("chat-radio-message-wrap", ("channel", $"\\[{channel}\\]"), ("name", Name: _entMan.GetComponent<MetaDataComponent>(speaker).EntityName)); msg.MessageWrap = Loc.GetString("chat-radio-message-wrap", ("channel", $"\\[{channel}\\]"), ("name", _entMan.GetComponent<MetaDataComponent>(speaker).EntityName));
_netManager.ServerSendMessage(msg, playerChannel); _netManager.ServerSendMessage(msg, playerChannel);
} }

View File

@@ -99,21 +99,21 @@ namespace Content.Server.Hands.Components
var source = @event.Source; var source = @event.Source;
var target = @event.Target; var target = @event.Target;
if (source != null) if (source.Valid)
{ {
SoundSystem.Play(Filter.Pvs(source), _disarmedSound.GetSound(), source, AudioHelpers.WithVariation(0.025f)); SoundSystem.Play(Filter.Pvs(source), _disarmedSound.GetSound(), source, AudioHelpers.WithVariation(0.025f));
if (target != null) if (target.Valid)
{ {
if (ActiveHand != null && Drop(ActiveHand, false)) if (ActiveHand != null && Drop(ActiveHand, false))
{ {
source.PopupMessageOtherClients(Loc.GetString("hands-component-disarm-success-others-message", ("disarmer", Name: _entities.GetComponent<MetaDataComponent>(source).EntityName), ("disarmed", Name: _entities.GetComponent<MetaDataComponent>(target).EntityName))); source.PopupMessageOtherClients(Loc.GetString("hands-component-disarm-success-others-message", ("disarmer", _entities.GetComponent<MetaDataComponent>(source).EntityName), ("disarmed", _entities.GetComponent<MetaDataComponent>(target).EntityName)));
source.PopupMessageCursor(Loc.GetString("hands-component-disarm-success-message", ("disarmed", Name: _entities.GetComponent<MetaDataComponent>(target).EntityName))); source.PopupMessageCursor(Loc.GetString("hands-component-disarm-success-message", ("disarmed", _entities.GetComponent<MetaDataComponent>(target).EntityName)));
} }
else else
{ {
source.PopupMessageOtherClients(Loc.GetString("hands-component-shove-success-others-message", ("shover", Name: _entities.GetComponent<MetaDataComponent>(source).EntityName), ("shoved", Name: _entities.GetComponent<MetaDataComponent>(target).EntityName))); source.PopupMessageOtherClients(Loc.GetString("hands-component-shove-success-others-message", ("shover", _entities.GetComponent<MetaDataComponent>(source).EntityName), ("shoved", _entities.GetComponent<MetaDataComponent>(target).EntityName)));
source.PopupMessageCursor(Loc.GetString("hands-component-shove-success-message", ("shoved", Name: _entities.GetComponent<MetaDataComponent>(target).EntityName))); source.PopupMessageCursor(Loc.GetString("hands-component-shove-success-message", ("shoved", _entities.GetComponent<MetaDataComponent>(target).EntityName)));
} }
} }
} }

View File

@@ -33,7 +33,6 @@ namespace Content.Server.Hands.Systems
[UsedImplicitly] [UsedImplicitly]
internal sealed class HandsSystem : SharedHandsSystem internal sealed class HandsSystem : SharedHandsSystem
{ {
[Dependency] private readonly InteractionSystem _interactionSystem = default!;
[Dependency] private readonly StackSystem _stackSystem = default!; [Dependency] private readonly StackSystem _stackSystem = default!;
[Dependency] private readonly HandVirtualItemSystem _virtualItemSystem = default!; [Dependency] private readonly HandVirtualItemSystem _virtualItemSystem = default!;
[Dependency] private readonly ActionBlockerSystem _actionBlockerSystem = default!; [Dependency] private readonly ActionBlockerSystem _actionBlockerSystem = default!;

View File

@@ -70,7 +70,7 @@ namespace Content.Server.Headset
msg.Channel = ChatChannel.Radio; msg.Channel = ChatChannel.Radio;
msg.Message = message; msg.Message = message;
//Square brackets are added here to avoid issues with escaping //Square brackets are added here to avoid issues with escaping
msg.MessageWrap = Loc.GetString("chat-radio-message-wrap", ("channel", $"\\[{channel}\\]"), ("name", Name: _entMan.GetComponent<MetaDataComponent>(source).EntityName)); msg.MessageWrap = Loc.GetString("chat-radio-message-wrap", ("channel", $"\\[{channel}\\]"), ("name", _entMan.GetComponent<MetaDataComponent>(source).EntityName));
_netManager.ServerSendMessage(msg, playerChannel); _netManager.ServerSendMessage(msg, playerChannel);
} }
} }

View File

@@ -468,7 +468,7 @@ namespace Content.Server.Inventory.Components
var canEquip = CanEquip(msg.Inventoryslot, activeHand, true, out var reason); var canEquip = CanEquip(msg.Inventoryslot, activeHand, true, out var reason);
_hoverEntity = _hoverEntity =
new KeyValuePair<Slots, (EntityUid entity, bool fits)>(msg.Inventoryslot, new KeyValuePair<Slots, (EntityUid entity, bool fits)>(msg.Inventoryslot,
(Uid: activeHand.Owner, canEquip)); (activeHand.Owner, canEquip));
Dirty(); Dirty();
} }

View File

@@ -67,17 +67,12 @@ namespace Content.Server.Light.EntitySystems
// standard interaction checks // standard interaction checks
if (!_blocker.CanInteract(eventArgs.User)) return; if (!_blocker.CanInteract(eventArgs.User)) return;
if (eventArgs.Used != null)
{
var usedUid = eventArgs.Used;
// want to insert a new light bulb? // want to insert a new light bulb?
if (EntityManager.TryGetComponent(usedUid, out LightBulbComponent ? bulb)) if (EntityManager.TryGetComponent(eventArgs.Used, out LightBulbComponent ? bulb))
eventArgs.Handled = TryInsertBulb(uid, usedUid, eventArgs.User, true, component, bulb); eventArgs.Handled = TryInsertBulb(uid, eventArgs.Used, eventArgs.User, true, component, bulb);
// add bulbs from storage? // add bulbs from storage?
else if (EntityManager.TryGetComponent(usedUid, out ServerStorageComponent? storage)) else if (EntityManager.TryGetComponent(eventArgs.Used, out ServerStorageComponent? storage))
eventArgs.Handled = TryInsertBulbsFromStorage(uid, usedUid, eventArgs.User, component, storage); eventArgs.Handled = TryInsertBulbsFromStorage(uid, eventArgs.Used, eventArgs.User, component, storage);
}
} }
/// <summary> /// <summary>
@@ -108,7 +103,7 @@ namespace Content.Server.Light.EntitySystems
(e) => EntityManager.GetComponentOrNull<LightBulbComponent>(e)?.Type == fixture.BulbType); (e) => EntityManager.GetComponentOrNull<LightBulbComponent>(e)?.Type == fixture.BulbType);
// found bulb in inserted storage // found bulb in inserted storage
if (bulb != null) if (bulb.Valid)
{ {
// try to remove it // try to remove it
var hasRemoved = replacer.InsertedBulbs.Remove(bulb); var hasRemoved = replacer.InsertedBulbs.Remove(bulb);

View File

@@ -64,7 +64,7 @@ namespace Content.Server.Lock
args.PushText(Loc.GetString(lockComp.Locked args.PushText(Loc.GetString(lockComp.Locked
? "lock-comp-on-examined-is-locked" ? "lock-comp-on-examined-is-locked"
: "lock-comp-on-examined-is-unlocked", : "lock-comp-on-examined-is-unlocked",
("entityName", Name: EntityManager.GetComponent<MetaDataComponent>(lockComp.Owner).EntityName))); ("entityName", EntityManager.GetComponent<MetaDataComponent>(lockComp.Owner).EntityName)));
} }
public bool TryLock(EntityUid uid, EntityUid user, LockComponent? lockComp = null) public bool TryLock(EntityUid uid, EntityUid user, LockComponent? lockComp = null)
@@ -78,13 +78,10 @@ namespace Content.Server.Lock
if (!HasUserAccess(uid, user, quiet: false)) if (!HasUserAccess(uid, user, quiet: false))
return false; return false;
lockComp.Owner.PopupMessage(user, Loc.GetString("lock-comp-do-lock-success", ("entityName",Name: EntityManager.GetComponent<MetaDataComponent>(lockComp.Owner).EntityName))); lockComp.Owner.PopupMessage(user, Loc.GetString("lock-comp-do-lock-success", ("entityName", EntityManager.GetComponent<MetaDataComponent>(lockComp.Owner).EntityName)));
lockComp.Locked = true; lockComp.Locked = true;
if(lockComp.LockSound != null)
{
SoundSystem.Play(Filter.Pvs(lockComp.Owner), lockComp.LockSound.GetSound(), lockComp.Owner, AudioParams.Default.WithVolume(-5)); SoundSystem.Play(Filter.Pvs(lockComp.Owner), lockComp.LockSound.GetSound(), lockComp.Owner, AudioParams.Default.WithVolume(-5));
}
if (EntityManager.TryGetComponent(lockComp.Owner, out AppearanceComponent? appearanceComp)) if (EntityManager.TryGetComponent(lockComp.Owner, out AppearanceComponent? appearanceComp))
{ {
@@ -110,10 +107,7 @@ namespace Content.Server.Lock
lockComp.Owner.PopupMessage(user, Loc.GetString("lock-comp-do-unlock-success", ("entityName", Name: EntityManager.GetComponent<MetaDataComponent>(lockComp.Owner).EntityName))); lockComp.Owner.PopupMessage(user, Loc.GetString("lock-comp-do-unlock-success", ("entityName", Name: EntityManager.GetComponent<MetaDataComponent>(lockComp.Owner).EntityName)));
lockComp.Locked = false; lockComp.Locked = false;
if(lockComp.UnlockSound != null)
{
SoundSystem.Play(Filter.Pvs(lockComp.Owner), lockComp.UnlockSound.GetSound(), lockComp.Owner, AudioParams.Default.WithVolume(-5)); SoundSystem.Play(Filter.Pvs(lockComp.Owner), lockComp.UnlockSound.GetSound(), lockComp.Owner, AudioParams.Default.WithVolume(-5));
}
if (EntityManager.TryGetComponent(lockComp.Owner, out AppearanceComponent? appearanceComp)) if (EntityManager.TryGetComponent(lockComp.Owner, out AppearanceComponent? appearanceComp))
{ {

View File

@@ -21,7 +21,6 @@ public class GameMapManager : IGameMapManager
[Dependency] private readonly IPlayerManager _playerManager = default!; [Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly IChatManager _chatManager = default!; [Dependency] private readonly IChatManager _chatManager = default!;
[Dependency] private readonly IMapLoader _mapLoader = default!;
private GameMapPrototype _currentMap = default!; private GameMapPrototype _currentMap = default!;
private bool _currentMapForced; private bool _currentMapForced;

View File

@@ -263,7 +263,7 @@ namespace Content.Server.Nutrition.EntitySystems
if (!drink.Opened) if (!drink.Opened)
{ {
_popupSystem.PopupEntity(Loc.GetString("drink-component-try-use-drink-not-open", _popupSystem.PopupEntity(Loc.GetString("drink-component-try-use-drink-not-open",
("owner", Name: EntityManager.GetComponent<MetaDataComponent>(drink.Owner).EntityName)), uid, Filter.Entities(userUid)); ("owner", EntityManager.GetComponent<MetaDataComponent>(drink.Owner).EntityName)), uid, Filter.Entities(userUid));
return true; return true;
} }
@@ -274,7 +274,7 @@ namespace Content.Server.Nutrition.EntitySystems
drinkSolution.DrainAvailable <= 0) drinkSolution.DrainAvailable <= 0)
{ {
_popupSystem.PopupEntity(Loc.GetString("drink-component-try-use-drink-is-empty", _popupSystem.PopupEntity(Loc.GetString("drink-component-try-use-drink-is-empty",
("entity", Name: EntityManager.GetComponent<MetaDataComponent>(drink.Owner).EntityName)), uid, Filter.Entities(userUid)); ("entity", EntityManager.GetComponent<MetaDataComponent>(drink.Owner).EntityName)), uid, Filter.Entities(userUid));
return true; return true;
} }
@@ -345,7 +345,7 @@ namespace Content.Server.Nutrition.EntitySystems
if (!drink.Opened) if (!drink.Opened)
{ {
_popupSystem.PopupEntity(Loc.GetString("drink-component-try-use-drink-not-open", _popupSystem.PopupEntity(Loc.GetString("drink-component-try-use-drink-not-open",
("owner", Name: EntityManager.GetComponent<MetaDataComponent>(drink.Owner).EntityName)), uid, Filter.Entities(userUid)); ("owner", EntityManager.GetComponent<MetaDataComponent>(drink.Owner).EntityName)), uid, Filter.Entities(userUid));
return true; return true;
} }
@@ -353,7 +353,7 @@ namespace Content.Server.Nutrition.EntitySystems
drinkSolution.DrainAvailable <= 0) drinkSolution.DrainAvailable <= 0)
{ {
_popupSystem.PopupEntity(Loc.GetString("drink-component-try-use-drink-is-empty", _popupSystem.PopupEntity(Loc.GetString("drink-component-try-use-drink-is-empty",
("entity", Name: EntityManager.GetComponent<MetaDataComponent>(drink.Owner).EntityName)), uid, Filter.Entities(userUid)); ("entity", EntityManager.GetComponent<MetaDataComponent>(drink.Owner).EntityName)), uid, Filter.Entities(userUid));
return true; return true;
} }

View File

@@ -1,5 +1,4 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using Content.Server.Body.Components; using Content.Server.Body.Components;
using Content.Server.Body.Systems; using Content.Server.Body.Systems;
using Content.Server.Chemistry.EntitySystems; using Content.Server.Chemistry.EntitySystems;
@@ -19,17 +18,13 @@ using Content.Shared.Interaction;
using Content.Shared.Interaction.Helpers; using Content.Shared.Interaction.Helpers;
using Content.Shared.Inventory; using Content.Shared.Inventory;
using Content.Shared.MobState.Components; using Content.Shared.MobState.Components;
using Content.Shared.Tag;
using Content.Shared.Verbs; using Content.Shared.Verbs;
using Robust.Shared.Audio; using Robust.Shared.Audio;
using Robust.Shared.GameObjects; using Robust.Shared.GameObjects;
using Robust.Shared.IoC; using Robust.Shared.IoC;
using Robust.Shared.Localization; using Robust.Shared.Localization;
using Robust.Shared.Player; using Robust.Shared.Player;
using System.Collections.Generic;
using Robust.Shared.Utility; using Robust.Shared.Utility;
using Content.Server.Inventory.Components;
using Content.Shared.Inventory;
using Content.Shared.Hands; using Content.Shared.Hands;
namespace Content.Server.Nutrition.EntitySystems namespace Content.Server.Nutrition.EntitySystems

View File

@@ -129,7 +129,7 @@ namespace Content.Server.PAI
private void AddWipeVerb(EntityUid uid, PAIComponent pai, GetActivationVerbsEvent args) private void AddWipeVerb(EntityUid uid, PAIComponent pai, GetActivationVerbsEvent args)
{ {
if (args.User == null || !args.CanAccess || !args.CanInteract) if (!args.User.Valid || !args.CanAccess || !args.CanInteract)
return; return;
if (EntityManager.TryGetComponent<MindComponent>(uid, out var mind) && mind.HasMind) if (EntityManager.TryGetComponent<MindComponent>(uid, out var mind) && mind.HasMind)

View File

@@ -48,7 +48,7 @@ namespace Content.Server.Power.EntitySystems
var held = hand.HeldEntity; var held = hand.HeldEntity;
// Pulsing is hardcoded here because I don't think it needs to be more complex than that right now. // Pulsing is hardcoded here because I don't think it needs to be more complex than that right now.
// Update if I'm wrong. // Update if I'm wrong.
if ((held != null) && _toolSystem.HasQuality(held, "Pulsing")) if (held.Valid && _toolSystem.HasQuality(held, "Pulsing"))
{ {
args.PushMarkup(GenerateCableMarkup(uid)); args.PushMarkup(GenerateCableMarkup(uid));
// args.PushFancyUpdatingPowerGraphs(uid); // args.PushFancyUpdatingPowerGraphs(uid);

View File

@@ -134,13 +134,10 @@ namespace Content.Server.PowerCell.Components
if (cell == null || !CanRemoveCell) return null; if (cell == null || !CanRemoveCell) return null;
if (!_cellContainer.Remove(cell.Owner)) return null; if (!_cellContainer.Remove(cell.Owner)) return null;
//Dirty(); //Dirty();
if (user != null)
{
if (!_entities.TryGetComponent(user, out HandsComponent? hands) || !hands.PutInHand(_entities.GetComponent<ItemComponent>(cell.Owner))) if (!_entities.TryGetComponent(user, out HandsComponent? hands) || !hands.PutInHand(_entities.GetComponent<ItemComponent>(cell.Owner)))
{ {
_entities.GetComponent<TransformComponent>(cell.Owner).Coordinates = _entities.GetComponent<TransformComponent>(user).Coordinates; _entities.GetComponent<TransformComponent>(cell.Owner).Coordinates = _entities.GetComponent<TransformComponent>(user).Coordinates;
} }
}
else else
{ {
_entities.GetComponent<TransformComponent>(cell.Owner).Coordinates = _entities.GetComponent<TransformComponent>(Owner).Coordinates; _entities.GetComponent<TransformComponent>(cell.Owner).Coordinates = _entities.GetComponent<TransformComponent>(Owner).Coordinates;

View File

@@ -235,7 +235,7 @@ namespace Content.Server.RCD.Systems
mode = (++mode) % _modes.Length; //Then, do a rollover on the value so it doesnt hit an invalid state mode = (++mode) % _modes.Length; //Then, do a rollover on the value so it doesnt hit an invalid state
rcd.Mode = (RcdMode) mode; //Finally, cast the newly acquired int mode to an RCDmode so we can use it. rcd.Mode = (RcdMode) mode; //Finally, cast the newly acquired int mode to an RCDmode so we can use it.
if (user != null) if (user.Valid)
{ {
var msg = Loc.GetString("rcd-component-change-mode", ("mode", rcd.Mode.ToString())); var msg = Loc.GetString("rcd-component-change-mode", ("mode", rcd.Mode.ToString()));
rcd.Owner.PopupMessage(user, msg); //Prints an overhead message above the RCD rcd.Owner.PopupMessage(user, msg); //Prints an overhead message above the RCD

View File

@@ -1,6 +1,5 @@
using Robust.Shared.GameObjects; using Robust.Shared.GameObjects;
using System.Collections.Generic; using System.Collections.Generic;
using Robust.Shared.GameObjects;
namespace Content.Server.Radio.Components namespace Content.Server.Radio.Components
{ {

View File

@@ -39,7 +39,7 @@ namespace Content.Server.Storage.Components
var lockerEnt = _robustRandom.Pick(lockers); var lockerEnt = _robustRandom.Pick(lockers);
if (lockerEnt == null) return; // No valid lockers anywhere. if (!lockerEnt.Valid) return; // No valid lockers anywhere.
var locker = _entMan.GetComponent<EntityStorageComponent>(lockerEnt); var locker = _entMan.GetComponent<EntityStorageComponent>(lockerEnt);

View File

@@ -40,16 +40,16 @@ namespace Content.Server.Stunnable
var source = args.Source; var source = args.Source;
var target = args.Target; var target = args.Target;
if (source != null) if (source.Valid)
{ {
var knock = EntityManager.GetComponent<KnockedDownComponent>(uid); var knock = EntityManager.GetComponent<KnockedDownComponent>(uid);
SoundSystem.Play(Filter.Pvs(source), knock.StunAttemptSound.GetSound(), source, AudioHelpers.WithVariation(0.025f)); SoundSystem.Play(Filter.Pvs(source), knock.StunAttemptSound.GetSound(), source, AudioHelpers.WithVariation(0.025f));
if (target != null) if (target.Valid)
{ {
// TODO: Use PopupSystem // TODO: Use PopupSystem
source.PopupMessageOtherClients(Loc.GetString("stunned-component-disarm-success-others", ("source", Name: EntityManager.GetComponent<MetaDataComponent>(source).EntityName), ("target", Name: EntityManager.GetComponent<MetaDataComponent>(target).EntityName))); source.PopupMessageOtherClients(Loc.GetString("stunned-component-disarm-success-others", ("source", EntityManager.GetComponent<MetaDataComponent>(source).EntityName), ("target", EntityManager.GetComponent<MetaDataComponent>(target).EntityName)));
source.PopupMessageCursor(Loc.GetString("stunned-component-disarm-success", ("target", Name: EntityManager.GetComponent<MetaDataComponent>(target).EntityName))); source.PopupMessageCursor(Loc.GetString("stunned-component-disarm-success", ("target", EntityManager.GetComponent<MetaDataComponent>(target).EntityName)));
} }
} }

View File

@@ -161,7 +161,7 @@ namespace Content.Server.Suspicion
continue; continue;
} }
allies.Add((role.Role!.Mind.CharacterName, Uid: role.Owner)); allies.Add((role.Role!.Mind.CharacterName, role.Owner));
} }
return new SuspicionRoleComponentState(Role?.Name, Role?.Antagonist, allies.ToArray()); return new SuspicionRoleComponentState(Role?.Name, Role?.Antagonist, allies.ToArray());

View File

@@ -40,7 +40,7 @@ namespace Content.Server.Toilet
private const float PryLidTime = 1f; private const float PryLidTime = 1f;
private bool _isPrying = false; private bool _isPrying;
[DataField("pryingQuality", customTypeSerializer:typeof(PrototypeIdSerializer<ToolQualityPrototype>))] [DataField("pryingQuality", customTypeSerializer:typeof(PrototypeIdSerializer<ToolQualityPrototype>))]
private string _pryingQuality = "Prying"; private string _pryingQuality = "Prying";
@@ -157,20 +157,20 @@ namespace Content.Server.Toilet
if (_entMan.TryGetComponent<SharedBodyComponent?>(victim, out var body) && if (_entMan.TryGetComponent<SharedBodyComponent?>(victim, out var body) &&
body.HasPartOfType(BodyPartType.Head)) body.HasPartOfType(BodyPartType.Head))
{ {
var othersMessage = Loc.GetString("toilet-component-suicide-head-message-others", ("victim",Name: _entMan.GetComponent<MetaDataComponent>(victim).EntityName),("owner", Name: _entMan.GetComponent<MetaDataComponent>(Owner).EntityName)); var othersMessage = Loc.GetString("toilet-component-suicide-head-message-others", ("victim", _entMan.GetComponent<MetaDataComponent>(victim).EntityName),("owner", _entMan.GetComponent<MetaDataComponent>(Owner).EntityName));
victim.PopupMessageOtherClients(othersMessage); victim.PopupMessageOtherClients(othersMessage);
var selfMessage = Loc.GetString("toilet-component-suicide-head-message", ("owner", Name: _entMan.GetComponent<MetaDataComponent>(Owner).EntityName)); var selfMessage = Loc.GetString("toilet-component-suicide-head-message", ("owner", _entMan.GetComponent<MetaDataComponent>(Owner).EntityName));
victim.PopupMessage(selfMessage); victim.PopupMessage(selfMessage);
return SuicideKind.Asphyxiation; return SuicideKind.Asphyxiation;
} }
else else
{ {
var othersMessage = Loc.GetString("toilet-component-suicide-message-others",("victim", Name: _entMan.GetComponent<MetaDataComponent>(victim).EntityName),("owner", Name: _entMan.GetComponent<MetaDataComponent>(Owner).EntityName)); var othersMessage = Loc.GetString("toilet-component-suicide-message-others",("victim", _entMan.GetComponent<MetaDataComponent>(victim).EntityName),("owner", _entMan.GetComponent<MetaDataComponent>(Owner).EntityName));
victim.PopupMessageOtherClients(othersMessage); victim.PopupMessageOtherClients(othersMessage);
var selfMessage = Loc.GetString("toilet-component-suicide-message", ("owner",Name: _entMan.GetComponent<MetaDataComponent>(Owner).EntityName)); var selfMessage = Loc.GetString("toilet-component-suicide-message", ("owner", _entMan.GetComponent<MetaDataComponent>(Owner).EntityName));
victim.PopupMessage(selfMessage); victim.PopupMessage(selfMessage);
return SuicideKind.Blunt; return SuicideKind.Blunt;

View File

@@ -270,7 +270,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
return false; return false;
} }
public bool UseEntity(UseEntityEventArgs eventArgs) bool IUse.UseEntity(UseEntityEventArgs eventArgs)
{ {
if (BoltOpen) if (BoltOpen)
{ {
@@ -284,7 +284,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
return true; return true;
} }
public async Task<bool> InteractUsing(InteractUsingEventArgs eventArgs) async Task<bool> IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs)
{ {
return TryInsertBullet(eventArgs.User, eventArgs.Using); return TryInsertBullet(eventArgs.User, eventArgs.Using);
} }

View File

@@ -226,13 +226,13 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
return false; return false;
} }
public bool UseEntity(UseEntityEventArgs eventArgs) bool IUse.UseEntity(UseEntityEventArgs eventArgs)
{ {
Cycle(true); Cycle(true);
return true; return true;
} }
public async Task<bool> InteractUsing(InteractUsingEventArgs eventArgs) async Task<bool> IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs)
{ {
return TryInsertBullet(eventArgs); return TryInsertBullet(eventArgs);
} }

View File

@@ -252,7 +252,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
/// <param name="eventArgs"></param> /// <param name="eventArgs"></param>
/// <returns></returns> /// <returns></returns>
/// <exception cref="NotImplementedException"></exception> /// <exception cref="NotImplementedException"></exception>
public bool UseEntity(UseEntityEventArgs eventArgs) bool IUse.UseEntity(UseEntityEventArgs eventArgs)
{ {
EjectAllSlots(); EjectAllSlots();
Dirty(); Dirty();
@@ -260,7 +260,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
return true; return true;
} }
public async Task<bool> InteractUsing(InteractUsingEventArgs eventArgs) async Task<bool> IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs)
{ {
return TryInsertBullet(eventArgs.User, eventArgs.Using); return TryInsertBullet(eventArgs.User, eventArgs.Using);
} }

View File

@@ -248,7 +248,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
_appearanceComponent?.SetData(AmmoVisuals.AmmoMax, Capacity); _appearanceComponent?.SetData(AmmoVisuals.AmmoMax, Capacity);
} }
public bool UseEntity(UseEntityEventArgs eventArgs) bool IUse.UseEntity(UseEntityEventArgs eventArgs)
{ {
// Behavior: // Behavior:
// If bolt open just close it // If bolt open just close it
@@ -305,7 +305,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
_chamberContainer.Insert(nextRound); _chamberContainer.Insert(nextRound);
if (_autoEjectMag && magazine != null && _entities.GetComponent<RangedMagazineComponent>(magazine).ShotsLeft == 0) if (_autoEjectMag && magazine.Valid && _entities.GetComponent<RangedMagazineComponent>(magazine).ShotsLeft == 0)
{ {
SoundSystem.Play(Filter.Pvs(Owner), _soundAutoEject.GetSound(), Owner, AudioParams.Default.WithVolume(-2)); SoundSystem.Play(Filter.Pvs(Owner), _soundAutoEject.GetSound(), Owner, AudioParams.Default.WithVolume(-2));
@@ -391,7 +391,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
UpdateAppearance(); UpdateAppearance();
} }
public async Task<bool> InteractUsing(InteractUsingEventArgs eventArgs) async Task<bool> IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs)
{ {
if (CanInsertMagazine(eventArgs.User, eventArgs.Using, quiet: false)) if (CanInsertMagazine(eventArgs.User, eventArgs.Using, quiet: false))
{ {

View File

@@ -468,7 +468,7 @@ namespace Content.Shared.Body.Components
var i = 0; var i = 0;
foreach (var (part, slot) in SlotParts) foreach (var (part, slot) in SlotParts)
{ {
parts[i] = (slot.Id, Owner: part.Owner); parts[i] = (slot.Id, part.Owner);
i++; i++;
} }

View File

@@ -111,9 +111,6 @@ namespace Content.Shared.Hands.Components
var hands = new List<HandVisualState>(); var hands = new List<HandVisualState>();
foreach (var hand in Hands) foreach (var hand in Hands)
{ {
if (hand.HeldEntity == null)
continue;
if (!entMan.TryGetComponent(hand.HeldEntity, out SharedItemComponent? item) || item.RsiPath == null) if (!entMan.TryGetComponent(hand.HeldEntity, out SharedItemComponent? item) || item.RsiPath == null)
continue; continue;
@@ -233,8 +230,8 @@ namespace Content.Shared.Hands.Components
public bool TryGetActiveHeldEntity(out EntityUid heldEntity) public bool TryGetActiveHeldEntity(out EntityUid heldEntity)
{ {
heldEntity = GetActiveHand()?.HeldEntity ?? default; heldEntity = GetActiveHand()?.HeldEntity ?? EntityUid.Invalid;
return heldEntity != null; return !heldEntity.Valid;
} }
public bool IsHolding(EntityUid entity) public bool IsHolding(EntityUid entity)
@@ -415,7 +412,7 @@ namespace Content.Shared.Hands.Components
/// </summary> /// </summary>
private bool CanRemoveHeldEntityFromHand(Hand hand) private bool CanRemoveHeldEntityFromHand(Hand hand)
{ {
if (hand.HeldEntity == null) if (!hand.HeldEntity.Valid)
return false; return false;
var heldEntity = hand.HeldEntity; var heldEntity = hand.HeldEntity;
@@ -446,7 +443,7 @@ namespace Content.Shared.Hands.Components
/// </summary> /// </summary>
private void RemoveHeldEntityFromHand(Hand hand) private void RemoveHeldEntityFromHand(Hand hand)
{ {
if (hand.HeldEntity == null) if (!hand.HeldEntity.Valid)
return; return;
var heldEntity = hand.HeldEntity; var heldEntity = hand.HeldEntity;
@@ -537,7 +534,7 @@ namespace Content.Shared.Hands.Components
private bool CanPutHeldEntityIntoContainer(Hand hand, IContainer targetContainer, bool checkActionBlocker) private bool CanPutHeldEntityIntoContainer(Hand hand, IContainer targetContainer, bool checkActionBlocker)
{ {
if (hand.HeldEntity == null) if (!hand.HeldEntity.Valid)
return false; return false;
var heldEntity = hand.HeldEntity; var heldEntity = hand.HeldEntity;
@@ -556,7 +553,7 @@ namespace Content.Shared.Hands.Components
/// </summary> /// </summary>
private void PutHeldEntityIntoContainer(Hand hand, IContainer targetContainer) private void PutHeldEntityIntoContainer(Hand hand, IContainer targetContainer)
{ {
if (hand.HeldEntity == null) if (!hand.HeldEntity.Valid)
return; return;
var heldEntity = hand.HeldEntity; var heldEntity = hand.HeldEntity;

View File

@@ -650,7 +650,7 @@ namespace Content.Shared.Interaction
/// <param name="used"></param> /// <param name="used"></param>
public void TryUseInteraction(EntityUid user, EntityUid used, bool altInteract = false) public void TryUseInteraction(EntityUid user, EntityUid used, bool altInteract = false)
{ {
if (user != null && used != null && _actionBlockerSystem.CanUse(user)) if (user.Valid && used.Valid && _actionBlockerSystem.CanUse(user))
{ {
if (altInteract) if (altInteract)
AltInteract(user, used); AltInteract(user, used);
@@ -820,7 +820,7 @@ namespace Content.Shared.Interaction
/// </summary> /// </summary>
public bool TryDroppedInteraction(EntityUid user, EntityUid item) public bool TryDroppedInteraction(EntityUid user, EntityUid item)
{ {
if (user == null || item == null || !_actionBlockerSystem.CanDrop(user)) return false; if (!user.Valid || !item.Valid || !_actionBlockerSystem.CanDrop(user)) return false;
DroppedInteraction(user, item); DroppedInteraction(user, item);
return true; return true;

View File

@@ -12,8 +12,6 @@ namespace Content.Shared.Standing
{ {
public sealed class StandingStateSystem : EntitySystem public sealed class StandingStateSystem : EntitySystem
{ {
[Dependency] private readonly SharedHandsSystem _sharedHandsSystem = default!;
public bool IsDown(EntityUid uid, StandingStateComponent? standingState = null) public bool IsDown(EntityUid uid, StandingStateComponent? standingState = null)
{ {
if (!Resolve(uid, ref standingState, false)) if (!Resolve(uid, ref standingState, false))