-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
unshaded thrall's eyes & change thrall owner when real died
- Loading branch information
Doublechest
committed
Jul 30, 2024
1 parent
6466a81
commit 10534a6
Showing
5 changed files
with
89 additions
and
12 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 |
---|---|---|
@@ -1,20 +1,45 @@ | ||
using Content.Shared.Humanoid; | ||
using Content.Shared.StatusIcon.Components; | ||
using Content.Shared.Stories.Conversion; | ||
using Content.Shared.Stories.Shadowling; | ||
using Robust.Client.GameObjects; | ||
using Robust.Client.Graphics; | ||
using Robust.Shared.Prototypes; | ||
|
||
namespace Content.Client.Stories.Shadowling; | ||
|
||
public sealed partial class ShadowlingSystem : EntitySystem | ||
{ | ||
[Dependency] private readonly IPrototypeManager _prototype = default!; | ||
private readonly ProtoId<ShaderPrototype> _unshadedShaderProtoId = "unshaded"; | ||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
|
||
SubscribeLocalEvent<ShadowlingComponent, GetStatusIconsEvent>(OnGetStatusIconsEvent); | ||
|
||
// TODO: Использовать события ConvertedEvent, RevertedEvent. Сейчас они только на сервере. | ||
SubscribeLocalEvent<ShadowlingThrallComponent, ComponentInit>(OnConverted); | ||
SubscribeLocalEvent<ShadowlingThrallComponent, ComponentShutdown>(OnReverted); | ||
} | ||
private void OnGetStatusIconsEvent(EntityUid uid, ShadowlingComponent component, ref GetStatusIconsEvent args) | ||
{ | ||
args.StatusIcons.Add(_prototype.Index(component.StatusIcon)); | ||
} | ||
private void OnConverted(EntityUid uid, ShadowlingThrallComponent component, ComponentInit args) | ||
{ | ||
if (!HasComp<HumanoidAppearanceComponent>(uid)) | ||
return; | ||
|
||
var sprite = Comp<SpriteComponent>(uid); | ||
sprite.LayerSetShader(sprite.LayerMapReserveBlank(HumanoidVisualLayers.Eyes), _prototype.Index(_unshadedShaderProtoId).Instance()); | ||
} | ||
private void OnReverted(EntityUid uid, ShadowlingThrallComponent component, ComponentShutdown args) | ||
{ | ||
if (!HasComp<HumanoidAppearanceComponent>(uid)) | ||
return; | ||
|
||
var sprite = Comp<SpriteComponent>(uid); | ||
sprite.LayerSetShader(sprite.LayerMapReserveBlank(HumanoidVisualLayers.Eyes), (ShaderInstance?) null); | ||
} | ||
} |
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
File renamed without changes.
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
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