Merge branch 'master' into buckle-locker-fix-1262
This commit is contained in:
@@ -1,11 +1,10 @@
|
||||
#nullable enable
|
||||
using System.Collections.Generic;
|
||||
using Content.Server.Interfaces;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Access
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -11,8 +12,6 @@ using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Access
|
||||
{
|
||||
/// <summary>
|
||||
@@ -69,7 +68,6 @@ namespace Content.Server.GameObjects.Components.Access
|
||||
return _accessLists.Count == 0 || _accessLists.Any(a => a.IsSubsetOf(accessTags));
|
||||
}
|
||||
|
||||
[CanBeNull]
|
||||
public static ICollection<string> FindAccessTags(IEntity entity)
|
||||
{
|
||||
if (entity.TryGetComponent(out IAccess accessComponent))
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#nullable enable
|
||||
using Content.Shared.Jobs;
|
||||
using Robust.Server.Interfaces.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
@@ -5,8 +6,6 @@ using Robust.Shared.IoC;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Access
|
||||
{
|
||||
[RegisterComponent]
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
using Content.Server.Cargo;
|
||||
#nullable enable
|
||||
using Content.Server.Cargo;
|
||||
using Content.Server.GameObjects.Components.Power.ApcNetComponents;
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using Content.Server.Interfaces.GameObjects.Components.Interaction;
|
||||
using Content.Shared.GameObjects.Components.Cargo;
|
||||
using Content.Shared.Prototypes.Cargo;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Server.GameObjects.Components.UserInterface;
|
||||
using Robust.Server.Interfaces.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
@@ -20,39 +20,43 @@ namespace Content.Server.GameObjects.Components.Cargo
|
||||
public class CargoConsoleComponent : SharedCargoConsoleComponent, IActivate
|
||||
{
|
||||
#pragma warning disable 649
|
||||
[Dependency] private readonly ICargoOrderDataManager _cargoOrderDataManager;
|
||||
[Dependency] private readonly ICargoOrderDataManager _cargoOrderDataManager = default!;
|
||||
#pragma warning restore 649
|
||||
|
||||
[ViewVariables]
|
||||
public int Points = 1000;
|
||||
|
||||
private BoundUserInterface _userInterface;
|
||||
private BoundUserInterface _userInterface = default!;
|
||||
|
||||
[ViewVariables]
|
||||
public GalacticMarketComponent Market { get; private set; }
|
||||
[ViewVariables]
|
||||
public CargoOrderDatabaseComponent Orders { get; private set; }
|
||||
|
||||
private CargoBankAccount _bankAccount;
|
||||
public GalacticMarketComponent Market { get; private set; } = default!;
|
||||
|
||||
[ViewVariables]
|
||||
[CanBeNull]
|
||||
public CargoBankAccount BankAccount
|
||||
public CargoOrderDatabaseComponent Orders { get; private set; } = default!;
|
||||
|
||||
private CargoBankAccount? _bankAccount;
|
||||
|
||||
[ViewVariables]
|
||||
public CargoBankAccount? BankAccount
|
||||
{
|
||||
get => _bankAccount;
|
||||
private set
|
||||
{
|
||||
if (_bankAccount == value)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_bankAccount != null)
|
||||
{
|
||||
_bankAccount.OnBalanceChange -= UpdateUIState;
|
||||
}
|
||||
|
||||
_bankAccount = value;
|
||||
|
||||
if (value != null)
|
||||
{
|
||||
_bankAccount.OnBalanceChange += UpdateUIState;
|
||||
value.OnBalanceChange += UpdateUIState;
|
||||
}
|
||||
|
||||
UpdateUIState();
|
||||
@@ -61,9 +65,9 @@ namespace Content.Server.GameObjects.Components.Cargo
|
||||
|
||||
private bool _requestOnly = false;
|
||||
|
||||
private PowerReceiverComponent _powerReceiver;
|
||||
private PowerReceiverComponent _powerReceiver = default!;
|
||||
private bool Powered => _powerReceiver.Powered;
|
||||
private CargoConsoleSystem _cargoConsoleSystem;
|
||||
private CargoConsoleSystem _cargoConsoleSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -98,8 +102,11 @@ namespace Content.Server.GameObjects.Components.Cargo
|
||||
{
|
||||
case CargoConsoleAddOrderMessage msg:
|
||||
{
|
||||
if (msg.Amount <= 0)
|
||||
if (msg.Amount <= 0 || _bankAccount == null)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
_cargoOrderDataManager.AddOrder(Orders.Database.Id, msg.Requester, msg.Reason, msg.ProductId, msg.Amount, _bankAccount.Id);
|
||||
break;
|
||||
}
|
||||
@@ -111,8 +118,12 @@ namespace Content.Server.GameObjects.Components.Cargo
|
||||
case CargoConsoleApproveOrderMessage msg:
|
||||
{
|
||||
if (_requestOnly ||
|
||||
!Orders.Database.TryGetOrder(msg.OrderNumber, out var order))
|
||||
!Orders.Database.TryGetOrder(msg.OrderNumber, out var order) ||
|
||||
_bankAccount == null)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
_prototypeManager.TryIndex(order.ProductId, out CargoProductPrototype product);
|
||||
if (product == null)
|
||||
break;
|
||||
|
||||
@@ -224,6 +224,7 @@ namespace Content.Server.GameObjects.Components.Chemistry
|
||||
if (!ActionBlockerSystem.CanInteract(user) ||
|
||||
!user.TryGetComponent<HandsComponent>(out var hands) ||
|
||||
hands.GetActiveHand == null ||
|
||||
hands.GetActiveHand.Owner == component.Owner ||
|
||||
!hands.GetActiveHand.Owner.TryGetComponent<SolutionComponent>(out var solution))
|
||||
{
|
||||
data.Visibility = VerbVisibility.Invisible;
|
||||
@@ -323,6 +324,7 @@ namespace Content.Server.GameObjects.Components.Chemistry
|
||||
if (!ActionBlockerSystem.CanInteract(user) ||
|
||||
!user.TryGetComponent<HandsComponent>(out var hands) ||
|
||||
hands.GetActiveHand == null ||
|
||||
hands.GetActiveHand.Owner == component.Owner ||
|
||||
!hands.GetActiveHand.Owner.TryGetComponent<SolutionComponent>(out var solution))
|
||||
{
|
||||
data.Visibility = VerbVisibility.Invisible;
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace Content.Server.GameObjects.Components.Explosion
|
||||
public override string Name => "FlashExplosive";
|
||||
|
||||
private float _range;
|
||||
private double _duration;
|
||||
private float _duration;
|
||||
private string _sound;
|
||||
private bool _deleteOnFlash;
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace Content.Server.GameObjects.Components.Explosion
|
||||
base.ExposeData(serializer);
|
||||
|
||||
serializer.DataField(ref _range, "range", 7.0f);
|
||||
serializer.DataField(ref _duration, "duration", 8.0);
|
||||
serializer.DataField(ref _duration, "duration", 8.0f);
|
||||
serializer.DataField(ref _sound, "sound", "/Audio/Effects/flash_bang.ogg");
|
||||
serializer.DataField(ref _deleteOnFlash, "deleteOnFlash", true);
|
||||
}
|
||||
@@ -41,7 +41,7 @@ namespace Content.Server.GameObjects.Components.Explosion
|
||||
ContainerHelpers.TryGetContainer(Owner, out var container);
|
||||
if (container == null || !container.Owner.HasComponent<EntityStorageComponent>())
|
||||
{
|
||||
ServerFlashableComponent.FlashAreaHelper(Owner, _range, _duration);
|
||||
FlashableComponent.FlashAreaHelper(Owner, _range, _duration);
|
||||
}
|
||||
|
||||
if (_sound != null)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Runtime.Remoting;
|
||||
using Content.Server.GameObjects.Components.Chemistry;
|
||||
using Content.Server.GameObjects.Components.Items.Storage;
|
||||
@@ -25,11 +26,11 @@ namespace Content.Server.GameObjects.Components.Interactable
|
||||
[RegisterComponent]
|
||||
[ComponentReference(typeof(ToolComponent))]
|
||||
[ComponentReference(typeof(IToolComponent))]
|
||||
public class WelderComponent : ToolComponent, IExamine, IUse, ISuicideAct
|
||||
public class WelderComponent : ToolComponent, IExamine, IUse, ISuicideAct, ISolutionChange
|
||||
{
|
||||
#pragma warning disable 649
|
||||
[Dependency] private IEntitySystemManager _entitySystemManager;
|
||||
[Dependency] private IServerNotifyManager _notifyManager;
|
||||
[Dependency] private readonly IEntitySystemManager _entitySystemManager = default!;
|
||||
[Dependency] private readonly IServerNotifyManager _notifyManager = default!;
|
||||
#pragma warning restore 649
|
||||
|
||||
public override string Name => "Welder";
|
||||
@@ -45,10 +46,11 @@ namespace Content.Server.GameObjects.Components.Interactable
|
||||
/// </summary>
|
||||
public const float FuelLossRate = 0.5f;
|
||||
|
||||
private bool _welderLit = false;
|
||||
private WelderSystem _welderSystem;
|
||||
private SpriteComponent _spriteComponent;
|
||||
private SolutionComponent _solutionComponent;
|
||||
private bool _welderLit;
|
||||
private WelderSystem _welderSystem = default!;
|
||||
private SpriteComponent? _spriteComponent;
|
||||
private SolutionComponent? _solutionComponent;
|
||||
private PointLightComponent? _pointLightComponent;
|
||||
|
||||
[ViewVariables]
|
||||
public float Fuel => _solutionComponent?.Solution.GetReagentQuantity("chem.WeldingFuel").Float() ?? 0f;
|
||||
@@ -80,6 +82,7 @@ namespace Content.Server.GameObjects.Components.Interactable
|
||||
|
||||
Owner.TryGetComponent(out _solutionComponent);
|
||||
Owner.TryGetComponent(out _spriteComponent);
|
||||
Owner.TryGetComponent(out _pointLightComponent);
|
||||
}
|
||||
|
||||
public override ComponentState GetComponentState()
|
||||
@@ -99,7 +102,7 @@ namespace Content.Server.GameObjects.Components.Interactable
|
||||
return base.UseTool(user, target, toolQualityNeeded) && TryWeld(fuelConsumed, user);
|
||||
}
|
||||
|
||||
private bool TryWeld(float value, IEntity user = null, bool silent = false)
|
||||
private bool TryWeld(float value, IEntity? user = null, bool silent = false)
|
||||
{
|
||||
if (!WelderLit)
|
||||
{
|
||||
@@ -132,7 +135,7 @@ namespace Content.Server.GameObjects.Components.Interactable
|
||||
/// <summary>
|
||||
/// Deactivates welding tool if active, activates welding tool if possible
|
||||
/// </summary>
|
||||
private bool ToggleWelderStatus(IEntity user = null)
|
||||
private bool ToggleWelderStatus(IEntity? user = null)
|
||||
{
|
||||
var item = Owner.GetComponent<ItemComponent>();
|
||||
|
||||
@@ -141,7 +144,10 @@ namespace Content.Server.GameObjects.Components.Interactable
|
||||
WelderLit = false;
|
||||
// Layer 1 is the flame.
|
||||
item.EquippedPrefix = "off";
|
||||
_spriteComponent.LayerSetVisible(1, false);
|
||||
_spriteComponent?.LayerSetVisible(1, false);
|
||||
|
||||
if (_pointLightComponent != null) _pointLightComponent.Enabled = false;
|
||||
|
||||
PlaySoundCollection("WelderOff", -5);
|
||||
_welderSystem.Unsubscribe(this);
|
||||
return true;
|
||||
@@ -155,7 +161,10 @@ namespace Content.Server.GameObjects.Components.Interactable
|
||||
|
||||
WelderLit = true;
|
||||
item.EquippedPrefix = "on";
|
||||
_spriteComponent.LayerSetVisible(1, true);
|
||||
_spriteComponent?.LayerSetVisible(1, true);
|
||||
|
||||
if (_pointLightComponent != null) _pointLightComponent.Enabled = true;
|
||||
|
||||
PlaySoundCollection("WelderOn", -5);
|
||||
_welderSystem.Subscribe(this);
|
||||
return true;
|
||||
@@ -189,12 +198,11 @@ namespace Content.Server.GameObjects.Components.Interactable
|
||||
if (!HasQuality(ToolQuality.Welding) || !WelderLit)
|
||||
return;
|
||||
|
||||
_solutionComponent.TryRemoveReagent("chem.WeldingFuel", ReagentUnit.New(FuelLossRate * frameTime));
|
||||
_solutionComponent?.TryRemoveReagent("chem.WeldingFuel", ReagentUnit.New(FuelLossRate * frameTime));
|
||||
|
||||
if (Fuel == 0)
|
||||
ToggleWelderStatus();
|
||||
|
||||
Dirty();
|
||||
}
|
||||
|
||||
public SuicideKind Suicide(IEntity victim, IChatManager chat)
|
||||
@@ -208,5 +216,10 @@ namespace Content.Server.GameObjects.Components.Interactable
|
||||
chat.EntityMe(victim, Loc.GetString("bashes {0:themselves} with the {1}!", victim, Owner.Name));
|
||||
return SuicideKind.Brute;
|
||||
}
|
||||
|
||||
public void SolutionChanged(SolutionChangeEventArgs eventArgs)
|
||||
{
|
||||
Dirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
using Content.Shared.GameObjects.Components.Movement;
|
||||
#nullable enable
|
||||
using Content.Shared.GameObjects.Components.Movement;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.GameObjects.Components;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Physics;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Movement
|
||||
{
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
@@ -23,8 +24,6 @@ using Robust.Shared.Localization;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace Content.Server.GameObjects.Components.PDA
|
||||
{
|
||||
[RegisterComponent]
|
||||
|
||||
@@ -17,16 +17,16 @@ namespace Content.Server.GameObjects.Components.Projectiles
|
||||
{
|
||||
public override string Name => "FlashProjectile";
|
||||
|
||||
private double _range;
|
||||
private double _duration;
|
||||
private float _range;
|
||||
private float _duration;
|
||||
|
||||
private bool _flashed;
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
serializer.DataField(ref _range, "range", 1.0);
|
||||
serializer.DataField(ref _duration, "duration", 8.0);
|
||||
serializer.DataField(ref _range, "range", 1.0f);
|
||||
serializer.DataField(ref _duration, "duration", 8.0f);
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
@@ -45,7 +45,7 @@ namespace Content.Server.GameObjects.Components.Projectiles
|
||||
{
|
||||
return;
|
||||
}
|
||||
ServerFlashableComponent.FlashAreaHelper(Owner, _range, _duration);
|
||||
FlashableComponent.FlashAreaHelper(Owner, _range, _duration);
|
||||
_flashed = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Content.Server.Utility;
|
||||
using Content.Shared.GameObjects.Components.Weapons;
|
||||
using Content.Shared.GameObjects.EntitySystems;
|
||||
using Content.Shared.Physics;
|
||||
using Robust.Server.GameObjects.EntitySystems;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Physics;
|
||||
using Robust.Shared.Interfaces.Timing;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Maths;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Weapon
|
||||
{
|
||||
[RegisterComponent]
|
||||
public sealed class FlashableComponent : SharedFlashableComponent
|
||||
{
|
||||
private double _duration;
|
||||
private TimeSpan _lastFlash;
|
||||
|
||||
public void Flash(double duration)
|
||||
{
|
||||
var timing = IoCManager.Resolve<IGameTiming>();
|
||||
_lastFlash = timing.CurTime;
|
||||
_duration = duration;
|
||||
Dirty();
|
||||
}
|
||||
|
||||
public override ComponentState GetComponentState()
|
||||
{
|
||||
return new FlashComponentState(_duration, _lastFlash);
|
||||
}
|
||||
|
||||
public static void FlashAreaHelper(IEntity source, float range, float duration, string sound = null)
|
||||
{
|
||||
foreach (var entity in IoCManager.Resolve<IEntityManager>().GetEntitiesInRange(source.Transform.GridPosition, range))
|
||||
{
|
||||
if (!InteractionChecks.InRangeUnobstructed(source, entity.Transform.MapPosition, range, ignoredEnt:entity))
|
||||
continue;
|
||||
|
||||
if(entity.TryGetComponent(out FlashableComponent flashable))
|
||||
flashable.Flash(duration);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(sound))
|
||||
{
|
||||
IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<AudioSystem>().PlayAtCoords(sound, source.Transform.GridPosition);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -53,7 +53,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
private float _slowdownTime = 5f;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)] public float EnergyPerUse { get; set; } = 1000;
|
||||
[ViewVariables(VVAccess.ReadWrite)] public float EnergyPerUse { get; set; } = 50;
|
||||
|
||||
[ViewVariables]
|
||||
public bool Activated => _activated;
|
||||
@@ -89,13 +89,12 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
|
||||
|
||||
protected override bool OnHitEntities(IReadOnlyList<IEntity> entities, AttackEventArgs eventArgs)
|
||||
{
|
||||
var cell = Cell;
|
||||
if (!Activated || entities.Count == 0 || cell == null)
|
||||
return false;
|
||||
if (!cell.TryUseCharge(EnergyPerUse))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!Activated || entities.Count == 0 || Cell == null)
|
||||
return true;
|
||||
|
||||
if (!Cell.TryUseCharge(EnergyPerUse))
|
||||
return true;
|
||||
|
||||
EntitySystem.Get<AudioSystem>().PlayAtCoords("/Audio/Weapons/egloves.ogg", Owner.Transform.GridPosition, AudioHelpers.WithVariation(0.25f));
|
||||
|
||||
foreach (var entity in entities)
|
||||
@@ -113,11 +112,11 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
|
||||
else
|
||||
stunnable.Slowdown(_slowdownTime);
|
||||
}
|
||||
if(cell.CurrentCharge < EnergyPerUse)
|
||||
{
|
||||
EntitySystem.Get<AudioSystem>().PlayAtCoords(AudioHelpers.GetRandomFileFromSoundCollection("sparks"), Owner.Transform.GridPosition, AudioHelpers.WithVariation(0.25f));
|
||||
TurnOff();
|
||||
}
|
||||
|
||||
if (!(Cell.CurrentCharge < EnergyPerUse)) return true;
|
||||
|
||||
EntitySystem.Get<AudioSystem>().PlayAtCoords(AudioHelpers.GetRandomFileFromSoundCollection("sparks"), Owner.Transform.GridPosition, AudioHelpers.WithVariation(0.25f));
|
||||
TurnOff();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,78 +0,0 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Content.Shared.GameObjects.Components.Weapons;
|
||||
using Content.Shared.Physics;
|
||||
using Robust.Server.GameObjects.EntitySystems;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Physics;
|
||||
using Robust.Shared.Interfaces.Timing;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Maths;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Weapon
|
||||
{
|
||||
[RegisterComponent]
|
||||
public sealed class ServerFlashableComponent : SharedFlashableComponent
|
||||
{
|
||||
private double _duration;
|
||||
private TimeSpan _lastFlash;
|
||||
|
||||
public void Flash(double duration)
|
||||
{
|
||||
var timing = IoCManager.Resolve<IGameTiming>();
|
||||
_lastFlash = timing.CurTime;
|
||||
_duration = duration;
|
||||
Dirty();
|
||||
}
|
||||
|
||||
public override ComponentState GetComponentState()
|
||||
{
|
||||
return new FlashComponentState(_duration, _lastFlash);
|
||||
}
|
||||
|
||||
public static void FlashAreaHelper(IEntity source, double range, double duration, string sound = null)
|
||||
{
|
||||
var physicsManager = IoCManager.Resolve<IPhysicsManager>();
|
||||
var entityManager = IoCManager.Resolve<IEntityManager>();
|
||||
|
||||
foreach (var entity in entityManager.GetEntities(new TypeEntityQuery(typeof(ServerFlashableComponent))))
|
||||
{
|
||||
if (source.Transform.MapID != entity.Transform.MapID ||
|
||||
entity == source)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var direction = entity.Transform.WorldPosition - source.Transform.WorldPosition;
|
||||
|
||||
if (direction.Length > range)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Direction will be zero if they're hit with the source only I think
|
||||
if (direction == Vector2.Zero)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var ray = new CollisionRay(source.Transform.WorldPosition, direction.Normalized, (int) CollisionGroup.Opaque);
|
||||
var rayCastResults = physicsManager.IntersectRay(source.Transform.MapID, ray, direction.Length, source, false).ToList();
|
||||
if (rayCastResults.Count == 0 ||
|
||||
rayCastResults[0].HitEntity != entity)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var flashable = entity.GetComponent<ServerFlashableComponent>();
|
||||
flashable.Flash(duration);
|
||||
}
|
||||
|
||||
if (sound != null)
|
||||
{
|
||||
IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<AudioSystem>().PlayAtCoords(sound, source.Transform.GridPosition);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Content.Server.GameObjects.Components.Interactable;
|
||||
@@ -32,12 +33,12 @@ namespace Content.Server.GameObjects.Components
|
||||
public class WiresComponent : SharedWiresComponent, IInteractUsing, IExamine, IMapInit
|
||||
{
|
||||
#pragma warning disable 649
|
||||
[Dependency] private readonly IRobustRandom _random;
|
||||
[Dependency] private readonly IServerNotifyManager _notifyManager;
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
[Dependency] private readonly IServerNotifyManager _notifyManager = default!;
|
||||
#pragma warning restore 649
|
||||
private AudioSystem _audioSystem;
|
||||
private AppearanceComponent _appearance;
|
||||
private BoundUserInterface _userInterface;
|
||||
private AudioSystem _audioSystem = default!;
|
||||
private AppearanceComponent _appearance = default!;
|
||||
private BoundUserInterface _userInterface = default!;
|
||||
|
||||
private bool _isPanelOpen;
|
||||
|
||||
@@ -93,7 +94,7 @@ namespace Content.Server.GameObjects.Components
|
||||
}
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public string SerialNumber
|
||||
public string? SerialNumber
|
||||
{
|
||||
get => _serialNumber;
|
||||
set
|
||||
@@ -127,16 +128,16 @@ namespace Content.Server.GameObjects.Components
|
||||
private readonly List<WireLetter> _availableLetters =
|
||||
new List<WireLetter>((WireLetter[]) Enum.GetValues(typeof(WireLetter)));
|
||||
|
||||
private string _boardName;
|
||||
private string _boardName = default!;
|
||||
|
||||
private string _serialNumber;
|
||||
private string? _serialNumber;
|
||||
|
||||
// Used to generate wire appearance randomization client side.
|
||||
// We honestly don't care what it is or such but do care that it doesn't change between UI re-opens.
|
||||
[ViewVariables]
|
||||
private int _wireSeed;
|
||||
[ViewVariables]
|
||||
private string _layoutId;
|
||||
private string? _layoutId;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -186,7 +187,7 @@ namespace Content.Server.GameObjects.Components
|
||||
base.Startup();
|
||||
|
||||
|
||||
WireLayout layout = null;
|
||||
WireLayout? layout = null;
|
||||
var hackingSystem = EntitySystem.Get<WireHackingSystem>();
|
||||
if (_layoutId != null)
|
||||
{
|
||||
@@ -299,9 +300,9 @@ namespace Content.Server.GameObjects.Components
|
||||
{
|
||||
[NotNull] private readonly WiresComponent _wires;
|
||||
[NotNull] private readonly IWires _owner;
|
||||
[CanBeNull] private readonly WireLayout _layout;
|
||||
private readonly WireLayout? _layout;
|
||||
|
||||
public WiresBuilder(WiresComponent wires, IWires owner, WireLayout layout)
|
||||
public WiresBuilder(WiresComponent wires, IWires owner, WireLayout? layout)
|
||||
{
|
||||
_wires = wires;
|
||||
_owner = owner;
|
||||
@@ -365,12 +366,12 @@ namespace Content.Server.GameObjects.Components
|
||||
{
|
||||
case WiresActionMessage msg:
|
||||
var wire = WiresList.Find(x => x.Id == msg.Id);
|
||||
if (wire == null)
|
||||
var player = serverMsg.Session.AttachedEntity;
|
||||
if (wire == null || player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var player = serverMsg.Session.AttachedEntity;
|
||||
if (!player.TryGetComponent(out IHandsComponent handsComponent))
|
||||
{
|
||||
_notifyManager.PopupMessage(Owner.Transform.GridPosition, player,
|
||||
@@ -386,7 +387,7 @@ namespace Content.Server.GameObjects.Components
|
||||
}
|
||||
|
||||
var activeHandEntity = handsComponent.GetActiveHand?.Owner;
|
||||
ToolComponent tool = null;
|
||||
ToolComponent? tool = null;
|
||||
activeHandEntity?.TryGetComponent(out tool);
|
||||
|
||||
switch (msg.Action)
|
||||
|
||||
Reference in New Issue
Block a user