-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'xtray85:master' into master
- Loading branch information
Showing
4 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
Content.Client/ADT/NovakidFeatures/NovakidFeaturesSystem.cs
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,31 @@ | ||
using Content.Shared.ADT.NovakidFeatures; | ||
using Robust.Client.GameObjects; | ||
|
||
namespace Content.Client.ADT.NovakidFeatures; | ||
public sealed partial class NovakidFeaturesSystem : EntitySystem | ||
{ | ||
[Dependency] private readonly IEntityManager _entityManager = default!; | ||
[Dependency] private readonly PointLightSystem _lights = default!; | ||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
|
||
SubscribeLocalEvent<NovakidGlowingComponent, ComponentInit>(OnEntityInit); | ||
} | ||
/// <summary> | ||
/// Makes Novakid to glow with color of his skin — layer number 0 of SpriteComponent. | ||
/// </summary> | ||
/// <param name="uid">Novakid</param> | ||
/// <param name="component">Компонент отвечающий за свечение новакида. Вообще-то говоря он нужен пока только для того, чтобы не пришлось перебирать сущности в поисках новакида.</param> | ||
/// <param name="args"></param> | ||
private void OnEntityInit(EntityUid uid, NovakidGlowingComponent component, ComponentInit args) | ||
{ | ||
_entityManager.GetComponent<SpriteComponent>(uid).TryGetLayer(0, out var layer); | ||
|
||
component.GlowingColor = _entityManager.GetComponent<SpriteComponent>(uid).Color; | ||
if (layer == null) return; | ||
_lights.SetColor(uid, layer.Color); | ||
//_lights.SetEnergy(uid, 0.6f); | ||
_entityManager.Dirty(_entityManager.GetComponent<SpriteComponent>(uid)); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
Content.Shared/ADT/NovakidFeatures/NovakidGlowingComponent.cs
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 @@ | ||
namespace Content.Shared.ADT.NovakidFeatures; | ||
|
||
[RegisterComponent] | ||
public sealed partial class NovakidGlowingComponent : Component | ||
{ | ||
[DataField] | ||
public Color GlowingColor; | ||
|
||
NovakidGlowingComponent(Color color) | ||
{ | ||
GlowingColor = color; | ||
} | ||
} |
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