Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Jabak
2024-06-22 15:40:08 +03:00
10 changed files with 136 additions and 142 deletions

View File

@@ -0,0 +1,95 @@
using Content.Shared._White.Lighting.PointLight.Airlock;
using Content.Shared.Doors.Components;
using Robust.Client.GameObjects;
namespace Content.Client._White.Lighting.PointLight.Airlock;
public sealed class PointLightAirlockSystem : EntitySystem
{
[Dependency] private readonly SharedPointLightSystem _pointLightSystem = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<PointLightAirlockComponent, AppearanceChangeEvent>(OnLightsChanged);
}
private void ToggleLight(EntityUid uid, string hex, PointLightAirlockComponent airlockLight, bool enable = true)
{
if (!_pointLightSystem.TryGetLight(uid, out var pointLightComponent))
return;
if (enable)
{
var color = Color.FromHex(hex);
_pointLightSystem.SetColor(uid, color, pointLightComponent);
}
_pointLightSystem.SetEnabled(uid, enable, pointLightComponent);
RaiseLocalEvent(uid, new PointLightToggleEvent(enable), true);
airlockLight.IsLightsEnabled = enable;
}
private void OnLightsChanged(EntityUid uid, PointLightAirlockComponent component, AppearanceChangeEvent args)
{
if (args.AppearanceData.TryGetValue(DoorVisuals.Powered, out var isPowered) && !(bool) isPowered)
{
if (component.IsLightsEnabled)
ToggleLight(uid, string.Empty, component, false);
return;
}
if (!args.AppearanceData.TryGetValue(DoorVisuals.State, out var state))
return;
HandleState(uid, component, (DoorState) state);
if (args.AppearanceData.TryGetValue(DoorVisuals.EmergencyLights, out var emergency))
ToggleLight(uid, component.YellowColor, component, (bool) emergency);
if (!args.AppearanceData.TryGetValue(DoorVisuals.BoltLights, out var boltsDown))
return;
if (component.LastBoltsState != (bool) boltsDown)
{
if ((bool) boltsDown)
ToggleLight(uid, component.RedColor, component, (bool) boltsDown);
else if (args.AppearanceData.TryGetValue(DoorVisuals.EmergencyLights, out var emergencyLights) && (bool) emergencyLights)
ToggleLight(uid, component.YellowColor, component);
else
HandleState(uid, component, (DoorState) state);
}
component.LastBoltsState = (bool) boltsDown;
}
private void HandleState(EntityUid uid, PointLightAirlockComponent component, DoorState state)
{
switch (state)
{
case DoorState.Open:
ToggleLight(uid, component.BlueColor, component);
break;
case DoorState.Opening:
ToggleLight(uid, component.GreenColor, component);
break;
case DoorState.Closing:
ToggleLight(uid, component.GreenColor, component);
break;
case DoorState.Closed:
ToggleLight(uid, component.BlueColor, component);
break;
case DoorState.Denying:
ToggleLight(uid, component.RedColor, component);
break;
}
}
}

View File

@@ -1,24 +0,0 @@
using Content.Server.Power.Components;
using Content.Shared._White.Lighting;
using Content.Shared._White.Lighting.PointLight.Airlock;
using Content.Shared.Doors.Components;
namespace Content.Server._White.Lighting.Pointlight.Airlock;
public sealed class PointLightAirlockSystem : EntitySystem
{
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<PointLightAirlockComponent, PowerChangedEvent>(OnPowerChanged);
}
private void OnPowerChanged(EntityUid uid, PointLightAirlockComponent component, PowerChangedEvent args)
{
if (!TryComp<DoorComponent>(uid, out var door))
return;
RaiseLocalEvent(uid, new DoorlightsChangedEvent(args.Powered ? door.State : null, args.Powered), true);
}
}

View File

@@ -121,7 +121,6 @@ public abstract class SharedAirlockSystem : EntitySystem
public void UpdateEmergencyLightStatus(EntityUid uid, AirlockComponent component)
{
RaiseLocalEvent(uid, new DoorlightsChangedEvent(DoorVisuals.EmergencyLights, component.EmergencyAccess));
Appearance.SetData(uid, DoorVisuals.EmergencyLights, component.EmergencyAccess);
}

View File

