Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/wizards/master'
Browse files Browse the repository at this point in the history
# Conflicts:
#	Resources/Prototypes/lobbyscreens.yml
#	Resources/Textures/LobbyScreens/attributions.yml
#	Resources/Textures/LobbyScreens/blueprint.webp.yml
#	Resources/Textures/LobbyScreens/justaweekaway.webp.yml
  • Loading branch information
VigersRay committed Jun 25, 2024
2 parents 7d60996 + 231e180 commit a8876c7
Show file tree
Hide file tree
Showing 15 changed files with 1,651 additions and 1,810 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,20 +52,12 @@ public AlertControl(AlertPrototype alert, short? severity)
TooltipSupplier = SupplyTooltip;
Alert = alert;
_severity = severity;

_spriteViewEntity = _entityManager.Spawn(Alert.AlertViewEntity);
if (_entityManager.TryGetComponent<SpriteComponent>(_spriteViewEntity, out var sprite))
{
var icon = Alert.GetIcon(_severity);
if (sprite.LayerMapTryGet(AlertVisualLayers.Base, out var layer))
sprite.LayerSetSprite(layer, icon);
}

_icon = new SpriteView
{
Scale = new Vector2(2, 2)
};
_icon.SetEntity(_spriteViewEntity);

SetupIcon();

Children.Add(_icon);
_cooldownGraphic = new CooldownGraphic
Expand Down Expand Up @@ -113,6 +105,36 @@ protected override void FrameUpdate(FrameEventArgs args)
_cooldownGraphic.FromTime(Cooldown.Value.Start, Cooldown.Value.End);
}

private void SetupIcon()
{
if (!_entityManager.Deleted(_spriteViewEntity))
_entityManager.QueueDeleteEntity(_spriteViewEntity);

_spriteViewEntity = _entityManager.Spawn(Alert.AlertViewEntity);
if (_entityManager.TryGetComponent<SpriteComponent>(_spriteViewEntity, out var sprite))
{
var icon = Alert.GetIcon(_severity);
if (sprite.LayerMapTryGet(AlertVisualLayers.Base, out var layer))
sprite.LayerSetSprite(layer, icon);
}

_icon.SetEntity(_spriteViewEntity);
}

protected override void EnteredTree()
{
base.EnteredTree();
SetupIcon();
}

protected override void ExitedTree()
{
base.ExitedTree();

if (!_entityManager.Deleted(_spriteViewEntity))
_entityManager.QueueDeleteEntity(_spriteViewEntity);
}

protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
Expand Down
89 changes: 89 additions & 0 deletions Content.IntegrationTests/Tests/Internals/AutoInternalsTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
using Content.Server.Atmos.EntitySystems;
using Content.Server.Body.Systems;
using Content.Server.Station.Systems;
using Content.Shared.Preferences;
using Content.Shared.Roles.Jobs;

namespace Content.IntegrationTests.Tests.Internals;

