Skip to content

Commit

Permalink
Merge branch 'xtray85:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
AserCreator authored Dec 6, 2023
2 parents 4804fe7 + 672a293 commit 43ee3bc
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 0 deletions.
31 changes: 31 additions & 0 deletions Content.Client/ADT/NovakidFeatures/NovakidFeaturesSystem.cs
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 Content.Shared/ADT/NovakidFeatures/NovakidGlowingComponent.cs
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;
}
}
7 changes: 7 additions & 0 deletions Resources/Changelog/ChangelogADT.yml
Original file line number Diff line number Diff line change
Expand Up @@ -664,3 +664,10 @@ Entries:
- {message: Колесо эмоций., type: Add}
id: 55621 #костыль отображения в Обновлениях
time: '2023-12-05T04:20:00.0000000+00:00'

- author: modern.df
changes:
- {message: Исправление свечения новакидов, type: Add}
- {message: Теперь они светятся оттенком их собственного цвета кожи, как и задумывалось., type: Fix}
id: 55615 #костыль отображения в Обновлениях
time: '2023-12-06T22:20:00.0000000+00:00'
1 change: 1 addition & 0 deletions Resources/Prototypes/ADT/Novakid/Mobs/Species/novakid.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
bloodReagent: Plasma
- type: ZombieImmune
- type: Thirst
- type: NovakidGlowing # see NovakidFeaturesSystem.cs
- type: PointLight
color: "#ffffff"
energy: 0.6
Expand Down

0 comments on commit 43ee3bc

Please sign in to comment.