Skip to content

Commit

Permalink
Merge pull request #85 from angelofallars/upstream-merge-02-12-25
Browse files Browse the repository at this point in the history
Upstream Merge 02-12-25
  • Loading branch information
Aidenkrz authored Feb 14, 2025
2 parents 9eb604d + f3ac53b commit 0fe2ed5
Show file tree
Hide file tree
Showing 211 changed files with 500,197 additions and 42,515 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Input;
using Robust.Shared.Prototypes;
using Robust.Shared.Timing;
using System.Numerics;
Expand Down Expand Up @@ -43,7 +44,11 @@ public ShopVendorWindow()
VendingContents.SearchBar = SearchBar;
VendingContents.DataFilterCondition += DataFilterCondition;
VendingContents.GenerateItem += GenerateButton;
VendingContents.ItemKeyBindDown += (args, data) => OnItemSelected?.Invoke(((ShopVendorListingData) data).Index);
VendingContents.ItemKeyBindDown += (args, data) =>
{
if (args.Function == EngineKeyFunctions.UIClick)
OnItemSelected?.Invoke(((ShopVendorListingData) data).Index);
};
}

public void SetEntity(EntityUid owner)
Expand Down
23 changes: 7 additions & 16 deletions Content.Client/Effects/ColorFlashEffectSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,7 @@ private void OnColorFlashEffect(ColorFlashEffectEvent ev)
continue;
}

if (!TryComp(ent, out AnimationPlayerComponent? player))
{
player = (AnimationPlayerComponent) _factory.GetComponent(typeof(AnimationPlayerComponent));
player.Owner = ent;
player.NetSyncEnabled = false;
AddComp(ent, player);
}
var player = EnsureComp<AnimationPlayerComponent>(ent);

// Need to stop the existing animation first to ensure the sprite color is fixed.
// Otherwise we might lerp to a red colour instead.
Expand All @@ -107,23 +101,20 @@ private void OnColorFlashEffect(ColorFlashEffectEvent ev)
continue;
}

if (TryComp<ColorFlashEffectComponent>(ent, out var effect))
// having to check lifestage because trycomp is special needs and may return a component which was shut down via RemCompDeferred.
// EnsureComp isn't, but we want to get the Color value stored in the component, and EnsureComp would overwrite it with the default value.
if (TryComp<ColorFlashEffectComponent>(ent, out var effect) && effect.LifeStage <= ComponentLifeStage.Running)
{
sprite.Color = effect.Color;
}


var animation = GetDamageAnimation(ent, color, sprite, ev.AnimationLength);

if (animation == null)
if (animation == null)
continue;

if (!TryComp(ent, out ColorFlashEffectComponent? comp))
{
comp = (ColorFlashEffectComponent) _factory.GetComponent(typeof(ColorFlashEffectComponent));
comp.Owner = ent;
comp.NetSyncEnabled = false;
AddComp(ent, comp);
}
var comp = EnsureComp<ColorFlashEffectComponent>(ent);

comp.Color = sprite.Color;
_animation.Play((ent, player), animation, AnimationKey);
Expand Down
1 change: 1 addition & 0 deletions Content.Client/Options/UI/Tabs/GraphicsTab.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
<CheckBox Name="ViewportLowResCheckBox" Text="{Loc 'ui-options-vp-low-res'}" />
<CheckBox Name="ParallaxLowQualityCheckBox" Text="{Loc 'ui-options-parallax-low-quality'}" />
<CheckBox Name="FpsCounterCheckBox" Text="{Loc 'ui-options-fps-counter'}" />
<CheckBox Name="MoodVisualEffectsCheckBox" Text="{Loc 'ui-options-mood-visual-effects'}" />
</BoxContainer>
<controls:StripeBack HasBottomEdge="False" HasMargins="False">
<Button Name="ApplyButton"
Expand Down
3 changes: 3 additions & 0 deletions Content.Client/Options/UI/Tabs/GraphicsTab.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ public GraphicsTab()
ViewportLowResCheckBox.OnToggled += OnCheckBoxToggled;
ParallaxLowQualityCheckBox.OnToggled += OnCheckBoxToggled;
FpsCounterCheckBox.OnToggled += OnCheckBoxToggled;
MoodVisualEffectsCheckBox.OnToggled += OnCheckBoxToggled;
ApplyButton.OnPressed += OnApplyButtonPressed;
VSyncCheckBox.Pressed = _cfg.GetCVar(CVars.DisplayVSync);
FullscreenCheckBox.Pressed = ConfigIsFullscreen;
Expand All @@ -89,6 +90,7 @@ public GraphicsTab()
ViewportLowResCheckBox.Pressed = !_cfg.GetCVar(CCVars.ViewportScaleRender);
ParallaxLowQualityCheckBox.Pressed = _cfg.GetCVar(CCVars.ParallaxLowQuality);
FpsCounterCheckBox.Pressed = _cfg.GetCVar(CCVars.HudFpsCounterVisible);
MoodVisualEffectsCheckBox.Pressed = _cfg.GetCVar(CCVars.MoodVisualEffects);
ViewportWidthSlider.Value = _cfg.GetCVar(CCVars.ViewportWidth);

