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

Sh1ntra elzuos #362

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Теперь цвет света вокруг эльзуос зависит от цвета их кожи
Sh1ntra committed Jul 4, 2024
commit 25199c71fc9e12b987b7cfb94bef378bd4713940
1 change: 1 addition & 0 deletions Content.Server/Corvax/Elzuosa/ElzuosaColorComponent.cs
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Robust.Shared.Audio;

namespace Content.Server.Corvax.Elzuosa
{
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
@@ -4,6 +4,7 @@
name: Urist McElzuosa
abstract: true
components:
- type: ElzuosaColor
- type: Hunger # Corvax-Frontier
starvationDamage:
types: