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

[Feature] Консоль вызова БЩ и Магистрата #521

Closed
wants to merge 12 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
15 changes: 0 additions & 15 deletions .github/workflows/check-crlf.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/close-master-pr.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Close PRs on master
name: Close PR's on master

on:
pull_request_target:
Expand Down
15 changes: 3 additions & 12 deletions Content.Client/Disposal/Systems/DisposalUnitSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ public sealed class DisposalUnitSystem : SharedDisposalUnitSystem

private const string AnimationKey = "disposal_unit_animation";

private const string DefaultFlushState = "disposal-flush";
private const string DefaultChargeState = "disposal-charging";

public override void Initialize()
{
base.Initialize();
Expand Down Expand Up @@ -104,18 +101,12 @@ private void UpdateState(EntityUid uid, SharedDisposalUnitComponent unit, Sprite
sprite.LayerSetVisible(DisposalUnitVisualLayers.Base, state == VisualState.Anchored);
sprite.LayerSetVisible(DisposalUnitVisualLayers.BaseFlush, state is VisualState.Flushing or VisualState.Charging);

var chargingState = sprite.LayerMapTryGet(DisposalUnitVisualLayers.BaseCharging, out var chargingLayer)
? sprite.LayerGetState(chargingLayer)
: new RSI.StateId(DefaultChargeState);

// This is a transient state so not too worried about replaying in range.
if (state == VisualState.Flushing)
{
if (!_animationSystem.HasRunningAnimation(uid, AnimationKey))
{
var flushState = sprite.LayerMapTryGet(DisposalUnitVisualLayers.BaseFlush, out var flushLayer)
? sprite.LayerGetState(flushLayer)
: new RSI.StateId(DefaultFlushState);
var flushState = new RSI.StateId("disposal-flush");

// Setup the flush animation to play
var anim = new Animation
Expand All @@ -133,7 +124,7 @@ private void UpdateState(EntityUid uid, SharedDisposalUnitComponent unit, Sprite
// Return to base state (though, depending on how the unit is
// configured we might get an appearance change event telling
// us to go to charging state)
new AnimationTrackSpriteFlick.KeyFrame(chargingState, (float) unit.FlushDelay.TotalSeconds)
new AnimationTrackSpriteFlick.KeyFrame("disposal-charging", (float) unit.FlushDelay.TotalSeconds)
}
},
}
Expand All @@ -156,7 +147,7 @@ private void UpdateState(EntityUid uid, SharedDisposalUnitComponent unit, Sprite
}
else if (state == VisualState.Charging)
{
sprite.LayerSetState(DisposalUnitVisualLayers.BaseFlush, chargingState);
sprite.LayerSetState(DisposalUnitVisualLayers.BaseFlush, new RSI.StateId("disposal-charging"));
}
else
{
Expand Down
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(args.Target, physics, BodyStatus.InAir);
_physics.SetBodyStatus(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(args.Target, physics, 0f);
_physics.SetAngularDamping(args.Target, physics, 0f);
_physics.SetLinearDamping(physics, 0f);
_physics.SetAngularDamping(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(args.Target, physics, BodyStatus.InAir);
_physics.SetBodyStatus(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(args.Target, physics, 0f);
_physics.SetAngularDamping(args.Target, physics, 0f);
_physics.SetLinearDamping(physics, 0f);
_physics.SetAngularDamping(physics, 0f);
},
Impact = LogImpact.Extreme,
Message = Loc.GetString("admin-smite-yeet-description")
Expand Down
16 changes: 2 additions & 14 deletions Content.Server/Administration/Systems/AdminVerbSystem.Tools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -718,21 +718,9 @@ private void AddTricksVerbs(GetVerbsEvent<Verb> args)
Icon = new SpriteSpecifier.Rsi(new("/Textures/Objects/Fun/caps.rsi"), "mag-6"),
Act = () =>
{
_quickDialog.OpenDialog(player, "Set Bullet Amount", $"Amount (standard {ballisticAmmo.Capacity}):", (string amount) =>
_quickDialog.OpenDialog(player, "Set Bullet Amount", $"Amount (max {ballisticAmmo.Capacity}):", (int amount) =>
{
if (!int.TryParse(amount, out var result))
return;

if (result > 0)
{
ballisticAmmo.UnspawnedCount = result;
}
else
{
ballisticAmmo.UnspawnedCount = 0;
}

_gun.UpdateBallisticAppearance(args.Target, ballisticAmmo);
ballisticAmmo.UnspawnedCount = amount;
});
},
Impact = LogImpact.Medium,
Expand Down
32 changes: 3 additions & 29 deletions Content.Server/Atmos/Components/AirtightComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,53 +9,27 @@ public sealed partial class AirtightComponent : Component
{
public (EntityUid Grid, Vector2i Tile) LastPosition { get; set; }

/// <summary>
/// The directions in which this entity should block airflow, relative to its own reference frame.
/// </summary>
[DataField("airBlockedDirection", customTypeSerializer: typeof(FlagSerializer<AtmosDirectionFlags>))]
public int InitialAirBlockedDirection { get; set; } = (int) AtmosDirection.All;

/// <summary>
/// The directions in which the entity is currently blocking airflow, relative to the grid that the entity is on.
/// I.e., this is a variant of <see cref="InitialAirBlockedDirection"/> that takes into account the entity's
/// current rotation.
/// </summary>
[ViewVariables]
public int CurrentAirBlockedDirection;

/// <summary>
/// Whether the airtight entity is currently blocking airflow.
/// </summary>
[DataField]
[DataField("airBlocked")]
public bool AirBlocked { get; set; } = true;

/// <summary>
/// If true, entities on this tile will attempt to draw air from surrounding tiles when they become unblocked
/// and currently have no air. This is generally only required when <see cref="NoAirWhenFullyAirBlocked"/> is
/// true, or if the entity is likely to occupy the same tile as another no-air airtight entity.
/// </summary>
[DataField]
[DataField("fixVacuum")]
public bool FixVacuum { get; set; } = true;
// I think fixvacuum exists to ensure that repeatedly closing/opening air-blocking doors doesn't end up
// depressurizing a room. However it can also effectively be used as a means of generating gasses for free
// TODO ATMOS Mass conservation. Make it actually push/pull air from adjacent tiles instead of destroying & creating,


// TODO ATMOS Do we need these two fields?
[DataField("rotateAirBlocked")]
public bool RotateAirBlocked { get; set; } = true;

// TODO ATMOS remove this? What is this even for??
[DataField("fixAirBlockedDirectionInitialize")]
public bool FixAirBlockedDirectionInitialize { get; set; } = true;

/// <summary>
/// If true, then the tile that this entity is on will have no air at all if all directions are blocked.
/// </summary>
[DataField]
[DataField("noAirWhenFullyAirBlocked")]
public bool NoAirWhenFullyAirBlocked { get; set; } = true;

/// <inheritdoc cref="CurrentAirBlockedDirection"/>
[Access(Other = AccessPermissions.ReadWriteExecute)]
public AtmosDirection AirBlockedDirection => (AtmosDirection)CurrentAirBlockedDirection;
}
Expand Down
2 changes: 2 additions & 0 deletions Content.Server/Atmos/EntitySystems/AirtightSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ private void OnAirtightMoved(Entity<AirtightComponent> airtight, ref MoveEvent e
private bool AirtightMove(Entity<AirtightComponent> ent, ref MoveEvent ev)
{
var (owner, airtight) = ent;
if (!airtight.RotateAirBlocked || airtight.InitialAirBlockedDirection == (int)AtmosDirection.Invalid)
return false;

airtight.CurrentAirBlockedDirection = (int) Rotate((AtmosDirection)airtight.InitialAirBlockedDirection, ev.NewRotation);
var pos = airtight.LastPosition;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,10 @@ private void GridIsHotspotActive(EntityUid uid, GridAtmosphereComponent componen
args.Handled = true;
}

private void GridFixTileVacuum(TileAtmosphere tile)
private void GridFixTileVacuum(
Entity<GridAtmosphereComponent, GasTileOverlayComponent, MapGridComponent, TransformComponent> ent,
TileAtmosphere tile,
float volume)
{
DebugTools.AssertNotNull(tile.Air);
DebugTools.Assert(tile.Air?.Immutable == false );
Expand All @@ -413,9 +416,6 @@ private void GridFixTileVacuum(TileAtmosphere tile)
count++;
}

if (count == 0)
return;

var ratio = 1f / count;
var totalTemperature = 0f;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ private void UpdateHighPressure(float frameTime)
if (HasComp<MobStateComponent>(uid) &&
TryComp<PhysicsComponent>(uid, out var body))
{
_physics.SetBodyStatus(uid, body, BodyStatus.OnGround);
_physics.SetBodyStatus(body, BodyStatus.OnGround);
}

if (TryComp<FixturesComponent>(uid, out var fixtures))
Expand All @@ -75,7 +75,7 @@ private void AddMobMovedByPressure(EntityUid uid, MovedByPressureComponent compo
if (!TryComp<FixturesComponent>(uid, out var fixtures))
return;

_physics.SetBodyStatus(uid, body, BodyStatus.InAir);
_physics.SetBodyStatus(body, BodyStatus.InAir);

foreach (var (id, fixture) in fixtures.Fixtures)
{
Expand All @@ -94,9 +94,9 @@ private void HighPressureMovements(Entity<GridAtmosphereComponent> gridAtmospher
// TODO ATMOS finish this

// Don't play the space wind sound on tiles that are on fire...
if (tile.PressureDifference > 15 && !tile.Hotspot.Valid)
if(tile.PressureDifference > 15 && !tile.Hotspot.Valid)
{
if (_spaceWindSoundCooldown == 0 && !string.IsNullOrEmpty(SpaceWindSound))
if(_spaceWindSoundCooldown == 0 && !string.IsNullOrEmpty(SpaceWindSound))
{
var coordinates = _mapSystem.ToCenterCoordinates(tile.GridIndex, tile.GridIndices);
_audio.PlayPvs(SpaceWindSound, coordinates, AudioParams.Default.WithVariation(0.125f).WithVolume(MathHelper.Clamp(tile.PressureDifference / 10, 10, 100)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ private void UpdateTileAir(
tile.Air = new GasMixture(volume){Temperature = Atmospherics.T20C};

if (data.FixVacuum)
GridFixTileVacuum(tile);
GridFixTileVacuum(ent, tile, volume);
}

private void QueueRunTiles(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,12 @@ private AirtightData GetAirtightData(EntityUid uid, MapGridComponent grid, Vecto
if (!_airtightQuery.TryGetComponent(ent, out var airtight))
continue;

fixVacuum |= airtight.FixVacuum;

if(!airtight.AirBlocked)
continue;

blockedDirs |= airtight.AirBlockedDirection;
noAirWhenBlocked |= airtight.NoAirWhenFullyAirBlocked;
fixVacuum |= airtight.FixVacuum;

if (blockedDirs == AtmosDirection.All && noAirWhenBlocked && fixVacuum)
break;
Expand Down
7 changes: 3 additions & 4 deletions Content.Server/Atmos/GasMixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ public float Temperature
get => _temperature;
set
{
DebugTools.Assert(!float.IsNaN(value));
if (!Immutable)
_temperature = MathF.Min(MathF.Max(value, Atmospherics.TCMB), Atmospherics.Tmax);
DebugTools.Assert(!float.IsNaN(_temperature));
if (Immutable) return;
_temperature = MathF.Min(MathF.Max(value, Atmospherics.TCMB), Atmospherics.Tmax);
}
}

Expand All @@ -91,7 +91,6 @@ public GasMixture(float[] moles, float temp, float volume = Atmospherics.CellVol
if (volume < 0)
volume = 0;

DebugTools.Assert(!float.IsNaN(temp));
_temperature = temp;
Moles = moles;
Volume = volume;
Expand Down
3 changes: 0 additions & 3 deletions Content.Server/Atmos/TileAtmosphere.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ public sealed class TileAtmosphere : IGasMixtureHolder
[ViewVariables]
public TileAtmosphere? PressureSpecificTarget { get; set; }

/// <summary>
/// This is either the pressure difference, or the quantity of moles transferred if monstermos is enabled.
/// </summary>
[ViewVariables]
public float PressureDifference { get; set; }

Expand Down

This file was deleted.

Loading
Loading