Generalize tile prying to any tool quality (#24432)

* Generalize tile prying to any tool quality

* ballin
This commit is contained in:
Nemanja
2024-01-23 02:45:40 -05:00
committed by GitHub
parent 258b9436b5
commit 5e2e652165
22 changed files with 267 additions and 389 deletions

View File

@@ -1,26 +0,0 @@
using Robust.Shared.GameStates;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
namespace Content.Shared.Tools.Components;
/// <summary>
/// Allows prying tiles up on a grid.
/// </summary>
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
public sealed partial class TilePryingComponent : Component
{
[DataField("toolComponentNeeded"), AutoNetworkedField]
public bool ToolComponentNeeded = true;
[DataField("qualityNeeded", customTypeSerializer:typeof(PrototypeIdSerializer<ToolQualityPrototype>)), AutoNetworkedField]
public string QualityNeeded = "Prying";
/// <summary>
/// Whether this tool can pry tiles with CanAxe.
/// </summary>
[DataField("advanced"), AutoNetworkedField]
public bool Advanced = false;
[DataField("delay"), AutoNetworkedField]
public float Delay = 1f;
}

View File

@@ -0,0 +1,44 @@
using Content.Shared.DoAfter;
using Content.Shared.Tools.Systems;
using Robust.Shared.GameStates;
using Robust.Shared.Map;
using Robust.Shared.Serialization;
namespace Content.Shared.Tools.Components;
/// <summary>
/// This is used for entities with <see cref="ToolComponent"/> that are additionally
/// able to modify tiles.
/// </summary>
[RegisterComponent, NetworkedComponent]
[Access(typeof(SharedToolSystem))]
public sealed partial class ToolTileCompatibleComponent : Component
{
/// <summary>
/// The time it takes to modify the tile.
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite)]
public TimeSpan Delay = TimeSpan.FromSeconds(1);
/// <summary>
/// Whether or not the tile being modified must be unobstructed
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite)]
public bool RequiresUnobstructed = true;
}
[Serializable, NetSerializable]
public sealed partial class TileToolDoAfterEvent : DoAfterEvent
{
public NetCoordinates Coordinates;
public TileToolDoAfterEvent(NetCoordinates coordinates)
{
Coordinates = coordinates;
}
public override DoAfterEvent Clone()
{
return this;
}
}