[TestFixture]
[TestOf(typeof(InternalsSystem))]
public sealed class AutoInternalsTests
{
[Test]
public async Task TestInternalsAutoActivateInSpaceForStationSpawn()
{
await using var pair = await PoolManager.GetServerClient();
var server = pair.Server;

var testMap = await pair.CreateTestMap();

var stationSpawning = server.System<StationSpawningSystem>();
var atmos = server.System<AtmosphereSystem>();
var internals = server.System<InternalsSystem>();

await server.WaitAssertion(() =>
{
var profile = new HumanoidCharacterProfile();
var dummy = stationSpawning.SpawnPlayerMob(testMap.GridCoords, new JobComponent()
{
Prototype = "TestInternalsDummy"
}, profile, station: null);

Assert.That(atmos.HasAtmosphere(testMap.Grid), Is.False, "Test map has atmosphere - test needs adjustment!");
Assert.That(internals.AreInternalsWorking(dummy), "Internals did not automatically connect!");

server.EntMan.DeleteEntity(dummy);
});

await pair.CleanReturnAsync();
}

[Test]
public async Task TestInternalsAutoActivateInSpaceForEntitySpawn()
{
await using var pair = await PoolManager.GetServerClient();
var server = pair.Server;

var testMap = await pair.CreateTestMap();

var atmos = server.System<AtmosphereSystem>();
var internals = server.System<InternalsSystem>();

await server.WaitAssertion(() =>
{
var dummy = server.EntMan.Spawn("TestInternalsDummyEntity", testMap.MapCoords);

Assert.That(atmos.HasAtmosphere(testMap.Grid), Is.False, "Test map has atmosphere - test needs adjustment!");
Assert.That(internals.AreInternalsWorking(dummy), "Internals did not automatically connect!");

server.EntMan.DeleteEntity(dummy);
});

await pair.CleanReturnAsync();
}

[TestPrototypes]
private const string Prototypes = @"
- type: playTimeTracker
id: PlayTimeInternalsDummy
- type: startingGear
id: InternalsDummyGear
equipment:
mask: ClothingMaskBreath
suitstorage: OxygenTankFilled
- type: job
id: TestInternalsDummy
playTimeTracker: PlayTimeInternalsDummy
startingGear: InternalsDummyGear
- type: entity
id: TestInternalsDummyEntity
parent: MobHuman
components:
- type: Loadout
prototypes: [InternalsDummyGear]
";
}
7 changes: 1 addition & 6 deletions Content.Server/Power/Generation/Teg/TegSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -181,12 +181,7 @@ private void GeneratorUpdate(EntityUid uid, TegGeneratorComponent component, ref
// Turn energy (at atmos tick rate) into wattage.
var power = electricalEnergy / args.dt;
// Add ramp factor. This magics slight power into existence, but allows us to ramp up.
power *= component.RampFactor;

// Simulate TEG powering itself after being started up. This means that if LV is lost this keeps running.
const float load = 1000;
supplier.MaxSupply = Math.Max(power - load, 0);
powerReceiver.Load = Math.Max(load - power, 0);
supplier.MaxSupply = power * component.RampFactor;

var circAComp = Comp<TegCirculatorComponent>(circA);
var circBComp = Comp<TegCirculatorComponent>(circB);
Expand Down
4 changes: 3 additions & 1 deletion Content.Shared/Clothing/LoadoutSystem.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Linq;
using Content.Shared.Body.Systems;
using Content.Shared.Clothing.Components;
using Content.Shared.Humanoid;
using Content.Shared.Preferences;
Expand Down Expand Up @@ -27,7 +28,8 @@ public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<LoadoutComponent, MapInitEvent>(OnMapInit);
// Wait until the character has all their organs before we give them their loadout
SubscribeLocalEvent<LoadoutComponent, MapInitEvent>(OnMapInit, after: [typeof(SharedBodySystem)]);
}

public static string GetJobPrototype(string? loadout)
Expand Down
47 changes: 25 additions & 22 deletions Resources/Changelog/Changelog.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,4 @@
Entries:
- author: PursuitInAshes
changes:
- message: Sake Bottles can now be found in the booze-o-mat.
type: Tweak
id: 6316
time: '2024-04-06T20:16:47.0000000+00:00'
url: https://github.com/space-wizards/space-station-14/pull/26776
- author: osjarw
changes:
- message: Removed broken anom behaviour, which causes APE shots to fly through
the anom.
type: Remove
id: 6317
time: '2024-04-06T22:27:16.0000000+00:00'
url: https://github.com/space-wizards/space-station-14/pull/26775
- author: Vermidia
changes:
- message: Water coolers show how full/what they're full of again.
type: Fix
id: 6318
time: '2024-04-06T23:58:57.0000000+00:00'
url: https://github.com/space-wizards/space-station-14/pull/26784
- author: Crotalus
changes:
- message: Show missing materials in lathe tooltip
Expand Down Expand Up @@ -3837,3 +3815,28 @@
id: 6815
time: '2024-06-24T22:03:05.0000000+00:00'
url: https://github.com/space-wizards/space-station-14/pull/29416
- author: Bhijn and Myr
changes:
- message: The colors of the LEDs on the heater and freezer thermomachines has been
changed from red/green (respectively) to orange/cyan (respectively). In laymen's
terms, this makes thermomachines far more reasonably differentiable for those
with colorblindness.
type: Tweak
id: 6816
time: '2024-06-24T22:40:20.0000000+00:00'
url: https://github.com/space-wizards/space-station-14/pull/29397
- author: Elysium206
changes:
- message: Increased Security Riot shields durability significantly and makes actively
blocking better
type: Tweak
id: 6817
time: '2024-06-25T03:56:46.0000000+00:00'
url: https://github.com/space-wizards/space-station-14/pull/29239
- author: Tayrtahn
changes:
- message: Fixed space ninja's starting with their internals disabled.
type: Fix
id: 6818
time: '2024-06-25T06:28:48.0000000+00:00'
url: https://github.com/space-wizards/space-station-14/pull/29213
Loading

0 comments on commit a8876c7

Please sign in to comment.