Inline GetComponentOrNull
This commit is contained in:
@@ -18,7 +18,7 @@ namespace Content.Client.Kitchen.Visualizers
|
|||||||
base.OnChangeData(component);
|
base.OnChangeData(component);
|
||||||
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<ISpriteComponent>(component.Owner.Uid);
|
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<ISpriteComponent>(component.Owner.Uid);
|
||||||
|
|
||||||
var microwaveComponent = component.Owner.GetComponentOrNull<MicrowaveComponent>();
|
var microwaveComponent = IoCManager.Resolve<IEntityManager>().GetComponentOrNull<MicrowaveComponent>(component.Owner.Uid);
|
||||||
|
|
||||||
if (!component.TryGetData(PowerDeviceVisuals.VisualState, out MicrowaveVisualState state))
|
if (!component.TryGetData(PowerDeviceVisuals.VisualState, out MicrowaveVisualState state))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using Content.Shared.Smoking;
|
|||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Serialization.Manager.Attributes;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
namespace Content.Client.Smoking
|
namespace Content.Client.Smoking
|
||||||
@@ -38,7 +39,7 @@ namespace Content.Client.Smoking
|
|||||||
|
|
||||||
private void SetState(AppearanceComponent component, SmokableState burnState)
|
private void SetState(AppearanceComponent component, SmokableState burnState)
|
||||||
{
|
{
|
||||||
var clothing = component.Owner.GetComponentOrNull<ClothingComponent>();
|
var clothing = IoCManager.Resolve<IEntityManager>().GetComponentOrNull<ClothingComponent>(component.Owner.Uid);
|
||||||
|
|
||||||
if (component.Owner.TryGetComponent<ISpriteComponent>(out var sprite))
|
if (component.Owner.TryGetComponent<ISpriteComponent>(out var sprite))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -231,9 +231,9 @@ namespace Content.Server.Atmos.Components
|
|||||||
private InternalsComponent? GetInternalsComponent(IEntity? owner = null)
|
private InternalsComponent? GetInternalsComponent(IEntity? owner = null)
|
||||||
{
|
{
|
||||||
if ((!IoCManager.Resolve<IEntityManager>().EntityExists(Owner.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Owner.Uid).EntityLifeStage) >= EntityLifeStage.Deleted) return null;
|
if ((!IoCManager.Resolve<IEntityManager>().EntityExists(Owner.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Owner.Uid).EntityLifeStage) >= EntityLifeStage.Deleted) return null;
|
||||||
if (owner != null) return owner.GetComponentOrNull<InternalsComponent>();
|
if (owner != null) return IoCManager.Resolve<IEntityManager>().GetComponentOrNull<InternalsComponent>(owner.Uid);
|
||||||
return Owner.TryGetContainer(out var container)
|
return Owner.TryGetContainer(out var container)
|
||||||
? container.Owner.GetComponentOrNull<InternalsComponent>()
|
? IoCManager.Resolve<IEntityManager>().GetComponentOrNull<InternalsComponent>(container.Owner.Uid)
|
||||||
: null;
|
: null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ namespace Content.Server.Atmos.EntitySystems
|
|||||||
|
|
||||||
var uid = barotrauma.Owner.Uid;
|
var uid = barotrauma.Owner.Uid;
|
||||||
|
|
||||||
var status = barotrauma.Owner.GetComponentOrNull<ServerAlertsComponent>();
|
var status = IoCManager.Resolve<IEntityManager>().GetComponentOrNull<ServerAlertsComponent>(barotrauma.Owner.Uid);
|
||||||
|
|
||||||
var pressure = 1f;
|
var pressure = 1f;
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems
|
|||||||
|
|
||||||
private void OnGasDualPortVentPumpUpdated(EntityUid uid, GasDualPortVentPumpComponent vent, AtmosDeviceUpdateEvent args)
|
private void OnGasDualPortVentPumpUpdated(EntityUid uid, GasDualPortVentPumpComponent vent, AtmosDeviceUpdateEvent args)
|
||||||
{
|
{
|
||||||
var appearance = vent.Owner.GetComponentOrNull<AppearanceComponent>();
|
var appearance = IoCManager.Resolve<IEntityManager>().GetComponentOrNull<AppearanceComponent>(vent.Owner.Uid);
|
||||||
|
|
||||||
if (vent.Welded)
|
if (vent.Welded)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems
|
|||||||
|
|
||||||
private void OnPumpUpdated(EntityUid uid, GasPressurePumpComponent pump, AtmosDeviceUpdateEvent args)
|
private void OnPumpUpdated(EntityUid uid, GasPressurePumpComponent pump, AtmosDeviceUpdateEvent args)
|
||||||
{
|
{
|
||||||
var appearance = pump.Owner.GetComponentOrNull<AppearanceComponent>();
|
var appearance = IoCManager.Resolve<IEntityManager>().GetComponentOrNull<AppearanceComponent>(pump.Owner.Uid);
|
||||||
|
|
||||||
if (!pump.Enabled
|
if (!pump.Enabled
|
||||||
|| !EntityManager.TryGetComponent(uid, out NodeContainerComponent? nodeContainer)
|
|| !EntityManager.TryGetComponent(uid, out NodeContainerComponent? nodeContainer)
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems
|
|||||||
|
|
||||||
private void OnFilterUpdated(EntityUid uid, GasFilterComponent filter, AtmosDeviceUpdateEvent args)
|
private void OnFilterUpdated(EntityUid uid, GasFilterComponent filter, AtmosDeviceUpdateEvent args)
|
||||||
{
|
{
|
||||||
var appearance = filter.Owner.GetComponentOrNull<AppearanceComponent>();
|
var appearance = IoCManager.Resolve<IEntityManager>().GetComponentOrNull<AppearanceComponent>(filter.Owner.Uid);
|
||||||
|
|
||||||
if (!filter.Enabled
|
if (!filter.Enabled
|
||||||
|| !EntityManager.TryGetComponent(uid, out NodeContainerComponent? nodeContainer)
|
|| !EntityManager.TryGetComponent(uid, out NodeContainerComponent? nodeContainer)
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
|||||||
|
|
||||||
private void OnThermoMachineUpdated(EntityUid uid, GasThermoMachineComponent thermoMachine, AtmosDeviceUpdateEvent args)
|
private void OnThermoMachineUpdated(EntityUid uid, GasThermoMachineComponent thermoMachine, AtmosDeviceUpdateEvent args)
|
||||||
{
|
{
|
||||||
var appearance = thermoMachine.Owner.GetComponentOrNull<AppearanceComponent>();
|
var appearance = IoCManager.Resolve<IEntityManager>().GetComponentOrNull<AppearanceComponent>(thermoMachine.Owner.Uid);
|
||||||
|
|
||||||
if (!thermoMachine.Enabled
|
if (!thermoMachine.Enabled
|
||||||
|| !EntityManager.TryGetComponent(uid, out NodeContainerComponent? nodeContainer)
|
|| !EntityManager.TryGetComponent(uid, out NodeContainerComponent? nodeContainer)
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
|||||||
|
|
||||||
private void OnGasVentPumpUpdated(EntityUid uid, GasVentPumpComponent vent, AtmosDeviceUpdateEvent args)
|
private void OnGasVentPumpUpdated(EntityUid uid, GasVentPumpComponent vent, AtmosDeviceUpdateEvent args)
|
||||||
{
|
{
|
||||||
var appearance = vent.Owner.GetComponentOrNull<AppearanceComponent>();
|
var appearance = IoCManager.Resolve<IEntityManager>().GetComponentOrNull<AppearanceComponent>(vent.Owner.Uid);
|
||||||
|
|
||||||
if (vent.Welded)
|
if (vent.Welded)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
|||||||
|
|
||||||
private void OnVentScrubberUpdated(EntityUid uid, GasVentScrubberComponent scrubber, AtmosDeviceUpdateEvent args)
|
private void OnVentScrubberUpdated(EntityUid uid, GasVentScrubberComponent scrubber, AtmosDeviceUpdateEvent args)
|
||||||
{
|
{
|
||||||
var appearance = scrubber.Owner.GetComponentOrNull<AppearanceComponent>();
|
var appearance = IoCManager.Resolve<IEntityManager>().GetComponentOrNull<AppearanceComponent>(scrubber.Owner.Uid);
|
||||||
|
|
||||||
if (scrubber.Welded)
|
if (scrubber.Welded)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ namespace Content.Server.Body.Surgery
|
|||||||
|
|
||||||
private bool VesselsClamped { get; set; }
|
private bool VesselsClamped { get; set; }
|
||||||
|
|
||||||
public SharedBodyPartComponent? Parent => Owner.GetComponentOrNull<SharedBodyPartComponent>();
|
public SharedBodyPartComponent? Parent => IoCManager.Resolve<IEntityManager>().GetComponentOrNull<SharedBodyPartComponent>(Owner.Uid);
|
||||||
|
|
||||||
public BodyPartType? ParentType => Parent?.PartType;
|
public BodyPartType? ParentType => Parent?.PartType;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using Content.Server.Chemistry.Components;
|
using Content.Server.Chemistry.Components;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Serialization.Manager.Attributes;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
namespace Content.Server.Chemistry.ReactionEffects
|
namespace Content.Server.Chemistry.ReactionEffects
|
||||||
@@ -11,7 +12,7 @@ namespace Content.Server.Chemistry.ReactionEffects
|
|||||||
{
|
{
|
||||||
protected override SolutionAreaEffectComponent? GetAreaEffectComponent(IEntity entity)
|
protected override SolutionAreaEffectComponent? GetAreaEffectComponent(IEntity entity)
|
||||||
{
|
{
|
||||||
return entity.GetComponentOrNull<FoamSolutionAreaEffectComponent>();
|
return IoCManager.Resolve<IEntityManager>().GetComponentOrNull<FoamSolutionAreaEffectComponent>(entity.Uid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using Content.Server.Chemistry.Components;
|
using Content.Server.Chemistry.Components;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Serialization.Manager.Attributes;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
namespace Content.Server.Chemistry.ReactionEffects
|
namespace Content.Server.Chemistry.ReactionEffects
|
||||||
@@ -11,7 +12,7 @@ namespace Content.Server.Chemistry.ReactionEffects
|
|||||||
{
|
{
|
||||||
protected override SolutionAreaEffectComponent? GetAreaEffectComponent(IEntity entity)
|
protected override SolutionAreaEffectComponent? GetAreaEffectComponent(IEntity entity)
|
||||||
{
|
{
|
||||||
return entity.GetComponentOrNull<SmokeSolutionAreaEffectComponent>();
|
return IoCManager.Resolve<IEntityManager>().GetComponentOrNull<SmokeSolutionAreaEffectComponent>(entity.Uid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ namespace Content.Server.Cuffs
|
|||||||
!cuffable.Initialized) return;
|
!cuffable.Initialized) return;
|
||||||
|
|
||||||
var dirty = false;
|
var dirty = false;
|
||||||
var handCount = owner.GetComponentOrNull<HandsComponent>()?.Count ?? 0;
|
var handCount = IoCManager.Resolve<IEntityManager>().GetComponentOrNull<HandsComponent>(owner.Uid)?.Count ?? 0;
|
||||||
|
|
||||||
while (cuffable.CuffedHandCount > handCount && cuffable.CuffedHandCount > 0)
|
while (cuffable.CuffedHandCount > handCount && cuffable.CuffedHandCount > 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using Content.Shared.Instruments;
|
|||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Server.Player;
|
using Robust.Server.Player;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.ViewVariables;
|
using Robust.Shared.ViewVariables;
|
||||||
|
|
||||||
namespace Content.Server.Instruments;
|
namespace Content.Server.Instruments;
|
||||||
@@ -23,8 +24,8 @@ public sealed class InstrumentComponent : SharedInstrumentComponent
|
|||||||
public int MidiEventCount = 0;
|
public int MidiEventCount = 0;
|
||||||
|
|
||||||
public IPlayerSession? InstrumentPlayer =>
|
public IPlayerSession? InstrumentPlayer =>
|
||||||
Owner.GetComponentOrNull<ActivatableUIComponent>()?.CurrentSingleUser
|
IoCManager.Resolve<IEntityManager>().GetComponentOrNull<ActivatableUIComponent>(Owner.Uid)?.CurrentSingleUser
|
||||||
?? Owner.GetComponentOrNull<ActorComponent>()?.PlayerSession;
|
?? IoCManager.Resolve<IEntityManager>().GetComponentOrNull<ActorComponent>(Owner.Uid)?.PlayerSession;
|
||||||
|
|
||||||
[ViewVariables] public BoundUserInterface? UserInterface => Owner.GetUIOrNull(InstrumentUiKey.Key);
|
[ViewVariables] public BoundUserInterface? UserInterface => Owner.GetUIOrNull(InstrumentUiKey.Key);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ namespace Content.Server.Inventory.Components
|
|||||||
public IEnumerable<T?> LookupItems<T>() where T : Component
|
public IEnumerable<T?> LookupItems<T>() where T : Component
|
||||||
{
|
{
|
||||||
return _slotContainers.Values
|
return _slotContainers.Values
|
||||||
.SelectMany(x => x.ContainedEntities.Select(e => e.GetComponentOrNull<T>()))
|
.SelectMany(x => x.ContainedEntities.Select(e => IoCManager.Resolve<IEntityManager>().GetComponentOrNull<T>(e.Uid)))
|
||||||
.Where(x => x != null);
|
.Where(x => x != null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ namespace Content.Server.Light.EntitySystems
|
|||||||
|
|
||||||
// try get first inserted bulb of the same type as targeted light fixtutre
|
// try get first inserted bulb of the same type as targeted light fixtutre
|
||||||
var bulb = replacer.InsertedBulbs.ContainedEntities.FirstOrDefault(
|
var bulb = replacer.InsertedBulbs.ContainedEntities.FirstOrDefault(
|
||||||
(e) => e.GetComponentOrNull<LightBulbComponent>()?.Type == fixture.BulbType);
|
(e) => IoCManager.Resolve<IEntityManager>().GetComponentOrNull<LightBulbComponent>(e.Uid)?.Type == fixture.BulbType);
|
||||||
|
|
||||||
// found bulb in inserted storage
|
// found bulb in inserted storage
|
||||||
if (bulb != null)
|
if (bulb != null)
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ namespace Content.Server.Medical.Components
|
|||||||
if (body == null)
|
if (body == null)
|
||||||
return MedicalScannerStatus.Open;
|
return MedicalScannerStatus.Open;
|
||||||
|
|
||||||
var state = body.GetComponentOrNull<MobStateComponent>();
|
var state = IoCManager.Resolve<IEntityManager>().GetComponentOrNull<MobStateComponent>(body.Uid);
|
||||||
|
|
||||||
return state == null ? MedicalScannerStatus.Open : GetStatusFromDamageState(state);
|
return state == null ? MedicalScannerStatus.Open : GetStatusFromDamageState(state);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -155,7 +155,7 @@ namespace Content.Server.Mind
|
|||||||
// This can be null if they're deleted (spike / brain nom)
|
// This can be null if they're deleted (spike / brain nom)
|
||||||
if (OwnedEntity == null)
|
if (OwnedEntity == null)
|
||||||
return true;
|
return true;
|
||||||
var targetMobState = OwnedEntity.GetComponentOrNull<MobStateComponent>();
|
var targetMobState = IoCManager.Resolve<IEntityManager>().GetComponentOrNull<MobStateComponent>(OwnedEntity.Uid);
|
||||||
// This can be null if it's a brain (this happens very often)
|
// This can be null if it's a brain (this happens very often)
|
||||||
// Brains are the result of gibbing so should definitely count as dead
|
// Brains are the result of gibbing so should definitely count as dead
|
||||||
if (targetMobState == null)
|
if (targetMobState == null)
|
||||||
|
|||||||
@@ -20,7 +20,11 @@ namespace Content.Server.Objectives.Conditions
|
|||||||
var allHumans = entityMgr.EntityQuery<MindComponent>(true).Where(mc =>
|
var allHumans = entityMgr.EntityQuery<MindComponent>(true).Where(mc =>
|
||||||
{
|
{
|
||||||
var entity = mc.Mind?.OwnedEntity;
|
var entity = mc.Mind?.OwnedEntity;
|
||||||
return (entity?.GetComponentOrNull<MobStateComponent>()?.IsAlive() ?? false) && mc.Mind != mind;
|
|
||||||
|
if (entity == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return (IoCManager.Resolve<IEntityManager>().GetComponentOrNull<MobStateComponent>(entity.Uid)?.IsAlive() ?? false) && mc.Mind != mind;
|
||||||
}).Select(mc => mc.Mind).ToList();
|
}).Select(mc => mc.Mind).ToList();
|
||||||
return new KillRandomPersonCondition {Target = IoCManager.Resolve<IRobustRandom>().Pick(allHumans)};
|
return new KillRandomPersonCondition {Target = IoCManager.Resolve<IRobustRandom>().Pick(allHumans)};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ namespace Content.Server.PDA
|
|||||||
private void OnItemInserted(EntityUid uid, PDAComponent pda, EntInsertedIntoContainerMessage args)
|
private void OnItemInserted(EntityUid uid, PDAComponent pda, EntInsertedIntoContainerMessage args)
|
||||||
{
|
{
|
||||||
if (args.Container.ID == pda.IdSlot.ID)
|
if (args.Container.ID == pda.IdSlot.ID)
|
||||||
pda.ContainedID = args.Entity.GetComponentOrNull<IdCardComponent>();
|
pda.ContainedID = IoCManager.Resolve<IEntityManager>().GetComponentOrNull<IdCardComponent>(args.Entity.Uid);
|
||||||
|
|
||||||
UpdatePDAAppearance(pda);
|
UpdatePDAAppearance(pda);
|
||||||
UpdatePDAUserInterface(pda);
|
UpdatePDAUserInterface(pda);
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ namespace Content.Server.Storage.EntitySystems
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// Get the session for the user
|
// Get the session for the user
|
||||||
var session = args.User.GetComponentOrNull<ActorComponent>()?.PlayerSession;
|
var session = IoCManager.Resolve<IEntityManager>().GetComponentOrNull<ActorComponent>(args.User.Uid)?.PlayerSession;
|
||||||
if (session == null)
|
if (session == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
|
|
||||||
namespace Content.Server.UserInterface
|
namespace Content.Server.UserInterface
|
||||||
{
|
{
|
||||||
@@ -7,7 +8,7 @@ namespace Content.Server.UserInterface
|
|||||||
{
|
{
|
||||||
public static BoundUserInterface? GetUIOrNull(this IEntity entity, object uiKey)
|
public static BoundUserInterface? GetUIOrNull(this IEntity entity, object uiKey)
|
||||||
{
|
{
|
||||||
return entity.GetComponentOrNull<ServerUserInterfaceComponent>()?.GetBoundUserInterfaceOrNull(uiKey);
|
return IoCManager.Resolve<IEntityManager>().GetComponentOrNull<ServerUserInterfaceComponent>(entity.Uid)?.GetBoundUserInterfaceOrNull(uiKey);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -192,7 +192,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
|
|||||||
if (chamberEntity == null)
|
if (chamberEntity == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
return chamberEntity.GetComponentOrNull<AmmoComponent>()?.TakeBullet(spawnAt);
|
return IoCManager.Resolve<IEntityManager>().GetComponentOrNull<AmmoComponent>(chamberEntity.Uid)?.TakeBullet(spawnAt);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool WeaponCanFire()
|
protected override bool WeaponCanFire()
|
||||||
|
|||||||
@@ -149,6 +149,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
|
|||||||
public override IEntity? TakeProjectile(EntityCoordinates spawnAt)
|
public override IEntity? TakeProjectile(EntityCoordinates spawnAt)
|
||||||
{
|
{
|
||||||
var chamberEntity = _chamberContainer.ContainedEntity;
|
var chamberEntity = _chamberContainer.ContainedEntity;
|
||||||
|
|
||||||
if (!_manualCycle)
|
if (!_manualCycle)
|
||||||
{
|
{
|
||||||
Cycle();
|
Cycle();
|
||||||
@@ -158,7 +159,10 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
|
|||||||
Dirty();
|
Dirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
return chamberEntity?.GetComponentOrNull<AmmoComponent>()?.TakeBullet(spawnAt);
|
if (chamberEntity == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
return IoCManager.Resolve<IEntityManager>().GetComponentOrNull<AmmoComponent>(chamberEntity.Uid)?.TakeBullet(spawnAt);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Cycle(bool manual = false)
|
private void Cycle(bool manual = false)
|
||||||
|
|||||||
@@ -36,7 +36,17 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
|
|||||||
[ViewVariables] private string? _ammoPrototype;
|
[ViewVariables] private string? _ammoPrototype;
|
||||||
|
|
||||||
[ViewVariables] public IEntity? PowerCellEntity => _powerCellContainer.ContainedEntity;
|
[ViewVariables] public IEntity? PowerCellEntity => _powerCellContainer.ContainedEntity;
|
||||||
public BatteryComponent? PowerCell => _powerCellContainer.ContainedEntity?.GetComponentOrNull<BatteryComponent>();
|
public BatteryComponent? PowerCell
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_powerCellContainer.ContainedEntity == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
return _powerCellContainer.ContainedEntity.GetComponentOrNull<BatteryComponent>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private ContainerSlot _powerCellContainer = default!;
|
private ContainerSlot _powerCellContainer = default!;
|
||||||
private ContainerSlot _ammoContainer = default!;
|
private ContainerSlot _ammoContainer = default!;
|
||||||
[DataField("powerCellPrototype")]
|
[DataField("powerCellPrototype")]
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ namespace Content.Shared.Body.Components
|
|||||||
public BodyPartSymmetry Symmetry { get; private set; } = BodyPartSymmetry.None;
|
public BodyPartSymmetry Symmetry { get; private set; } = BodyPartSymmetry.None;
|
||||||
|
|
||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
public ISurgeryData? SurgeryDataComponent => Owner.GetComponentOrNull<ISurgeryData>();
|
public ISurgeryData? SurgeryDataComponent => IoCManager.Resolve<IEntityManager>().GetComponentOrNull<ISurgeryData>(Owner.Uid);
|
||||||
|
|
||||||
protected virtual void OnAddMechanism(SharedMechanismComponent mechanism)
|
protected virtual void OnAddMechanism(SharedMechanismComponent mechanism)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ namespace Content.Shared.Friction
|
|||||||
Mover.UseMobMovement(body.OwnerUid)) continue;
|
Mover.UseMobMovement(body.OwnerUid)) continue;
|
||||||
|
|
||||||
var surfaceFriction = GetTileFriction(body);
|
var surfaceFriction = GetTileFriction(body);
|
||||||
var bodyModifier = body.Owner.GetComponentOrNull<SharedTileFrictionModifier>()?.Modifier ?? 1.0f;
|
var bodyModifier = IoCManager.Resolve<IEntityManager>().GetComponentOrNull<SharedTileFrictionModifier>(body.Owner.Uid)?.Modifier ?? 1.0f;
|
||||||
var friction = _frictionModifier * surfaceFriction * bodyModifier;
|
var friction = _frictionModifier * surfaceFriction * bodyModifier;
|
||||||
|
|
||||||
ReduceLinearVelocity(prediction, body, friction, frameTime);
|
ReduceLinearVelocity(prediction, body, friction, frameTime);
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ namespace Content.Shared.MobState.Components
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Initialize with some amount of damage, defaulting to 0.
|
// Initialize with some amount of damage, defaulting to 0.
|
||||||
UpdateState(Owner.GetComponentOrNull<DamageableComponent>()?.TotalDamage ?? FixedPoint2.Zero);
|
UpdateState(IoCManager.Resolve<IEntityManager>().GetComponentOrNull<DamageableComponent>(Owner.Uid)?.TotalDamage ?? FixedPoint2.Zero);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ namespace Content.Shared.Singularity
|
|||||||
|
|
||||||
value = Math.Clamp(value, 0, 6);
|
value = Math.Clamp(value, 0, 6);
|
||||||
|
|
||||||
var physics = singularity.Owner.GetComponentOrNull<PhysicsComponent>();
|
var physics = IoCManager.Resolve<IEntityManager>().GetComponentOrNull<PhysicsComponent>(singularity.Owner.Uid);
|
||||||
|
|
||||||
if (singularity.Level > 1 && value <= 1)
|
if (singularity.Level > 1 && value <= 1)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user