Add readonly where it is missing and fix those field names according to their modifiers (#2589)
This commit is contained in:
@@ -26,18 +26,20 @@ namespace Content.Server.GameObjects.Components.Arcade
|
||||
[ComponentReference(typeof(IActivate))]
|
||||
public class BlockGameArcadeComponent : Component, IActivate
|
||||
{
|
||||
[Dependency] private IRobustRandom _random = null!;
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
|
||||
public override string Name => "BlockGameArcade";
|
||||
public override uint? NetID => ContentNetIDs.BLOCKGAME_ARCADE;
|
||||
[ComponentDependency] private PowerReceiverComponent? _powerReceiverComponent = default!;
|
||||
|
||||
[ComponentDependency] private readonly PowerReceiverComponent? _powerReceiverComponent = default!;
|
||||
|
||||
private bool Powered => _powerReceiverComponent?.Powered ?? false;
|
||||
private BoundUserInterface? UserInterface => Owner.GetUIOrNull(BlockGameUiKey.Key);
|
||||
|
||||
private BlockGame? _game;
|
||||
|
||||
private IPlayerSession? _player;
|
||||
private List<IPlayerSession> _spectators = new List<IPlayerSession>();
|
||||
private readonly List<IPlayerSession> _spectators = new List<IPlayerSession>();
|
||||
|
||||
public void Activate(ActivateEventArgs eventArgs)
|
||||
{
|
||||
@@ -162,9 +164,9 @@ namespace Content.Server.GameObjects.Components.Arcade
|
||||
{
|
||||
//note: field is 10(0 -> 9) wide and 20(0 -> 19) high
|
||||
|
||||
private BlockGameArcadeComponent _component;
|
||||
private readonly BlockGameArcadeComponent _component;
|
||||
|
||||
private List<BlockGameBlock> _field = new List<BlockGameBlock>();
|
||||
private readonly List<BlockGameBlock> _field = new List<BlockGameBlock>();
|
||||
|
||||
private BlockGamePiece _currentPiece;
|
||||
|
||||
|
||||
@@ -29,10 +29,10 @@ namespace Content.Server.GameObjects.Components.Arcade
|
||||
[ComponentReference(typeof(IActivate))]
|
||||
public class SpaceVillainArcadeComponent : SharedSpaceVillainArcadeComponent, IActivate, IWires
|
||||
{
|
||||
[Dependency] private IRobustRandom _random = null!;
|
||||
[Dependency] private readonly IRobustRandom _random = null!;
|
||||
|
||||
[ComponentDependency] private PowerReceiverComponent? _powerReceiverComponent = default!;
|
||||
[ComponentDependency] private WiresComponent? _wiresComponent = default!;
|
||||
[ComponentDependency] private readonly PowerReceiverComponent? _powerReceiverComponent = default!;
|
||||
[ComponentDependency] private readonly WiresComponent? _wiresComponent = default!;
|
||||
|
||||
private bool Powered => _powerReceiverComponent != null && _powerReceiverComponent.Powered;
|
||||
|
||||
@@ -240,7 +240,7 @@ namespace Content.Server.GameObjects.Components.Arcade
|
||||
{
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
|
||||
[ViewVariables] private SpaceVillainArcadeComponent Owner;
|
||||
[ViewVariables] private readonly SpaceVillainArcadeComponent _owner;
|
||||
|
||||
[ViewVariables] public string Name => $"{_fightVerb} {_enemyName}";
|
||||
[ViewVariables(VVAccess.ReadWrite)] private int _playerHp = 30;
|
||||
@@ -253,8 +253,8 @@ namespace Content.Server.GameObjects.Components.Arcade
|
||||
[ViewVariables(VVAccess.ReadWrite)] private int _enemyMpMax = 20;
|
||||
[ViewVariables(VVAccess.ReadWrite)] private int _turtleTracker;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)] private string _fightVerb;
|
||||
[ViewVariables(VVAccess.ReadWrite)] private string _enemyName;
|
||||
[ViewVariables(VVAccess.ReadWrite)] private readonly string _fightVerb;
|
||||
[ViewVariables(VVAccess.ReadWrite)] private readonly string _enemyName;
|
||||
|
||||
[ViewVariables] private bool _running = true;
|
||||
|
||||
@@ -266,7 +266,7 @@ namespace Content.Server.GameObjects.Components.Arcade
|
||||
public SpaceVillainGame(SpaceVillainArcadeComponent owner, string fightVerb, string enemyName)
|
||||
{
|
||||
IoCManager.InjectDependencies(this);
|
||||
Owner = owner;
|
||||
_owner = owner;
|
||||
//todo defeat the curse secret game mode
|
||||
_fightVerb = fightVerb;
|
||||
_enemyName = enemyName;
|
||||
@@ -278,7 +278,7 @@ namespace Content.Server.GameObjects.Components.Arcade
|
||||
/// </summary>
|
||||
private void ValidateVars()
|
||||
{
|
||||
if(Owner._overflowFlag) return;
|
||||
if(_owner._overflowFlag) return;
|
||||
|
||||
if (_playerHp > _playerHpMax) _playerHp = _playerHpMax;
|
||||
if (_playerMp > _playerMpMax) _playerMp = _playerMpMax;
|
||||
@@ -299,23 +299,23 @@ namespace Content.Server.GameObjects.Components.Arcade
|
||||
case PlayerAction.Attack:
|
||||
var attackAmount = _random.Next(2, 6);
|
||||
_latestPlayerActionMessage = Loc.GetString("You attack {0} for {1}!", _enemyName, attackAmount);
|
||||
EntitySystem.Get<AudioSystem>().PlayFromEntity("/Audio/Effects/Arcade/player_attack.ogg", Owner.Owner, AudioParams.Default.WithVolume(-4f));
|
||||
if(!Owner._enemyInvincibilityFlag) _enemyHp -= attackAmount;
|
||||
EntitySystem.Get<AudioSystem>().PlayFromEntity("/Audio/Effects/Arcade/player_attack.ogg", _owner.Owner, AudioParams.Default.WithVolume(-4f));
|
||||
if(!_owner._enemyInvincibilityFlag) _enemyHp -= attackAmount;
|
||||
_turtleTracker -= _turtleTracker > 0 ? 1 : 0;
|
||||
break;
|
||||
case PlayerAction.Heal:
|
||||
var pointAmount = _random.Next(1, 3);
|
||||
var healAmount = _random.Next(6, 8);
|
||||
_latestPlayerActionMessage = Loc.GetString("You use {0} magic to heal for {1} damage!", pointAmount, healAmount);
|
||||
EntitySystem.Get<AudioSystem>().PlayFromEntity("/Audio/Effects/Arcade/player_heal.ogg", Owner.Owner, AudioParams.Default.WithVolume(-4f));
|
||||
if(!Owner._playerInvincibilityFlag) _playerMp -= pointAmount;
|
||||
EntitySystem.Get<AudioSystem>().PlayFromEntity("/Audio/Effects/Arcade/player_heal.ogg", _owner.Owner, AudioParams.Default.WithVolume(-4f));
|
||||
if(!_owner._playerInvincibilityFlag) _playerMp -= pointAmount;
|
||||
_playerHp += healAmount;
|
||||
_turtleTracker++;
|
||||
break;
|
||||
case PlayerAction.Recharge:
|
||||
var chargeAmount = _random.Next(4, 7);
|
||||
_latestPlayerActionMessage = Loc.GetString("You regain {0} points", chargeAmount);
|
||||
EntitySystem.Get<AudioSystem>().PlayFromEntity("/Audio/Effects/Arcade/player_charge.ogg", Owner.Owner, AudioParams.Default.WithVolume(-4f));
|
||||
EntitySystem.Get<AudioSystem>().PlayFromEntity("/Audio/Effects/Arcade/player_charge.ogg", _owner.Owner, AudioParams.Default.WithVolume(-4f));
|
||||
_playerMp += chargeAmount;
|
||||
_turtleTracker -= _turtleTracker > 0 ? 1 : 0;
|
||||
break;
|
||||
@@ -347,8 +347,8 @@ namespace Content.Server.GameObjects.Components.Arcade
|
||||
{
|
||||
_running = false;
|
||||
UpdateUi(Loc.GetString("You won!"), Loc.GetString("{0} dies.", _enemyName), true);
|
||||
EntitySystem.Get<AudioSystem>().PlayFromEntity("/Audio/Effects/Arcade/win.ogg", Owner.Owner, AudioParams.Default.WithVolume(-4f));
|
||||
Owner.ProcessWin();
|
||||
EntitySystem.Get<AudioSystem>().PlayFromEntity("/Audio/Effects/Arcade/win.ogg", _owner.Owner, AudioParams.Default.WithVolume(-4f));
|
||||
_owner.ProcessWin();
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -358,14 +358,14 @@ namespace Content.Server.GameObjects.Components.Arcade
|
||||
{
|
||||
_running = false;
|
||||
UpdateUi(Loc.GetString("You lost!"), Loc.GetString("{0} cheers.", _enemyName), true);
|
||||
EntitySystem.Get<AudioSystem>().PlayFromEntity("/Audio/Effects/Arcade/gameover.ogg", Owner.Owner, AudioParams.Default.WithVolume(-4f));
|
||||
EntitySystem.Get<AudioSystem>().PlayFromEntity("/Audio/Effects/Arcade/gameover.ogg", _owner.Owner, AudioParams.Default.WithVolume(-4f));
|
||||
return false;
|
||||
}
|
||||
if (_enemyHp <= 0 || _enemyMp <= 0)
|
||||
{
|
||||
_running = false;
|
||||
UpdateUi(Loc.GetString("You lost!"), Loc.GetString("{0} dies, but takes you with him.", _enemyName), true);
|
||||
EntitySystem.Get<AudioSystem>().PlayFromEntity("/Audio/Effects/Arcade/gameover.ogg", Owner.Owner, AudioParams.Default.WithVolume(-4f));
|
||||
EntitySystem.Get<AudioSystem>().PlayFromEntity("/Audio/Effects/Arcade/gameover.ogg", _owner.Owner, AudioParams.Default.WithVolume(-4f));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -377,7 +377,7 @@ namespace Content.Server.GameObjects.Components.Arcade
|
||||
/// </summary>
|
||||
private void UpdateUi(bool metadata = false)
|
||||
{
|
||||
Owner.UserInterface?.SendMessage(metadata ? GenerateMetaDataMessage() : GenerateUpdateMessage());
|
||||
_owner.UserInterface?.SendMessage(metadata ? GenerateMetaDataMessage() : GenerateUpdateMessage());
|
||||
}
|
||||
|
||||
private void UpdateUi(string message1, string message2, bool metadata = false)
|
||||
@@ -397,14 +397,14 @@ namespace Content.Server.GameObjects.Components.Arcade
|
||||
{
|
||||
var boomAmount = _random.Next(5, 10);
|
||||
_latestEnemyActionMessage = Loc.GetString("{0} throws a bomb, exploding you for {1} damage!", _enemyName, boomAmount);
|
||||
if (Owner._playerInvincibilityFlag) return;
|
||||
if (_owner._playerInvincibilityFlag) return;
|
||||
_playerHp -= boomAmount;
|
||||
_turtleTracker--;
|
||||
}else if (_enemyMp <= 5 && _random.Prob(0.7f))
|
||||
{
|
||||
var stealAmount = _random.Next(2, 3);
|
||||
_latestEnemyActionMessage = Loc.GetString("{0} steals {1} of your power!", _enemyName, stealAmount);
|
||||
if (Owner._playerInvincibilityFlag) return;
|
||||
if (_owner._playerInvincibilityFlag) return;
|
||||
_playerMp -= stealAmount;
|
||||
_enemyMp += stealAmount;
|
||||
}else if (_enemyHp <= 10 && _enemyMp > 4)
|
||||
@@ -418,7 +418,7 @@ namespace Content.Server.GameObjects.Components.Arcade
|
||||
var attackAmount = _random.Next(3, 6);
|
||||
_latestEnemyActionMessage =
|
||||
Loc.GetString("{0} attacks you for {1} damage!", _enemyName, attackAmount);
|
||||
if (Owner._playerInvincibilityFlag) return;
|
||||
if (_owner._playerInvincibilityFlag) return;
|
||||
_playerHp -= attackAmount;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,8 +19,8 @@ namespace Content.Server.GameObjects.Components.Damage
|
||||
[RegisterComponent]
|
||||
public class DamageOnHighSpeedImpactComponent : Component, ICollideBehavior
|
||||
{
|
||||
[Dependency] private IRobustRandom _robustRandom = default!;
|
||||
[Dependency] private IGameTiming _gameTiming = default!;
|
||||
[Dependency] private readonly IRobustRandom _robustRandom = default!;
|
||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||
|
||||
public override string Name => "DamageOnHighSpeedImpact";
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@ using Content.Shared.GameObjects.Components.Doors;
|
||||
using Content.Shared.GameObjects.Components.Interactable;
|
||||
using Content.Shared.GameObjects.Components.Movement;
|
||||
using Content.Shared.Interfaces.GameObjects.Components;
|
||||
using Content.Shared.Physics;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.GameObjects.EntitySystems;
|
||||
using Robust.Shared.Audio;
|
||||
@@ -64,7 +63,7 @@ namespace Content.Server.GameObjects.Components.Doors
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
protected float CloseSpeed = AutoCloseDelay;
|
||||
|
||||
private CancellationTokenSource _cancellationTokenSource = new CancellationTokenSource();
|
||||
private readonly CancellationTokenSource _cancellationTokenSource = new CancellationTokenSource();
|
||||
|
||||
protected virtual TimeSpan CloseTimeOne => TimeSpan.FromSeconds(0.3f);
|
||||
protected virtual TimeSpan CloseTimeTwo => TimeSpan.FromSeconds(0.9f);
|
||||
|
||||
@@ -4,7 +4,6 @@ using Content.Shared.Interfaces.GameObjects.Components;
|
||||
using Robust.Server.GameObjects.EntitySystems;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.GameObjects.Systems;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Random;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Random;
|
||||
@@ -17,7 +16,7 @@ namespace Content.Server.GameObjects.Components.Items.Storage
|
||||
[RegisterComponent]
|
||||
public class CursedEntityStorageComponent : EntityStorageComponent
|
||||
{
|
||||
[Dependency] private IRobustRandom _robustRandom = default!;
|
||||
[Dependency] private readonly IRobustRandom _robustRandom = default!;
|
||||
|
||||
public override string Name => "CursedEntityStorage";
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ using Content.Server.GameTicking;
|
||||
using Content.Server.Interfaces.GameTicking;
|
||||
using Robust.Server.Interfaces.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Random;
|
||||
using Robust.Shared.Interfaces.Reflection;
|
||||
using Robust.Shared.IoC;
|
||||
@@ -28,7 +27,7 @@ namespace Content.Server.GameObjects.Components.Markers
|
||||
public List<string> Prototypes { get; set; } = new List<string>();
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
private List<string> _gameRules = new List<string>();
|
||||
private readonly List<string> _gameRules = new List<string>();
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public float Chance { get; set; } = 1.0f;
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace Content.Server.GameObjects.Components.Morgue
|
||||
public override string Name => "BodyBagEntityStorage";
|
||||
|
||||
[ViewVariables]
|
||||
[ComponentDependency] private AppearanceComponent? _appearance = null;
|
||||
[ComponentDependency] private readonly AppearanceComponent? _appearance = null;
|
||||
|
||||
[ViewVariables] public ContainerSlot? LabelContainer { get; private set; }
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace Content.Server.GameObjects.Components.NodeContainer.NodeGroups
|
||||
|
||||
public AMEControllerComponent MasterController => _masterController;
|
||||
|
||||
private List<AMEShieldComponent> _cores = new List<AMEShieldComponent>();
|
||||
private readonly List<AMEShieldComponent> _cores = new List<AMEShieldComponent>();
|
||||
|
||||
public int CoreCount => _cores.Count;
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ using Content.Server.GameObjects.Components.Mobs;
|
||||
using Content.Shared.Alert;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.GameObjects.Components.Damage;
|
||||
using Content.Shared.GameObjects.Components.Mobs;
|
||||
using Content.Shared.GameObjects.Components.Movement;
|
||||
using Content.Shared.GameObjects.Components.Nutrition;
|
||||
using Robust.Shared.GameObjects;
|
||||
@@ -55,7 +54,7 @@ namespace Content.Server.GameObjects.Components.Nutrition
|
||||
|
||||
[ViewVariables(VVAccess.ReadOnly)]
|
||||
public Dictionary<HungerThreshold, float> HungerThresholds => _hungerThresholds;
|
||||
private Dictionary<HungerThreshold, float> _hungerThresholds = new Dictionary<HungerThreshold, float>
|
||||
private readonly Dictionary<HungerThreshold, float> _hungerThresholds = new Dictionary<HungerThreshold, float>
|
||||
{
|
||||
{HungerThreshold.Overfed, 600.0f},
|
||||
{HungerThreshold.Okay, 450.0f},
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace Content.Server.GameObjects.Components.Power.ApcNetComponents.PowerRece
|
||||
[RegisterComponent]
|
||||
public class PoweredLightComponent : Component, IInteractHand, IInteractUsing, IMapInit, ISignalReceiver<bool>, ISignalReceiver<ToggleSignal>
|
||||
{
|
||||
[Dependency] private IGameTiming _gameTiming = default!;
|
||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||
|
||||
public override string Name => "PoweredLight";
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ using System.Diagnostics.CodeAnalysis;
|
||||
using Content.Server.GameObjects.Components.Conveyor;
|
||||
using Content.Server.GameObjects.Components.Items.Storage;
|
||||
using Content.Server.GameObjects.Components.Power.ApcNetComponents;
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using Content.Shared.Construction;
|
||||
using Content.Shared.GameObjects.Components.Body;
|
||||
using Content.Shared.GameObjects.Components.Recycling;
|
||||
@@ -13,9 +12,7 @@ using Robust.Shared.Containers;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.GameObjects.Components;
|
||||
using Robust.Shared.GameObjects.Components.Map;
|
||||
using Robust.Shared.GameObjects.Systems;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.ViewVariables;
|
||||
@@ -28,7 +25,7 @@ namespace Content.Server.GameObjects.Components.Recycling
|
||||
{
|
||||
public override string Name => "Recycler";
|
||||
|
||||
private List<IEntity> _intersecting = new List<IEntity>();
|
||||
private readonly List<IEntity> _intersecting = new List<IEntity>();
|
||||
|
||||
/// <summary>
|
||||
/// Whether or not sentient beings will be recycled
|
||||
|
||||
@@ -15,9 +15,9 @@ namespace Content.Server.GameObjects.Components.Singularity
|
||||
{
|
||||
public readonly ContainmentFieldGeneratorComponent Generator1;
|
||||
public readonly ContainmentFieldGeneratorComponent Generator2;
|
||||
private List<IEntity> _fields = new List<IEntity>();
|
||||
private readonly List<IEntity> _fields = new List<IEntity>();
|
||||
private int _sharedEnergyPool;
|
||||
private CancellationTokenSource _powerDecreaseCancellationTokenSource = new CancellationTokenSource();
|
||||
private readonly CancellationTokenSource _powerDecreaseCancellationTokenSource = new CancellationTokenSource();
|
||||
public int SharedEnergyPool
|
||||
{
|
||||
get => _sharedEnergyPool;
|
||||
|
||||
@@ -1,24 +1,18 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using Content.Server.GameObjects.Components.Projectiles;
|
||||
using Content.Server.Utility;
|
||||
using Content.Shared.GameObjects.EntitySystems;
|
||||
using Content.Shared.Physics;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.GameObjects.Components;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Physics;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Log;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Physics;
|
||||
using Robust.Shared.Utility;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Singularity
|
||||
@@ -26,7 +20,7 @@ namespace Content.Server.GameObjects.Components.Singularity
|
||||
[RegisterComponent]
|
||||
public class ContainmentFieldGeneratorComponent : Component, ICollideBehavior
|
||||
{
|
||||
[Dependency] private IPhysicsManager _physicsManager = null!;
|
||||
[Dependency] private readonly IPhysicsManager _physicsManager = null!;
|
||||
|
||||
public override string Name => "ContainmentFieldGenerator";
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@ using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.GameObjects.ComponentDependencies;
|
||||
using Robust.Shared.GameObjects.Components;
|
||||
using Robust.Shared.GameObjects.Systems;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Random;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
@@ -37,8 +36,8 @@ namespace Content.Server.GameObjects.Components.Singularity
|
||||
{
|
||||
[Dependency] private readonly IRobustRandom _robustRandom = default!;
|
||||
|
||||
[ComponentDependency] private AppearanceComponent? _appearance = default;
|
||||
[ComponentDependency] private AccessReader? _accessReader = default;
|
||||
[ComponentDependency] private readonly AppearanceComponent? _appearance = default;
|
||||
[ComponentDependency] private readonly AccessReader? _accessReader = default;
|
||||
|
||||
public override string Name => "Emitter";
|
||||
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Content.Server.GameObjects.Components.StationEvents;
|
||||
using Content.Shared.GameObjects;
|
||||
using Content.Shared.GameObjects.EntitySystemMessages;
|
||||
using Content.Shared.Physics;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.GameObjects.EntitySystems;
|
||||
@@ -15,7 +13,6 @@ using Robust.Shared.GameObjects.Components;
|
||||
using Robust.Shared.GameObjects.Components.Map;
|
||||
using Robust.Shared.GameObjects.Systems;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Map;
|
||||
using Robust.Shared.Interfaces.Random;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Log;
|
||||
@@ -29,9 +26,7 @@ namespace Content.Server.GameObjects.Components.Singularity
|
||||
[RegisterComponent]
|
||||
public class SingularityComponent : Component, ICollideBehavior
|
||||
{
|
||||
[Dependency] private IEntityManager _entityManager = null!;
|
||||
[Dependency] private IRobustRandom _random = null!;
|
||||
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
|
||||
public override uint? NetID => ContentNetIDs.SINGULARITY;
|
||||
|
||||
@@ -163,17 +158,17 @@ namespace Content.Server.GameObjects.Components.Singularity
|
||||
_singularityController?.Push(pushVector.Normalized, 2);
|
||||
}
|
||||
|
||||
List<IEntity> _previousPulledEntites = new List<IEntity>();
|
||||
private readonly List<IEntity> _previousPulledEntities = new List<IEntity>();
|
||||
public void PullUpdate()
|
||||
{
|
||||
foreach (var previousPulledEntity in _previousPulledEntites)
|
||||
foreach (var previousPulledEntity in _previousPulledEntities)
|
||||
{
|
||||
if(previousPulledEntity.Deleted) continue;
|
||||
if (!previousPulledEntity.TryGetComponent<PhysicsComponent>(out var collidableComponent)) continue;
|
||||
var controller = collidableComponent.EnsureController<SingularityPullController>();
|
||||
controller.StopPull();
|
||||
}
|
||||
_previousPulledEntites.Clear();
|
||||
_previousPulledEntities.Clear();
|
||||
|
||||
var entitiesToPull = Owner.EntityManager.GetEntitiesInRange(Owner.Transform.Coordinates, Level * 10);
|
||||
foreach (var entity in entitiesToPull)
|
||||
@@ -187,7 +182,7 @@ namespace Content.Server.GameObjects.Components.Singularity
|
||||
var speed = 10 / vec.Length * Level;
|
||||
|
||||
controller.Pull(vec.Normalized, speed);
|
||||
_previousPulledEntites.Add(entity);
|
||||
_previousPulledEntities.Add(entity);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Ammunition
|
||||
{
|
||||
public override string Name => "RangedMagazine";
|
||||
|
||||
private Stack<IEntity> _spawnedAmmo = new Stack<IEntity>();
|
||||
private readonly Stack<IEntity> _spawnedAmmo = new Stack<IEntity>();
|
||||
private Container _ammoContainer;
|
||||
|
||||
public int ShotsLeft => _spawnedAmmo.Count + _unspawnedCount;
|
||||
|
||||
Reference in New Issue
Block a user