Merge remote-tracking branch 'upstream/master' into ups

This commit is contained in:
Jabak
2024-08-23 02:25:53 +03:00
163 changed files with 2022 additions and 714 deletions

View File

@@ -1,7 +1,6 @@
<BoxContainer xmlns="https://spacestation14.io"
Orientation="Horizontal"
HorizontalExpand="True"
>
HorizontalExpand="True">
<Label Name="SongName" HorizontalAlignment="Left" HorizontalExpand="True"/>
<Button Name="PlayButton" StyleClasses="OpenRight" Text="{Loc 'jukebox-menu-buttonplay'}" />
<Button Name="StopButton" StyleClasses="OpenLeft" Text="{Loc 'jukebox-menu-buttonstop'}" />

View File

@@ -1,7 +1,6 @@
using Content.Client._White.Chat;
using Content.Client._White.JoinQueue;
using Content.Client._White.Jukebox;
using Content.Client._White.Overlays;
using Content.Client._White.Reputation;
using Content.Client._White.Sponsors;
using Content.Client._White.Stalin;
@@ -10,7 +9,6 @@ using Content.Client.Administration.Managers;
using Content.Client.Changelog;
using Content.Client.Chat.Managers;
using Content.Client.Eui;
using Content.Client.Flash;
using Content.Client.Fullscreen;
using Content.Client.GhostKick;
using Content.Client.Guidebook;
@@ -26,6 +24,7 @@ using Content.Client.Radiation.Overlays;
using Content.Client.Replay;
using Content.Client.Screenshot;
using Content.Client.Singularity;
using Content.Client._White.Explosion;
using Content.Client.Stylesheets;
using Content.Client.Viewport;
using Content.Client.Voting;
@@ -179,6 +178,7 @@ namespace Content.Client.Entry
_parallaxManager.LoadDefaultParallax();
_overlayManager.AddOverlay(new SingularityOverlay());
_overlayManager.AddOverlay(new ExplosionShockWaveOverlay());
_overlayManager.AddOverlay(new RadiationPulseOverlay());
// _overlayManager.AddOverlay(new GrainOverlay());
// _overlayManager.AddOverlay(new AtmOverlay());

View File

@@ -244,7 +244,7 @@ namespace Content.Client.Lobby
_lobby!.ServerInfo.SetInfoBlob(_gameTicker.ServerInfoBlob);
}
_lobby!.LabelName.SetMarkup("[font=\"Bedstead\" size=20] White Dream [/font]");
_lobby!.LabelName.SetMarkup("[font=\"Bedstead\" size=20] Giedi Prime [/font]");
_lobby!.ChangelogLabel.SetMarkup("Список изменений:");
}

View File

@@ -41,6 +41,7 @@
<CheckBox Name="FpsCounterCheckBox" Text="{Loc 'ui-options-fps-counter'}" />
<CheckBox Name="LogInChatCheckBox" Text="Логировать действия в чат" />
<CheckBox Name="ShowTrailsCheckBox" Text="Отображать трейлы от пуль" />
<CheckBox Name="EnableLightsGlowingBox" Text="Включить свечение от ламп" />
</BoxContainer>
<controls:StripeBack HasBottomEdge="False" HasMargins="False">
<Button Name="ApplyButton"

View File

