roof adapt
This commit is contained in:
@@ -17,6 +17,7 @@ public sealed class CP14RoofSystem : EntitySystem
|
||||
private bool _roofVisible = true;
|
||||
public bool DisabledByCommand = false;
|
||||
|
||||
private EntityQuery<MapGridComponent> _gridQuery;
|
||||
private EntityQuery<GhostComponent> _ghostQuery;
|
||||
private EntityQuery<TransformComponent> _xformQuery;
|
||||
|
||||
@@ -36,8 +37,11 @@ public sealed class CP14RoofSystem : EntitySystem
|
||||
|
||||
_ghostQuery = GetEntityQuery<GhostComponent>();
|
||||
_xformQuery = GetEntityQuery<TransformComponent>();
|
||||
_gridQuery = GetEntityQuery<MapGridComponent>();
|
||||
|
||||
SubscribeLocalEvent<CP14RoofComponent, ComponentStartup>(RoofStartup);
|
||||
SubscribeLocalEvent<CP14RoofComponent, ComponentRemove>(RoofRemove);
|
||||
|
||||
SubscribeLocalEvent<GhostComponent, CP14ToggleRoofVisibilityAction>(OnToggleRoof);
|
||||
}
|
||||
|
||||
@@ -95,6 +99,25 @@ public sealed class CP14RoofSystem : EntitySystem
|
||||
return;
|
||||
|
||||
UpdateVisibility(ent, sprite);
|
||||
|
||||
var xform = Transform(ent);
|
||||
|
||||
if (_gridQuery.TryComp(xform.GridUid, out var grid))
|
||||
{
|
||||
var index = _map.LocalToTile(xform.GridUid.Value, grid, xform.Coordinates);
|
||||
_roof.SetRoof((xform.GridUid.Value, grid, null), index, true);
|
||||
}
|
||||
}
|
||||
|
||||
private void RoofRemove(Entity<CP14RoofComponent> ent, ref ComponentRemove args)
|
||||
{
|
||||
var xform = Transform(ent);
|
||||
|
||||
if (_gridQuery.TryComp(xform.GridUid, out var grid))
|
||||
{
|
||||
var index = _map.LocalToTile(xform.GridUid.Value, grid, xform.Coordinates);
|
||||
_roof.SetRoof((xform.GridUid.Value, grid, null), index, false);
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateVisibility(Entity<CP14RoofComponent> ent, SpriteComponent sprite)
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System.Linq;
|
||||
using Content.Server._CP14.Currency;
|
||||
using Content.Server._CP14.RoundRemoveShuttle;
|
||||
using Content.Server.Shuttles.Systems;
|
||||
@@ -13,6 +14,7 @@ using Content.Shared.Storage;
|
||||
using Content.Shared.Storage.EntitySystems;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.EntitySerialization.Systems;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Random;
|
||||
@@ -87,14 +89,13 @@ public sealed partial class CP14CargoSystem : CP14SharedCargoSystem
|
||||
if (!Deleted(station.Comp.Shuttle))
|
||||
return;
|
||||
|
||||
var tradepostMap = _mapManager.CreateMap();
|
||||
|
||||
if (!_loader.TryLoad(tradepostMap, station.Comp.ShuttlePath.ToString(), out var shuttleUids))
|
||||
if (!_loader.TryLoadMap(station.Comp.ShuttlePath, out var tradepostMap, out var shuttleUids))
|
||||
return;
|
||||
|
||||
var shuttle = shuttleUids[0];
|
||||
|
||||
var shuttle = shuttleUids.First();
|
||||
station.Comp.Shuttle = shuttle;
|
||||
station.Comp.TradePostMap = _mapManager.GetMapEntityId(tradepostMap);
|
||||
station.Comp.TradePostMap = _mapManager.GetMapEntityId(tradepostMap.Value.Comp.MapId);
|
||||
var travelingStoreShipComp = EnsureComp<CP14TravelingStoreShipComponent>(station.Comp.Shuttle.Value);
|
||||
travelingStoreShipComp.Station = station;
|
||||
|
||||
|
||||
@@ -5,7 +5,8 @@ using Content.Server.Station.Systems;
|
||||
using Content.Shared.Maps;
|
||||
using Content.Shared.Station.Components;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.Maps;
|
||||
using Robust.Shared.EntitySerialization;
|
||||
using Robust.Shared.EntitySerialization.Systems;
|
||||
using Robust.Shared.Map;
|
||||
|
||||
namespace Content.Server._CP14.ZLevels.EntitySystems;
|
||||
@@ -60,10 +61,9 @@ public sealed partial class CP14StationZLevelsSystem : EntitySystem
|
||||
continue;
|
||||
}
|
||||
|
||||
var path = level.Path.ToString();
|
||||
if (path is null)
|
||||
if (level.Path is null)
|
||||
{
|
||||
Log.Error($"path {path} for CP14StationZLevelsSystem at level {map} don't exist!");
|
||||
Log.Error($"path {level.Path.ToString()} for CP14StationZLevelsSystem at level {map} don't exist!");
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -72,9 +72,8 @@ public sealed partial class CP14StationZLevelsSystem : EntitySystem
|
||||
member.Station = ent;
|
||||
|
||||
Log.Info($"Created map {mapId} for CP14StationZLevelsSystem at level {map}");
|
||||
var options = new MapLoadOptions { LoadMap = true };
|
||||
|
||||
if (!_mapLoader.TryLoad(mapId, path, out var grids, options))
|
||||
if (!_mapLoader.TryLoadMap(level.Path.Value, out var mapEnt, out var grids))
|
||||
{
|
||||
Log.Error($"Failed to load map for CP14StationZLevelsSystem at level {map}!");
|
||||
Del(mapUid);
|
||||
|
||||
@@ -85,6 +85,7 @@ entities:
|
||||
components:
|
||||
- type: MetaData
|
||||
name: grid
|
||||
- type: Roof
|
||||
- type: Transform
|
||||
parent: 1
|
||||
- type: BecomesStation
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
- type: gameMap
|
||||
id: CentComm
|
||||
mapName: 'Central Command'
|
||||
mapPath: /Maps/centcomm.yml
|
||||
minPlayers: 10
|
||||
stations:
|
||||
centcomm:
|
||||
stationProto: NanotrasenCentralCommand
|
||||
components:
|
||||
- type: StationNameSetup
|
||||
mapNameTemplate: '{0} Central Command {1}'
|
||||
nameGenerator:
|
||||
!type:NanotrasenNameGenerator
|
||||
prefixCreator: 'TG'
|
||||
Reference in New Issue
Block a user