Make component states dependant on the player getting them (#3280)

* Make component states dependant on the player getting them

Co-authored-by: Metal Gear Sloth <metalgearsloth@gmail.com>

* Updated submodule to v0.3.7.

Co-authored-by: Metal Gear Sloth <metalgearsloth@gmail.com>
Co-authored-by: Acruid <shatter66@gmail.com>
This commit is contained in:
DrSmugleaf
2021-02-18 09:09:07 +01:00
committed by GitHub
parent 77c8fc5b42
commit 1477cd4d0a
61 changed files with 145 additions and 88 deletions

View File

@@ -4,6 +4,7 @@ using Content.Shared.Utility;
using Robust.Server.GameObjects;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Players;
using Robust.Shared.Timing;
namespace Content.Server.GameObjects.Components.Weapon
@@ -23,7 +24,7 @@ namespace Content.Server.GameObjects.Components.Weapon
Dirty();
}
public override ComponentState GetComponentState()
public override ComponentState GetComponentState(ICommonSession player)
{
return new FlashComponentState(_duration, _lastFlash);
}

View File

@@ -14,6 +14,7 @@ using Robust.Shared.Containers;
using Robust.Shared.GameObjects;
using Robust.Shared.Localization;
using Robust.Shared.Map;
using Robust.Shared.Players;
using Robust.Shared.Serialization;
using Robust.Shared.Utility;
using Robust.Shared.ViewVariables;
@@ -128,7 +129,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Barrels
UpdateAppearance();
}
public override ComponentState GetComponentState()
public override ComponentState GetComponentState(ICommonSession player)
{
(int, int)? count = (ShotsLeft, Capacity);
var chamberedExists = _chamberContainer.ContainedEntity != null;

View File

@@ -11,6 +11,7 @@ using Robust.Shared.Audio;
using Robust.Shared.GameObjects;
using Robust.Shared.Localization;
using Robust.Shared.Map;
using Robust.Shared.Players;
using Robust.Shared.Serialization;
using Robust.Shared.Utility;
using Robust.Shared.ViewVariables;
@@ -82,7 +83,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Barrels
UpdateAppearance();
}
public override ComponentState GetComponentState()
public override ComponentState GetComponentState(ICommonSession player)
{
(int, int)? count = (ShotsLeft, Capacity);
var chamberedExists = _chamberContainer.ContainedEntity != null;

View File

@@ -13,6 +13,7 @@ using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Map;
using Robust.Shared.Players;
using Robust.Shared.Random;
using Robust.Shared.Serialization;
using Robust.Shared.ViewVariables;
@@ -66,7 +67,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Barrels
serializer.DataField(ref _soundSpin, "soundSpin", "/Audio/Weapons/Guns/Misc/revolver_spin.ogg");
}
public override ComponentState GetComponentState()
public override ComponentState GetComponentState(ICommonSession player)
{
var slotsSpent = new bool?[Capacity];
for (var i = 0; i < Capacity; i++)

View File

@@ -16,6 +16,7 @@ using Robust.Shared.Audio;
using Robust.Shared.GameObjects;
using Robust.Shared.Localization;
using Robust.Shared.Map;
using Robust.Shared.Players;
using Robust.Shared.Serialization;
using Robust.Shared.ViewVariables;
@@ -89,7 +90,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Barrels
serializer.DataField(ref _soundPowerCellEject, "soundPowerCellEject", null);
}
public override ComponentState GetComponentState()
public override ComponentState GetComponentState(ICommonSession player)
{
(int, int)? count = (ShotsLeft, Capacity);

View File

@@ -18,6 +18,7 @@ using Robust.Shared.Containers;
using Robust.Shared.GameObjects;
using Robust.Shared.Localization;
using Robust.Shared.Map;
using Robust.Shared.Players;
using Robust.Shared.Serialization;
using Robust.Shared.Utility;
using Robust.Shared.ViewVariables;
@@ -164,7 +165,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Barrels
return types;
}
public override ComponentState GetComponentState()
public override ComponentState GetComponentState(ICommonSession player)
{
(int, int)? count = null;
var magazine = _magazineContainer.ContainedEntity;

View File

@@ -18,7 +18,6 @@ using Robust.Shared.Map;
using Robust.Shared.Maths;
using Robust.Shared.Network;
using Robust.Shared.Players;
using Robust.Shared.Random;
using Robust.Shared.Serialization;
using Robust.Shared.Timing;
using Robust.Shared.ViewVariables;
@@ -120,7 +119,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged
}
}
public override ComponentState GetComponentState()
public override ComponentState GetComponentState(ICommonSession player)
{
return new RangedWeaponComponentState(FireRateSelector);
}