@@ -73,8 +73,9 @@ namespace Content.Client.Options.UI.Tabs
ViewportLowResCheckBox.OnToggled += OnCheckBoxToggled;
ParallaxLowQualityCheckBox.OnToggled += OnCheckBoxToggled;
FpsCounterCheckBox.OnToggled += OnCheckBoxToggled;
LogInChatCheckBox.OnToggled += OnCheckBoxToggled;
ShowTrailsCheckBox.OnToggled += OnCheckBoxToggled;
LogInChatCheckBox.OnToggled += OnCheckBoxToggled; // WD
ShowTrailsCheckBox.OnToggled += OnCheckBoxToggled; // WD
EnableLightsGlowingBox.OnToggled += OnCheckBoxToggled; // WD
ApplyButton.OnPressed += OnApplyButtonPressed;
VSyncCheckBox.Pressed = _cfg.GetCVar(CVars.DisplayVSync);
FullscreenCheckBox.Pressed = ConfigIsFullscreen;
@@ -86,8 +87,9 @@ namespace Content.Client.Options.UI.Tabs
ViewportLowResCheckBox.Pressed = !_cfg.GetCVar(CCVars.ViewportScaleRender);
ParallaxLowQualityCheckBox.Pressed = _cfg.GetCVar(CCVars.ParallaxLowQuality);
FpsCounterCheckBox.Pressed = _cfg.GetCVar(CCVars.HudFpsCounterVisible);
LogInChatCheckBox.Pressed = _cfg.GetCVar(WhiteCVars.LogChatActions);
ShowTrailsCheckBox.Pressed = _cfg.GetCVar(WhiteCVars.ShowTrails);
LogInChatCheckBox.Pressed = _cfg.GetCVar(WhiteCVars.LogChatActions); // WD
ShowTrailsCheckBox.Pressed = _cfg.GetCVar(WhiteCVars.ShowTrails); // WD
EnableLightsGlowingBox.Pressed = _cfg.GetCVar(WhiteCVars.EnableLightsGlowing); // WD
ViewportWidthSlider.Value = _cfg.GetCVar(CCVars.ViewportWidth);
_cfg.OnValueChanged(CCVars.ViewportMinimumWidth, _ => UpdateViewportWidthRange());
@@ -120,8 +122,9 @@ namespace Content.Client.Options.UI.Tabs
_cfg.SetCVar(CCVars.ViewportScaleRender, !ViewportLowResCheckBox.Pressed);
_cfg.SetCVar(CCVars.ParallaxLowQuality, ParallaxLowQualityCheckBox.Pressed);
_cfg.SetCVar(CCVars.HudFpsCounterVisible, FpsCounterCheckBox.Pressed);
_cfg.SetCVar(WhiteCVars.LogChatActions, LogInChatCheckBox.Pressed);
_cfg.SetCVar(WhiteCVars.ShowTrails, ShowTrailsCheckBox.Pressed);
_cfg.SetCVar(WhiteCVars.LogChatActions, LogInChatCheckBox.Pressed); // WD
_cfg.SetCVar(WhiteCVars.ShowTrails, ShowTrailsCheckBox.Pressed); // WD
_cfg.SetCVar(WhiteCVars.EnableLightsGlowing, EnableLightsGlowingBox.Pressed); // WD
_cfg.SetCVar(CCVars.ViewportWidth, (int) ViewportWidthSlider.Value);
_cfg.SaveToFile();
@@ -151,8 +154,9 @@ namespace Content.Client.Options.UI.Tabs
var isVPResSame = ViewportLowResCheckBox.Pressed == !_cfg.GetCVar(CCVars.ViewportScaleRender);
var isPLQSame = ParallaxLowQualityCheckBox.Pressed == _cfg.GetCVar(CCVars.ParallaxLowQuality);
var isFpsCounterVisibleSame = FpsCounterCheckBox.Pressed == _cfg.GetCVar(CCVars.HudFpsCounterVisible);
var isLogInChatSame = LogInChatCheckBox.Pressed == _cfg.GetCVar(WhiteCVars.LogChatActions);
var isShowTrailsSame = ShowTrailsCheckBox.Pressed == _cfg.GetCVar(WhiteCVars.ShowTrails);
var isLogInChatSame = LogInChatCheckBox.Pressed == _cfg.GetCVar(WhiteCVars.LogChatActions); // WD
var isShowTrailsSame = ShowTrailsCheckBox.Pressed == _cfg.GetCVar(WhiteCVars.ShowTrails); // WD
var isEnableLightsGlowing = EnableLightsGlowingBox.Pressed == _cfg.GetCVar(WhiteCVars.EnableLightsGlowing); // WD
var isWidthSame = (int) ViewportWidthSlider.Value == _cfg.GetCVar(CCVars.ViewportWidth);
ApplyButton.Disabled = isVSyncSame &&
@@ -167,7 +171,8 @@ namespace Content.Client.Options.UI.Tabs
isFpsCounterVisibleSame &&
isWidthSame &&
isLogInChatSame &&
isShowTrailsSame;
isShowTrailsSame &&
isEnableLightsGlowing;
}
private bool ConfigIsFullscreen =>

