pvs content (#5484)

Co-authored-by: Paul <ritter.paul1+git@googlemail.com>
This commit is contained in:
Paul Ritter
2021-11-30 15:20:38 +01:00
committed by GitHub
parent d0efe50e83
commit fbcb53dcc0
63 changed files with 72 additions and 68 deletions

View File

@@ -99,7 +99,7 @@ namespace Content.IntegrationTests.Tests.Buckle
Assert.True(buckle.Buckled);
var player = IoCManager.Resolve<IPlayerManager>().Sessions.Single();
Assert.True(((BuckleComponentState) buckle.GetComponentState(player)).Buckled);
Assert.True(((BuckleComponentState) buckle.GetComponentState()).Buckled);
Assert.False(actionBlocker.CanMove(human.Uid));
Assert.False(actionBlocker.CanChangeDirection(human.Uid));
Assert.False(standingState.Down(human.Uid));

View File

@@ -418,7 +418,7 @@ namespace Content.IntegrationTests.Tests.Networking
Foo = pred.Foo;
}
public override ComponentState GetComponentState(ICommonSession player)
public override ComponentState GetComponentState()
{
return new PredictionComponentState(Foo);
}

View File

@@ -42,7 +42,7 @@ namespace Content.Server.Atmos.Components
Owner.TryGetComponent(out _appearance);
}
public override ComponentState GetComponentState(ICommonSession player)
public override ComponentState GetComponentState()
{
return new GasAnalyzerComponentState(_pressureDanger);
}

View File

@@ -390,7 +390,7 @@ namespace Content.Server.Buckle.Components
base.Shutdown();
}
public override ComponentState GetComponentState(ICommonSession player)
public override ComponentState GetComponentState()
{
int? drawDepth = null;

View File

@@ -158,7 +158,7 @@ namespace Content.Server.Buckle.Components
_occupiedSize = 0;
}
public override ComponentState GetComponentState(ICommonSession player)
public override ComponentState GetComponentState()
{
return new StrapComponentState(Position);
}

View File

@@ -17,7 +17,7 @@ namespace Content.Server.Cargo.Components
Database = EntitySystem.Get<CargoConsoleSystem>().StationOrderDatabase;
}
public override ComponentState GetComponentState(ICommonSession player)
public override ComponentState GetComponentState()
{
if (!ConnectedToDatabase)
return new CargoOrderDatabaseState(null);

View File

@@ -7,7 +7,7 @@ namespace Content.Server.Cargo.Components
[RegisterComponent]
public class GalacticMarketComponent : SharedGalacticMarketComponent
{
public override ComponentState GetComponentState(ICommonSession player)
public override ComponentState GetComponentState()
{
return new GalacticMarketState(GetProductIdList());
}

View File

@@ -122,7 +122,7 @@ namespace Content.Server.Chemistry.Components
return true;
}
public override ComponentState GetComponentState(ICommonSession player)
public override ComponentState GetComponentState()
{
var solutionSys = Owner.EntityManager.EntitySysManager.GetEntitySystem<SolutionContainerSystem>();
return solutionSys.TryGetSolution(Owner.Uid, SolutionName, out var solution)

View File

@@ -313,7 +313,7 @@ namespace Content.Server.Chemistry.Components
}
public override ComponentState GetComponentState(ICommonSession player)
public override ComponentState GetComponentState()
{
Owner.EntityManager.EntitySysManager.GetEntitySystem<SolutionContainerSystem>()
.TryGetSolution(Owner.Uid, SolutionName, out var solution);

View File

@@ -99,7 +99,7 @@ namespace Content.Server.Climbing.Components
IsClimbing = false;
}
public override ComponentState GetComponentState(ICommonSession player)
public override ComponentState GetComponentState()
{
return new ClimbModeComponentState(_isClimbing, OwnerIsTransitioning);
}

View File

@@ -52,7 +52,7 @@ namespace Content.Server.Clothing.Components
}
}
public override ComponentState GetComponentState(ICommonSession player)
public override ComponentState GetComponentState()
{
return new ClothingComponentState(ClothingEquippedPrefix, EquippedPrefix);
}

View File

@@ -114,7 +114,7 @@ namespace Content.Server.Clothing.Components
Toggle(eventArgs.User);
}
public override ComponentState GetComponentState(ICommonSession player)
public override ComponentState GetComponentState()
{
return new MagbootsComponentState(On);
}

