-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
637f429
commit ae37801
Showing
3 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using Robust.Shared.GameStates; | ||
|
||
namespace Content.Shared.Traits.Assorted; | ||
|
||
/// <summary> | ||
/// This is used for making something blind forever. | ||
/// </summary> | ||
[RegisterComponent, NetworkedComponent] | ||
public sealed partial class GlassesComponent : Component | ||
{ | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
using Content.Shared.Damage.Components; | ||
using Content.Shared.Examine; | ||
using Content.Shared.Eye.Blinding.Components; | ||
using Content.Shared.Eye.Blinding.Systems; | ||
using Content.Shared.IdentityManagement; | ||
using Robust.Shared.Network; | ||
using Content.Shared.Inventory.Events; | ||
using Content.Shared.Inventory; | ||
using Content.Shared.Traits.Assorted; | ||
|
||
namespace Content.Shared.Traits.Assorted; | ||
|
||
/// <summary> | ||
/// This handles permanent blindness, both the examine and the actual effect. | ||
/// </summary> | ||
public sealed class GlassesSystem : EntitySystem | ||
{ | ||
[Dependency] private readonly INetManager _net = default!; | ||
[Dependency] private readonly IEntityManager _entityManager = default!; | ||
[Dependency] private readonly BlindableSystem _blinding = default!; | ||
|
||
/// <inheritdoc/> | ||
public override void Initialize() | ||
{ | ||
SubscribeLocalEvent<GlassesComponent, GotEquippedEvent>(Equipped); | ||
SubscribeLocalEvent<GlassesComponent, GotUnequippedEvent>(Unequipped); | ||
|
||
} | ||
|
||
private void Equipped(EntityUid uid, GlassesComponent component, ref GotEquippedEvent args) | ||
{ | ||
if (!TryComp<MyopiaComponent>(args.Equipee, out var myopia)) | ||
return; | ||
myopia.Active = false; | ||
if (!TryComp<BlindableComponent>(args.Equipee, out var blindable)) | ||
return; | ||
_blinding.AdjustEyeDamage((args.Equipee, blindable), -myopia.EyeDamage); | ||
} | ||
|
||
private void Unequipped(EntityUid uid, GlassesComponent component, ref GotUnequippedEvent args) | ||
{ | ||
if (!TryComp<MyopiaComponent>(args.Equipee, out var myopia)) | ||
return; | ||
myopia.Active = true; | ||
if (!TryComp<BlindableComponent>(args.Equipee, out var blindable)) | ||
return; | ||
_blinding.AdjustEyeDamage((args.Equipee, blindable), myopia.EyeDamage); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters