Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cluster grenade refactor and contra markings #31108

Merged
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
117 changes: 0 additions & 117 deletions Content.Server/Explosion/Components/ClusterGrenadeComponent.cs

This file was deleted.

42 changes: 42 additions & 0 deletions Content.Server/Explosion/Components/ProjectileGrenadeComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
using Content.Server.Explosion.EntitySystems;
using Robust.Shared.Containers;
using Robust.Shared.Prototypes;

namespace Content.Server.Explosion.Components;
/// <summary>
/// Grenades that, when triggered, explode into projectiles
/// </summary>
[RegisterComponent, Access(typeof(ProjectileGrenadeSystem))]
public sealed partial class ProjectileGrenadeComponent : Component
{
public Container Container = default!;

/// <summary>
/// The kind of projectile that the prototype is filled with.
/// </summary>
[DataField]
public EntProtoId? FillPrototype;

/// <summary>
/// If we have a pre-fill how many more can we spawn.
/// </summary>
public int UnspawnedCount;

/// <summary>
/// Total amount of projectiles
/// </summary>
[DataField]
public int Capacity = 3;

/// <summary>
/// Should the angle of the projectiles be uneven?
/// </summary>
[DataField]
public bool RandomAngle = false;

/// <summary>
/// The speed the projectiles are shot at
/// </summary>
[DataField]
public float Velocity = 1.5f;
}
107 changes: 107 additions & 0 deletions Content.Server/Explosion/Components/ScatteringGrenadeComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
using Content.Server.Explosion.EntitySystems;
using Content.Shared.Whitelist;
using Robust.Shared.Containers;
using Robust.Shared.Prototypes;

namespace Content.Server.Explosion.Components;

/// <summary>
/// Use this component if the grenade splits into entities that make use of Timers
/// or if you just want it to throw entities out in the world
/// </summary>
[RegisterComponent, Access(typeof(ScatteringGrenadeSystem))]
public sealed partial class ScatteringGrenadeComponent : Component
{
public Container Container = default!;

[DataField]
public EntityWhitelist? Whitelist;

/// <summary>
/// What we fill our prototype with if we want to pre-spawn with entities.
/// </summary>
[DataField]
public EntProtoId? FillPrototype;

/// <summary>
/// If we have a pre-fill how many more can we spawn.
/// </summary>
public int UnspawnedCount;

/// <summary>
/// Max amount of entities inside the container
/// </summary>
[DataField]
public int Capacity = 3;

/// <summary>
/// Decides if contained entities trigger after getting launched
/// </summary>
[DataField]
public bool TriggerContents = true;

#region Trigger time parameters for scattered entities
/// <summary>
/// Minimum delay in seconds before any entities start to be triggered.
/// </summary>
[DataField]
public float DelayBeforeTriggerContents = 1.0f;

/// <summary>
/// Maximum delay in seconds to add between individual entity triggers
/// </summary>
[DataField]
public float IntervalBetweenTriggersMax;

/// <summary>
/// Minimum delay in seconds to add between individual entity triggers
/// </summary>
[DataField]
public float IntervalBetweenTriggersMin;
#endregion

#region Throwing parameters for the scattered entities
/// <summary>
/// Should the angle the entities get thrown at be random
/// instead of uniformly distributed
/// </summary>
[DataField]
public bool RandomAngle;

/// <summary>
/// The speed at which the entities get thrown
/// </summary>
[DataField]
public float Velocity = 5;

/// <summary>
/// Static distance grenades will be thrown to if RandomDistance is false.
/// </summary>
[DataField]
public float Distance = 1f;

/// <summary>
/// Should the distance the entities get thrown be random
/// </summary>
[DataField]
public bool RandomDistance;

/// <summary>
/// Max distance grenades can randomly be thrown to.
/// </summary>
[DataField]
public float RandomThrowDistanceMax = 2.5f;

/// <summary>
/// Minimal distance grenades can randomly be thrown to.
/// </summary>
[DataField]
public float RandomThrowDistanceMin;
#endregion

/// <summary>
/// Whether the main grenade has been triggered or not
/// We need to store this because we are only allowed to spawn and trigger timed entities on the next available frame update
/// </summary>
public bool IsTriggered = false;
}
Loading
Loading