This repository has been archived by the owner on Nov 1, 2024. It is now read-only.
forked from new-frontiers-14/frontier-station-14
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Теперь цвет света вокруг эльзуос зависит от цвета их кожи
- Loading branch information
Showing
3 changed files
with
15 additions
and
51 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
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 |
---|---|---|
@@ -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); | ||
} | ||
} | ||
} |
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