Skip to content

Commit

Permalink
Merge branch 'master' into Canister-Resprites
Browse files Browse the repository at this point in the history
  • Loading branch information
FoxxoTrystan authored May 20, 2024
2 parents f6320da + 156dfb6 commit 2ee9135
Show file tree
Hide file tree
Showing 94 changed files with 1,161 additions and 728 deletions.
5 changes: 4 additions & 1 deletion .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
"Changes: C#":
"Changes: Audio":
- "**/*.ogg"

"Changes: C#":
- "**/*.cs"

"Changes: Config":
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-map-renderer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
- name: Setup .NET Core
uses: actions/[email protected]
with:
dotnet-version: 8.0.x
dotnet-version: 8.0.100

- name: Install dependencies
run: dotnet restore
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-test-debug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
- name: Setup .NET Core
uses: actions/[email protected]
with:
dotnet-version: 8.0.x
dotnet-version: 8.0.100

- name: Install dependencies
run: dotnet restore
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/close-master-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
steps:
- uses: superbrothers/close-pull-request@v3
with:
comment: "Thank you for contributing to the Space Station 14 repository. Unfortunately, it looks like you submitted your pull request from the master branch. We suggest you follow [our git usage documentation](https://docs.spacestation14.com/en/general-development/setup/git-for-the-ss14-developer.html) \n\n You can move your current work from the master branch to another branch by doing `git branch <branch_name` and resetting the master branch."
comment: "Thank you for contributing to our repository. Unfortunately, it looks like you submitted your pull request from the master branch. We suggest you follow [the git usage documentation](https://docs.spacestation14.com/en/general-development/setup/git-for-the-ss14-developer.html). \n\n You can move your current work from the master branch to another branch by [branching](https://git-scm.com/docs/git-branch) from and [resetting](https://git-scm.com/docs/git-reset) the master branch."

# If you prefer to just comment on the pr and not close it, uncomment the bellow and comment the above

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Setup .NET Core
uses: actions/[email protected]
with:
dotnet-version: 8.0.x
dotnet-version: 8.0.100

- name: Get Engine Tag
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-packaging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
- name: Setup .NET Core
uses: actions/[email protected]
with:
dotnet-version: 8.0.x
dotnet-version: 8.0.100

- name: Install dependencies
run: dotnet restore
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/yaml-linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Setup .NET Core
uses: actions/[email protected]
with:
dotnet-version: 8.0.x
dotnet-version: 8.0.100
- name: Install dependencies
run: dotnet restore
- name: Build
Expand Down
70 changes: 46 additions & 24 deletions Content.Client/Atmos/Overlays/GasTileOverlay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
using Robust.Client.Graphics;
using Robust.Client.ResourceManagement;
using Robust.Shared.Enums;
using Robust.Shared.Graphics;
using Robust.Shared.Graphics.RSI;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
Expand All @@ -23,7 +22,7 @@ public sealed class GasTileOverlay : Overlay
private readonly IEntityManager _entManager;
private readonly IMapManager _mapManager;

public override OverlaySpace Space => OverlaySpace.WorldSpaceEntities;
public override OverlaySpace Space => OverlaySpace.WorldSpaceEntities | OverlaySpace.WorldSpaceBelowWorld;
private readonly ShaderInstance _shader;

