more component ref removal + combining server/client comps (#13178)
Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com>
This commit is contained in:
@@ -25,6 +25,7 @@ using Content.Shared.Damage;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.Inventory;
|
||||
using Content.Shared.PDA;
|
||||
using Content.Shared.Stacks;
|
||||
using Content.Shared.Verbs;
|
||||
using Content.Shared.Weapons.Ranged.Components;
|
||||
using Robust.Server.GameObjects;
|
||||
|
||||
@@ -3,6 +3,7 @@ using Content.Server.Chat;
|
||||
using Content.Server.Chat.Systems;
|
||||
using Content.Server.Power.Components;
|
||||
using Content.Server.VendingMachines;
|
||||
using Content.Shared.VendingMachines;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Timing;
|
||||
|
||||
@@ -10,6 +10,7 @@ using Content.Shared.Body.Components;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using Content.Shared.Materials;
|
||||
using Content.Shared.MobState.Components;
|
||||
using Content.Shared.Stacks;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.Map;
|
||||
|
||||
@@ -22,6 +22,7 @@ using Content.Server.Construction.Components;
|
||||
using Content.Server.Materials;
|
||||
using Content.Server.Stack;
|
||||
using Content.Server.Jobs;
|
||||
using Content.Shared.Humanoid;
|
||||
using Content.Shared.Humanoid.Prototypes;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.Containers;
|
||||
|
||||
@@ -2,6 +2,7 @@ using Content.Server.Stack;
|
||||
using Content.Shared.Construction;
|
||||
using Content.Shared.Hands.EntitySystems;
|
||||
using Content.Shared.Prototypes;
|
||||
using Content.Shared.Stacks;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Content.Server.Stack;
|
||||
using Content.Shared.Construction;
|
||||
using Content.Shared.Prototypes;
|
||||
using Content.Shared.Stacks;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
||||
|
||||
@@ -3,6 +3,7 @@ using Content.Server.Stack;
|
||||
using Content.Shared.Construction;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Stacks;
|
||||
using Content.Shared.Tag;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Containers;
|
||||
|
||||
@@ -2,6 +2,7 @@ using Content.Server.Construction.Components;
|
||||
using Content.Server.Tools;
|
||||
using Content.Server.Stack;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Stacks;
|
||||
using Content.Shared.Tools.Components;
|
||||
|
||||
namespace Content.Server.Construction
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Content.Server.VendingMachines;
|
||||
using Content.Shared.VendingMachines;
|
||||
|
||||
namespace Content.Server.Destructible.Thresholds.Behaviors
|
||||
{
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Content.Server.Stack;
|
||||
using Content.Shared.Prototypes;
|
||||
using Content.Shared.Stacks;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Dictionary;
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@ using System.Threading;
|
||||
using Content.Server.Chat.Systems;
|
||||
using Content.Server.GameTicking;
|
||||
using Content.Server.GameTicking.Rules;
|
||||
using Content.Server.Humanoid;
|
||||
using Content.Server.NPC;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.Dragon;
|
||||
@@ -22,6 +21,7 @@ using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Random;
|
||||
using Content.Server.NPC.Systems;
|
||||
using Content.Shared.Humanoid;
|
||||
|
||||
namespace Content.Server.Dragon
|
||||
{
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace Content.Server.Engineering.EntitySystems
|
||||
if (component.Deleted || Deleted(component.Owner))
|
||||
return;
|
||||
|
||||
if (EntityManager.TryGetComponent<SharedStackComponent?>(component.Owner, out var stackComp)
|
||||
if (EntityManager.TryGetComponent<StackComponent?>(component.Owner, out var stackComp)
|
||||
&& component.RemoveOnInteract && !_stackSystem.Use(uid, 1, stackComp))
|
||||
{
|
||||
return;
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
using Content.Shared.Flash;
|
||||
|
||||
namespace Content.Server.Flash.Components
|
||||
{
|
||||
[ComponentReference(typeof(SharedFlashableComponent))]
|
||||
[RegisterComponent, Access(typeof(FlashSystem))]
|
||||
public sealed class FlashableComponent : SharedFlashableComponent
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,6 @@ using Content.Server.Actions;
|
||||
using Content.Server.Chat.Managers;
|
||||
using Content.Server.Disease;
|
||||
using Content.Server.Disease.Components;
|
||||
using Content.Server.Humanoid;
|
||||
using Content.Server.Mind.Components;
|
||||
using Content.Server.MobState;
|
||||
using Content.Server.Players;
|
||||
@@ -14,6 +13,7 @@ using Content.Server.Traitor;
|
||||
using Content.Server.Zombies;
|
||||
using Content.Shared.Actions.ActionTypes;
|
||||
using Content.Shared.CCVar;
|
||||
using Content.Shared.Humanoid;
|
||||
using Content.Shared.MobState;
|
||||
using Content.Shared.MobState.Components;
|
||||
using Content.Shared.Preferences;
|
||||
@@ -21,7 +21,6 @@ using Content.Shared.Roles;
|
||||
using Content.Shared.Zombies;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Configuration;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
@@ -15,6 +15,7 @@ using Content.Shared.Input;
|
||||
using Content.Shared.Inventory;
|
||||
using Content.Shared.Physics.Pull;
|
||||
using Content.Shared.Pulling.Components;
|
||||
using Content.Shared.Stacks;
|
||||
using Content.Shared.Throwing;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Server.Player;
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
using Content.Shared.Humanoid;
|
||||
using Content.Shared.Humanoid.Markings;
|
||||
using Content.Shared.Preferences;
|
||||
using Robust.Shared.Enums;
|
||||
|
||||
namespace Content.Server.Humanoid;
|
||||
|
||||
[RegisterComponent]
|
||||
public sealed class HumanoidComponent : SharedHumanoidComponent
|
||||
{
|
||||
public MarkingSet CurrentMarkings = new();
|
||||
|
||||
/// <summary>
|
||||
/// Any custom base layers this humanoid might have. See:
|
||||
/// limb transplants (potentially), robotic arms, etc.
|
||||
/// Stored on the server, this is merged in the client into
|
||||
/// all layer settings.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadOnly)]
|
||||
public Dictionary<HumanoidVisualLayers, CustomBaseLayerInfo> CustomBaseLayers = new();
|
||||
|
||||
public HashSet<HumanoidVisualLayers> PermanentlyHidden = new();
|
||||
|
||||
public HashSet<HumanoidVisualLayers> AllHiddenLayers
|
||||
{
|
||||
get
|
||||
{
|
||||
var result = new HashSet<HumanoidVisualLayers>(HiddenLayers);
|
||||
result.UnionWith(PermanentlyHidden);
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
// Couldn't these be somewhere else?
|
||||
[ViewVariables] public Gender Gender = default!;
|
||||
[ViewVariables] public int Age = 18;
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using Content.Server.CharacterAppearance.Components;
|
||||
using Content.Shared.Humanoid;
|
||||
using Content.Shared.Preferences;
|
||||
|
||||
namespace Content.Server.Humanoid.Systems;
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
using Content.Server.Access.Systems;
|
||||
using Content.Server.Administration.Logs;
|
||||
using Content.Server.Humanoid;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.Hands;
|
||||
using Content.Shared.Humanoid;
|
||||
using Content.Shared.IdentityManagement;
|
||||
using Content.Shared.IdentityManagement.Components;
|
||||
using Content.Shared.Inventory;
|
||||
using Content.Shared.Inventory.Events;
|
||||
using Content.Shared.Preferences;
|
||||
using Robust.Shared.Enums;
|
||||
using Robust.Shared.GameObjects.Components.Localization;
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ using Content.Shared.Interaction;
|
||||
using Content.Shared.Kitchen;
|
||||
using Content.Shared.Popups;
|
||||
using Content.Shared.Random.Helpers;
|
||||
using Content.Shared.Stacks;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Audio;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Linq;
|
||||
using Content.Server.Humanoid;
|
||||
using Content.Server.UserInterface;
|
||||
using Content.Shared.Humanoid;
|
||||
using Content.Shared.Humanoid.Markings;
|
||||
using Content.Shared.MagicMirror;
|
||||
using Robust.Server.GameObjects;
|
||||
|
||||
@@ -17,12 +17,11 @@ using Content.Server.Body.Components;
|
||||
using Content.Server.Climbing;
|
||||
using Content.Server.Construction;
|
||||
using Content.Server.DoAfter;
|
||||
using Content.Server.Humanoid;
|
||||
using Content.Server.Mind.Components;
|
||||
using Content.Server.Stack;
|
||||
using Content.Shared.Humanoid;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Popups;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Configuration;
|
||||
using Robust.Server.Player;
|
||||
|
||||
@@ -123,7 +123,7 @@ public sealed class HealingSystem : EntitySystem
|
||||
return false;
|
||||
}
|
||||
|
||||
if (TryComp<SharedStackComponent>(component.Owner, out var stack) && stack.Count < 1)
|
||||
if (TryComp<StackComponent>(component.Owner, out var stack) && stack.Count < 1)
|
||||
return false;
|
||||
|
||||
component.CancelToken = new CancellationTokenSource();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using Content.Server.Projectiles;
|
||||
using Content.Server.Projectiles.Components;
|
||||
using Content.Server.Singularity.Components;
|
||||
using Content.Shared.Projectiles;
|
||||
using Content.Shared.Singularity.Components;
|
||||
using Robust.Shared.Physics.Components;
|
||||
using Robust.Shared.Timing;
|
||||
|
||||
@@ -2,6 +2,7 @@ using Content.Server.Power.Components;
|
||||
using Content.Server.Stack;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Maps;
|
||||
using Content.Shared.Stacks;
|
||||
using Robust.Shared.Map;
|
||||
|
||||
namespace Content.Server.Power.EntitySystems;
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.Projectiles;
|
||||
using Robust.Shared.Audio;
|
||||
|
||||
namespace Content.Server.Projectiles.Components
|
||||
{
|
||||
[RegisterComponent]
|
||||
[ComponentReference(typeof(SharedProjectileComponent))]
|
||||
public sealed class ProjectileComponent : SharedProjectileComponent
|
||||
{
|
||||
[DataField("damage", required: true)]
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public DamageSpecifier Damage = default!;
|
||||
|
||||
[DataField("deleteOnCollide")]
|
||||
public bool DeleteOnCollide { get; } = true;
|
||||
|
||||
[DataField("ignoreResistances")]
|
||||
public bool IgnoreResistances { get; } = false;
|
||||
|
||||
// Get that juicy FPS hit sound
|
||||
[DataField("soundHit")] public SoundSpecifier? SoundHit;
|
||||
|
||||
[DataField("soundForce")]
|
||||
public bool ForceSound = false;
|
||||
|
||||
public bool DamagedEntity;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
using Content.Server.Administration.Logs;
|
||||
using Content.Server.Projectiles.Components;
|
||||
using Content.Server.Weapons.Ranged.Systems;
|
||||
using Content.Shared.Camera;
|
||||
using Content.Shared.Damage;
|
||||
|
||||
@@ -27,6 +27,7 @@ using Content.Server.Humanoid;
|
||||
using Content.Server.Revenant.Components;
|
||||
using Content.Server.Store.Components;
|
||||
using Content.Shared.FixedPoint;
|
||||
using Content.Shared.Humanoid;
|
||||
using Content.Shared.Revenant.Components;
|
||||
using Robust.Shared.Physics.Components;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
@@ -1,92 +0,0 @@
|
||||
using Content.Shared.Singularity.Components;
|
||||
using Content.Server.Singularity.EntitySystems;
|
||||
using Robust.Shared.Audio;
|
||||
|
||||
namespace Content.Server.Singularity.Components;
|
||||
|
||||
/// <summary>
|
||||
/// The server-side version of <see cref="SharedSingularityComponent">.
|
||||
/// Primarily managed by <see cref="SingularitySystem">.
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
[ComponentReference(typeof(SharedSingularityComponent))]
|
||||
public sealed class SingularityComponent : SharedSingularityComponent
|
||||
{
|
||||
/// <summary>
|
||||
/// The amount of energy this singularity contains.
|
||||
/// If you want to set this go through <see cref="SingularitySystem.SetEnergy"/>
|
||||
/// </summary>
|
||||
[DataField("energy")]
|
||||
[Access(friends:typeof(SingularitySystem))]
|
||||
public float Energy = 180f;
|
||||
|
||||
/// <summary>
|
||||
/// The rate at which this singularity loses energy over time.
|
||||
/// </summary>
|
||||
[DataField("energyLoss")]
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public float EnergyDrain;
|
||||
|
||||
#region Audio
|
||||
|
||||
/// <summary>
|
||||
/// The sound that this singularity produces by existing.
|
||||
/// </summary>
|
||||
[DataField("ambientSound")]
|
||||
[ViewVariables(VVAccess.ReadOnly)]
|
||||
public SoundSpecifier? AmbientSound = new SoundPathSpecifier(
|
||||
"/Audio/Effects/singularity_form.ogg",
|
||||
AudioParams.Default.WithVolume(5).WithLoop(true).WithMaxDistance(20f)
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// The audio stream that plays the sound specified by <see cref="AmbientSound"> on loop.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public IPlayingAudioStream? AmbientSoundStream = null;
|
||||
|
||||
/// <summary>
|
||||
/// The sound that the singularity produces when it forms.
|
||||
/// </summary>
|
||||
[DataField("formationSound")]
|
||||
[ViewVariables(VVAccess.ReadOnly)]
|
||||
public SoundSpecifier? FormationSound = null;
|
||||
|
||||
/// <summary>
|
||||
/// The sound that the singularity produces when it dissipates.
|
||||
/// </summary>
|
||||
[DataField("dissipationSound")]
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public SoundSpecifier? DissipationSound = new SoundPathSpecifier(
|
||||
"/Audio/Effects/singularity_collapse.ogg",
|
||||
AudioParams.Default
|
||||
);
|
||||
|
||||
#endregion Audio
|
||||
|
||||
#region Update Timing
|
||||
|
||||
/// <summary>
|
||||
/// The amount of time that should elapse between automated updates to this singularity.
|
||||
/// </summary>
|
||||
[DataField("updatePeriod")]
|
||||
[ViewVariables(VVAccess.ReadOnly)]
|
||||
[Access(typeof(SingularitySystem))]
|
||||
public TimeSpan TargetUpdatePeriod { get; internal set; } = TimeSpan.FromSeconds(1.0);
|
||||
|
||||
/// <summary>
|
||||
/// The next time this singularity should be updated by <see cref="SingularitySystem"/>
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadOnly)]
|
||||
[Access(typeof(SingularitySystem))]
|
||||
public TimeSpan NextUpdateTime { get; internal set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// The last time this singularity was be updated by <see cref="SingularitySystem"/>
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadOnly)]
|
||||
[Access(typeof(SingularitySystem))]
|
||||
public TimeSpan LastUpdateTime { get; internal set; } = default!;
|
||||
|
||||
#endregion Update Timing
|
||||
}
|
||||
@@ -4,19 +4,18 @@ using Content.Server.Construction;
|
||||
using Content.Server.Power.Components;
|
||||
using Content.Server.Power.EntitySystems;
|
||||
using Content.Server.Projectiles;
|
||||
using Content.Server.Projectiles.Components;
|
||||
using Content.Server.Singularity.Components;
|
||||
using Content.Server.Storage.Components;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Popups;
|
||||
using Content.Shared.Projectiles;
|
||||
using Content.Shared.Singularity.Components;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Physics;
|
||||
using Robust.Shared.Physics.Components;
|
||||
using Robust.Shared.Physics.Systems;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Utility;
|
||||
using Timer = Robust.Shared.Timing.Timer;
|
||||
|
||||
@@ -14,9 +14,9 @@ using Content.Server.Singularity.Events;
|
||||
namespace Content.Server.Singularity.EntitySystems;
|
||||
|
||||
/// <summary>
|
||||
/// The server-side version of <seed cref="SharedSingularitySystem">.
|
||||
/// The server-side version of <see cref="SharedSingularitySystem"/>.
|
||||
/// Primarily responsible for managing <see cref="SingularityComponent"/>s.
|
||||
/// Handles their accumulation of energy upon consuming entities (see <see cref="EventHorizonComponent">) and gradual dissipation.
|
||||
/// Handles their accumulation of energy upon consuming entities (see <see cref="EventHorizonComponent"/>) and gradual dissipation.
|
||||
/// Also handles synchronizing server-side components with the singuarities level.
|
||||
/// </summary>
|
||||
public sealed class SingularitySystem : SharedSingularitySystem
|
||||
@@ -41,7 +41,6 @@ public sealed class SingularitySystem : SharedSingularitySystem
|
||||
{
|
||||
base.Initialize();
|
||||
SubscribeLocalEvent<SingularityDistortionComponent, ComponentStartup>(OnDistortionStartup);
|
||||
SubscribeLocalEvent<SingularityComponent, ComponentStartup>(OnSingularityStartup);
|
||||
SubscribeLocalEvent<SingularityComponent, ComponentShutdown>(OnSingularityShutdown);
|
||||
SubscribeLocalEvent<SingularityComponent, EventHorizonConsumedEntityEvent>(OnConsumed);
|
||||
SubscribeLocalEvent<SinguloFoodComponent, EventHorizonConsumedEntityEvent>(OnConsumed);
|
||||
@@ -198,7 +197,7 @@ public sealed class SingularitySystem : SharedSingularitySystem
|
||||
/// <param name="uid">The entity UID of the singularity that is forming.</param>
|
||||
/// <param name="comp">The component of the singularity that is forming.</param>
|
||||
/// <param name="args">The event arguments.</param>
|
||||
public void OnSingularityStartup(EntityUid uid, SingularityComponent comp, ComponentStartup args)
|
||||
protected override void OnSingularityStartup(EntityUid uid, SingularityComponent comp, ComponentStartup args)
|
||||
{
|
||||
comp.LastUpdateTime = _timing.CurTime;
|
||||
comp.NextUpdateTime = comp.LastUpdateTime + comp.TargetUpdatePeriod;
|
||||
@@ -309,7 +308,8 @@ public sealed class SingularitySystem : SharedSingularitySystem
|
||||
/// <param name="args">The event arguments.</param>
|
||||
public void UpdateEnergyDrain(EntityUid uid, SingularityComponent comp, SingularityLevelChangedEvent args)
|
||||
{
|
||||
comp.EnergyDrain = args.NewValue switch {
|
||||
comp.EnergyDrain = args.NewValue switch
|
||||
{
|
||||
6 => 20,
|
||||
5 => 15,
|
||||
4 => 10,
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
using Content.Shared.Stacks;
|
||||
|
||||
namespace Content.Server.Stack
|
||||
{
|
||||
// TODO: Naming and presentation and such could use some improvement.
|
||||
[RegisterComponent, Access(typeof(StackSystem))]
|
||||
[ComponentReference(typeof(SharedStackComponent))]
|
||||
public sealed class StackComponent : SharedStackComponent
|
||||
{
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public bool ThrowIndividually { get; set; } = false;
|
||||
}
|
||||
}
|
||||
@@ -26,7 +26,7 @@ namespace Content.Server.Stack
|
||||
SubscribeLocalEvent<StackComponent, GetVerbsEvent<AlternativeVerb>>(OnStackAlternativeInteract);
|
||||
}
|
||||
|
||||
public override void SetCount(EntityUid uid, int amount, SharedStackComponent? component = null)
|
||||
public override void SetCount(EntityUid uid, int amount, StackComponent? component = null)
|
||||
{
|
||||
if (!Resolve(uid, ref component, false))
|
||||
return;
|
||||
@@ -41,7 +41,7 @@ namespace Content.Server.Stack
|
||||
/// <summary>
|
||||
/// Try to split this stack into two. Returns a non-null <see cref="Robust.Shared.GameObjects.EntityUid"/> if successful.
|
||||
/// </summary>
|
||||
public EntityUid? Split(EntityUid uid, int amount, EntityCoordinates spawnPosition, SharedStackComponent? stack = null)
|
||||
public EntityUid? Split(EntityUid uid, int amount, EntityCoordinates spawnPosition, StackComponent? stack = null)
|
||||
{
|
||||
if (!Resolve(uid, ref stack))
|
||||
return null;
|
||||
@@ -61,7 +61,7 @@ namespace Content.Server.Stack
|
||||
// Set the output parameter in the event instance to the newly split stack.
|
||||
var entity = Spawn(prototype, spawnPosition);
|
||||
|
||||
if (TryComp(entity, out SharedStackComponent? stackComp))
|
||||
if (TryComp(entity, out StackComponent? stackComp))
|
||||
{
|
||||
// Set the split stack's count.
|
||||
SetCount(entity, amount, stackComp);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Content.Server.Humanoid;
|
||||
using Content.Shared.Humanoid;
|
||||
using Content.Shared.Store;
|
||||
using Content.Shared.Humanoid.Prototypes;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Set;
|
||||
|
||||
@@ -8,6 +8,7 @@ using Robust.Shared.Player;
|
||||
using Robust.Shared.Prototypes;
|
||||
using System.Linq;
|
||||
using Content.Server.UserInterface;
|
||||
using Content.Shared.Stacks;
|
||||
|
||||
namespace Content.Server.Store.Systems;
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ using Content.Shared.Audio;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Maps;
|
||||
using Content.Shared.Physics;
|
||||
using Content.Shared.Stacks;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Map.Components;
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
using Content.Shared.Tools.Components;
|
||||
|
||||
namespace Content.Server.Tools.Components;
|
||||
|
||||
[RegisterComponent]
|
||||
[ComponentReference(typeof(SharedMultipleToolComponent))]
|
||||
public sealed class MultipleToolComponent : SharedMultipleToolComponent
|
||||
{
|
||||
}
|
||||
@@ -1,80 +0,0 @@
|
||||
using Content.Shared.Actions.ActionTypes;
|
||||
using Content.Shared.VendingMachines;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
||||
|
||||
namespace Content.Server.VendingMachines
|
||||
{
|
||||
[RegisterComponent]
|
||||
[ComponentReference(typeof(SharedVendingMachineComponent))]
|
||||
[Access(typeof(VendingMachineSystem))]
|
||||
public sealed class VendingMachineComponent : SharedVendingMachineComponent
|
||||
{
|
||||
public bool Ejecting;
|
||||
public bool Denying;
|
||||
public bool DispenseOnHitCoolingDown;
|
||||
|
||||
public string? NextItemToEject;
|
||||
|
||||
public bool Broken;
|
||||
|
||||
/// <summary>
|
||||
/// When true, will forcefully throw any object it dispenses
|
||||
/// </summary>
|
||||
[DataField("speedLimiter")]
|
||||
public bool CanShoot = false;
|
||||
|
||||
public bool ThrowNextItem = false;
|
||||
|
||||
/// <summary>
|
||||
/// The chance that a vending machine will randomly dispense an item on hit.
|
||||
/// Chance is 0 if null.
|
||||
/// </summary>
|
||||
[DataField("dispenseOnHitChance")]
|
||||
public float? DispenseOnHitChance;
|
||||
|
||||
/// <summary>
|
||||
/// The minimum amount of damage that must be done per hit to have a chance
|
||||
/// of dispensing an item.
|
||||
/// </summary>
|
||||
[DataField("dispenseOnHitThreshold")]
|
||||
public float? DispenseOnHitThreshold;
|
||||
|
||||
/// <summary>
|
||||
/// Amount of time in seconds that need to pass before damage can cause a vending machine to eject again.
|
||||
/// This value is separate to <see cref="SharedVendingMachineComponent.EjectDelay"/> because that value might be
|
||||
/// 0 for a vending machine for legitimate reasons (no desired delay/no eject animation)
|
||||
/// and can be circumvented with forced ejections.
|
||||
/// </summary>
|
||||
[DataField("dispenseOnHitCooldown")]
|
||||
public float? DispenseOnHitCooldown = 1.0f;
|
||||
|
||||
/// <summary>
|
||||
/// Sound that plays when ejecting an item
|
||||
/// </summary>
|
||||
[DataField("soundVend")]
|
||||
// Grabbed from: https://github.com/discordia-space/CEV-Eris/blob/f702afa271136d093ddeb415423240a2ceb212f0/sound/machines/vending_drop.ogg
|
||||
public SoundSpecifier SoundVend = new SoundPathSpecifier("/Audio/Machines/machine_vend.ogg");
|
||||
|
||||
/// <summary>
|
||||
/// Sound that plays when an item can't be ejected
|
||||
/// </summary>
|
||||
[DataField("soundDeny")]
|
||||
// Yoinked from: https://github.com/discordia-space/CEV-Eris/blob/35bbad6764b14e15c03a816e3e89aa1751660ba9/sound/machines/Custom_deny.ogg
|
||||
public SoundSpecifier SoundDeny = new SoundPathSpecifier("/Audio/Machines/custom_deny.ogg");
|
||||
|
||||
/// <summary>
|
||||
/// The action available to the player controlling the vending machine
|
||||
/// </summary>
|
||||
[DataField("action", customTypeSerializer: typeof(PrototypeIdSerializer<InstantActionPrototype>))]
|
||||
public string? Action = "VendingThrow";
|
||||
|
||||
public float NonLimitedEjectForce = 7.5f;
|
||||
|
||||
public float NonLimitedEjectRange = 5f;
|
||||
|
||||
public float EjectAccumulator = 0f;
|
||||
public float DenyAccumulator = 0f;
|
||||
public float DispenseOnHitAccumulator = 0f;
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,6 @@ using Content.Shared.Throwing;
|
||||
using Content.Shared.VendingMachines;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Random;
|
||||
|
||||
@@ -72,11 +71,9 @@ namespace Content.Server.VendingMachines
|
||||
args.Price += price;
|
||||
}
|
||||
|
||||
protected override void OnComponentInit(EntityUid uid, SharedVendingMachineComponent sharedComponent, ComponentInit args)
|
||||
protected override void OnComponentInit(EntityUid uid, VendingMachineComponent component, ComponentInit args)
|
||||
{
|
||||
base.OnComponentInit(uid, sharedComponent, args);
|
||||
|
||||
var component = (VendingMachineComponent) sharedComponent;
|
||||
base.OnComponentInit(uid, component, args);
|
||||
|
||||
if (HasComp<ApcPowerReceiverComponent>(component.Owner))
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using Content.Server.Power.Components;
|
||||
using Content.Server.Projectiles.Components;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.FixedPoint;
|
||||
using Content.Shared.Projectiles;
|
||||
using Content.Shared.Verbs;
|
||||
using Content.Shared.Weapons.Ranged;
|
||||
using Content.Shared.Weapons.Ranged.Components;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using Content.Server.Projectiles.Components;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.FixedPoint;
|
||||
using Content.Shared.Projectiles;
|
||||
using Content.Shared.Verbs;
|
||||
using Content.Shared.Weapons.Ranged.Components;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
using System.Linq;
|
||||
using Content.Server.Cargo.Systems;
|
||||
using Content.Server.Damage.Systems;
|
||||
using Content.Server.Examine;
|
||||
using Content.Server.Interaction;
|
||||
using Content.Server.Interaction.Components;
|
||||
using Content.Server.Projectiles.Components;
|
||||
using Content.Server.Stunnable;
|
||||
using Content.Server.Weapons.Melee;
|
||||
using Content.Server.Weapons.Ranged.Components;
|
||||
@@ -12,6 +10,7 @@ using Content.Shared.Damage;
|
||||
using Content.Shared.Damage.Systems;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.FixedPoint;
|
||||
using Content.Shared.Projectiles;
|
||||
using Content.Shared.Weapons.Melee;
|
||||
using Content.Shared.Weapons.Ranged;
|
||||
using Content.Shared.Weapons.Ranged.Components;
|
||||
|
||||
Reference in New Issue
Block a user