View File

@@ -0,0 +1,90 @@
using Robust.Client.Graphics;
using Robust.Shared.Enums;
using Robust.Shared.Prototypes;
using System.Numerics;
using Content.Shared._White.Explosion;
namespace Content.Client._White.Explosion;
public sealed class ExplosionShockWaveOverlay : Overlay, IEntityEventSubscriber
{
[Dependency] private readonly IEntityManager _entMan = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
private SharedTransformSystem? _xformSystem;
public override OverlaySpace Space => OverlaySpace.WorldSpace;
public override bool RequestScreenTexture => true;
private readonly ShaderInstance _shader;
/// <summary>
/// Maximum number of distortions that can be shown on screen at a time.
/// </summary>
public const int MaxCount = 30;
public ExplosionShockWaveOverlay()
{
IoCManager.InjectDependencies(this);
_shader = _prototypeManager.Index<ShaderPrototype>("ShockWave").Instance().Duplicate();
}
private readonly Vector2[] _positions = new Vector2[MaxCount];
private readonly float[] _falloffPower = new float[MaxCount];
private readonly float[] _sharpness = new float[MaxCount];
private readonly float[] _width = new float[MaxCount];
private int _count;
protected override bool BeforeDraw(in OverlayDrawArgs args)
{
if (args.Viewport.Eye == null || _xformSystem is null && !_entMan.TrySystem(out _xformSystem))
return false;
var query = _entMan.EntityQueryEnumerator<ExplosionShockWaveComponent, TransformComponent>();
_count = 0;
while (query.MoveNext(out var uid, out var distortion, out var xform))
{
if (xform.MapID != args.MapId)
continue;
var mapPos = _xformSystem.GetWorldPosition(uid);
var tempCoords = args.Viewport.WorldToLocal(mapPos);
// normalized coords, 0 - 1 plane. This is pure hell, we subtract 1 because fragment calculates from the bottom and local goes from the top of the viewport
tempCoords.Y = 1 - (tempCoords.Y / args.Viewport.Size.Y);
tempCoords.X /= args.Viewport.Size.X;
_positions[_count] = tempCoords;
_falloffPower[_count] = distortion.FalloffPower;
_sharpness[_count] = distortion.Sharpness;
_width[_count] = distortion.Width;
_count++;
if (_count == MaxCount)
break;
}
return _count > 0;
}
protected override void Draw(in OverlayDrawArgs args)
{
if (ScreenTexture == null || args.Viewport.Eye == null)
return;
_shader?.SetParameter("renderScale", args.Viewport.RenderScale * args.Viewport.Eye.Scale);
_shader?.SetParameter("count", _count);
_shader?.SetParameter("position", _positions);
_shader?.SetParameter("falloffPower", _falloffPower);
_shader?.SetParameter("sharpness", _sharpness);
_shader?.SetParameter("width", _width);
_shader?.SetParameter("SCREEN_TEXTURE", ScreenTexture);
var worldHandle = args.WorldHandle;
worldHandle.UseShader(_shader);
worldHandle.DrawRect(args.WorldAABB, Color.White);
worldHandle.UseShader(null);
}
}

View File