// Gas overlays
Expand Down Expand Up @@ -79,7 +78,8 @@ public GasTileOverlay(GasTileOverlaySystem system, IEntityManager entManager, IR
var rsi = resourceCache.GetResource<RSIResource>(animated.RsiPath).RSI;
var stateId = animated.RsiState;

if (!rsi.TryGetState(stateId, out var state)) continue;
if (!rsi.TryGetState(stateId, out var state))
continue;

_frames[i] = state.GetFrames(RsiDirection.South);
_frameDelays[i] = state.GetDelays();
Expand Down Expand Up @@ -111,7 +111,8 @@ protected override void FrameUpdate(FrameEventArgs args)
for (var i = 0; i < _gasCount; i++)
{
var delays = _frameDelays[i];
if (delays.Length == 0) continue;
if (delays.Length == 0)
continue;

var frameCount = _frameCounter[i];
_timer[i] += args.DeltaSeconds;
Expand All @@ -127,7 +128,8 @@ protected override void FrameUpdate(FrameEventArgs args)
for (var i = 0; i < FireStates; i++)
{
var delays = _fireFrameDelays[i];
if (delays.Length == 0) continue;
if (delays.Length == 0)
continue;

var frameCount = _fireFrameCounter[i];
_fireTimer[i] += args.DeltaSeconds;
Expand Down Expand Up @@ -161,26 +163,10 @@ protected override void Draw(in OverlayDrawArgs args)
var mapUid = _mapManager.GetMapEntityId(args.MapId);

if (_entManager.TryGetComponent<MapAtmosphereComponent>(mapUid, out var atmos))
{
var bottomLeft = args.WorldAABB.BottomLeft.Floored();
var topRight = args.WorldAABB.TopRight.Ceiled();

for (var x = bottomLeft.X; x <= topRight.X; x++)
{
for (var y = bottomLeft.Y; y <= topRight.Y; y++)
{
var tilePosition = new Vector2(x, y);

for (var i = 0; i < atmos.OverlayData.Opacity.Length; i++)
{
var opacity = atmos.OverlayData.Opacity[i];
DrawMapOverlay(drawHandle, args, mapUid, atmos);

if (opacity > 0)
args.WorldHandle.DrawTexture(_frames[i][_frameCounter[i]], tilePosition, Color.White.WithAlpha(opacity));
}
}
}
}
if (args.Space != OverlaySpace.WorldSpaceEntities)
return;

// TODO: WorldBounds callback.
_mapManager.FindGridsIntersecting(args.MapId, args.WorldAABB, ref gridState,
Expand Down Expand Up @@ -265,5 +251,41 @@ protected override void Draw(in OverlayDrawArgs args)
drawHandle.UseShader(null);
drawHandle.SetTransform(Matrix3.Identity);
}

private void DrawMapOverlay(
DrawingHandleWorld handle,
OverlayDrawArgs args,
EntityUid map,
MapAtmosphereComponent atmos)
{
var mapGrid = _entManager.HasComponent<MapGridComponent>(map);

// map-grid atmospheres get drawn above grids
if (mapGrid && args.Space != OverlaySpace.WorldSpaceEntities)
return;

// Normal map atmospheres get drawn below grids
if (!mapGrid && args.Space != OverlaySpace.WorldSpaceBelowWorld)
return;

var bottomLeft = args.WorldAABB.BottomLeft.Floored();
var topRight = args.WorldAABB.TopRight.Ceiled();

for (var x = bottomLeft.X; x <= topRight.X; x++)
{
for (var y = bottomLeft.Y; y <= topRight.Y; y++)
{
var tilePosition = new Vector2(x, y);

for (var i = 0; i < atmos.OverlayData.Opacity.Length; i++)
{
var opacity = atmos.OverlayData.Opacity[i];

if (opacity > 0)
handle.DrawTexture(_frames[i][_frameCounter[i]], tilePosition, Color.White.WithAlpha(opacity));
}
}
}
}
}
}
2 changes: 1 addition & 1 deletion Content.Client/Mapping/MappingSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ private void OnFillActionSlot(FillActionSlotEvent ev)
if (tileDef is not ContentTileDefinition contentTileDef)
return;

var tileIcon = contentTileDef.IsSpace
var tileIcon = contentTileDef.MapAtmosphere
? _spaceIcon
: new Texture(contentTileDef.Sprite!.Value);

Expand Down
2 changes: 1 addition & 1 deletion Content.Client/Options/UI/Tabs/KeyRebindTab.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ private void InputManagerOnFirstChanceOnKeyEvent(KeyEventArgs keyEvent, KeyEvent
Mod1 = mods[0],
Mod2 = mods[1],
Mod3 = mods[2],
Priority = 0,
Priority = _currentlyRebinding.Binding?.Priority ?? 0,
Type = bindType,
CanFocus = key == Keyboard.Key.MouseLeft
|| key == Keyboard.Key.MouseRight
Expand Down
2 changes: 1 addition & 1 deletion Content.IntegrationTests/Tests/Body/LungTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ await server.WaitAssertion(() =>
metaSys.Update(1.0f);
metaSys.Update(1.0f);
respSys.Update(2.0f);
Assert.That(GetMapMoles(), Is.EqualTo(startingMoles).Within(0.0001));
Assert.That(GetMapMoles(), Is.EqualTo(startingMoles).Within(0.0002));
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1006,15 +1006,10 @@ protected async Task AddAtmosphere(EntityUid? uid = null)
await Server.WaitPost(() =>
{
var atmosSystem = SEntMan.System<AtmosphereSystem>();
var atmos = SEntMan.EnsureComponent<MapAtmosphereComponent>(target);
var moles = new float[Atmospherics.AdjustedNumberOfGases];
moles[(int) Gas.Oxygen] = 21.824779f;
moles[(int) Gas.Nitrogen] = 82.10312f;
atmosSystem.SetMapAtmosphere(target, false, new GasMixture(2500)
{
Temperature = 293.15f,
Moles = moles,
}, atmos);
atmosSystem.SetMapAtmosphere(target, false, new GasMixture(moles, Atmospherics.T20C));
});
}

Expand Down
12 changes: 6 additions & 6 deletions Content.Server/Administration/Systems/AdminVerbSystem.Smites.cs
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ private void AddSmiteVerbs(GetVerbsEvent<Verb> args)
var fixtures = Comp<FixturesComponent>(args.Target);
xform.Anchored = false; // Just in case.
_physics.SetBodyType(args.Target, BodyType.Dynamic, manager: fixtures, body: physics);
_physics.SetBodyStatus(physics, BodyStatus.InAir);
_physics.SetBodyStatus(args.Target, physics, BodyStatus.InAir);
_physics.WakeBody(args.Target, manager: fixtures, body: physics);
foreach (var fixture in fixtures.Fixtures.Values)
Expand All @@ -424,8 +424,8 @@ private void AddSmiteVerbs(GetVerbsEvent<Verb> args)
_physics.SetLinearVelocity(args.Target, _random.NextVector2(1.5f, 1.5f), manager: fixtures, body: physics);
_physics.SetAngularVelocity(args.Target, MathF.PI * 12, manager: fixtures, body: physics);
_physics.SetLinearDamping(physics, 0f);
_physics.SetAngularDamping(physics, 0f);
_physics.SetLinearDamping(args.Target, physics, 0f);
_physics.SetAngularDamping(args.Target, physics, 0f);
},
Impact = LogImpact.Extreme,
Message = Loc.GetString("admin-smite-pinball-description")
Expand All @@ -444,7 +444,7 @@ private void AddSmiteVerbs(GetVerbsEvent<Verb> args)
xform.Anchored = false; // Just in case.
_physics.SetBodyType(args.Target, BodyType.Dynamic, body: physics);
_physics.SetBodyStatus(physics, BodyStatus.InAir);
_physics.SetBodyStatus(args.Target, physics, BodyStatus.InAir);
_physics.WakeBody(args.Target, manager: fixtures, body: physics);
foreach (var fixture in fixtures.Fixtures.Values)
Expand All @@ -454,8 +454,8 @@ private void AddSmiteVerbs(GetVerbsEvent<Verb> args)
_physics.SetLinearVelocity(args.Target, _random.NextVector2(8.0f, 8.0f), manager: fixtures, body: physics);
_physics.SetAngularVelocity(args.Target, MathF.PI * 12, manager: fixtures, body: physics);
_physics.SetLinearDamping(physics, 0f);
_physics.SetAngularDamping(physics, 0f);
_physics.SetLinearDamping(args.Target, physics, 0f);
_physics.SetAngularDamping(args.Target, physics, 0f);
},
Impact = LogImpact.Extreme,
Message = Loc.GetString("admin-smite-yeet-description")
Expand Down
94 changes: 94 additions & 0 deletions Content.Server/Atmos/Commands/SetMapAtmosCommand.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
using Content.Server.Administration;
using Content.Server.Atmos.Components;
using Content.Server.Atmos.EntitySystems;
using Content.Shared.Administration;
using Content.Shared.Atmos;
using Robust.Shared.Console;
using Robust.Shared.Map;