@@ -86,8 +86,6 @@ public abstract partial class SharedDoorSystem
Dirty(ent, ent.Comp);
UpdateBoltLightStatus(ent);
RaiseLocalEvent(ent, new DoorlightsChangedEvent(DoorVisuals.BoltLights, value), true);
var sound = value ? ent.Comp.BoltDownSound : ent.Comp.BoltUpSound;
if (predicted)
Audio.PlayPredicted(sound, ent, user: user);

View File

@@ -118,7 +118,6 @@ public abstract partial class SharedDoorSystem : EntitySystem
SetCollidable(ent, collidable, door);
RaiseLocalEvent(ent, new DoorlightsChangedEvent(door.State, true), true);
AppearanceSystem.SetData(ent, DoorVisuals.State, door.State);
}
@@ -167,7 +166,6 @@ public abstract partial class SharedDoorSystem : EntitySystem
_activeDoors.Add(ent);
RaiseLocalEvent(ent, new DoorStateChangedEvent(door.State));
RaiseLocalEvent(ent, new DoorlightsChangedEvent(door.State, true), true);
AppearanceSystem.SetData(ent, DoorVisuals.State, door.State);
}
@@ -219,7 +217,6 @@ public abstract partial class SharedDoorSystem : EntitySystem
Dirty(uid, door);
RaiseLocalEvent(uid, new DoorStateChangedEvent(state));
RaiseLocalEvent(uid, new DoorlightsChangedEvent(door.State, true), true);
AppearanceSystem.SetData(uid, DoorVisuals.State, door.State);
return true;
@@ -525,7 +522,6 @@ public abstract partial class SharedDoorSystem : EntitySystem
door.NextStateChange = GameTiming.CurTime + door.OpenTimeTwo;
door.State = DoorState.Opening;
RaiseLocalEvent(uid, new DoorlightsChangedEvent(door.State, true), true);
AppearanceSystem.SetData(uid, DoorVisuals.State, DoorState.Opening);
return false;
}

View File

@@ -1,13 +0,0 @@
namespace Content.Shared._White.Lighting;
public sealed class DoorlightsChangedEvent : EntityEventArgs
{
public Enum? State;
public bool Value;
public DoorlightsChangedEvent(Enum? key, bool value)
{
State = key;
Value = value;
}
}

View File

@@ -6,14 +6,20 @@ namespace Content.Shared._White.Lighting.PointLight.Airlock;
public sealed partial class PointLightAirlockComponent : Component
{
[ViewVariables]
public string RedColor = "#D56C6C";
public bool IsLightsEnabled;
[ViewVariables]
public string BlueColor = "#7F93C0";
public bool LastBoltsState;
[ViewVariables]
public string YellowColor = "#BDC07F";
public readonly string RedColor = "#D56C6C";
[ViewVariables]
public string GreenColor = "#7FC080";
public readonly string BlueColor = "#7F93C0";
[ViewVariables]
public readonly string YellowColor = "#BDC07F";
[ViewVariables]
public readonly string GreenColor = "#7FC080";
}

View File

@@ -1,83 +0,0 @@
using Content.Shared.Doors.Components;
namespace Content.Shared._White.Lighting.PointLight.Airlock;
//TODO: Когда-нибудь починить эту хуйню: Когда дверь открыта на аварийный доступ и ее болтируют, то свет будет желтым, хотя должен быть красным из-за болтов.
public sealed class SharedPointLightAirlockSystem : EntitySystem
{
[Dependency] private readonly SharedPointLightSystem _pointLightSystem = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<PointLightAirlockComponent, DoorlightsChangedEvent>(OnDoorLightChanged);
}
public void ToggleLight(EntityUid uid, string hex, bool enable = true)
{
if (!_pointLightSystem.TryGetLight(uid, out var pointLightComponent))
return;
if (enable)
{
var color = Color.FromHex(hex);
_pointLightSystem.SetColor(uid, color, pointLightComponent);
}
_pointLightSystem.SetEnabled(uid, enable, pointLightComponent);
RaiseLocalEvent(uid, new PointLightToggleEvent(enable), true);
}
public void OnDoorLightChanged(EntityUid uid, PointLightAirlockComponent component, DoorlightsChangedEvent args)
{
if (!TryComp<DoorComponent>(uid, out var door))
return;
if (TryComp<AirlockComponent>(uid, out var airlockComponent) && airlockComponent.EmergencyAccess && args.Value && args.State is not DoorVisuals.EmergencyLights && args.State != null)
return; // While emergency access lights must be yellow no matter what
switch (args.State)
{
case DoorVisuals.BoltLights:
if (args.Value)
ToggleLight(uid, component.RedColor);
else
RaiseLocalEvent(uid, new DoorlightsChangedEvent(door.State, true));
break;
case DoorState.Denying:
ToggleLight(uid, component.RedColor);
break;
case DoorState.Closed:
ToggleLight(uid, component.BlueColor);
break;
case DoorVisuals.EmergencyLights:
if (args.Value)
ToggleLight(uid, component.YellowColor);
else
RaiseLocalEvent(uid, new DoorlightsChangedEvent(door.State, true));
break;
case DoorState.Open:
ToggleLight(uid, component.BlueColor);
break;
case DoorState.Opening:
ToggleLight(uid, component.GreenColor);
break;
case DoorState.Closing:
ToggleLight(uid, component.GreenColor);
break;
default:
ToggleLight(uid, "", false);
break;
}
}
}