@@ -0,0 +1,92 @@
using System.Numerics;
using Content.Shared._White;
using Content.Shared._White.Lighting.Shaders;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Shared.Configuration;
using Robust.Shared.Enums;
using Robust.Shared.Prototypes;
using Robust.Shared.Utility;
using DrawDepth = Content.Shared.DrawDepth.DrawDepth;
namespace Content.Client._White.Lighting.Shaders;
public sealed class LightingOverlay : Overlay
{
private readonly IPrototypeManager _prototypeManager;
private readonly EntityManager _entityManager;
private readonly SpriteSystem _spriteSystem;
private readonly TransformSystem _transformSystem;
private readonly IConfigurationManager _cfg;
public override OverlaySpace Space => OverlaySpace.WorldSpaceEntities;
public override bool RequestScreenTexture => true;
private readonly ShaderInstance _shader;
private bool _enableGlowing;
public LightingOverlay(EntityManager entityManager, IPrototypeManager prototypeManager)
{
_entityManager = entityManager;
_spriteSystem = entityManager.EntitySysManager.GetEntitySystem<SpriteSystem>();
_prototypeManager = prototypeManager;
_transformSystem = entityManager.EntitySysManager.GetEntitySystem<TransformSystem>();
_cfg = IoCManager.Resolve<IConfigurationManager>();
_cfg.OnValueChanged(WhiteCVars.EnableLightsGlowing, val => _enableGlowing = val, true);
IoCManager.InjectDependencies(this);
_shader = _prototypeManager.Index<ShaderPrototype>("LightingOverlay").InstanceUnique();
ZIndex = (int) DrawDepth.Overdoors;
}
protected override void Draw(in OverlayDrawArgs args)
{
if (!_enableGlowing)
return;
if (ScreenTexture == null)
return;
var xformCompQuery = _entityManager.GetEntityQuery<TransformComponent>();
var handle = args.WorldHandle;
var bounds = args.WorldAABB.Enlarged(5f);
_shader.SetParameter("SCREEN_TEXTURE", ScreenTexture);
var query = _entityManager.AllEntityQueryEnumerator<LightingOverlayComponent, PointLightComponent, TransformComponent>();
while (query.MoveNext(out _, out var component, out var pointLight, out var xform))
{
if (xform.MapID != args.MapId)
continue;
if (!component.Enabled ?? !pointLight.Enabled)
continue;
var worldPos = _transformSystem.GetWorldPosition(xform, xformCompQuery);
if (!bounds.Contains(worldPos))
continue;
var color = component.Color ?? pointLight.Color;
var (_, _, worldMatrix) = xform.GetWorldPositionRotationMatrix(xformCompQuery);
handle.SetTransform(worldMatrix);
var mask = _spriteSystem.Frame0(component.Sprite); // mask
var xOffset = component.Offsetx - (mask.Width / 2) / EyeManager.PixelsPerMeter;
var yOffset = component.Offsety - (mask.Height / 2) / EyeManager.PixelsPerMeter;
var textureVector = new Vector2(xOffset, yOffset);
handle.DrawTexture(mask, textureVector, color);
handle.UseShader(_shader);
}
handle.UseShader(null);
handle.SetTransform(Matrix3.Identity);
}
}

View File

@@ -0,0 +1,25 @@
using Robust.Client.Graphics;
using Robust.Shared.Prototypes;
namespace Content.Client._White.Lighting.Shaders;
public sealed class LightingOverlaySystem : EntitySystem
{
[Dependency] private readonly IOverlayManager _overlayManager = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
private LightingOverlay _lightingOverlay = default!;
public override void Initialize()
{
base.Initialize();
_lightingOverlay = new LightingOverlay(EntityManager, _prototypeManager);
_overlayManager.AddOverlay(_lightingOverlay);
}
public override void Shutdown()
{
base.Shutdown();
_overlayManager.RemoveOverlay(_lightingOverlay);
}
}

View File

