Skip to content
This repository has been archived by the owner on Nov 1, 2024. It is now read-only.

Commit

Permalink
Space VGRoids support (new-frontiers-14#2334)
Browse files Browse the repository at this point in the history
* Fix older files

* Restore code to support vg roids

* Update RoomFillComponent.cs

* Update base.yml

* Fix unused BaseStationShuttles from outpost

* SpawnableFrontierOutpost<RecordsFrontierOutpost

---------

Co-authored-by: Whatstone <[email protected]>
  • Loading branch information
dvir001 and whatston3 authored Oct 26, 2024
1 parent 3be4d61 commit 1cf18c1
Show file tree
Hide file tree
Showing 17 changed files with 3,125 additions and 341 deletions.
37 changes: 37 additions & 0 deletions Content.Server/Procedural/RoomFillComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using Content.Shared.Procedural;
using Content.Shared.Whitelist;
using Robust.Shared.Prototypes;

namespace Content.Server.Procedural;

/// <summary>
/// Marker that indicates the specified room prototype should occupy this space.
/// </summary>
[RegisterComponent]
public sealed partial class RoomFillComponent : Component
{
/// <summary>
/// Are we allowed to rotate room templates?
/// If the room is not a square this will only do 180 degree rotations.
/// </summary>
[DataField]
public bool Rotation = true;

/// <summary>
/// Size of the room to fill.
/// </summary>
[DataField(required: true)]
public Vector2i Size;

/// <summary>
/// Rooms allowed for the marker.
/// </summary>
[DataField]
public EntityWhitelist? RoomWhitelist;

/// <summary>
/// Should any existing entities / decals be bulldozed first.
/// </summary>
[DataField]
public bool ClearExisting;
}
51 changes: 51 additions & 0 deletions Content.Server/Procedural/RoomFillSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
using Robust.Shared.Map.Components;

namespace Content.Server.Procedural;

public sealed class RoomFillSystem : EntitySystem
{
[Dependency] private readonly DungeonSystem _dungeon = default!;
[Dependency] private readonly SharedMapSystem _maps = default!;

public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<RoomFillComponent, MapInitEvent>(OnRoomFillMapInit);
}

private void OnRoomFillMapInit(EntityUid uid, RoomFillComponent component, MapInitEvent args)
{
// Just test things.
if (component.Size == Vector2i.Zero)
return;

var xform = Transform(uid);

if (xform.GridUid != null)
{
var random = new Random();
var room = _dungeon.GetRoomPrototype(component.Size, random, component.RoomWhitelist);

if (room != null)
{
var mapGrid = Comp<MapGridComponent>(xform.GridUid.Value);
_dungeon.SpawnRoom(
xform.GridUid.Value,
mapGrid,
_maps.LocalToTile(xform.GridUid.Value, mapGrid, xform.Coordinates),
room,
random,
null,
clearExisting: component.ClearExisting,
rotation: component.Rotation);
}
else
{
Log.Error($"Unable to find matching room prototype for {ToPrettyString(uid)}");
}
}

// Final cleanup
QueueDel(uid);
}
}
2,363 changes: 2,363 additions & 0 deletions Resources/Maps/_NF/Dungeon/vgroidinterior.yml

Large diffs are not rendered by default.

26 changes: 13 additions & 13 deletions Resources/Prototypes/Entities/Markers/rooms.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# - type: entity
# id: BaseRoomMarker
# name: Room marker
# parent: MarkerBase
# suffix: Weh
# components:
# - type: RoomFill
# size: 5,5
# - type: Sprite
# layers:
# - state: red
# - sprite: Mobs/Aliens/elemental.rsi
# state: alive
- type: entity
id: BaseRoomMarker
name: Room marker
parent: MarkerBase
suffix: Weh
components:
- type: RoomFill
size: 5,5
- type: Sprite
layers:
- state: red
- sprite: Mobs/Aliens/elemental.rsi
state: alive
6 changes: 3 additions & 3 deletions Resources/Prototypes/Entities/Stations/base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@
- type: Gravity
enabled: true
inherent: true
# protos: # Frontier: VGRoid prototype removed for now
# - VGRoid # Frontier: VGRoid prototype removed for now
protos:
- VGRoid

- type: entity
id: BaseStationCentcomm
Expand Down Expand Up @@ -129,4 +129,4 @@
id: BaseStationAllEventsEligible
abstract: true
components:
- type: StationEventEligible # For when someone makes this more granular in the future.
- type: StationEventEligible # For when someone makes this more granular in the future.
186 changes: 93 additions & 93 deletions Resources/Prototypes/Procedural/Themes/vgroidinterior.yml
Original file line number Diff line number Diff line change
@@ -1,105 +1,105 @@
# - type: dungeonRoom
# id: VGRoidInterior5x5a
# size: 5,5
# atlas: /Maps/Dungeon/vgroidinterior.yml
# offset: 0,0
# tags:
# - VGRoidInterior
- type: dungeonRoom
id: VGRoidInterior5x5a
size: 5,5
atlas: /Maps/Dungeon/vgroidinterior.yml
offset: 0,0
tags:
- VGRoidInterior

