Files
wwdpublic/Content.Server/Clock/ClockSystem.cs
bruhmogus 84faccfd1f Ports Smuggler Satchel, Watches, and Rings (#2088)
# Description

Adds the watches, smuggler satchel, and rings from wizden.
If I fucked anything up, tell me and I'll do my best to fix it, IF I
CAN. I'll probably need some help.
Yell at me really loudly if I managed to delete the entire repo or
something

---

# TODO

- [x] Smuggler satchel
- [x] Watches
- [x] Rings

---

https://github.com/user-attachments/assets/7d1e06a7-a049-4d74-9f7e-2b8f04d1e5d1

---

# Changelog

🆑
- add: Ported Smuggler Satchels from Wizden
- add: Ported watches (both normal and gold) from Wizden
- Ported rings from Wizden

---------

Signed-off-by: bruhmogus <104110869+bruhmogus@users.noreply.github.com>
Signed-off-by: VMSolidus <evilexecutive@gmail.com>
Signed-off-by: Timfa <timfalken@hotmail.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: VMSolidus <evilexecutive@gmail.com>
Co-authored-by: Timfa <timfalken@hotmail.com>
(cherry picked from commit 667013f9f82b3b291641b5501421653d7f79ddbd)
2025-04-04 14:51:58 +03:00

43 lines
1.3 KiB
C#

using Content.Server.GameTicking.Events;
using Content.Shared.Clock;
using Content.Shared.Destructible;
using Robust.Server.GameStates;
using Robust.Shared.Random;
namespace Content.Server.Clock;
public sealed class ClockSystem : SharedClockSystem
{
[Dependency] private readonly PvsOverrideSystem _pvsOverride = default!;
[Dependency] private readonly IRobustRandom _robustRandom = default!;
/// <inheritdoc/>
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<RoundStartingEvent>(OnRoundStart);
SubscribeLocalEvent<GlobalTimeManagerComponent, MapInitEvent>(OnMapInit);
SubscribeLocalEvent<ClockComponent, BreakageEventArgs>(OnBreak);
}
private void OnRoundStart(RoundStartingEvent ev)
{
var manager = Spawn();
AddComp<GlobalTimeManagerComponent>(manager);
}
private void OnMapInit(Entity<GlobalTimeManagerComponent> ent, ref MapInitEvent args)
{
ent.Comp.TimeOffset = TimeSpan.FromHours(_robustRandom.NextFloat(0, 24));
_pvsOverride.AddGlobalOverride(ent);
Dirty(ent);
}
private void OnBreak(Entity<ClockComponent> ent, ref BreakageEventArgs args)
{
ent.Comp.StuckTime = GetClockTime(ent);
Dirty(ent, ent.Comp);
}
}