CatStation/Content.Shared/Dice/DiceComponent.cs
Miguel4387 8f92040155
Coin tossing (#44622)
* Ported all I did inside forky to wizden

* Added new weighted coin to the uplink

* fixed the attributions license

* fixed the attributions license but this time for real

* fixed the attributions license but this time for real 2: electric boogaloo

* Changed diamond and gold tail sprites because I was dissatisfied with them

* dice bikeshed

* Changed gold coin tails sprite again, this time to one that makes more sense since I found out THAT ITS A HEAD WHAT THE HELL

* Minor review changes

* Oops All Yaml

* Removed the weighted coin from the uplink

* Fixed that fucking license that I hate

* Added attributions for the tails sprites

* Submodule

* Submodule for real

* Performed requested changes

---------

Co-authored-by: Whatstone <whatston3@gmail.com>
Co-authored-by: SlamBamActionman <slambamactionman@gmail.com>
Co-authored-by: AJCM-git <ajcm_mail@disroot.org>
2026-07-28 19:03:57 +00:00

79 lines
2.6 KiB
C#

using Content.Shared.Dataset;
using Robust.Shared.Audio;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
namespace Content.Shared.Dice;
[RegisterComponent, NetworkedComponent, Access(typeof(SharedDiceSystem))]
[AutoGenerateComponentState(true)]
public sealed partial class DiceComponent : Component
{
/// <summary>
/// The sounds to play when rolling the die.
/// </summary>
[DataField]
public SoundSpecifier Sound { get; private set; } = new SoundCollectionSpecifier("Dice");
/// <summary>
/// Multiplier for the value of a die. Applied after the <see cref="Offset"/>.
/// </summary>
[DataField]
public int Multiplier { get; private set; } = 1;
/// <summary>
/// Quantity that is subtracted from the value of a die. Can be used to make dice that start at "0". Applied
/// before the <see cref="Multiplier"/>
/// </summary>
[DataField]
public int Offset { get; private set; } = 0;
/// <summary>
/// The number of sides the dice has.
/// </summary>
[DataField]
public int Sides { get; private set; } = 20;
/// <summary>
/// A localized string of the type of object type this is (a die? a coin? a magic pool ball?), with how many sides.
/// This gets inserted in <c>$name</c> in <c>dice-component-on-examine-message-part-1</c>. If null, the examine string will be omitted.
/// </summary>
[DataField]
[AutoNetworkedField]
public LocId? ExamineObjectText = "dice-component-type-die";
/// <summary>
/// A localized string of how to print the value this has landed on when examining the entity.
/// Expects the die's value at <c>$currentSide</c>.
/// </summary>
[DataField]
[AutoNetworkedField]
public LocId ExamineLandedOnText = "dice-component-roll-generic";
/// <summary>
/// A dataset of the values. Expected to contain values from 1 to Sides.
/// If null, a numeric value will be printed out instead.
/// </summary>
[DataField]
[AutoNetworkedField]
public ProtoId<LocalizedDatasetPrototype>? Values;
/// <summary>
/// An optional value for this die to land on if weighted.
/// </summary>
[DataField]
public int? WeightedValue = null;
/// <summary>
/// If <see cref="WeightedValue"/> is not null, the die will roll that value with this probability, otherwise it selects a random value.
/// </summary>
[DataField]
public float WeightedProb = 1.0f;
/// <summary>
/// The currently displayed value.
/// </summary>
[DataField]
[AutoNetworkedField]
public int CurrentValue = 20;
}