diff --git a/Content.Client/_White/Lighting/Shaders/LightingOverlay.cs b/Content.Client/_White/Lighting/Shaders/LightingOverlay.cs index 2c8a96786d..75acca625f 100644 --- a/Content.Client/_White/Lighting/Shaders/LightingOverlay.cs +++ b/Content.Client/_White/Lighting/Shaders/LightingOverlay.cs @@ -55,13 +55,13 @@ public sealed class LightingOverlay : Overlay _shader.SetParameter("SCREEN_TEXTURE", ScreenTexture); - var query = _entityManager.AllEntityQueryEnumerator(); - while (query.MoveNext(out var uid, out var component, out var xform)) + var query = _entityManager.AllEntityQueryEnumerator(); + while (query.MoveNext(out _, out var component, out var pointLight, out var xform)) { if (xform.MapID != args.MapId) continue; - if (!component.Enabled) + if (!component.Enabled ?? !pointLight.Enabled) continue; var worldPos = _transformSystem.GetWorldPosition(xform, xformCompQuery); @@ -69,10 +69,7 @@ public sealed class LightingOverlay : Overlay if (!bounds.Contains(worldPos)) continue; - var color = component.Color; - - if (color == null && _entityManager.TryGetComponent(uid, out var pointLight)) - color = pointLight.Color; + var color = component.Color ?? pointLight.Color; var (_, _, worldMatrix) = xform.GetWorldPositionRotationMatrix(xformCompQuery); handle.SetTransform(worldMatrix); diff --git a/Content.Client/_White/Lighting/Shaders/TogglingLightOverlaySystem.cs b/Content.Client/_White/Lighting/Shaders/TogglingLightOverlaySystem.cs deleted file mode 100644 index 4c6dc1016f..0000000000 --- a/Content.Client/_White/Lighting/Shaders/TogglingLightOverlaySystem.cs +++ /dev/null @@ -1,21 +0,0 @@ -using Content.Shared._White.Lighting.Shaders; -using Content.Shared.Power; -using Robust.Client.GameObjects; - -namespace Content.Client._White.Lighting.Shaders; - -public sealed class TogglingLightOverlaySystem : EntitySystem -{ - public override void Initialize() - { - SubscribeLocalEvent(OnAppearanceChange); - } - - private void OnAppearanceChange(EntityUid uid, LightingOverlayComponent component, AppearanceChangeEvent args) - { - if (!args.AppearanceData.TryGetValue(PowerDeviceVisuals.Powered, out var state)) - return; - - component.Enabled = (bool) state; - } -} diff --git a/Content.Server/GameTicking/GameTicker.RoundFlow.cs b/Content.Server/GameTicking/GameTicker.RoundFlow.cs index 15abb06427..3347295cbb 100644 --- a/Content.Server/GameTicking/GameTicker.RoundFlow.cs +++ b/Content.Server/GameTicking/GameTicker.RoundFlow.cs @@ -23,6 +23,7 @@ using Robust.Shared.Player; using Robust.Shared.Random; using Robust.Shared.Utility; using Content.Server._White.PandaSocket.Main; +using Content.Server._White.RandomArtifacts; using Content.Server._White.RealRoundEnded; using Content.Server._White.Reputation; using Content.Server._White.Stalin; @@ -288,6 +289,8 @@ namespace Content.Server.GameTicking // MapInitialize *before* spawning players, our codebase is too shit to do it afterwards... _mapManager.DoMapInitialize(DefaultMap); + RaiseLocalEvent(new RandomArtifactsSystem.MainMapInitEvent()); // Please no more organs-artifacts in players + SpawnPlayers(readyPlayers, readyPlayerProfiles, force); _roundStartDateTime = DateTime.UtcNow; diff --git a/Content.Server/_White/AspectsSystem/Aspects/RandomAccentAspect.cs b/Content.Server/_White/AspectsSystem/Aspects/RandomAccentAspect.cs index 7948b80e98..1dccd6807e 100644 --- a/Content.Server/_White/AspectsSystem/Aspects/RandomAccentAspect.cs +++ b/Content.Server/_White/AspectsSystem/Aspects/RandomAccentAspect.cs @@ -23,6 +23,7 @@ public sealed class RandomAccentAspect : AspectSystem(); + while (query.MoveNext(out var ent, out _)) { ApplyRandomAccent(ent); @@ -48,6 +49,8 @@ public sealed class RandomAccentAspect : AspectSystem().ToList(); + var randomIndex = _random.Next(allAccents.Count); var selectedAccent = allAccents[randomIndex]; + ApplyAccent(uid, selectedAccent); } @@ -94,15 +101,17 @@ public sealed class RandomAccentAspect : AspectSystem(uid); break; - case AccentType.Anime: + case AccentType.OwO: EntityManager.EnsureComponent(uid); break; case AccentType.Lizard: EntityManager.EnsureComponent(uid); break; + /* Not funny case AccentType.Backwards: EntityManager.EnsureComponent(uid); break; + */ case AccentType.Bark: EntityManager.EnsureComponent(uid); break; @@ -116,6 +125,12 @@ public sealed class RandomAccentAspect : AspectSystem(uid); break; + case AccentType.French: + EntityManager.EnsureComponent(uid); + break; + case AccentType.Gnome: + EntityManager.EnsureComponent(uid); + break; } } diff --git a/Content.Server/_White/RandomArtifacts/RandomArtifactsSystem.cs b/Content.Server/_White/RandomArtifacts/RandomArtifactsSystem.cs index 63378cc845..1ef1ac8f11 100644 --- a/Content.Server/_White/RandomArtifacts/RandomArtifactsSystem.cs +++ b/Content.Server/_White/RandomArtifacts/RandomArtifactsSystem.cs @@ -1,7 +1,8 @@ using System.Linq; +using Content.Server.Station.Components; +using Content.Server.Station.Systems; using Content.Server.Xenoarchaeology.XenoArtifacts; using Content.Shared._White; -using Content.Shared.GameTicking; using Content.Shared.Item; using Robust.Shared.Configuration; using Robust.Shared.Random; @@ -13,6 +14,7 @@ public sealed class RandomArtifactsSystem : EntitySystem [Dependency] private readonly ArtifactSystem _artifactsSystem = default!; [Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly IConfigurationManager _configurationManager = default!; + [Dependency] private readonly StationSystem _station = default!; private float _itemToArtifactRatio; // from 0 to 100. In % percents. Default is 0.7% private bool _artifactsEnabled; @@ -24,10 +26,10 @@ public sealed class RandomArtifactsSystem : EntitySystem _configurationManager.OnValueChanged(WhiteCVars.EnableRandomArtifacts, b => OnCvarChanged(b), true); _configurationManager.OnValueChanged(WhiteCVars.ItemToArtifactRatio, r => _itemToArtifactRatio = r, true); - SubscribeLocalEvent(OnRoundStart); + SubscribeLocalEvent(OnRoundStart); } - private void OnRoundStart(RoundStartedEvent ev) + private void OnRoundStart(MainMapInitEvent ev) { if (!_artifactsEnabled) return; @@ -46,6 +48,12 @@ public sealed class RandomArtifactsSystem : EntitySystem foreach (var item in selectedItems) { var entity = item.Owner; + var xform = Transform(entity); + + var station = _station.GetStationInMap(xform.MapID); + + if (!HasComp(station)) + continue; var artifactComponent = EnsureComp(entity); _artifactsSystem.RandomizeArtifact(entity, artifactComponent); @@ -74,6 +82,8 @@ public sealed class RandomArtifactsSystem : EntitySystem _artifactsEnabled = enabled; } + public sealed class MainMapInitEvent : EntityEventArgs { } + } /* diff --git a/Content.Shared/_White/Lighting/Shaders/LightingOverlayComponent.cs b/Content.Shared/_White/Lighting/Shaders/LightingOverlayComponent.cs index 71a94d44b7..692e56a61d 100644 --- a/Content.Shared/_White/Lighting/Shaders/LightingOverlayComponent.cs +++ b/Content.Shared/_White/Lighting/Shaders/LightingOverlayComponent.cs @@ -11,7 +11,7 @@ namespace Content.Shared._White.Lighting.Shaders; public sealed partial class LightingOverlayComponent : Component { [DataField, ViewVariables(VVAccess.ReadWrite)] - public bool Enabled = true; + public bool? Enabled; [DataField] public SpriteSpecifier Sprite = new Texture(new ResPath("Effects/LightMasks/lightmask_lamp.png")); diff --git a/Content.Shared/_White/WhiteCVars.cs b/Content.Shared/_White/WhiteCVars.cs index 7513370645..370e0748f8 100644 --- a/Content.Shared/_White/WhiteCVars.cs +++ b/Content.Shared/_White/WhiteCVars.cs @@ -418,5 +418,5 @@ public sealed class WhiteCVars CVarDef.Create("white.random_artifacts_enabled", true, CVar.SERVERONLY); public static readonly CVarDef ItemToArtifactRatio = - CVarDef.Create("white.random_artifacts_ratio", 0.7f, CVar.SERVERONLY); + CVarDef.Create("white.random_artifacts_ratio", 0.4f, CVar.SERVERONLY); }