polishing, bugfixing

This commit is contained in:
Ed
2024-07-17 17:38:00 +03:00
parent 951e553926
commit 7c0c8c5b33
9 changed files with 62 additions and 17 deletions

View File

@@ -118,7 +118,7 @@ public sealed partial class DungeonSystem
// go BRRNNTTT on existing stuff
if (clearExisting)
{
var gridBounds = new Box2(Vector2.Transform(Vector2.Zero, roomTransform), Vector2.Transform(room.Size, roomTransform));
var gridBounds = new Box2(Vector2.Transform(-room.Size/2, roomTransform), Vector2.Transform(room.Size/2, roomTransform)); //CP14 bugfix
_entitySet.Clear();
// Polygon skin moment
gridBounds = gridBounds.Enlarged(-0.05f);

View File

@@ -13,7 +13,6 @@ public sealed class CP14RoomSpawnerSystem : EntitySystem
[Dependency] private readonly IPrototypeManager _proto = default!;
[Dependency] private readonly DungeonSystem _dungeon = default!;
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly TransformSystem _transform = default!;
[Dependency] private readonly SharedMapSystem _maps = default!;
public override void Initialize()
@@ -31,19 +30,23 @@ public sealed class CP14RoomSpawnerSystem : EntitySystem
var roomProto = rooms.Pick(_random);
if (!_proto.TryIndex<DungeonRoomPrototype>(roomProto, out var room))
{
Log.Error($"Unable to find matching room prototype ({room}) for {ToPrettyString(spawner)}");
return;
}
var gridUid = Transform(spawner).GridUid;
if (!TryComp<MapGridComponent>(gridUid, out var gridComp))
return;
var xform = Transform(spawner).Coordinates.Offset(- room.Size / 2);
var random = new Random();
_dungeon.SpawnRoom(
gridUid.Value,
gridComp,
_maps.LocalToTile(gridUid.Value, gridComp, Transform(spawner).Coordinates),
_maps.LocalToTile(gridUid.Value, gridComp, xform),
room,
random,
null,

View File

@@ -1,17 +1,8 @@
- type: weightedRandom
id: CP14RoomSpawnerCaelid
weights:
LavaBrig17x5a: 1
LavaBrig17x5b: 1
LavaBrig7x7a: 1
LavaBrig7x7b: 1
LavaBrig7x7c: 1
LavaBrig7x7d: 1
LavaBrig11x5a: 1
- type: entity
id: CP14BaseRoomSpawner
name: room spawner
abstract: true
description: A marker that creates a random building at the specified location. Warning! Wipes out everything in that location, including agosts!
parent: MarkerBase
placement:
mode: SnapgridCenter
@@ -21,7 +12,27 @@
- type: Clickable
- type: InteractionOutline
- type: Sprite
layers:
- state: green
sprite: _CP14/Markers/biome.rsi
snapCardinals: true
- type: entity
id: CP14RoomSpawnerCaelid7x7
suffix: Caelid Test
parent: CP14BaseRoomSpawner
components:
- type: CP14RoomSpawner
roomsRandom: CP14RoomSpawnerCaelid
roomsRandom: CP14RoomSpawnerCaelid
- type: Sprite
layers:
- state: room
- sprite: _CP14/Markers/RoomBorders/7x7.rsi
state: frame
- type: weightedRandom
id: CP14RoomSpawnerCaelid
weights:
LavaBrig7x7a: 1
LavaBrig7x7b: 1
LavaBrig7x7c: 1
LavaBrig7x7d: 1

Binary file not shown.

After

Width:  |  Height:  |  Size: 571 B

View File

@@ -0,0 +1,14 @@
{
"version": 1,
"license": "CC-BY-SA-3.0",
"copyright": "Created by TheShuEd (Github) for CrystallPunk",
"size": {
"x": 160,
"y": 160
},
"states": [
{
"name": "frame"
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 787 B

View File

@@ -0,0 +1,14 @@
{
"version": 1,
"license": "CC-BY-SA-3.0",
"copyright": "Created by TheShuEd (Github) for CrystallPunk",
"size": {
"x": 224,
"y": 224
},
"states": [
{
"name": "frame"
}
]
}

View File

@@ -13,6 +13,9 @@
{
"name": "frame"
},
{
"name": "room"
},
{
"name": "grass"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 445 B