Merge remote-tracking branch 'upstream/stable' into ed-27-05-2025-upstream-sync
# Conflicts: # .github/CODEOWNERS # Content.Client/Guidebook/Controls/GuideReagentReaction.xaml.cs # Content.IntegrationTests/Tests/Chemistry/TryAllReactionsTest.cs # Content.Server/Procedural/DungeonJob/DungeonJob.OreDunGen.cs # Resources/Prototypes/Entities/Effects/chemistry_effects.yml # Resources/Prototypes/Entities/Mobs/Customization/Markings/human_hair.yml # Resources/Prototypes/GameRules/meteorswarms.yml # Resources/Prototypes/Procedural/dungeon_configs.yml
This commit is contained in:
@@ -1,89 +0,0 @@
|
||||
using Content.Server.Atmos.Components;
|
||||
using Content.Shared.Atmos.Visuals;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Random;
|
||||
|
||||
namespace Content.Server.Atmos.EntitySystems;
|
||||
|
||||
public sealed class AtmosPlaqueSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
|
||||
[Dependency] private readonly MetaDataSystem _metaData = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
SubscribeLocalEvent<AtmosPlaqueComponent, MapInitEvent>(OnPlaqueMapInit);
|
||||
}
|
||||
|
||||
private void OnPlaqueMapInit(EntityUid uid, AtmosPlaqueComponent component, MapInitEvent args)
|
||||
{
|
||||
var rand = _random.Next(100);
|
||||
// Let's not pat ourselves on the back too hard.
|
||||
// 1% chance of zumos
|
||||
if (rand == 0) component.Type = PlaqueType.Zumos;
|
||||
// 9% FEA
|
||||
else if (rand <= 10) component.Type = PlaqueType.Fea;
|
||||
// 45% ZAS
|
||||
else if (rand <= 55) component.Type = PlaqueType.Zas;
|
||||
// 45% LINDA
|
||||
else component.Type = PlaqueType.Linda;
|
||||
|
||||
UpdateSign(uid, component);
|
||||
}
|
||||
|
||||
public void UpdateSign(EntityUid uid, AtmosPlaqueComponent component)
|
||||
{
|
||||
var metaData = MetaData(uid);
|
||||
|
||||
var val = component.Type switch
|
||||
{
|
||||
PlaqueType.Zumos =>
|
||||
Loc.GetString("atmos-plaque-component-desc-zum"),
|
||||
PlaqueType.Fea =>
|
||||
Loc.GetString("atmos-plaque-component-desc-fea"),
|
||||
PlaqueType.Linda =>
|
||||
Loc.GetString("atmos-plaque-component-desc-linda"),
|
||||
PlaqueType.Zas =>
|
||||
Loc.GetString("atmos-plaque-component-desc-zas"),
|
||||
PlaqueType.Unset => Loc.GetString("atmos-plaque-component-desc-unset"),
|
||||
_ => Loc.GetString("atmos-plaque-component-desc-unset"),
|
||||
};
|
||||
|
||||
_metaData.SetEntityDescription(uid, val, metaData);
|
||||
|
||||
var val1 = component.Type switch
|
||||
{
|
||||
PlaqueType.Zumos =>
|
||||
Loc.GetString("atmos-plaque-component-name-zum"),
|
||||
PlaqueType.Fea =>
|
||||
Loc.GetString("atmos-plaque-component-name-fea"),
|
||||
PlaqueType.Linda =>
|
||||
Loc.GetString("atmos-plaque-component-name-linda"),
|
||||
PlaqueType.Zas =>
|
||||
Loc.GetString("atmos-plaque-component-name-zas"),
|
||||
PlaqueType.Unset => Loc.GetString("atmos-plaque-component-name-unset"),
|
||||
_ => Loc.GetString("atmos-plaque-component-name-unset"),
|
||||
};
|
||||
|
||||
_metaData.SetEntityName(uid, val1, metaData);
|
||||
|
||||
if (TryComp<AppearanceComponent>(uid, out var appearance))
|
||||
{
|
||||
var state = component.Type == PlaqueType.Zumos ? "zumosplaque" : "atmosplaque";
|
||||
|
||||
_appearance.SetData(uid, AtmosPlaqueVisuals.State, state, appearance);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If you get the ZUM plaque it means your round will be blessed with good engineering luck.
|
||||
public enum PlaqueType : byte
|
||||
{
|
||||
Unset = 0,
|
||||
Zumos,
|
||||
Fea,
|
||||
Linda,
|
||||
Zas
|
||||
}
|
||||
@@ -81,7 +81,10 @@ public sealed partial class AtmosphereSystem : SharedAtmosphereSystem
|
||||
|
||||
private void OnTileChanged(ref TileChangedEvent ev)
|
||||
{
|
||||
InvalidateTile(ev.NewTile.GridUid, ev.NewTile.GridIndices);
|
||||
foreach (var change in ev.Changes)
|
||||
{
|
||||
InvalidateTile(ev.Entity.Owner, change.GridIndices);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnPrototypesReloaded(PrototypesReloadedEventArgs ev)
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
using Content.Server.Atmos.Components;
|
||||
using Content.Server.Shuttles.Systems;
|
||||
using Content.Shared.Maps;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Physics.Components;
|
||||
using Robust.Shared.Map.Components;
|
||||
using Robust.Shared.Physics.Events;
|
||||
|
||||
namespace Content.Server.Atmos.EntitySystems;
|
||||
|
||||
@@ -12,40 +11,29 @@ namespace Content.Server.Atmos.EntitySystems;
|
||||
/// </summary>
|
||||
public sealed class AutomaticAtmosSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly ITileDefinitionManager _tileDefinitionManager = default!;
|
||||
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
SubscribeLocalEvent<TileChangedEvent>(OnTileChanged);
|
||||
SubscribeLocalEvent<MapGridComponent, MassDataChangedEvent>(OnMassDataChanged);
|
||||
}
|
||||
|
||||
private void OnTileChanged(ref TileChangedEvent ev)
|
||||
private void OnMassDataChanged(Entity<MapGridComponent> ent, ref MassDataChangedEvent ev)
|
||||
{
|
||||
// Only if a atmos-holding tile has been added or removed.
|
||||
// Also, these calls are surprisingly slow.
|
||||
// TODO: Make tiledefmanager cache the IsSpace property, and turn this lookup-through-two-interfaces into
|
||||
// TODO: a simple array lookup, as tile IDs are likely contiguous, and there's at most 2^16 possibilities anyway.
|
||||
|
||||
var oldSpace = ev.OldTile.IsSpace(_tileDefinitionManager);
|
||||
var newSpace = ev.NewTile.IsSpace(_tileDefinitionManager);
|
||||
|
||||
if (!(oldSpace && !newSpace ||
|
||||
!oldSpace && newSpace) ||
|
||||
_atmosphereSystem.HasAtmosphere(ev.Entity))
|
||||
return;
|
||||
|
||||
if (!TryComp<PhysicsComponent>(ev.Entity, out var physics))
|
||||
if (_atmosphereSystem.HasAtmosphere(ent))
|
||||
return;
|
||||
|
||||
// We can't actually count how many tiles there are efficiently, so instead estimate with the mass.
|
||||
if (physics.Mass / ShuttleSystem.TileMassMultiplier >= 7.0f)
|
||||
if (ev.NewMass / ShuttleSystem.TileDensityMultiplier >= 7.0f)
|
||||
{
|
||||
AddComp<GridAtmosphereComponent>(ev.Entity);
|
||||
Log.Info($"Giving grid {ev.Entity} GridAtmosphereComponent.");
|
||||
AddComp<GridAtmosphereComponent>(ent);
|
||||
Log.Info($"Giving grid {ent} GridAtmosphereComponent.");
|
||||
}
|
||||
|
||||
// It's not super important to remove it should the grid become too small again.
|
||||
// If explosions ever gain the ability to outright shatter grids, do rethink this.
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user