View File

@@ -89,7 +89,7 @@ namespace Content.Server.Crayon
}
}
public override ComponentState GetComponentState(ICommonSession player)
public override ComponentState GetComponentState()
{
return new CrayonComponentState(_color, SelectedState, Charges, Capacity);
}

View File

@@ -56,7 +56,7 @@ namespace Content.Server.Cuffs.Components
Owner.EnsureComponentWarn<HandsComponent>();
}
public override ComponentState GetComponentState(ICommonSession player)
public override ComponentState GetComponentState()
{
// there are 2 approaches i can think of to handle the handcuff overlay on players
// 1 - make the current RSI the handcuff type that's currently active. all handcuffs on the player will appear the same.

View File

@@ -138,7 +138,7 @@ namespace Content.Server.Cuffs.Components
/// </summary>
private bool _cuffing;
public override ComponentState GetComponentState(ICommonSession player)
public override ComponentState GetComponentState()
{
return new HandcuffedComponentState(Broken ? BrokenState : string.Empty);
}

View File

@@ -15,7 +15,7 @@ namespace Content.Server.DoAfter
// we'll just send them the index. Doesn't matter if it wraps around.
private byte _runningIndex;
public override ComponentState GetComponentState(ICommonSession player)
public override ComponentState GetComponentState()
{
var toAdd = new List<ClientDoAfter>();

View File

@@ -769,7 +769,7 @@ namespace Content.Server.Doors.Components
*/
}
public override ComponentState GetComponentState(ICommonSession player)
public override ComponentState GetComponentState()
{
return new DoorComponentState(State, StateChangeStartTime, CurrentlyCrushing, GameTiming.CurTime);
}

View File

@@ -517,7 +517,7 @@ namespace Content.Server.Inventory.Components
}
}
public override ComponentState GetComponentState(ICommonSession player)
public override ComponentState GetComponentState()
{
var list = new List<KeyValuePair<Slots, EntityUid>>();
foreach (var (slot, container) in _slotContainers)

View File

@@ -18,7 +18,7 @@ namespace Content.Server.Lathe.Components
[DataField("static")]
public bool Static { get; private set; } = false;
public override ComponentState GetComponentState(ICommonSession player)
public override ComponentState GetComponentState()
{
return new LatheDatabaseState(GetRecipeIdList());
}

View File

@@ -22,7 +22,7 @@ namespace Content.Server.Lathe.Components
[DataField("StorageLimit")]
private int _storageLimit = -1;
public override ComponentState GetComponentState(ICommonSession player)
public override ComponentState GetComponentState()
{
return new MaterialStorageState(Storage);
}

View File

@@ -17,7 +17,7 @@ namespace Content.Server.Lathe.Components
public override string Name => "ProtolatheDatabase";
public override ComponentState GetComponentState(ICommonSession player)
public override ComponentState GetComponentState()
{
return new ProtolatheDatabaseState(GetRecipeIdList());
}

View File

@@ -241,7 +241,7 @@ namespace Content.Server.Light.Components
return (byte?) ContentHelpers.RoundToNearestLevels(currentCharge / Cell.MaxCharge * 255, 255, StatusLevels);
}
public override ComponentState GetComponentState(ICommonSession player)
public override ComponentState GetComponentState()
{
return new HandheldLightComponentState(GetLevel());
}

View File

@@ -223,7 +223,7 @@ namespace Content.Server.Nutrition.Components
UpdateCurrentThreshold();
}
public override ComponentState GetComponentState(ICommonSession player)
public override ComponentState GetComponentState()
{
return new HungerComponentState(_currentHungerThreshold);
}

View File

@@ -220,7 +220,7 @@ namespace Content.Server.Nutrition.Components
UpdateCurrentThreshold();
}
public override ComponentState GetComponentState(ICommonSession player)
public override ComponentState GetComponentState()
{
return new ThirstComponentState(_currentThirstThreshold);
}

View File

@@ -38,7 +38,7 @@ namespace Content.Server.Projectiles.Components
Dirty();
}
public override ComponentState GetComponentState(ICommonSession player)
public override ComponentState GetComponentState()
{
return new ProjectileComponentState(Shooter, IgnoreShooter);
}

View File

@@ -98,7 +98,7 @@ namespace Content.Server.Radiation
Dirty();
}
public override ComponentState GetComponentState(ICommonSession player)
public override ComponentState GetComponentState()
{
return new RadiationPulseState(_radsPerSecond, _range, Draw, Decay, _endTime);
}

