mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-19 06:28:40 +03:00
Lots of stuff. Also moved everything I could to the _Shitmed namespace
as I do in Goob. Will make future ports way faster
# Changelog
🆑 Mocho
- add: Added some fun organs and other thingies, check out the Goob PRs
if you want more details.
- fix: Fixed tons of issues with shitmed. Too many for the changelog in
fact.
(cherry picked from commit 3c9db94102cb25b28a83d51ac8d659fa31fe7d12)
58 lines
2.0 KiB
C#
58 lines
2.0 KiB
C#
using Content.Shared.Item.ItemToggle.Components;
|
|
using Content.Shared.Popups;
|
|
using Content.Shared.Smoking;
|
|
using Content.Shared.Smoking.Components;
|
|
using Content.Shared.Weapons.Ranged;
|
|
using Content.Shared.Weapons.Ranged.Components;
|
|
using Content.Shared.Weapons.Ranged.Events;
|
|
|
|
namespace Content.Shared._Shitmed.Medical.Surgery.Tools;
|
|
|
|
/// <summary>
|
|
/// Prevents using esword or welder when off, laser when no charges.
|
|
/// </summary>
|
|
public sealed class SurgeryToolConditionsSystem : EntitySystem
|
|
{
|
|
[Dependency] private readonly SharedPopupSystem _popup = default!;
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeLocalEvent<ItemToggleComponent, SurgeryToolUsedEvent>(OnToggleUsed);
|
|
SubscribeLocalEvent<GunComponent, SurgeryToolUsedEvent>(OnGunUsed);
|
|
SubscribeLocalEvent<MatchstickComponent, SurgeryToolUsedEvent>(OnMatchUsed);
|
|
}
|
|
|
|
private void OnToggleUsed(Entity<ItemToggleComponent> ent, ref SurgeryToolUsedEvent args)
|
|
{
|
|
if (ent.Comp.Activated)
|
|
return;
|
|
|
|
_popup.PopupEntity(Loc.GetString("surgery-tool-turn-on"), ent, args.User);
|
|
args.Cancelled = true;
|
|
}
|
|
|
|
private void OnGunUsed(Entity<GunComponent> ent, ref SurgeryToolUsedEvent args)
|
|
{
|
|
var coords = Transform(args.User).Coordinates;
|
|
var ev = new TakeAmmoEvent(1, new List<(EntityUid? Entity, IShootable Shootable)>(), coords, args.User);
|
|
if (ev.Ammo.Count > 0)
|
|
return;
|
|
|
|
_popup.PopupEntity(Loc.GetString("surgery-tool-reload"), ent, args.User);
|
|
args.Cancelled = true;
|
|
}
|
|
|
|
private void OnMatchUsed(Entity<MatchstickComponent> ent, ref SurgeryToolUsedEvent args)
|
|
{
|
|
var state = ent.Comp.CurrentState;
|
|
if (state == SmokableState.Lit)
|
|
return;
|
|
|
|
var key = "surgery-tool-match-" + (state == SmokableState.Burnt ? "replace" : "light");
|
|
_popup.PopupEntity(Loc.GetString(key), ent, args.User);
|
|
args.Cancelled = true;
|
|
}
|
|
}
|