_cfg.OnValueChanged(CCVars.ViewportMinimumWidth, _ => UpdateViewportWidthRange());
Expand Down Expand Up @@ -122,6 +124,7 @@ private void OnApplyButtonPressed(BaseButton.ButtonEventArgs args)
_cfg.SetCVar(CCVars.ViewportScaleRender, !ViewportLowResCheckBox.Pressed);
_cfg.SetCVar(CCVars.ParallaxLowQuality, ParallaxLowQualityCheckBox.Pressed);
_cfg.SetCVar(CCVars.HudFpsCounterVisible, FpsCounterCheckBox.Pressed);
_cfg.SetCVar(CCVars.MoodVisualEffects, MoodVisualEffectsCheckBox.Pressed);
_cfg.SetCVar(CCVars.ViewportWidth, (int) ViewportWidthSlider.Value);

_cfg.SaveToFile();
Expand Down
29 changes: 25 additions & 4 deletions Content.Client/Overlays/SaturationScaleSystem.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
using Content.Shared.GameTicking;
using Content.Shared.CCVar;
using Content.Shared.GameTicking;
using Content.Shared.Mood;
using Content.Shared.Overlays;
using Robust.Client.Graphics;
using Robust.Shared.Configuration;
using Robust.Shared.Player;

namespace Content.Client.Overlays;
Expand All @@ -10,15 +12,18 @@ public sealed class SaturationScaleSystem : EntitySystem
{
[Dependency] private readonly IOverlayManager _overlayMan = default!;
[Dependency] private readonly ISharedPlayerManager _playerMan = default!;
[Dependency] private readonly IConfigurationManager _cfgMan = default!;

private SaturationScaleOverlay _overlay = default!;

private bool _moodEffectsEnabled;

public override void Initialize()
{
base.Initialize();

_overlay = new();
_moodEffectsEnabled = _cfgMan.GetCVar(CCVars.MoodVisualEffects);
_cfgMan.OnValueChanged(CCVars.MoodVisualEffects, HandleMoodEffectsUpdated);

SubscribeLocalEvent<SaturationScaleOverlayComponent, ComponentInit>(OnInit);
SubscribeLocalEvent<SaturationScaleOverlayComponent, ComponentShutdown>(OnShutdown);
Expand All @@ -29,33 +34,49 @@ public override void Initialize()
SubscribeNetworkEvent<RoundRestartCleanupEvent>(RoundRestartCleanup);
}

private void HandleMoodEffectsUpdated(bool moodEffectsEnabled)
{
if (_overlayMan.HasOverlay<SaturationScaleOverlay>() && !moodEffectsEnabled)
_overlayMan.RemoveOverlay(_overlay);

_moodEffectsEnabled = moodEffectsEnabled;
}

private void RoundRestartCleanup(RoundRestartCleanupEvent ev)
{
if (!_moodEffectsEnabled)
return;

_overlayMan.RemoveOverlay(_overlay);
}

private void OnPlayerDetached(EntityUid uid, SaturationScaleOverlayComponent component, PlayerDetachedEvent args)
{
if (!_moodEffectsEnabled)
return;

_overlayMan.RemoveOverlay(_overlay);
}

private void OnPlayerAttached(EntityUid uid, SaturationScaleOverlayComponent component, PlayerAttachedEvent args)
{
if (!_moodEffectsEnabled)
return;

_overlayMan.AddOverlay(_overlay);
}

private void OnShutdown(EntityUid uid, SaturationScaleOverlayComponent component, ComponentShutdown args)
{
if (uid != _playerMan.LocalEntity)
if (uid != _playerMan.LocalEntity || !_moodEffectsEnabled)
return;

_overlayMan.RemoveOverlay(_overlay);
}

private void OnInit(EntityUid uid, SaturationScaleOverlayComponent component, ComponentInit args)
{
if (uid != _playerMan.LocalEntity)
if (uid != _playerMan.LocalEntity || !_moodEffectsEnabled)
return;

_overlayMan.AddOverlay(_overlay);
Expand Down
9 changes: 7 additions & 2 deletions Content.Client/Traits/SingerSystem.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
using Content.Client.Instruments;
using Content.Shared.Instruments;
using Content.Shared.Traits.Assorted.Prototypes;
using Content.Shared.Traits.Assorted.Systems;

namespace Content.Client.Traits;

public sealed class SingerSystem : SharedSingerSystem
{
protected override SharedInstrumentComponent EnsureInstrumentComp(EntityUid uid)
protected override SharedInstrumentComponent EnsureInstrumentComp(EntityUid uid, SingerInstrumentPrototype singer)
{
return EnsureComp<InstrumentComponent>(uid); // I hate this, but it's the only way.
var instrumentComp = EnsureComp<InstrumentComponent>(uid);
instrumentComp.AllowPercussion = singer.AllowPercussion;
instrumentComp.AllowProgramChange = singer.AllowProgramChange;

return instrumentComp;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public SeparatedChatGameScreen()
SetAnchorAndMarginPreset(TopLeftContainer, LayoutPreset.TopLeft, margin: 10);
SetAnchorAndMarginPreset(Ghost, LayoutPreset.BottomWide, margin: 80);
SetAnchorAndMarginPreset(Hotbar, LayoutPreset.BottomWide, margin: 5);
SetAnchorAndMarginPreset(Alerts, LayoutPreset.CenterRight, margin: 10);
SetAnchorAndMarginPreset(Alerts, LayoutPreset.TopRight, margin: 10);
SetAnchorAndMarginPreset(Targeting, LayoutPreset.BottomRight, margin: 5);

ScreenContainer.OnSplitResizeFinished += () =>
Expand Down
6 changes: 3 additions & 3 deletions Content.Client/_Shitmed/Autodoc/PickSurgeryWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ private void UpdateSurgeries()
var protoId = new EntProtoId<SurgeryComponent>(id);
if (_part is not BodyPartType part)
{
Surgeries.AddItem(name, metadata: id);
Surgeries.AddItem(name, metadata: protoId);
continue;
}

Expand All @@ -124,7 +124,7 @@ private void UpdateSurgeries()

if (!_entMan.TryGetComponent<SurgeryPartConditionComponent>(ent.Value, out var comp))
{
Surgeries.AddItem(name, metadata: id);
Surgeries.AddItem(name, metadata: protoId);
continue;
}

Expand All @@ -134,7 +134,7 @@ private void UpdateSurgeries()
var passesFilter = (partOk && symmetryOk) ^ comp.Inverse;

if (passesFilter)
Surgeries.AddItem(name, metadata: id);
Surgeries.AddItem(name, metadata: protoId);
}
Surgeries.SortItemsByText();
}
Expand Down
39 changes: 21 additions & 18 deletions Content.IntegrationTests/Tests/PostMapInitTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,24 +52,27 @@ public sealed class PostMapInitTest
"CentCommHarmony",
"MeteorArena",
"NukieOutpost",
"Core",
"Pebble", //DeltaV
"Edge", //DeltaV
"Saltern",
"Shoukou", //DeltaV
"Tortuga", //DeltaV
"Arena", //DeltaV
"Asterisk", //DeltaV
"Glacier", //DeltaV
"TheHive", //DeltaV
"Hammurabi", //DeltaV
"Lighthouse", //DeltaV
"Submarine", //DeltaV
"Gax",
"Rad",
"Europa",
"Meta",
"Box"
"Core", // No current maintainer. In need of a rework...
// "Pebble", // De-rotated, no current maintainer.
// "Edge", // De-rotated, no current maintainer.
"Saltern", // Maintained by the Sin Mapping Team, ODJ, and TCJ.
"Shoukou", // Maintained by Violet
// "Tortuga", // De-rotated, no current maintainer.
// "Arena", // De-rotated, no current maintainer.
// "Asterisk", // De-rotated, no current maintainer.
"Glacier", // Maintained by Violet
// "TheHive", // De-rotated, no current maintainer.
// "Hammurabi", // De-rotated, no current maintainer.
"Lighthouse", // Maintained by Violet
// "Submarine", // De-rotated, no current maintainer.
"Gax", // Maintained by Estacao Pirata
"Rad", // Maintained by Estacao Pirata
// "Europa", // De-rotated, has significant issues.
"Meta", // Maintained by Estacao Pirata
"Box", // Maintained by Estacao Pirata
"Lambda", // Maintained by Estacao Pirata
"Bagel", // Maintained by Estacao Pirata
"Northway" // Maintained by Violet
};

/// <summary>
Expand Down
16 changes: 15 additions & 1 deletion Content.Server/Anomaly/AnomalySystem.Vessel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
using Content.Shared.Interaction;
using Content.Shared.Research.Components;
using Content.Server.Psionics.Glimmer;
using Content.Shared.Radiation.Components;


namespace Content.Server.Anomaly;

Expand All @@ -21,6 +23,7 @@ private void InitializeVessel()
{
SubscribeLocalEvent<AnomalyVesselComponent, ComponentShutdown>(OnVesselShutdown);
SubscribeLocalEvent<AnomalyVesselComponent, MapInitEvent>(OnVesselMapInit);
SubscribeLocalEvent<AnomalyVesselComponent, RefreshPartsEvent>(OnRefreshParts);
SubscribeLocalEvent<AnomalyVesselComponent, UpgradeExamineEvent>(OnUpgradeExamine);
SubscribeLocalEvent<AnomalyVesselComponent, InteractUsingEvent>(OnVesselInteractUsing);
SubscribeLocalEvent<AnomalyVesselComponent, ExaminedEvent>(OnExamined);
Expand Down Expand Up @@ -67,9 +70,20 @@ private void OnVesselMapInit(EntityUid uid, AnomalyVesselComponent component, Ma
UpdateVesselAppearance(uid, component);
}

private void OnRefreshParts(EntityUid uid, AnomalyVesselComponent component, RefreshPartsEvent args)
{
var pointRating = args.PartRatings[component.MachinePartPointMultiplier];
var radRating = args.PartRatings[component.MachinePartPointMultiplier];

component.PointMultiplier = component.BasePointMultiplier * (component.UpgradePointMultiplier * pointRating);

if (TryComp<RadiationSourceComponent>(uid, out var radiation))
radiation.Intensity = component.BaseRadiation * radRating;
}

private void OnUpgradeExamine(EntityUid uid, AnomalyVesselComponent component, UpgradeExamineEvent args)
{
args.AddPercentageUpgrade("anomaly-vessel-component-upgrade-output", component.PointMultiplier);
args.AddPercentageUpgrade("anomaly-vessel-component-upgrade-output", component.PointMultiplier / component.BasePointMultiplier);
}

private void OnVesselInteractUsing(EntityUid uid, AnomalyVesselComponent component, InteractUsingEvent args)
Expand Down
36 changes: 36 additions & 0 deletions Content.Server/Anomaly/Components/AnomalyVesselComponent.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
using Content.Shared.Anomaly;
using Content.Shared.Construction.Prototypes;
using Robust.Shared.Audio;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;


namespace Content.Server.Anomaly.Components;

Expand All @@ -20,12 +23,45 @@ public sealed partial class AnomalyVesselComponent : Component
[ViewVariables]
public EntityUid? Anomaly;

/// <summary>
/// The base multiplier without any frills
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite)]
public float BasePointMultiplier = 1;