# - type: dungeonRoom
# id: VGRoidInterior5x5b
# size: 5,5
# atlas: /Maps/Dungeon/vgroidinterior.yml
# offset: 6,0
# tags:
# - VGRoidInterior
- type: dungeonRoom
id: VGRoidInterior5x5b
size: 5,5
atlas: /Maps/Dungeon/vgroidinterior.yml
offset: 6,0
tags:
- VGRoidInterior

# - type: dungeonRoom
# id: VGRoidInterior5x5c
# size: 5,5
# atlas: /Maps/Dungeon/vgroidinterior.yml
# offset: 12,0
# tags:
# - VGRoidInterior
- type: dungeonRoom
id: VGRoidInterior5x5c
size: 5,5
atlas: /Maps/Dungeon/vgroidinterior.yml
offset: 12,0
tags:
- VGRoidInterior

# - type: dungeonRoom
# id: VGRoidInterior5x5d
# size: 5,5
# atlas: /Maps/Dungeon/vgroidinterior.yml
# offset: 18,0
# tags:
# - VGRoidInterior
- type: dungeonRoom
id: VGRoidInterior5x5d
size: 5,5
atlas: /Maps/Dungeon/vgroidinterior.yml
offset: 18,0
tags:
- VGRoidInterior

# - type: dungeonRoom
# id: VGRoidInterior5x5e
# size: 5,5
# atlas: /Maps/Dungeon/vgroidinterior.yml
# offset: 0,6
# tags:
# - VGRoidInterior
- type: dungeonRoom
id: VGRoidInterior5x5e
size: 5,5
atlas: /Maps/Dungeon/vgroidinterior.yml
offset: 0,6
tags:
- VGRoidInterior

# - type: dungeonRoom
# id: VGRoidInterior5x5f
# size: 5,5
# atlas: /Maps/Dungeon/vgroidinterior.yml
# offset: 6,6
# tags:
# - VGRoidInterior
- type: dungeonRoom
id: VGRoidInterior5x5f
size: 5,5
atlas: /Maps/Dungeon/vgroidinterior.yml
offset: 6,6
tags:
- VGRoidInterior

# - type: dungeonRoom
# id: VGRoidInterior5x5g
# size: 5,5
# atlas: /Maps/Dungeon/vgroidinterior.yml
# offset: 12,6
# tags:
# - VGRoidInterior
- type: dungeonRoom
id: VGRoidInterior5x5g
size: 5,5
atlas: /Maps/Dungeon/vgroidinterior.yml
offset: 12,6
tags:
- VGRoidInterior

# - type: dungeonRoom
# id: VGRoidInterior5x5h
# size: 5,5
# atlas: /Maps/Dungeon/vgroidinterior.yml
# offset: 18,6
# tags:
# - VGRoidInterior
- type: dungeonRoom
id: VGRoidInterior5x5h
size: 5,5
atlas: /Maps/Dungeon/vgroidinterior.yml
offset: 18,6
tags:
- VGRoidInterior

# - type: dungeonRoom
# id: VGRoidInterior5x5i
# size: 5,5
# atlas: /Maps/Dungeon/vgroidinterior.yml
# offset: 0,12
# tags:
# - VGRoidInterior
- type: dungeonRoom
id: VGRoidInterior5x5i
size: 5,5
atlas: /Maps/Dungeon/vgroidinterior.yml
offset: 0,12
tags:
- VGRoidInterior

# - type: dungeonRoom
# id: VGRoidInterior5x5j
# size: 5,5
# atlas: /Maps/Dungeon/vgroidinterior.yml
# offset: 6,12
# tags:
# - VGRoidInterior
- type: dungeonRoom
id: VGRoidInterior5x5j
size: 5,5
atlas: /Maps/Dungeon/vgroidinterior.yml
offset: 6,12
tags:
- VGRoidInterior

# - type: dungeonRoom
# id: VGRoidInterior5x5k
# size: 5,5
# atlas: /Maps/Dungeon/vgroidinterior.yml
# offset: 12,12
# tags:
# - VGRoidInterior
- type: dungeonRoom
id: VGRoidInterior5x5k
size: 5,5
atlas: /Maps/Dungeon/vgroidinterior.yml
offset: 12,12
tags:
- VGRoidInterior

# - type: dungeonRoom
# id: VGRoidInterior5x5l
# size: 5,5
# atlas: /Maps/Dungeon/vgroidinterior.yml
# offset: 18,12
# tags:
# - VGRoidInterior
- type: dungeonRoom
id: VGRoidInterior5x5l
size: 5,5
atlas: /Maps/Dungeon/vgroidinterior.yml
offset: 18,12
tags:
- VGRoidInterior

# - type: entity
# id: VGRoidInteriorRoomMarker
# parent: BaseRoomMarker
# name: VGRoid interior marker
# components:
# - type: RoomFill
# roomWhitelist:
# tags:
# - VGRoidInterior
- type: entity
id: VGRoidInteriorRoomMarker
parent: BaseRoomMarker
name: VGRoid interior marker
components:
- type: RoomFill
roomWhitelist:
tags:
- VGRoidInterior
Loading

0 comments on commit 1cf18c1

Please sign in to comment.