@@ -8,7 +8,7 @@ namespace Content.Client._White.WeaponsModules;
public sealed partial class WeaponModulesVisuals : VisualizerSystem<WeaponModulesComponent>
{
[Dependency] private readonly PointLightSystem _lightSystem = default!;
[Dependency] private readonly PointLightSystem _lightSystem = default!;
protected override void OnAppearanceChange(EntityUid uid, WeaponModulesComponent component, ref AppearanceChangeEvent args)
{
base.OnAppearanceChange(uid, component, ref args);
@@ -16,34 +16,57 @@ public sealed partial class WeaponModulesVisuals : VisualizerSystem<WeaponModule
if(args.Sprite == null)
return;
args.Sprite.LayerSetVisible(ModuleVisualState.HandGuardModule, false);
args.Sprite.LayerSetVisible(ModuleVisualState.BarrelModule, false);
args.Sprite.LayerSetVisible(ModuleVisualState.AimModule, false);
if (AppearanceSystem.TryGetData<string>(uid, ModuleVisualState.HandGuardModule, out var handguardModule, args.Component) && handguardModule.Length != 0 && handguardModule != "none")
if (AppearanceSystem.TryGetData<string>(uid, ModuleVisualState.BarrelModule, out var barrelModule, args.Component))
{
args.Sprite.LayerSetState(ModuleVisualState.HandGuardModule, handguardModule);
args.Sprite.LayerSetVisible(ModuleVisualState.HandGuardModule, true);
if (barrelModule.Length != 0 && barrelModule != "none")
{
args.Sprite.LayerSetState(ModuleVisualState.BarrelModule, barrelModule);
args.Sprite.LayerSetVisible(ModuleVisualState.BarrelModule, true);
}
else
args.Sprite.LayerSetVisible(ModuleVisualState.BarrelModule, false);
}
if (AppearanceSystem.TryGetData<string>(uid, ModuleVisualState.BarrelModule, out var barrelModule, args.Component) && barrelModule.Length != 0 && barrelModule != "none")
if (AppearanceSystem.TryGetData<string>(uid, ModuleVisualState.HandGuardModule, out var handguardModule, args.Component))
{
args.Sprite.LayerSetState(ModuleVisualState.BarrelModule, barrelModule);
args.Sprite.LayerSetVisible(ModuleVisualState.BarrelModule, true);
if (handguardModule.Length != 0 && handguardModule != "none")
{
args.Sprite.LayerSetState(ModuleVisualState.HandGuardModule, handguardModule);
args.Sprite.LayerSetVisible(ModuleVisualState.HandGuardModule, true);
}
else
args.Sprite.LayerSetVisible(ModuleVisualState.HandGuardModule, false);
}
if (AppearanceSystem.TryGetData<string>(uid, ModuleVisualState.AimModule, out var aimModule, args.Component) && aimModule.Length != 0 && aimModule != "none")
if (AppearanceSystem.TryGetData<string>(uid, ModuleVisualState.AimModule, out var aimModule, args.Component))
{
args.Sprite.LayerSetState(ModuleVisualState.AimModule, aimModule);
args.Sprite.LayerSetVisible(ModuleVisualState.AimModule, true);
if (aimModule.Length != 0 && aimModule != "none")
{
args.Sprite.LayerSetState(ModuleVisualState.AimModule, aimModule);
args.Sprite.LayerSetVisible(ModuleVisualState.AimModule, true);
}
else
args.Sprite.LayerSetVisible(ModuleVisualState.AimModule, false);
}
if (AppearanceSystem.TryGetData(uid, Modules.Light, out var data, args.Component))
if (AppearanceSystem.TryGetData<string>(uid, ModuleVisualState.ShutterModule, out var shutterModule, args.Component))
{
if (shutterModule.Length != 0 && shutterModule != "none")
{
args.Sprite.LayerSetState(ModuleVisualState.ShutterModule, shutterModule);
args.Sprite.LayerSetVisible(ModuleVisualState.ShutterModule, true);
}
else
args.Sprite.LayerSetVisible(ModuleVisualState.ShutterModule, false);
}
if (AppearanceSystem.TryGetData(uid, Modules.Light, out _, args.Component))
{
if (TryComp<PointLightComponent>(uid, out var pointLightComponent))
{
if(!pointLightComponent.Enabled)
return;
_lightSystem.SetMask("/Textures/White/Effects/LightMasks/lightModule.png", pointLightComponent!);
}
}