View File

@@ -4785,3 +4785,26 @@
id: 321
time: '2024-06-21T10:44:40.0000000+00:00'
url: https://api.github.com/repos/frosty-dev/ss14-core/pulls/373
- author: Jabak
changes:
- message: "\u041D\u043E\u0432\u0430\u044F \u043C\u0443\u0437\u044B\u043A\u0430\
\ \u0432 \u043B\u043E\u0431\u0431\u0438"
type: Add
id: 322
time: '2024-06-21T19:03:52.0000000+00:00'
url: https://api.github.com/repos/frosty-dev/ss14-core/pulls/368
- author: ThereDrD
changes:
- message: "\u0421\u0438\u0441\u0442\u0435\u043C\u0430 \u0434\u0432\u0435\u0440\u0435\
\u0439 \u0431\u044B\u043B\u0430 \u043F\u0435\u0440\u0435\u043F\u0438\u0441\u0430\
\u043D\u0430, \u0442\u0435\u043F\u0435\u0440\u044C \u043E\u043D\u0430 \u0440\
\u0430\u0431\u043E\u0442\u0430\u0435\u0442 \u043B\u0443\u0447\u0448\u0435"
type: Fix
- message: "\u0414\u0432\u0435\u0440\u0438 \u0431\u043E\u043B\u044C\u0448\u0435\
\ \u043D\u0435 \u0441\u0432\u0435\u0442\u044F\u0442\u0441\u044F, \u043A\u043E\
\u0433\u0434\u0430 \u0442\u0435\u0440\u044F\u044E\u0442 \u044D\u043D\u0435\u0440\
\u0433\u0438\u044E"
type: Fix
id: 323
time: '2024-06-22T10:53:37.0000000+00:00'
url: https://api.github.com/repos/frosty-dev/ss14-core/pulls/375

View File

@@ -1,21 +1,18 @@
- type: soundCollection
id: LobbyMusic
files:
# - /Audio/Lobby/thunderdome.ogg
# - /Audio/Lobby/singuloose.ogg
# - /Audio/Lobby/title2.ogg
# - /Audio/Lobby/title3.ogg
# - /Audio/Lobby/lasers_rip_apart_the_bulkhead.ogg
# - /Audio/Lobby/every_light_is_blinking_at_once.ogg
- /Audio/Lobby/atomicamnesiammx.ogg
- /Audio/Lobby/itachi.ogg
- /Audio/Lobby/thunderdome.ogg
# - /Audio/Lobby/singuloose.ogg
# - /Audio/Lobby/title2.ogg
# - /Audio/Lobby/title3.ogg
# - /Audio/Lobby/lasers_rip_apart_the_bulkhead.ogg
# - /Audio/Lobby/every_light_is_blinking_at_once.ogg
# - /Audio/Lobby/atomicamnesiammx.ogg
# - /Audio/Lobby/itachi.ogg
- /Audio/Lobby/govnovoz.ogg
- /Audio/Lobby/govnovoz2.ogg
- /Audio/Lobby/govnovoz3.ogg
- /Audio/Lobby/govnovoz4.ogg
- /Audio/Lobby/nevergonna.ogg
- /Audio/Lobby/lolimou.ogg
- /Audio/Lobby/xos.ogg
- /Audio/Lobby/spaceoddity.ogg
# - /Audio/Lobby/absconditus.ogg
# - /Audio/Lobby/space_asshole.ogg