View File

@@ -8,7 +8,7 @@ namespace Content.Server.Research.Components
[RegisterComponent]
public class TechnologyDatabaseComponent : SharedTechnologyDatabaseComponent
{
public override ComponentState GetComponentState(ICommonSession player)
public override ComponentState GetComponentState()
{
return new TechnologyDatabaseState(_technologies);
}

View File

@@ -73,7 +73,7 @@ namespace Content.Server.Singularity.Components
[DataField("singularityFormingSound")] private SoundSpecifier _singularityFormingSound = new SoundPathSpecifier("/Audio/Effects/singularity_form.ogg");
[DataField("singularityCollapsingSound")] private SoundSpecifier _singularityCollapsingSound = new SoundPathSpecifier("/Audio/Effects/singularity_collapse.ogg");
public override ComponentState GetComponentState(ICommonSession player)
public override ComponentState GetComponentState()
{
return new SingularityComponentState(Level);
}

View File

@@ -142,7 +142,7 @@ namespace Content.Server.Suspicion
message.AddMarkup(tooltip);
}
public override ComponentState GetComponentState(ICommonSession player)
public override ComponentState GetComponentState()
{
if (Role == null)
{

View File

@@ -117,7 +117,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
UpdateAppearance();
}
public override ComponentState GetComponentState(ICommonSession player)
public override ComponentState GetComponentState()
{
(int, int)? count = (ShotsLeft, Capacity);
var chamberedExists = _chamberContainer.ContainedEntity != null;

View File

@@ -78,7 +78,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
UpdateAppearance();
}
public override ComponentState GetComponentState(ICommonSession player)
public override ComponentState GetComponentState()
{
(int, int)? count = (ShotsLeft, Capacity);
var chamberedExists = _chamberContainer.ContainedEntity != null;

View File

@@ -75,7 +75,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
_ammoSlots = new IEntity[_serializedCapacity];
}
public override ComponentState GetComponentState(ICommonSession player)
public override ComponentState GetComponentState()
{
var slotsSpent = new bool?[Capacity];
for (var i = 0; i < Capacity; i++)

View File

@@ -81,7 +81,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
[DataField("soundPowerCellEject", required: true)]
private SoundSpecifier _soundPowerCellEject = default!;
public override ComponentState GetComponentState(ICommonSession player)
public override ComponentState GetComponentState()
{
(int, int)? count = (ShotsLeft, Capacity);

View File

@@ -149,7 +149,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
return types;
}
public override ComponentState GetComponentState(ICommonSession player)
public override ComponentState GetComponentState()
{
(int, int)? count = null;
var magazine = MagazineContainer.ContainedEntity;

View File

@@ -134,7 +134,7 @@ namespace Content.Server.Weapon.Ranged
}
}
public override ComponentState GetComponentState(ICommonSession player)
public override ComponentState GetComponentState()
{
return new RangedWeaponComponentState(FireRateSelector);
}

View File

@@ -75,7 +75,7 @@ namespace Content.Shared.Actions.Components
}
public override ComponentState GetComponentState(ICommonSession player)
public override ComponentState GetComponentState()
{
return new ActionComponentState(_actions, _itemActions);
}

View File

@@ -36,7 +36,7 @@ namespace Content.Shared.Alert
_alerts = state.Alerts;
}
public override ComponentState GetComponentState(ICommonSession player)
public override ComponentState GetComponentState()
{
return new AlertsComponentState(_alerts);
}

View File

@@ -547,7 +547,7 @@ namespace Content.Shared.Body.Components
return SlotParts.ElementAt(index);
}
public override ComponentState GetComponentState(ICommonSession player)
public override ComponentState GetComponentState()
{
var parts = new (string slot, EntityUid partId)[SlotParts.Count];

View File

@@ -138,7 +138,7 @@ namespace Content.Shared.Body.Components
Dirty();
}
public override ComponentState GetComponentState(ICommonSession player)
public override ComponentState GetComponentState()
{
var mechanismIds = new EntityUid[_mechanisms.Count];

View File

@@ -31,7 +31,7 @@ namespace Content.Shared.Chemistry.Components
[ViewVariables]
public TimeSpan ModifierTimer { get; set; } = TimeSpan.Zero;
public override ComponentState GetComponentState(ICommonSession player)
public override ComponentState GetComponentState()
{
return new MovespeedModifierMetabolismComponentState(WalkSpeedModifier, SprintSpeedModifier, ModifierTimer);
}

View File

@@ -65,7 +65,7 @@ namespace Content.Shared.CombatMode
}
public override ComponentState GetComponentState(ICommonSession player)
public override ComponentState GetComponentState()
{
return new CombatModeComponentState(IsInCombatMode, ActiveZone);
}

