Skip to content
This repository has been archived by the owner on Nov 1, 2024. It is now read-only.

Commit

Permalink
Теперь цвет света вокруг эльзуос зависит от цвета их кожи
Browse files Browse the repository at this point in the history
  • Loading branch information
Sh1ntra committed Jul 4, 2024
1 parent ddc4ac8 commit 25199c7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 51 deletions.
1 change: 1 addition & 0 deletions Content.Server/Corvax/Elzuosa/ElzuosaColorComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Robust.Shared.Audio;

namespace Content.Server.Corvax.Elzuosa
{
Expand Down
64 changes: 13 additions & 51 deletions Content.Server/Corvax/Elzuosa/ElzuosaColorSystem.cs
Original file line number Diff line number Diff line change
@@ -1,75 +1,37 @@
using Content.Server.Humanoid;
using Content.Shared.Humanoid;
using Content.Shared.Interaction;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Content.Server.Chat.Systems;
using Content.Shared.Light;
using Content.Shared.Light.Components;
using Content.Shared.Tools.Components;
using FastAccessors;
using Content.Shared.Preferences;
using Robust.Server.GameObjects;
using Robust.Shared.Network;

using Content.Server.GameTicking;
namespace Content.Server.Corvax.Elzuosa
{
public sealed class ElzuosaColorSystem : EntitySystem
{
[Dependency] private readonly HumanoidAppearanceSystem _humanoidAppearance = default!;
[Dependency] private readonly SharedRgbLightControllerSystem _rgbSystem = default!;
[Dependency] private readonly SharedPointLightSystem _sharedPointLightSystem = default!;
[Dependency] private readonly INetManager _netManager = default!;
[Dependency] private readonly PointLightSystem _pointLightSystem = default!;
public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<ElzuosaColorComponent, MapInitEvent>(OnMapInit);
SubscribeLocalEvent<ElzuosaColorComponent, InteractUsingEvent>(OnInteractUsing);
//SubscribeLocalEvent<ElzuosaColorComponent, MapInitEvent>(OnInit);
SubscribeLocalEvent<ElzuosaColorComponent, PlayerSpawnCompleteEvent>(OnPlayerSpawn);
}

private void OnMapInit(EntityUid uid, ElzuosaColorComponent comp, MapInitEvent args)
private void OnPlayerSpawn(EntityUid uid, ElzuosaColorComponent comp, PlayerSpawnCompleteEvent args)
{
if (!HasComp<HumanoidAppearanceComponent>(uid))
return;
if (TryComp<HumanoidAppearanceComponent>(uid, out var humanoid))
{
var color = humanoid.SkinColor;
_sharedPointLightSystem.SetColor(uid, color);
}
}
/*private void OnInit(EntityUid uid, ElzuosaColorComponent comp, AfterAutoHandleStateEvent args)
{
if (!HasComp<HumanoidAppearanceComponent>(uid))
if (args == null)
return;
if (TryComp<HumanoidAppearanceComponent>(uid, out var humanoid))
{
var color = humanoid.SkinColor;
_sharedPointLightSystem.SetColor(uid, color);
}
}*/
var profile = args.Profile;
SetEntityPointLightColor(uid, profile);
}

private void OnInteractUsing(EntityUid uid, ElzuosaColorComponent comp, InteractUsingEvent args)
public void SetEntityPointLightColor(EntityUid uid, HumanoidCharacterProfile? profile)
{
if (args.Handled)
return;

if (!TryComp(args.Used, out ToolComponent? tool) || !tool.Qualities.ContainsAny("Pulsing"))
if (profile == null)
return;

args.Handled = true;
comp.Hacked = !comp.Hacked;
var color = profile.Appearance.SkinColor;
_pointLightSystem.SetColor(uid,color);

if (comp.Hacked)
{
var rgb = EnsureComp<RgbLightControllerComponent>(uid);
_rgbSystem.SetCycleRate(uid, comp.CycleRate, rgb);
}
else
RemComp<RgbLightControllerComponent>(uid);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
name: Urist McElzuosa
abstract: true
components:
- type: ElzuosaColor
- type: Hunger # Corvax-Frontier
starvationDamage:
types:
Expand Down

0 comments on commit 25199c7

Please sign in to comment.