Predicted dice rolls (#34863)
* Predicted dice rolls * Removed server-side dice system, make Shared no longer abstract, move visual code to client-side system * cleanup --------- Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
This commit is contained in:
@@ -1,28 +1,5 @@
|
||||
using Content.Shared.Dice;
|
||||
using Content.Shared.Popups;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Random;
|
||||
|
||||
namespace Content.Server.Dice;
|
||||
|
||||
[UsedImplicitly]
|
||||
public sealed class DiceSystem : SharedDiceSystem
|
||||
{
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||
[Dependency] private readonly SharedPopupSystem _popup = default!;
|
||||
|
||||
public override void Roll(EntityUid uid, DiceComponent? die = null)
|
||||
{
|
||||
if (!Resolve(uid, ref die))
|
||||
return;
|
||||
|
||||
var roll = _random.Next(1, die.Sides + 1);
|
||||
SetCurrentSide(uid, roll, die);
|
||||
|
||||
_popup.PopupEntity(Loc.GetString("dice-component-on-roll-land", ("die", uid), ("currentSide", die.CurrentValue)), uid);
|
||||
_audio.PlayPvs(die.Sound, uid);
|
||||
}
|
||||
}
|
||||
public sealed class DiceSystem : SharedDiceSystem;
|
||||
|
||||
Reference in New Issue
Block a user