View File

@@ -53,7 +53,7 @@ namespace Content.Shared.Cooldown
}
}
public override ComponentState GetComponentState(ICommonSession player)
public override ComponentState GetComponentState()
{
return new ItemCooldownComponentState
{

View File

@@ -68,7 +68,7 @@ namespace Content.Shared.Disposal.Components
Pressurizing
}
public override ComponentState GetComponentState(ICommonSession player)
public override ComponentState GetComponentState()
{
return new DisposalUnitComponentState(RecentlyEjected);
}

View File

@@ -28,7 +28,7 @@ namespace Content.Shared.Emoting
}
}
public override ComponentState GetComponentState(ICommonSession player)
public override ComponentState GetComponentState()
{
return new EmotingComponentState(Enabled);
}

View File

@@ -10,14 +10,18 @@ namespace Content.Shared.Flash
base.Initialize();
SubscribeLocalEvent<SharedFlashableComponent, ComponentGetState>(OnFlashableGetState);
SubscribeLocalEvent<SharedFlashableComponent, ComponentGetStateAttemptEvent>(OnGetStateAttempt);
}
private void OnGetStateAttempt(EntityUid uid, SharedFlashableComponent component, ComponentGetStateAttemptEvent args)
{
// Only send state to the player attached to the entity.
if (args.Player.AttachedEntityUid != uid)
args.Cancel();
}
private void OnFlashableGetState(EntityUid uid, SharedFlashableComponent component, ref ComponentGetState args)
{
// Only send state to the player attached to the entity.
if (args.Player.AttachedEntityUid != uid)
return;
args.State = new FlashableComponentState(component.Duration, component.LastFlash);
}
}

View File

@@ -31,7 +31,7 @@ namespace Content.Shared.Friction
[DataField("modifier")]
private float _modifier = 1.0f;
public override ComponentState GetComponentState(ICommonSession session)
public override ComponentState GetComponentState()
{
return new TileFrictionComponentState(_modifier);
}

View File

@@ -47,7 +47,7 @@ namespace Content.Shared.Ghost
[DataField("canReturnToBody")]
private bool _canReturnToBody;
public override ComponentState GetComponentState(ICommonSession player)
public override ComponentState GetComponentState()
{
return new GhostComponentState(CanReturnToBody, CanGhostInteract);
}

View File

@@ -41,7 +41,7 @@ namespace Content.Shared.Gravity
private bool _enabled;
public override ComponentState GetComponentState(ICommonSession player)
public override ComponentState GetComponentState()
{
return new GravityComponentState(_enabled);
}

View File

@@ -26,7 +26,7 @@ namespace Content.Shared.Hands.Components
}
}
public override ComponentState GetComponentState(ICommonSession player)
public override ComponentState GetComponentState()
{
return new VirtualItemComponentState(BlockingEntity);
}

View File

@@ -78,7 +78,7 @@ namespace Content.Shared.Hands.Components
[ViewVariables(VVAccess.ReadWrite)]
public float ThrowRange { get; set; } = 8f;
public override ComponentState GetComponentState(ICommonSession player)
public override ComponentState GetComponentState()
{
var hands = new HandState[Hands.Count];

View File

@@ -88,7 +88,7 @@ namespace Content.Shared.Item
[DataField("sprite")]
private string? _rsiPath;
public override ComponentState GetComponentState(ICommonSession player)
public override ComponentState GetComponentState()
{
return new ItemComponentState(Size, EquippedPrefix, Color, RsiPath);
}

View File

@@ -73,7 +73,7 @@ namespace Content.Shared.MobState.Components
base.OnRemove();
}
public override ComponentState GetComponentState(ICommonSession player)
public override ComponentState GetComponentState()
{
return new MobStateComponentState(CurrentThreshold);
}

View File

