Files
OldThink/Content.Shared/RCD/RCDPrototype.cs
ThereDrD0 d627758826 Баффы (#510)
* Moodsystem cleanups

* remove overhydrated and overfed mood debuffs

* admins now join game deadmined + new player timers

* faster arrivals

* recharging rcd with metal, glass, plastic or cable coils

* better timings and costs + building apc and camera

* preparing for rpd

* RPD + make RCD more generic

* add rpd to atmos lockers, rcd to engivend

* rcd and rpd to technologies

* dont deadmin me in debug

* rcd ammo buff

* add ChargeCountModifier logic for non stackable items

* increase time to become experienced player

* Dynamic Radial Menus (#29678)

* fix

* Clean Some Code

* Some Commentaries

* Update Content.Client/UserInterface/Controls/RadialContainer.cs

* Update Content.Client/UserInterface/Controls/RadialContainer.cs

---------

Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>

* more dynamically parameters

---------

Co-authored-by: Rinary <72972221+Rinary1@users.noreply.github.com>
Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
2024-07-29 06:04:21 +03:00

146 lines
4.9 KiB
C#

using Content.Shared._White.RCD;
using Content.Shared.Physics;
using Robust.Shared.Physics.Collision.Shapes;
using Robust.Shared.Prototypes;
using Robust.Shared.Utility;
namespace Content.Shared.RCD;
/// <summary>
/// Contains the parameters for a RCD construction / operation
/// </summary>
[Prototype("rcd")]
public sealed class RCDPrototype : IPrototype
{
[IdDataField]
public string ID { get; private set; } = default!;
/// <summary>
/// The RCD mode associated with the operation
/// </summary>
[DataField(required: true), ViewVariables(VVAccess.ReadOnly)]
public RcdMode Mode { get; private set; } = RcdMode.Invalid;
/// <summary>
/// The name associated with the prototype
/// </summary>
[DataField, ViewVariables(VVAccess.ReadOnly)]
public string Name { get; private set; } = "Unknown";
/// <summary>
/// The name of the radial container that this prototype will be listed under on the RCD menu
/// </summary>
[DataField, ViewVariables(VVAccess.ReadOnly)]
public ProtoId<RCDCategoryPrototype> Category { get; private set; } = "WallsAndFlooring"; // WD
/// <summary>
/// Texture path for this prototypes menu icon
/// </summary>
[DataField, ViewVariables(VVAccess.ReadOnly)]
public SpriteSpecifier? Sprite { get; private set; } = null;
/// <summary>
/// The entity prototype that will be constructed (mode dependent)
/// </summary>
[DataField, ViewVariables(VVAccess.ReadOnly)]
public ProtoId<EntityPrototype>? Prototype { get; private set; } = null;
/// <summary>
/// Number of charges consumed when the operation is completed
/// </summary>
[DataField, ViewVariables(VVAccess.ReadOnly)]
public int Cost { get; private set; } = 1;
/// <summary>
/// The length of the operation
/// </summary>
[DataField, ViewVariables(VVAccess.ReadOnly)]
public float Delay { get; private set; } = 1f;
/// <summary>
/// The visual effect that plays during this operation
/// </summary>
[DataField("fx"), ViewVariables(VVAccess.ReadOnly)]
public EntProtoId? Effect { get; private set; } = null;
/// <summary>
/// A list of rules that govern where the entity prototype can be contructed
/// </summary>
[DataField("rules"), ViewVariables(VVAccess.ReadOnly)]
public HashSet<RcdConstructionRule> ConstructionRules { get; private set; } = new();
/// <summary>
/// The collision mask used for determining whether the entity prototype will fit into a target tile
/// </summary>
[DataField, ViewVariables(VVAccess.ReadOnly)]
public CollisionGroup CollisionMask { get; private set; } = CollisionGroup.None;
/// <summary>
/// Specifies a set of custom collision bounds for determining whether the entity prototype will fit into a target tile
/// </summary>
/// <remarks>
/// Should be set assuming that the entity faces south.
/// Make sure that Rotation is set to RcdRotation.User if the entity is to be rotated by the user
/// </remarks>
[DataField, ViewVariables(VVAccess.ReadOnly)]
public Box2? CollisionBounds
{
get
{
return _collisionBounds;
}
private set
{
_collisionBounds = value;
if (_collisionBounds != null)
{
var poly = new PolygonShape();
poly.SetAsBox(_collisionBounds.Value);
CollisionPolygon = poly;
}
}
}
private Box2? _collisionBounds = null;
/// <summary>
/// The polygon shape associated with the prototype CollisionBounds (if set)
/// </summary>
[ViewVariables(VVAccess.ReadOnly)]
public PolygonShape? CollisionPolygon { get; private set; } = null;
/// <summary>
/// Governs how the local rotation of the constructed entity will be set
/// </summary>
[DataField, ViewVariables(VVAccess.ReadOnly)]
public RcdRotation Rotation { get; private set; } = RcdRotation.User;
}
public enum RcdMode : byte
{
Invalid,
Deconstruct,
ConstructTile,
ConstructObject,
}
// These are to be replaced with more flexible 'RulesRule' at a later time
public enum RcdConstructionRule : byte
{
MustBuildOnEmptyTile, // Can only be built on empty space (e.g. lattice)
CanBuildOnEmptyTile, // Can be built on empty space or replace an existing tile (e.g. hull plating)
MustBuildOnSubfloor, // Can only be built on exposed subfloor (e.g. catwalks on lattice or hull plating)
IsWindow, // The entity is a window and can be built on grilles
IsCatwalk, // The entity is a catwalk
}
public enum RcdRotation : byte
{
Fixed, // The entity has a local rotation of zero
Camera, // The rotation of the entity matches the local player camera
User, // The entity can be rotated by the local player prior to placement
}