Skip to content

Commit

Permalink
Освещение от эльзуос
Browse files Browse the repository at this point in the history
  • Loading branch information
Sh1ntra committed Aug 10, 2024
1 parent 18c0e65 commit a406314
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 1 deletion.
20 changes: 20 additions & 0 deletions Content.Server/Corvax/Elzuosa/ElzuosaColorComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Robust.Shared.Audio;

namespace Content.Server.Corvax.Elzuosa
{
[RegisterComponent]
public sealed partial class ElzuosaColorComponent : Component
{
public Color SkinColor { get; set; }

public bool Hacked { get; set; } = false;

[DataField("cycleRate")]
public float CycleRate = 1f;
}
}
37 changes: 37 additions & 0 deletions Content.Server/Corvax/Elzuosa/ElzuosaColorSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using Content.Shared.Humanoid;
using Content.Shared.Preferences;
using Robust.Server.GameObjects;
using Content.Server.GameTicking;
namespace Content.Server.Corvax.Elzuosa
{
public sealed class ElzuosaColorSystem : EntitySystem
{
[Dependency] private readonly PointLightSystem _pointLightSystem = default!;
public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<ElzuosaColorComponent, PlayerSpawnCompleteEvent>(OnPlayerSpawn);
}

private void OnPlayerSpawn(EntityUid uid, ElzuosaColorComponent comp, PlayerSpawnCompleteEvent args)
{
if (!HasComp<HumanoidAppearanceComponent>(uid))
return;
if (args == null)
return;
var profile = args.Profile;
SetEntityPointLightColor(uid, profile);
}

public void SetEntityPointLightColor(EntityUid uid, HumanoidCharacterProfile? profile)
{
if (profile == null)
return;

var color = profile.Appearance.SkinColor;
_pointLightSystem.SetColor(uid,color);

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,10 @@
requirePower: false
shockDamage: 2
shockTime: 2
- type: ElzuosaColor
- type: PointLight
enabled: true
radius: 2
radius: 2.3
- type: InteractionPopup
successChance: 1
interactSuccessString: pat-success-elzuosa
Expand Down

0 comments on commit a406314

Please sign in to comment.