/// <summary>
/// The base radiation for only the experimental vessel
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite)]
public float BaseRadiation = .75f;

/// <summary>
/// A multiplier applied to the amount of points generated.
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite)]
public float PointMultiplier = 1;

/// <summary>
/// A multiplier applied to the amount of points generated based on the machine parts inserted.
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite)]
public float UpgradePointMultiplier = .5f;

/// <summary>
/// A multipler applied to the radiation
/// </summary>
/// <remarks>
/// no free ultra point machine 100% legit
/// </remarks>
[DataField, ViewVariables(VVAccess.ReadWrite)]
public float UpgradeRadiationMultiplier = .35f;

/// <summary>
/// Which machine part affects the point multiplier
/// </summary>
[DataField(customTypeSerializer: typeof(PrototypeIdSerializer<MachinePartPrototype>))]
public string MachinePartPointMultiplier = "Capacitor";

/// <summary>
/// The maximum time between each beep
/// </summary>
Expand Down
12 changes: 12 additions & 0 deletions Content.Server/Shuttles/Components/ShuttleComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,17 @@ public sealed partial class ShuttleComponent : Component

[DataField("angularDamping"), ViewVariables(VVAccess.ReadWrite)]
public float AngularDamping = 0.05f;

/// <summary>
/// How far from the shuttle's bounding box will it crush and destroy things?
/// </summary>
[DataField]
public float SmimshDistance = 0.2f;

/// <summary>
/// Whether or not the shuttle calls the DoTheDinosaur function upon FTL'ing. I'm not explaining this, you owe it to yourself to do a code search for it.
/// </summary>
[DataField]
public bool DoTheDinosaur = true;
}
}
Loading

0 comments on commit 0fe2ed5

Please sign in to comment.