@@ -198,7 +198,7 @@ namespace Content.Shared.Movement.Components
}
}
public override ComponentState GetComponentState(ICommonSession player)
public override ComponentState GetComponentState()
{
return new MoverComponentState(_heldMoveButtons);
}

View File

@@ -91,7 +91,7 @@ namespace Content.Shared.Movement.Components
}
}
public override ComponentState GetComponentState(ICommonSession session)
public override ComponentState GetComponentState()
{
return new PlayerMobMoverComponentState(_grabRange, _pushStrength, _weightlessStrength);
}

View File

@@ -28,7 +28,7 @@ namespace Content.Shared.Placeable
[DataField("positionOffset")]
public Vector2 PositionOffset { get; set; }
public override ComponentState GetComponentState(ICommonSession session)
public override ComponentState GetComponentState()
{
return new PlaceableSurfaceComponentState(IsPlaceable,PlaceCentered, PositionOffset);
}

View File

@@ -38,7 +38,7 @@ namespace Content.Shared.Pulling.Components
public EntityCoordinates? MovingTo { get; set; }
public override ComponentState GetComponentState(ICommonSession player)
public override ComponentState GetComponentState()
{
return new PullableComponentState(Puller?.Uid);
}

View File

@@ -47,7 +47,7 @@ namespace Content.Shared.Shuttles.Components
Console = shuttleConsoleComponent;
}
public override ComponentState GetComponentState(ICommonSession player)
public override ComponentState GetComponentState()
{
return new PilotComponentState(Console?.OwnerUid);
}

View File

@@ -34,7 +34,7 @@ namespace Content.Shared.Singularity.Components
set => this.SetAndDirtyIfChanged(ref _falloff, value);
}
public override ComponentState GetComponentState(ICommonSession player)
public override ComponentState GetComponentState()
{
return new SingularityDistortionComponentState(Intensity, Falloff);
}

View File

@@ -138,7 +138,7 @@ namespace Content.Shared.Slippery
}
}
public override ComponentState GetComponentState(ICommonSession player)
public override ComponentState GetComponentState()
{
return new SlipperyComponentState(ParalyzeTime, IntersectPercentage, RequiredSlipSpeed, LaunchForwardsMultiplier, Slippery, SlipSound.GetSound(), Slipped.ToArray());
}

View File

@@ -24,7 +24,7 @@ namespace Content.Shared.Standing
[DataField("standing")]
public bool Standing { get; set; } = true;
public override ComponentState GetComponentState(ICommonSession player)
public override ComponentState GetComponentState()
{
return new StandingComponentState(Standing);
}

View File

@@ -35,7 +35,7 @@ namespace Content.Shared.SubFloor
[DataField("requireAnchored")]
public bool RequireAnchored { get; set; } = true;
public override ComponentState GetComponentState(ICommonSession player)
public override ComponentState GetComponentState()
{
return new SubFloorHideComponentState(Enabled, RequireAnchored);
}

View File

@@ -32,7 +32,7 @@ namespace Content.Shared.Tag
}
}
public override ComponentState GetComponentState(ICommonSession player)
public override ComponentState GetComponentState()
{
var tags = new string[_tags.Count];
var i = 0;

View File

@@ -52,18 +52,18 @@ namespace Content.Tests.Server.GameObjects.Components.Mobs
Assert.That(alertManager.TryGet(AlertType.HighPressure, out var highpressure));
alertsComponent.ShowAlert(AlertType.LowPressure);
var alertState = alertsComponent.GetComponentState(null) as AlertsComponentState;
var alertState = alertsComponent.GetComponentState() as AlertsComponentState;
Assert.NotNull(alertState);
Assert.That(alertState.Alerts.Count, Is.EqualTo(1));
Assert.That(alertState.Alerts.ContainsKey(lowpressure.AlertKey));
alertsComponent.ShowAlert(AlertType.HighPressure);
alertState = alertsComponent.GetComponentState(null) as AlertsComponentState;
alertState = alertsComponent.GetComponentState() as AlertsComponentState;
Assert.That(alertState.Alerts.Count, Is.EqualTo(1));
Assert.That(alertState.Alerts.ContainsKey(highpressure.AlertKey));
alertsComponent.ClearAlertCategory(AlertCategory.Pressure);
alertState = alertsComponent.GetComponentState(null) as AlertsComponentState;
alertState = alertsComponent.GetComponentState() as AlertsComponentState;
Assert.That(alertState.Alerts.Count, Is.EqualTo(0));
}
}