Skip to content

Commit c904fe6

Browse files
authored
hotfix (#1431)
1 parent d41c6b9 commit c904fe6

30 files changed

+162
-95
lines changed

Content.Server/Atmos/EntitySystems/FlammableSystem.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,9 +426,17 @@ public override void Update(float frameTime)
426426
_timer -= UpdateTime;
427427

428428
// TODO: This needs cleanup to take off the crust from TemperatureComponent and shit.
429+
var q = new Queue<(EntityUid, FlammableComponent)>();
429430
var query = EntityQueryEnumerator<FlammableComponent, TransformComponent>();
430431
while (query.MoveNext(out var uid, out var flammable, out _))
431432
{
433+
q.Enqueue((uid, flammable));
434+
}
435+
436+
while (q.TryDequeue(out var d))
437+
{
438+
var (uid, flammable) = d;
439+
432440
// Slowly dry ourselves off if wet.
433441
if (flammable.FireStacks < 0)
434442
{

Content.Server/Backmen/NPC/Systems/NPCConversationSystem.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -803,7 +803,7 @@ private async Task UpdateGigaToken()
803803

804804
private async Task<(GptResponseApi? responseApi, string? err)> SendGptApiRequest(NPCGptHistory history, EntityUid uid)
805805
{
806-
if (!_gptEnabled || string.IsNullOrEmpty(_gptApiUrl) || string.IsNullOrEmpty(_gptApiToken) || string.IsNullOrEmpty(_gptApiModel))
806+
if (!_gptEnabled || string.IsNullOrEmpty(_gptApiUrl) || string.IsNullOrEmpty(_gptApiModel))
807807
{
808808
return (null, "GPT не настроен или отключен");
809809
}

Content.Server/_Lavaland/Procedural/Systems/LavalandPlanetSystem.Grid.cs

Lines changed: 36 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,31 @@
1-
using System;
1+
using System;
22
using System.Linq;
33
using System.Numerics;
44
using Content.Server._Lavaland.Procedural.Components;
5+
using Content.Server.Atmos;
6+
using Content.Server.Atmos.Components;
7+
using Content.Server.Atmos.EntitySystems;
8+
using Content.Server.Light.Components;
59
using Content.Shared._Lavaland.Procedural.Components;
610
using Content.Shared._Lavaland.Procedural.Prototypes;
11+
using Content.Shared.Atmos;
12+
using Content.Shared.Atmos.Components;
13+
using Content.Shared.Light.Components;
14+
using Content.Shared.Light.EntitySystems;
715
using Content.Shared.Maps;
816
using Robust.Server.Physics;
917
using Robust.Shared.Map;
1018
using Robust.Shared.Map.Components;
1119
using Robust.Shared.Random;
20+
using Robust.Shared.Utility;
1221

1322
namespace Content.Server._Lavaland.Procedural.Systems;
1423

1524
public sealed partial class LavalandPlanetSystem
1625
{
1726
[Dependency] private readonly GridFixtureSystem _gridFixture = default!;
1827
[Dependency] private readonly ITileDefinitionManager _tileDef = default!;
28+
[Dependency] private readonly SharedRoofSystem _roofSystem = default!;
1929

2030
private bool LoadGridRuin(
2131
LavalandGridRuinPrototype ruin,
@@ -130,27 +140,41 @@ private bool LoadGridRuin(
130140
// Get the rotation of the target grid
131141
var rotation = Transform(spawned.Value).LocalRotation;
132142

133-
// Replace empty tiles in spawned grid with tiles from the same position in lavaland grid
134-
foreach (var tile in _map.GetAllTiles(spawned.Value, spawnedGrid, false))
143+
var tilesToRoof = new HashSet<Vector2i>();
144+
Entity<MapGridComponent, RoofComponent> spawnedRoof = (spawned.Value, spawnedGrid, EnsureComp<RoofComponent>(spawned.Value));
145+
Entity<MapGridComponent?, RoofComponent?> roofMap = (sourceGridUid, sourceGrid, EnsureComp<RoofComponent>(sourceGridUid));
146+
147+
var matrix = Matrix3Helpers.CreateTransform(offset, rotation);
148+
135149
{
136-
if (tile.Tile == Tile.Empty)
150+
var enumerator = _map.GetAllTilesEnumerator(spawned.Value, spawnedGrid);
151+
while (enumerator.MoveNext(out var tileRef))
137152
{
138-
// Get world position of this tile
139-
var tileWorldPos = _map.GridTileToWorldPos(spawned.Value, spawnedGrid, tile.GridIndices);
153+
var offsetTile = Vector2.Transform(new Vector2(tileRef.Value.GridIndices.X, tileRef.Value.GridIndices.Y) + sourceGrid.TileSizeHalfVector, matrix)
154+
.Floored();
155+
if (_roofSystem.IsRooved(spawnedRoof, tileRef.Value.GridIndices))
156+
{
157+
_roofSystem.SetRoof(roofMap, offsetTile, true);
158+
tilesToRoof.Add(offsetTile);
159+
}
140160

141-
// Convert to local coordinates in lavaland grid
142-
var lavalandTileIndices = _map.WorldToTile(sourceGridUid, sourceGrid, tileWorldPos);
161+
if(tileRef.Value.Tile != Tile.Empty)
162+
continue;
143163

144-
// Get tile from lavaland grid at this position
145-
if (_map.TryGetTileRef(sourceGridUid, sourceGrid, lavalandTileIndices, out var lavalandTile) &&
164+
if (_map.TryGetTileRef(sourceGridUid, sourceGrid, offsetTile, out var lavalandTile) &&
146165
!lavalandTile.Tile.IsEmpty)
147166
{
148-
_map.SetTile(spawned.Value, spawnedGrid, tile.GridIndices, lavalandTile.Tile);
167+
_map.SetTile(spawned.Value, spawnedGrid, offsetTile, lavalandTile.Tile);
149168
}
150169
}
151170
}
152171

153-
_gridFixture.Merge(sourceGridUid, spawned.Value, offset, rotation);
172+
_gridFixture.Merge(sourceGridUid, spawned.Value, matrix);
173+
174+
foreach (var vector2I in tilesToRoof)
175+
{
176+
_roofSystem.SetRoof(roofMap, vector2I, true);
177+
}
154178
}
155179
catch (Exception ex)
156180
{

Content.Server/_Lavaland/Procedural/Systems/LavalandPlanetSystem.cs

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
using Content.Shared._Lavaland.Procedural.Components;
1313
using Content.Shared._Lavaland.Procedural.Prototypes;
1414
using Content.Shared.Atmos;
15+
using Content.Shared.Atmos.Components;
1516
using Content.Shared.CCVar;
1617
using Content.Shared.GameTicking;
1718
using Content.Shared.Gravity;
@@ -157,6 +158,17 @@ public bool SetupLavalandPlanet(
157158
return false;
158159
}
159160

161+
{
162+
var moles = new float[Atmospherics.AdjustedNumberOfGases];
163+
moles[(int)Gas.Oxygen] = 21.824779f;
164+
moles[(int)Gas.Nitrogen] = 82.10312f;
165+
166+
var mixture = new GasMixture(moles, Atmospherics.T20C);
167+
_atmos.SetMapAtmosphere(preloader.Value, false, mixture);
168+
}
169+
170+
171+
160172
// Basic setup.
161173
var lavalandMap = _map.CreateMap(out var lavalandMapId, runMapInit: false);
162174
var mapComp = EnsureComp<LavalandMapComponent>(lavalandMap);
@@ -199,12 +211,16 @@ public bool SetupLavalandPlanet(
199211
_shuttle.AddIFFFlag(grid, flag);
200212
}
201213

214+
QueueDel(preloader.Value);
215+
202216
// Start!!1!!!
203217
_map.InitializeMap(lavalandMapId);
204218

205219
// also preload the planet itself
206220
_biome.Preload(lavalandMap, Comp<BiomeComponent>(lavalandMap), loadBox);
207221

222+
//_atmos.RebuildGridTiles((lavalandMap, gridAtmos, Comp<GasTileOverlayComponent>(lavalandMap), Comp<MapGridComponent>(lavalandMap), Transform(lavalandMap)));
223+
208224
// Finally add destination
209225
var dest = AddComp<FTLDestinationComponent>(lavalandMap);
210226
dest.Whitelist = prototype.ShuttleWhitelist;
@@ -239,8 +255,7 @@ private void PlanetBasicSetup(EntityUid lavalandMap, LavalandMapPrototype protot
239255
var moles = new float[Atmospherics.AdjustedNumberOfGases];
240256
air.CopyTo(moles, 0);
241257

242-
var atmos = EnsureComp<MapAtmosphereComponent>(lavalandMap);
243-
_atmos.SetMapGasMixture(lavalandMap, new GasMixture(moles, prototype.Temperature), atmos);
258+
_atmos.SetMapAtmosphere(lavalandMap, false, new GasMixture(moles, prototype.Temperature));
244259

245260
// Restricted Range
246261
var restricted = new RestrictedRangeComponent

Content.Server/_Lavaland/Weather/LavalandWeatherSystem.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System.Threading;
22
using System.Threading.Tasks;
33
using Content.Server._Lavaland.Procedural.Components;
4+
using Content.Server.Light.EntitySystems;
45
using Content.Server.Temperature.Systems;
56
using Content.Server.Weather;
67
using Content.Shared._Lavaland.Procedural.Components;
@@ -9,9 +10,12 @@
910
using Content.Shared.Damage.Components;
1011
using Content.Shared.Damage.Systems;
1112
using Content.Shared.Humanoid;
13+
using Content.Shared.Light.Components;
1214
using Content.Shared.Popups;
1315
using Robust.Shared.CPUJob.JobQueues;
1416
using Robust.Shared.CPUJob.JobQueues.Queues;
17+
using Robust.Shared.Map;
18+
using Robust.Shared.Map.Components;
1519
using Robust.Shared.Prototypes;
1620
using Robust.Shared.Random;
1721

@@ -25,6 +29,10 @@ public sealed class LavalandWeatherSystem : EntitySystem
2529
[Dependency] private readonly IPrototypeManager _proto = default!;
2630
[Dependency] private readonly TemperatureSystem _temperature = default!;
2731
[Dependency] private readonly DamageableSystem _damage = default!;
32+
[Dependency] private readonly RoofSystem _roof = default!;
33+
[Dependency] private readonly IMapManager _mapManager = default!;
34+
[Dependency] private readonly SharedTransformSystem _transform = default!;
35+
[Dependency] private readonly SharedMapSystem _mapSystem = default!;
2836

2937
private const double LavalandWeatherJobTime = 0.005;
3038
private readonly JobQueue _lavalandWeatherJobQueue = new(LavalandWeatherJobTime);
@@ -52,6 +60,16 @@ private void ProcessLavalandDamage(Entity<DamageableComponent> entity, Entity<La
5260
if (xform.GridUid != lavaland.Owner)
5361
return;
5462

63+
64+
if (
65+
_mapSystem.TryGetTileRef(lavaland.Owner, Comp<MapGridComponent>(lavaland.Owner), xform.Coordinates, out var tile) &&
66+
_roof.IsRooved(
67+
(lavaland.Owner, Comp<MapGridComponent>(lavaland.Owner), Comp<RoofComponent>(lavaland.Owner)),
68+
tile.GridIndices))
69+
{
70+
return;
71+
}
72+
5573
var proto = _proto.Index(lavaland.Comp.CurrentWeather);
5674
_temperature.ChangeHeat(entity, proto.TemperatureChange, ignoreHeatResistance: true);
5775
_damage.ChangeDamage(entity.AsNullable(), proto.Damage);

Resources/Maps/Backmen/Lavaland/InteQ_Sizo.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
meta:
22
format: 7
33
category: Grid
4-
engineVersion: 270.1.0
4+
engineVersion: 271.1.0
55
forkId: ""
66
forkVersion: ""
7-
time: 01/05/2026 13:54:44
7+
time: 01/22/2026 16:13:54
88
entityCount: 4368
99
maps: []
1010
grids:

Resources/Maps/Backmen/Lavaland/ZENoblomMet2.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
meta:
22
format: 7
33
category: Grid
4-
engineVersion: 270.1.0
4+
engineVersion: 271.1.0
55
forkId: ""
66
forkVersion: ""
7-
time: 01/05/2026 13:54:46
7+
time: 01/22/2026 16:19:51
88
entityCount: 584
99
maps: []
1010
grids:

Resources/Maps/Backmen/Lavaland/ZENrndOblom.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
meta:
22
format: 7
33
category: Grid
4-
engineVersion: 270.1.0
4+
engineVersion: 271.1.0
55
forkId: ""
66
forkVersion: ""
7-
time: 01/05/2026 13:54:47
7+
time: 01/22/2026 16:21:33
88
entityCount: 630
99
maps: []
1010
grids:

Resources/Maps/Backmen/Lavaland/ZENshuttle1.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
meta:
22
format: 7
33
category: Grid
4-
engineVersion: 270.1.0
4+
engineVersion: 271.1.0
55
forkId: ""
66
forkVersion: ""
7-
time: 01/05/2026 13:54:47
7+
time: 01/22/2026 16:22:22
88
entityCount: 171
99
maps: []
1010
grids:
@@ -123,10 +123,10 @@ entities:
123123
- type: RadiationGridResistance
124124
- type: Roof
125125
data:
126-
-1,0: 552448594160
127-
-1,-1: 11583469899732746240
128-
0,0: 64678215551
129-
0,-1: 8102028708582719488
126+
-1,0: 9259612768512831728
127+
-1,-1: 16204198715190181888
128+
0,0: 1085120253746167679
129+
0,-1: 9187131305196719872
130130
- type: ExplosionAirtightGrid
131131
- proto: ADTHyperNobliumCanisterBroken
132132
entities:

Resources/Maps/Backmen/Lavaland/ZENtelega2.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
meta:
22
format: 7
33
category: Grid
4-
engineVersion: 270.1.0
4+
engineVersion: 271.1.0
55
forkId: ""
66
forkVersion: ""
7-
time: 01/05/2026 13:54:47
7+
time: 01/22/2026 16:23:04
88
entityCount: 60
99
maps: []
1010
grids:

0 commit comments

Comments
 (0)