Прибытие и ЦК теперь нельзя сломать и предметы на них ничего не стоят.
This commit is contained in:
parent
9fc63735af
commit
4fd9a62618
12 changed files with 200 additions and 13 deletions
|
|
@ -1,5 +1,7 @@
|
|||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using Content.Server._Sunrise.DontSellingGrid;
|
||||
using Content.Server._Sunrise.ImmortalGrid;
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.DeviceNetwork.Components;
|
||||
using Content.Server.DeviceNetwork.Systems;
|
||||
|
|
@ -43,9 +45,7 @@ public sealed class ArrivalsSystem : EntitySystem
|
|||
[Dependency] private readonly IConsoleHost _console = default!;
|
||||
[Dependency] private readonly IGameTiming _timing = default!;
|
||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||
[Dependency] private readonly IPrototypeManager _protoManager = default!;
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
[Dependency] private readonly BiomeSystem _biomes = default!;
|
||||
[Dependency] private readonly GameTicker _ticker = default!;
|
||||
[Dependency] private readonly MapLoaderSystem _loader = default!;
|
||||
[Dependency] private readonly DeviceNetworkSystem _deviceNetworkSystem = default!;
|
||||
|
|
@ -68,13 +68,6 @@ public sealed class ArrivalsSystem : EntitySystem
|
|||
/// </summary>
|
||||
private const float RoundStartFTLDuration = 10f;
|
||||
|
||||
private readonly List<ProtoId<BiomeTemplatePrototype>> _arrivalsBiomeOptions = new()
|
||||
{
|
||||
"Grasslands",
|
||||
"LowDesert",
|
||||
"Snow",
|
||||
};
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
|
@ -543,7 +536,9 @@ public sealed class ArrivalsSystem : EntitySystem
|
|||
var shuttleComp = Comp<ShuttleComponent>(shuttleUids[0]);
|
||||
var arrivalsComp = EnsureComp<ArrivalsShuttleComponent>(shuttleUids[0]);
|
||||
arrivalsComp.Station = uid;
|
||||
EnsureComp<ProtectedGridComponent>(uid);
|
||||
EnsureComp<ImmortalGridComponent>(shuttleUids[0]); // Sunrise-Edit
|
||||
EnsureComp<DontSellingGridComponent>(shuttleUids[0]); // Sunrise-Edit
|
||||
|
||||
var target = destination == Destination.Station ? uid : arrivals;
|
||||
_shuttles.FTLToDock(shuttleUids[0], shuttleComp, target, hyperspaceTime: RoundStartFTLDuration, priorityTag: "DockArrivals");
|
||||
arrivalsComp.NextTransfer = _timing.CurTime + TimeSpan.FromSeconds(_cfgManager.GetCVar(CCVars.ArrivalsCooldown));
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
using System.Numerics;
|
||||
using System.Threading;
|
||||
using Content.Server._Sunrise.DontSellingGrid;
|
||||
using Content.Server._Sunrise.ImmortalGrid;
|
||||
using Content.Server._Sunrise.TransitHub;
|
||||
using Content.Server.Access.Systems;
|
||||
using Content.Server.Administration.Logs;
|
||||
|
|
@ -130,10 +132,10 @@ public sealed partial class EmergencyShuttleSystem : EntitySystem
|
|||
|
||||
private void OnCentcommShutdown(EntityUid uid, StationTransitHubComponent component, ComponentShutdown args) // Sunrise-Edit
|
||||
{
|
||||
ClearCentcomm(component);
|
||||
ClearTransitHub(component);
|
||||
}
|
||||
|
||||
private void ClearCentcomm(StationTransitHubComponent component) // Sunrise-Edit
|
||||
private void ClearTransitHub(StationTransitHubComponent component) // Sunrise-Edit
|
||||
{
|
||||
QueueDel(component.Entity);
|
||||
QueueDel(component.MapEntity);
|
||||
|
|
@ -441,7 +443,7 @@ public sealed partial class EmergencyShuttleSystem : EntitySystem
|
|||
if (!Exists(otherComp.MapEntity) || !Exists(otherComp.Entity))
|
||||
{
|
||||
Log.Error($"Discovered invalid centcomm component?");
|
||||
ClearCentcomm(otherComp);
|
||||
ClearTransitHub(otherComp);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -472,6 +474,8 @@ public sealed partial class EmergencyShuttleSystem : EntitySystem
|
|||
|
||||
EnsureComp<ProtectedGridComponent>(uids[0]);
|
||||
EnsureComp<ArrivalsSourceComponent>(uids[0]); // Sunrise-Edit
|
||||
EnsureComp<ImmortalGridComponent>(uids[0]); // Sunrise-Edit
|
||||
EnsureComp<DontSellingGridComponent>(uids[0]); // Sunrise-Edit
|
||||
|
||||
var template = _random.Pick(component.Biomes);
|
||||
_biomes.EnsurePlanet(mapUid, _protoManager.Index<BiomeTemplatePrototype>(template), mapLight: component.PlanetLightColor);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,10 @@
|
|||
namespace Content.Server._Sunrise.DontSellingGrid;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
public sealed partial class DontSellingGridComponent : Component
|
||||
{
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
using Content.Server.Cargo.Components;
|
||||
using Content.Server.GameTicking;
|
||||
using Content.Server.Station.Events;
|
||||
using Robust.Shared.Containers;
|
||||
|
||||
namespace Content.Server._Sunrise.DontSellingGrid;
|
||||
|
||||
public sealed class StationDontSellingSystems : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly EntityLookupSystem _lookup = default!;
|
||||
private EntityQuery<StaticPriceComponent> _priseQuery;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
SubscribeLocalEvent<DontSellingGridComponent, ComponentStartup>(OnStartup);
|
||||
SubscribeLocalEvent<StationDontSellingGridComponent, StationPostInitEvent>(OnPostInit);
|
||||
SubscribeLocalEvent<PlayerSpawnCompleteEvent>(OnPlayerSpawning);
|
||||
|
||||
_priseQuery = GetEntityQuery<StaticPriceComponent>();
|
||||
}
|
||||
|
||||
private void OnStartup(EntityUid uid, DontSellingGridComponent component, ref ComponentStartup args)
|
||||
{
|
||||
var entities = new HashSet<Entity<StaticPriceComponent>>();
|
||||
_lookup.GetChildEntities(uid, entities);
|
||||
|
||||
foreach (var entityUid in entities)
|
||||
{
|
||||
DepreciatePrice(entityUid);
|
||||
}
|
||||
}
|
||||
|
||||
private void DepreciatePrice(EntityUid uid)
|
||||
{
|
||||
if (_priseQuery.TryGetComponent(uid, out var priceComponent))
|
||||
priceComponent.Price = 0;
|
||||
|
||||
if (!TryComp<ContainerManagerComponent>(uid, out var containers))
|
||||
return;
|
||||
|
||||
foreach (var container in containers.Containers.Values)
|
||||
{
|
||||
foreach (var ent in container.ContainedEntities)
|
||||
{
|
||||
DepreciatePrice(ent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnPlayerSpawning(PlayerSpawnCompleteEvent ev)
|
||||
{
|
||||
if (!HasComp<StationDontSellingGridComponent>(ev.Station))
|
||||
return;
|
||||
|
||||
var entities = new HashSet<Entity<StaticPriceComponent>>();
|
||||
_lookup.GetChildEntities(ev.Mob, entities);
|
||||
|
||||
foreach (var entityUid in entities)
|
||||
{
|
||||
DepreciatePrice(entityUid);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnPostInit(EntityUid uid, StationDontSellingGridComponent component, ref StationPostInitEvent args)
|
||||
{
|
||||
foreach (var gridUid in args.Station.Comp.Grids)
|
||||
{
|
||||
AddComp<DontSellingGridComponent>(gridUid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
namespace Content.Server._Sunrise.DontSellingGrid;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
public sealed partial class StationDontSellingGridComponent : Component
|
||||
{
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
namespace Content.Server._Sunrise.ImmortalGrid;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
public sealed partial class ImmortalGridComponent : Component
|
||||
{
|
||||
|
||||
}
|
||||
40
Content.Server/_Sunrise/ImmortalGrid/ImmortalGridSystems.cs
Normal file
40
Content.Server/_Sunrise/ImmortalGrid/ImmortalGridSystems.cs
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
using Content.Server.Station.Events;
|
||||
using Content.Shared._Sunrise.BlockedTool;
|
||||
using Content.Shared.Damage.Components;
|
||||
using Content.Shared.Tiles;
|
||||
|
||||
namespace Content.Server._Sunrise.ImmortalGrid;
|
||||
|
||||
public sealed class ImmortalGridSystems : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly EntityLookupSystem _lookup = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
SubscribeLocalEvent<ImmortalGridComponent, ComponentStartup>(OnStartup);
|
||||
SubscribeLocalEvent<StationImmortalComponent, StationPostInitEvent>(OnPostInit);
|
||||
}
|
||||
|
||||
private void OnPostInit(EntityUid uid, StationImmortalComponent component, ref StationPostInitEvent args)
|
||||
{
|
||||
foreach (var gridUid in args.Station.Comp.Grids)
|
||||
{
|
||||
AddComp<ImmortalGridComponent>(gridUid);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnStartup(EntityUid uid, ImmortalGridComponent component, ref ComponentStartup args)
|
||||
{
|
||||
EnsureComp<ProtectedGridComponent>(uid);
|
||||
|
||||
var entities = new HashSet<Entity<TransformComponent>>();
|
||||
_lookup.GetChildEntities(uid, entities);
|
||||
|
||||
foreach (var entityUid in entities)
|
||||
{
|
||||
EnsureComp<GodmodeComponent>(entityUid);
|
||||
EnsureComp<BlockedToolComponent>(entityUid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
namespace Content.Server._Sunrise.ImmortalGrid;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
public sealed partial class StationImmortalComponent : Component
|
||||
{
|
||||
|
||||
}
|
||||
|
|
@ -12,6 +12,7 @@ using Robust.Shared.Map;
|
|||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Utility;
|
||||
using BlockedToolComponent = Content.Shared._Sunrise.BlockedTool.BlockedToolComponent;
|
||||
|
||||
namespace Content.Shared.Tools.Systems;
|
||||
|
||||
|
|
@ -50,7 +51,13 @@ public abstract partial class SharedToolSystem : EntitySystem
|
|||
ev.DoAfter = args.DoAfter;
|
||||
|
||||
if (args.OriginalTarget != null)
|
||||
{
|
||||
// Sunrise-Start
|
||||
if (HasComp<BlockedToolComponent>(GetEntity(args.OriginalTarget.Value)))
|
||||
return;
|
||||
// Sunrise-End
|
||||
RaiseLocalEvent(GetEntity(args.OriginalTarget.Value), (object) ev);
|
||||
}
|
||||
else
|
||||
RaiseLocalEvent((object) ev);
|
||||
}
|
||||
|
|
|
|||
10
Content.Shared/_Sunrise/BlockedTool/BlockedToolComponent.cs
Normal file
10
Content.Shared/_Sunrise/BlockedTool/BlockedToolComponent.cs
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
namespace Content.Shared._Sunrise.BlockedTool;
|
||||
|
||||
/// <summary>
|
||||
/// Я думаю здесь всё ясно
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
public sealed partial class BlockedToolComponent : Component
|
||||
{
|
||||
|
||||
}
|
||||
|
|
@ -147,6 +147,18 @@
|
|||
- CentCommShuttle
|
||||
- ErtShuttle
|
||||
|
||||
- type: entity
|
||||
id: BaseStationImmortal
|
||||
abstract: true
|
||||
components:
|
||||
- type: StationImmortal
|
||||
|
||||
- type: entity
|
||||
id: BaseStationDontSelling
|
||||
abstract: true
|
||||
components:
|
||||
- type: StationDontSellingGrid
|
||||
|
||||
- type: entity
|
||||
id: BaseStationTransitHub
|
||||
abstract: true
|
||||
|
|
|
|||
|
|
@ -26,7 +26,10 @@
|
|||
- BaseStationNanotrasen
|
||||
- BaseRandomStation
|
||||
- BaseStationCentComm
|
||||
# Sunrise-Start
|
||||
- BaseStationTransitHub
|
||||
- BaseStationDontSelling
|
||||
# Sunrise-End
|
||||
noSpawn: true
|
||||
components:
|
||||
- type: Transform
|
||||
|
|
@ -40,7 +43,11 @@
|
|||
- BaseStationRecords
|
||||
- BaseRandomStation
|
||||
- BaseStationJobsSpawning
|
||||
# Sunrise-Start
|
||||
- BaseCentCommShuttles
|
||||
- BaseStationImmortal
|
||||
- BaseStationDontSelling
|
||||
# Sunrise-End
|
||||
noSpawn: true
|
||||
components:
|
||||
- type: Transform
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue