Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upstream update #1

Merged
merged 29 commits into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
24c47c8
Fire Axe resprite 45 degrees v3 (#28866)
AndreyCamper Jul 5, 2024
84ff5e3
nuke biochem (#29751)
laok233 Jul 5, 2024
4c5c6a8
Shuttle map button tweaks (#29757)
metalgearsloth Jul 6, 2024
12edad8
Automatic changelog update
PJBot Jul 6, 2024
7b99d1f
Don't allow toggling internals while asleep (#29753)
themias Jul 6, 2024
7ae3e35
You no longer get deleted when cuffed and buckled (#29718)
Killerqu00 Jul 6, 2024
34f3666
Fixes a minor typo for the base gingerbread body part (#29717)
MFMessage Jul 6, 2024
b418338
Phoronman 1984 (#29747)
Errant-4 Jul 6, 2024
5cd7cf1
Added cryosleep UnitSpawner and UnitSpawnerLate to the map Origin (#2…
JIPDawg Jul 6, 2024
fa6d680
Automatic changelog update
PJBot Jul 6, 2024
60ef784
Fix wielding while pulling (#29781)
themias Jul 7, 2024
0098d71
Update Credits (#29784)
github-actions[bot] Jul 7, 2024
18df27d
Spilling reagents on mutliple entities at once fix (#29763)
beck-thompson Jul 7, 2024
d9be666
Automatic changelog update
PJBot Jul 7, 2024
23887d5
Improve buckling's interactions with standing state (#29741)
Tayrtahn Jul 7, 2024
336f264
Automatic changelog update
PJBot Jul 7, 2024
c9c721b
Add supplybot moving states (#29795)
lzk228 Jul 7, 2024
f50488d
Raise ratking migration minimum players to 30 from 15 (#29737)
Simyon264 Jul 7, 2024
063c5de
Automatic changelog update
PJBot Jul 7, 2024
0e9ed36
Intercom buffs and fixes (#29580)
EmoGarbage404 Jul 7, 2024
71b7ddd
Automatic changelog update
PJBot Jul 7, 2024
13b8487
Bartending+: Shaking and Stirring (#29243)
Vermidia Jul 7, 2024
437f6f4
Slicing food with Swords (#29005)
NotSoDana Jul 7, 2024
70b5613
fix(hardsuits): Give the carp suit and hardsuit a suit storage slot (…
Brandon-Huu Jul 7, 2024
ff93070
Automatic changelog update
PJBot Jul 7, 2024
21d0f85
metal foam grenades (#29428)
EmoGarbage404 Jul 7, 2024
ed7f006
The real AME nerf (#29587)
EmoGarbage404 Jul 7, 2024
04249e8
Removes max damage threshold on healing for hyperzine (#29712)
Plykiya Jul 7, 2024
eab93cb
Automatic changelog update
PJBot Jul 7, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions Content.Client/Radio/EntitySystems/RadioDeviceSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using Content.Client.Radio.Ui;
using Content.Shared.Radio;
using Content.Shared.Radio.Components;
using Robust.Client.GameObjects;

namespace Content.Client.Radio.EntitySystems;

public sealed class RadioDeviceSystem : EntitySystem
{
[Dependency] private readonly UserInterfaceSystem _ui = default!;

/// <inheritdoc/>
public override void Initialize()
{
SubscribeLocalEvent<IntercomComponent, AfterAutoHandleStateEvent>(OnAfterHandleState);
}

private void OnAfterHandleState(Entity<IntercomComponent> ent, ref AfterAutoHandleStateEvent args)
{
if (_ui.TryGetOpenUi<IntercomBoundUserInterface>(ent.Owner, IntercomUiKey.Key, out var bui))
bui.Update(ent);
}
}
15 changes: 6 additions & 9 deletions Content.Client/Radio/Ui/IntercomBoundUserInterface.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Content.Shared.Radio;
using Content.Shared.Radio.Components;
using JetBrains.Annotations;
using Robust.Client.GameObjects;

namespace Content.Client.Radio.Ui;

Expand All @@ -19,7 +19,9 @@ protected override void Open()
{
base.Open();

_menu = new();
var comp = EntMan.GetComponent<IntercomComponent>(Owner);

_menu = new((Owner, comp));

_menu.OnMicPressed += enabled =>
{
Expand All @@ -46,13 +48,8 @@ protected override void Dispose(bool disposing)
_menu?.Close();
}

protected override void UpdateState(BoundUserInterfaceState state)
public void Update(Entity<IntercomComponent> ent)
{
base.UpdateState(state);

if (state is not IntercomBoundUIState msg)
return;

_menu?.Update(msg);
_menu?.Update(ent);
}
}
37 changes: 27 additions & 10 deletions Content.Client/Radio/Ui/IntercomMenu.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
using Content.Client.UserInterface.Controls;
using Content.Shared.Radio;
using Content.Shared.Radio.Components;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Prototypes;
using Robust.Shared.Utility;

namespace Content.Client.Radio.Ui;

Expand All @@ -17,38 +18,54 @@ public sealed partial class IntercomMenu : FancyWindow

private readonly List<string> _channels = new();

public IntercomMenu()
public IntercomMenu(Entity<IntercomComponent> entity)
{
RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this);

MicButton.OnPressed += args => OnMicPressed?.Invoke(args.Button.Pressed);
SpeakerButton.OnPressed += args => OnSpeakerPressed?.Invoke(args.Button.Pressed);

Update(entity);
}

public void Update(IntercomBoundUIState state)
public void Update(Entity<IntercomComponent> entity)
{
MicButton.Pressed = state.MicEnabled;
SpeakerButton.Pressed = state.SpeakerEnabled;
MicButton.Pressed = entity.Comp.MicrophoneEnabled;
SpeakerButton.Pressed = entity.Comp.SpeakerEnabled;

MicButton.Disabled = entity.Comp.SupportedChannels.Count == 0;
SpeakerButton.Disabled = entity.Comp.SupportedChannels.Count == 0;
ChannelOptions.Disabled = entity.Comp.SupportedChannels.Count == 0;

ChannelOptions.Clear();
_channels.Clear();
for (var i = 0; i < state.AvailableChannels.Count; i++)
for (var i = 0; i < entity.Comp.SupportedChannels.Count; i++)
{
var channel = state.AvailableChannels[i];
if (!_prototype.TryIndex<RadioChannelPrototype>(channel, out var prototype))
var channel = entity.Comp.SupportedChannels[i];
if (!_prototype.TryIndex(channel, out var prototype))
continue;

_channels.Add(channel);
ChannelOptions.AddItem(Loc.GetString(prototype.Name), i);

if (channel == state.SelectedChannel)
if (channel == entity.Comp.CurrentChannel)
ChannelOptions.Select(i);
}

if (entity.Comp.SupportedChannels.Count == 0)
{
ChannelOptions.AddItem(Loc.GetString("intercom-options-none"), 0);
ChannelOptions.Select(0);
}

ChannelOptions.OnItemSelected += args =>
{
if (!_channels.TryGetValue(args.Id, out var proto))
return;

ChannelOptions.SelectId(args.Id);
OnChannelSelected?.Invoke(_channels[args.Id]);
OnChannelSelected?.Invoke(proto);
};
}
}
Expand Down
17 changes: 11 additions & 6 deletions Content.Client/Shuttles/UI/MapScreen.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ private void RebuildMapObjects()
ourMap = shuttleXform.MapID;
}

while (mapComps.MoveNext(out var mapComp, out var mapXform, out var mapMetadata))
while (mapComps.MoveNext(out var mapUid, out var mapComp, out var mapXform, out var mapMetadata))
{
if (_console != null && !_shuttles.CanFTLTo(_shuttleEntity.Value, mapComp.MapId, _console.Value))
{
Expand Down Expand Up @@ -327,20 +327,28 @@ private void RebuildMapObjects()
{
AddMapObject(mapComp.MapId, gridObj);
}
else if (!_shuttles.IsBeaconMap(_mapManager.GetMapEntityId(mapComp.MapId)) && (iffComp == null ||
(iffComp.Flags & IFFFlags.Hide) == 0x0))
// If we can show it then add it to pending.
else if (!_shuttles.IsBeaconMap(mapUid) && (iffComp == null ||
(iffComp.Flags & IFFFlags.Hide) == 0x0) &&
!gridObj.HideButton)
{
_pendingMapObjects.Add((mapComp.MapId, gridObj));
}
}

foreach (var (beacon, _) in _shuttles.GetExclusions(mapComp.MapId, _exclusions))
{
if (beacon.HideButton)
continue;

_pendingMapObjects.Add((mapComp.MapId, beacon));
}

foreach (var (beacon, _) in _shuttles.GetBeacons(mapComp.MapId, _beacons))
{
if (beacon.HideButton)
continue;

_pendingMapObjects.Add((mapComp.MapId, beacon));
}

Expand Down Expand Up @@ -425,9 +433,6 @@ private void AddMapObject(MapId mapId, IMapObject mapObj)
var existing = _mapObjects.GetOrNew(mapId);
existing.Add(mapObj);

if (mapObj.HideButton)
return;

var gridContents = _mapHeadings[mapId];

var gridButton = new Button()
Expand Down
27 changes: 9 additions & 18 deletions Content.Server/Ame/AmeNodeGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,22 +134,11 @@ public float InjectFuel(int fuel, out bool overloading)
// The AME is being overloaded.
// Note about these maths: I would assume the general idea here is to make larger engines less safe to overload.
// In other words, yes, those are supposed to be CoreCount, not safeFuelLimit.
var instability = 0;
var overloadVsSizeResult = fuel - CoreCount;

// fuel > safeFuelLimit: Slow damage. Can safely run at this level for burst periods if the engine is small and someone is keeping an eye on it.
if (_random.Prob(0.5f))
instability = 1;
// overloadVsSizeResult > 5:
if (overloadVsSizeResult > 5)
instability = 3;
// overloadVsSizeResult > 10: This will explode in at most 20 injections.
if (overloadVsSizeResult > 10)
instability = 5;

// Apply calculated instability
if (instability == 0)
return powerOutput;
var instability = overloadVsSizeResult / CoreCount;
var fuzz = _random.Next(-1, 2); // -1 to 1
instability += fuzz; // fuzz the values a tiny bit.

overloading = true;
var integrityCheck = 100;
Expand Down Expand Up @@ -179,10 +168,12 @@ public float InjectFuel(int fuel, out bool overloading)
/// </summary>
public float CalculatePower(int fuel, int cores)
{
// Fuel is squared so more fuel vastly increases power and efficiency
// We divide by the number of cores so a larger AME is less efficient at the same fuel settings
// this results in all AMEs having the same efficiency at the same fuel-per-core setting
return 20000f * fuel * fuel / cores;
// Balanced around a single core AME with injection level 2 producing 120KW.
// Overclocking yields diminishing returns until it evens out at around 360KW.

// The adjustment for cores make it so that a 1 core AME at 2 injections is better than a 2 core AME at 2 injections.
// However, for the relative amounts for each (1 core at 2 and 2 core at 4), more cores has more output.
return 200000f * MathF.Log10(fuel * fuel) * MathF.Pow(0.75f, cores - 1);
}

public int GetTotalStability()
Expand Down
20 changes: 15 additions & 5 deletions Content.Server/Ame/EntitySystems/AmeControllerSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -274,9 +274,9 @@ public void SetInjectionAmount(EntityUid uid, int value, EntityUid? user = null,
At the time of editing, players regularly "overclock" the AME and those cases require no admin attention.

// Admin alert
var safeLimit = 0;
var safeLimit = int.MaxValue;
if (TryGetAMENodeGroup(uid, out var group))
safeLimit = group.CoreCount * 2;
safeLimit = group.CoreCount * 4;

if (oldValue <= safeLimit && value > safeLimit)
{
Expand All @@ -291,10 +291,20 @@ public void SetInjectionAmount(EntityUid uid, int value, EntityUid? user = null,
*/
}

public void AdjustInjectionAmount(EntityUid uid, int delta, int min = 0, int max = int.MaxValue, EntityUid? user = null, AmeControllerComponent? controller = null)
public void AdjustInjectionAmount(EntityUid uid, int delta, EntityUid? user = null, AmeControllerComponent? controller = null)
{
if (Resolve(uid, ref controller))
SetInjectionAmount(uid, MathHelper.Clamp(controller.InjectionAmount + delta, min, max), user, controller);
if (!Resolve(uid, ref controller))
return;

var max = GetMaxInjectionAmount((uid, controller));
SetInjectionAmount(uid, MathHelper.Clamp(controller.InjectionAmount + delta, 0, max), user, controller);
}

public int GetMaxInjectionAmount(Entity<AmeControllerComponent> ent)
{
if (!TryGetAMENodeGroup(ent, out var group))
return 0;
return group.CoreCount * 8;
}

private void UpdateDisplay(EntityUid uid, int stability, AmeControllerComponent? controller = null, AppearanceComponent? appearance = null)
Expand Down
2 changes: 1 addition & 1 deletion Content.Server/Body/Systems/InternalsSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public void ToggleInternals(
// Toggle off if they're on
if (AreInternalsWorking(internals))
{
if (force || user == uid)
if (force)
{
DisconnectTank(internals);
return;
Expand Down
57 changes: 47 additions & 10 deletions Content.Server/Chemistry/EntitySystems/ReactionMixerSystem.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
using Content.Shared.Chemistry.Components;
using Content.Shared.Chemistry.Reaction;
using Content.Shared.DoAfter;
using Content.Shared.IdentityManagement;
using Content.Shared.Interaction;
using Content.Shared.Nutrition.EntitySystems;
using Content.Server.Chemistry.Containers.EntitySystems;
using Content.Server.Popups;

Expand All @@ -10,34 +13,68 @@ public sealed partial class ReactionMixerSystem : EntitySystem
{
[Dependency] private readonly PopupSystem _popup = default!;
[Dependency] private readonly SolutionContainerSystem _solutionContainers = default!;
[Dependency] private readonly SharedDoAfterSystem _doAfterSystem = default!;

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

SubscribeLocalEvent<ReactionMixerComponent, AfterInteractEvent>(OnAfterInteract);
SubscribeLocalEvent<ReactionMixerComponent, ShakeEvent>(OnShake);
SubscribeLocalEvent<ReactionMixerComponent, ReactionMixDoAfterEvent>(OnDoAfter);
}

private void OnAfterInteract(Entity<ReactionMixerComponent> entity, ref AfterInteractEvent args)
{
if (!args.Target.HasValue || !args.CanReach)
if (!args.Target.HasValue || !args.CanReach || !entity.Comp.MixOnInteract)
return;

var mixAttemptEvent = new MixingAttemptEvent(entity);
RaiseLocalEvent(entity, ref mixAttemptEvent);
if (mixAttemptEvent.Cancelled)
{
if (!MixAttempt(entity, args.Target.Value, out var solution))
return;
}

if (!_solutionContainers.TryGetMixableSolution(args.Target.Value, out var solution, out _))
var doAfterArgs = new DoAfterArgs(EntityManager, args.User, entity.Comp.TimeToMix, new ReactionMixDoAfterEvent(), entity, args.Target.Value, entity);

_doAfterSystem.TryStartDoAfter(doAfterArgs);
}

private void OnDoAfter(Entity<ReactionMixerComponent> entity, ref ReactionMixDoAfterEvent args)
{
//Do again to get the solution again
if (!MixAttempt(entity, args.Target!.Value, out var solution))
return;

_popup.PopupEntity(Loc.GetString(entity.Comp.MixMessage, ("mixed", Identity.Entity(args.Target.Value, EntityManager)), ("mixer", Identity.Entity(entity.Owner, EntityManager))), args.User, args.User);
_popup.PopupEntity(Loc.GetString(entity.Comp.MixMessage, ("mixed", Identity.Entity(args.Target!.Value, EntityManager)), ("mixer", Identity.Entity(entity.Owner, EntityManager))), args.User, args.User);

_solutionContainers.UpdateChemicals(solution!.Value, true, entity.Comp);

var afterMixingEvent = new AfterMixingEvent(entity, args.Target!.Value);
RaiseLocalEvent(entity, afterMixingEvent);
}

private void OnShake(Entity<ReactionMixerComponent> entity, ref ShakeEvent args)
{
if (!MixAttempt(entity, entity, out var solution))
return;

_solutionContainers.UpdateChemicals(solution.Value, true, entity.Comp);
_solutionContainers.UpdateChemicals(solution!.Value, true, entity.Comp);

var afterMixingEvent = new AfterMixingEvent(entity, args.Target.Value);
var afterMixingEvent = new AfterMixingEvent(entity, entity);
RaiseLocalEvent(entity, afterMixingEvent);
}

private bool MixAttempt(EntityUid ent, EntityUid target, out Entity<SolutionComponent>? solution)
{
solution = null;
var mixAttemptEvent = new MixingAttemptEvent(ent);
RaiseLocalEvent(ent, ref mixAttemptEvent);
if (mixAttemptEvent.Cancelled)
{
return false;
}

if (!_solutionContainers.TryGetMixableSolution(target, out solution, out _))
return false;

return true;
}
}
10 changes: 7 additions & 3 deletions Content.Server/EntityEffects/Effects/AreaReactionEffect.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Content.Server.Fluids.EntitySystems;
using Content.Server.Spreader;
using Content.Shared.Audio;
using Content.Shared.Coordinates.Helpers;
using Content.Shared.Database;
Expand Down Expand Up @@ -64,16 +65,19 @@ public override void Effect(EntityEffectBaseArgs args)
var transform = reagentArgs.EntityManager.GetComponent<TransformComponent>(reagentArgs.TargetEntity);
var mapManager = IoCManager.Resolve<IMapManager>();
var mapSys = reagentArgs.EntityManager.System<MapSystem>();
var sys = reagentArgs.EntityManager.System<TransformSystem>();
var spreaderSys = args.EntityManager.System<SpreaderSystem>();
var sys = args.EntityManager.System<TransformSystem>();
var mapCoords = sys.GetMapCoordinates(reagentArgs.TargetEntity, xform: transform);

if (!mapManager.TryFindGridAt(mapCoords, out var gridUid, out var grid) ||
!mapSys.TryGetTileRef(gridUid, grid, transform.Coordinates, out var tileRef) ||
tileRef.Tile.IsSpace())
!mapSys.TryGetTileRef(gridUid, grid, transform.Coordinates, out var tileRef))
{
return;
}

if (spreaderSys.RequiresFloorToSpread(_prototypeId) && tileRef.Tile.IsSpace())
return;

var coords = mapSys.MapToGrid(gridUid, mapCoords);
var ent = reagentArgs.EntityManager.SpawnEntity(_prototypeId, coords.SnapToGrid());

Expand Down
Loading
Loading