using Content.Shared.CCVar;
using Robust.Shared.Player;
using Robust.Shared.Prototypes;
namespace Content.Shared.Tips;
///
/// Handles periodically displaying gameplay tips to all players ingame.
///
public abstract class SharedTipsSystem : EntitySystem
{
///
/// Always adds this time to a speech message. This is so really short message stay around for a bit.
///
private const float SpeechBuffer = 3f;
///
/// Expected reading speed.
///
private const float Wpm = 180f;
///
/// Send a tippy message to all clients.
///
/// The text to show in the speech bubble.
/// The entity to show. Defaults to tippy.
/// The time the speech bubble is shown, in seconds.
/// The time the entity takes to walk onto the screen, in seconds.
/// The time between waddle animation steps, in seconds.
public virtual void SendTippy(
string message,
EntProtoId? prototype = null,
float speakTime = 5f,
float slideTime = 3f,
float waddleInterval = 0.5f)
{ }
///
/// Send a tippy message to the given player session.
///
/// The player session to send the message to.
/// The text to show in the speech bubble.
/// The entity to show. Defaults to tippy.
/// The time the speech bubble is shown, in seconds.
/// The time the entity takes to walk onto the screen, in seconds.
/// The time between waddle animation steps, in seconds.
public virtual void SendTippy(
ICommonSession session,
string message,
EntProtoId? prototype = null,
float speakTime = 5f,
float slideTime = 3f,
float waddleInterval = 0.5f)
{ }
///
/// Send a random tippy message from the dataset given in .
///
public virtual void AnnounceRandomTip() { }
///
/// Set a random time stamp for the next automatic game tip.
///
public virtual void RecalculateNextTipTime() { }
///
/// Calculate the recommended speak time for a given message.
///
public float GetSpeechTime(string text)
{
var wordCount = (float)text.Split().Length;
return SpeechBuffer + wordCount * (60f / Wpm);
}
}