-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #753 from Roudenn/upstream-sync
[Feature] Upstream Sync 17.09.24
- Loading branch information
Showing
254 changed files
with
6,049 additions
and
2,832 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,50 @@ | ||
using Content.Shared.Anomaly.Components; | ||
using Content.Shared.Anomaly.Effects; | ||
using Content.Shared.Body.Components; | ||
using Robust.Client.GameObjects; | ||
|
||
namespace Content.Client.Anomaly.Effects; | ||
|
||
public sealed class ClientInnerBodyAnomalySystem : SharedInnerBodyAnomalySystem | ||
{ | ||
public override void Initialize() | ||
{ | ||
SubscribeLocalEvent<InnerBodyAnomalyComponent, AfterAutoHandleStateEvent>(OnAfterHandleState); | ||
SubscribeLocalEvent<InnerBodyAnomalyComponent, ComponentShutdown>(OnCompShutdown); | ||
} | ||
|
||
private void OnAfterHandleState(Entity<InnerBodyAnomalyComponent> ent, ref AfterAutoHandleStateEvent args) | ||
{ | ||
if (!TryComp<SpriteComponent>(ent, out var sprite)) | ||
return; | ||
|
||
if (ent.Comp.FallbackSprite is null) | ||
return; | ||
|
||
if (!sprite.LayerMapTryGet(ent.Comp.LayerMap, out var index)) | ||
index = sprite.LayerMapReserveBlank(ent.Comp.LayerMap); | ||
|
||
if (TryComp<BodyComponent>(ent, out var body) && | ||
body.Prototype is not null && | ||
ent.Comp.SpeciesSprites.TryGetValue(body.Prototype.Value, out var speciesSprite)) | ||
{ | ||
sprite.LayerSetSprite(index, speciesSprite); | ||
} | ||
else | ||
{ | ||
sprite.LayerSetSprite(index, ent.Comp.FallbackSprite); | ||
} | ||
|
||
sprite.LayerSetVisible(index, true); | ||
sprite.LayerSetShader(index, "unshaded"); | ||
} | ||
|
||
private void OnCompShutdown(Entity<InnerBodyAnomalyComponent> ent, ref ComponentShutdown args) | ||
{ | ||
if (!TryComp<SpriteComponent>(ent, out var sprite)) | ||
return; | ||
|
||
var index = sprite.LayerMapGet(ent.Comp.LayerMap); | ||
sprite.LayerSetVisible(index, false); | ||
} | ||
} |
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
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
Oops, something went wrong.