namespace Content.Server.Atmos.Commands;

[AdminCommand(AdminFlags.Admin)]
public sealed class AddMapAtmosCommand : LocalizedCommands
{
[Dependency] private readonly IEntityManager _entities = default!;
[Dependency] private readonly IMapManager _map = default!;

private const string _cmd = "cmd-set-map-atmos";
public override string Command => "setmapatmos";
public override string Description => Loc.GetString($"{_cmd}-desc");
public override string Help => Loc.GetString($"{_cmd}-help");

public override void Execute(IConsoleShell shell, string argStr, string[] args)
{
if (args.Length < 2)
{
shell.WriteLine(Help);
return;
}

int.TryParse(args[0], out var id);
var map = _map.GetMapEntityId(new MapId(id));
if (!map.IsValid())
{
shell.WriteError(Loc.GetString("cmd-parse-failure-mapid", ("arg", args[0])));
return;
}

if (!bool.TryParse(args[1], out var space))
{
shell.WriteError(Loc.GetString("cmd-parse-failure-bool", ("arg", args[1])));
return;
}

if (space || args.Length < 4)
{
_entities.RemoveComponent<MapAtmosphereComponent>(map);
shell.WriteLine(Loc.GetString($"{_cmd}-removed", ("map", id)));
return;
}

if (!float.TryParse(args[2], out var temp))
{
shell.WriteError(Loc.GetString("cmd-parse-failure-float", ("arg", args[2])));
return;
}

var mix = new GasMixture(Atmospherics.CellVolume) {Temperature = Math.Min(temp, Atmospherics.TCMB)};
for (var i = 0; i < Atmospherics.TotalNumberOfGases; i++)
{
if (args.Length == 3 + i)
break;

if (!float.TryParse(args[3+i], out var moles))
{
shell.WriteError(Loc.GetString("cmd-parse-failure-float", ("arg", args[3+i])));
return;
}

mix.AdjustMoles(i, moles);
}

var atmos = _entities.EntitySysManager.GetEntitySystem<AtmosphereSystem>();
atmos.SetMapAtmosphere(map, space, mix);
shell.WriteLine(Loc.GetString($"{_cmd}-updated", ("map", id)));
}

public override CompletionResult GetCompletion(IConsoleShell shell, string[] args)
{
if (args.Length == 1)
return CompletionResult.FromHintOptions(CompletionHelper.MapIds(_entities), Loc.GetString($"{_cmd}-hint-map"));

if (args.Length == 2)
return CompletionResult.FromHintOptions(new[]{ "false", "true"}, Loc.GetString($"{_cmd}-hint-space"));

if (!bool.TryParse(args[1], out var space) || space)
return CompletionResult.Empty;

if (args.Length == 3)
return CompletionResult.FromHint(Loc.GetString($"{_cmd}-hint-temp"));

var gas = (Gas) args.Length - 4;
return CompletionResult.FromHint(Loc.GetString($"{_cmd}-hint-gas" , ("gas", gas.ToString())));
}
}
4 changes: 3 additions & 1 deletion Content.Server/Atmos/Components/AirtightComponent.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
using Content.Server.Atmos.EntitySystems;
using Content.Shared.Atmos;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;

namespace Content.Server.Atmos.Components
{
[RegisterComponent]
[RegisterComponent, Access(typeof(AirtightSystem))]
public sealed partial class AirtightComponent : Component
{
public (EntityUid Grid, Vector2i Tile) LastPosition { get; set; }
Expand All @@ -29,6 +30,7 @@ public sealed partial class AirtightComponent : Component
[DataField("noAirWhenFullyAirBlocked")]
public bool NoAirWhenFullyAirBlocked { get; set; } = true;

[Access(Other = AccessPermissions.ReadWriteExecute)]
public AtmosDirection AirBlockedDirection => (AtmosDirection)CurrentAirBlockedDirection;
}
}
Loading

0 comments on commit 2ee9135

Please sign in to comment.