polishing, bugfixing
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
BIN
Resources/Textures/_CP14/Markers/RoomBorders/5x5.rsi/frame.png
Normal file
BIN
Resources/Textures/_CP14/Markers/RoomBorders/5x5.rsi/frame.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 571 B |
@@ -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"
|
||||
}
|
||||
]
|
||||
}
|
||||
BIN
Resources/Textures/_CP14/Markers/RoomBorders/7x7.rsi/frame.png
Normal file
BIN
Resources/Textures/_CP14/Markers/RoomBorders/7x7.rsi/frame.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 787 B |
@@ -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"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -13,6 +13,9 @@
|
||||
{
|
||||
"name": "frame"
|
||||
},
|
||||
{
|
||||
"name": "room"
|
||||
},
|
||||
{
|
||||
"name": "grass"
|
||||
}
|
||||
|
||||
BIN
Resources/Textures/_CP14/Markers/biome.rsi/room.png
Normal file
BIN
Resources/Textures/_CP14/Markers/biome.rsi/room.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 445 B |
Reference in New Issue
Block a user