diff --git a/Content.Server/Shuttles/Systems/ArrivalsSystem.cs b/Content.Server/Shuttles/Systems/ArrivalsSystem.cs index 90e1662d37..ac03a17325 100644 --- a/Content.Server/Shuttles/Systems/ArrivalsSystem.cs +++ b/Content.Server/Shuttles/Systems/ArrivalsSystem.cs @@ -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 /// private const float RoundStartFTLDuration = 10f; - private readonly List> _arrivalsBiomeOptions = new() - { - "Grasslands", - "LowDesert", - "Snow", - }; - public override void Initialize() { base.Initialize(); @@ -543,7 +536,9 @@ public sealed class ArrivalsSystem : EntitySystem var shuttleComp = Comp(shuttleUids[0]); var arrivalsComp = EnsureComp(shuttleUids[0]); arrivalsComp.Station = uid; - EnsureComp(uid); + EnsureComp(shuttleUids[0]); // Sunrise-Edit + EnsureComp(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)); diff --git a/Content.Server/Shuttles/Systems/EmergencyShuttleSystem.cs b/Content.Server/Shuttles/Systems/EmergencyShuttleSystem.cs index f7a4929e57..52de838826 100644 --- a/Content.Server/Shuttles/Systems/EmergencyShuttleSystem.cs +++ b/Content.Server/Shuttles/Systems/EmergencyShuttleSystem.cs @@ -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(uids[0]); EnsureComp(uids[0]); // Sunrise-Edit + EnsureComp(uids[0]); // Sunrise-Edit + EnsureComp(uids[0]); // Sunrise-Edit var template = _random.Pick(component.Biomes); _biomes.EnsurePlanet(mapUid, _protoManager.Index(template), mapLight: component.PlanetLightColor); diff --git a/Content.Server/_Sunrise/DontSellingGrid/DontSellingGridComponent.cs b/Content.Server/_Sunrise/DontSellingGrid/DontSellingGridComponent.cs new file mode 100644 index 0000000000..cdb4c5fcc6 --- /dev/null +++ b/Content.Server/_Sunrise/DontSellingGrid/DontSellingGridComponent.cs @@ -0,0 +1,10 @@ +namespace Content.Server._Sunrise.DontSellingGrid; + +/// +/// +/// +[RegisterComponent] +public sealed partial class DontSellingGridComponent : Component +{ + +} diff --git a/Content.Server/_Sunrise/DontSellingGrid/DontSellingGridSystems.cs b/Content.Server/_Sunrise/DontSellingGrid/DontSellingGridSystems.cs new file mode 100644 index 0000000000..6fa3556975 --- /dev/null +++ b/Content.Server/_Sunrise/DontSellingGrid/DontSellingGridSystems.cs @@ -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 _priseQuery; + + public override void Initialize() + { + base.Initialize(); + SubscribeLocalEvent(OnStartup); + SubscribeLocalEvent(OnPostInit); + SubscribeLocalEvent(OnPlayerSpawning); + + _priseQuery = GetEntityQuery(); + } + + private void OnStartup(EntityUid uid, DontSellingGridComponent component, ref ComponentStartup args) + { + var entities = new HashSet>(); + _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(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(ev.Station)) + return; + + var entities = new HashSet>(); + _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(gridUid); + } + } +} diff --git a/Content.Server/_Sunrise/DontSellingGrid/StationDontSellingComponent.cs b/Content.Server/_Sunrise/DontSellingGrid/StationDontSellingComponent.cs new file mode 100644 index 0000000000..6b37844c84 --- /dev/null +++ b/Content.Server/_Sunrise/DontSellingGrid/StationDontSellingComponent.cs @@ -0,0 +1,10 @@ +namespace Content.Server._Sunrise.DontSellingGrid; + +/// +/// +/// +[RegisterComponent] +public sealed partial class StationDontSellingGridComponent : Component +{ + +} diff --git a/Content.Server/_Sunrise/ImmortalGrid/ImmortalGridComponent.cs b/Content.Server/_Sunrise/ImmortalGrid/ImmortalGridComponent.cs new file mode 100644 index 0000000000..3bbbb2eb1e --- /dev/null +++ b/Content.Server/_Sunrise/ImmortalGrid/ImmortalGridComponent.cs @@ -0,0 +1,10 @@ +namespace Content.Server._Sunrise.ImmortalGrid; + +/// +/// +/// +[RegisterComponent] +public sealed partial class ImmortalGridComponent : Component +{ + +} diff --git a/Content.Server/_Sunrise/ImmortalGrid/ImmortalGridSystems.cs b/Content.Server/_Sunrise/ImmortalGrid/ImmortalGridSystems.cs new file mode 100644 index 0000000000..9c27bff9ce --- /dev/null +++ b/Content.Server/_Sunrise/ImmortalGrid/ImmortalGridSystems.cs @@ -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(OnStartup); + SubscribeLocalEvent(OnPostInit); + } + + private void OnPostInit(EntityUid uid, StationImmortalComponent component, ref StationPostInitEvent args) + { + foreach (var gridUid in args.Station.Comp.Grids) + { + AddComp(gridUid); + } + } + + private void OnStartup(EntityUid uid, ImmortalGridComponent component, ref ComponentStartup args) + { + EnsureComp(uid); + + var entities = new HashSet>(); + _lookup.GetChildEntities(uid, entities); + + foreach (var entityUid in entities) + { + EnsureComp(entityUid); + EnsureComp(entityUid); + } + } +} diff --git a/Content.Server/_Sunrise/ImmortalGrid/StationImmortalComponent.cs b/Content.Server/_Sunrise/ImmortalGrid/StationImmortalComponent.cs new file mode 100644 index 0000000000..608e2a0fdc --- /dev/null +++ b/Content.Server/_Sunrise/ImmortalGrid/StationImmortalComponent.cs @@ -0,0 +1,10 @@ +namespace Content.Server._Sunrise.ImmortalGrid; + +/// +/// +/// +[RegisterComponent] +public sealed partial class StationImmortalComponent : Component +{ + +} diff --git a/Content.Shared/Tools/Systems/SharedToolSystem.cs b/Content.Shared/Tools/Systems/SharedToolSystem.cs index 72e984fd82..60ffb2f060 100644 --- a/Content.Shared/Tools/Systems/SharedToolSystem.cs +++ b/Content.Shared/Tools/Systems/SharedToolSystem.cs @@ -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(GetEntity(args.OriginalTarget.Value))) + return; + // Sunrise-End RaiseLocalEvent(GetEntity(args.OriginalTarget.Value), (object) ev); + } else RaiseLocalEvent((object) ev); } diff --git a/Content.Shared/_Sunrise/BlockedTool/BlockedToolComponent.cs b/Content.Shared/_Sunrise/BlockedTool/BlockedToolComponent.cs new file mode 100644 index 0000000000..004298151e --- /dev/null +++ b/Content.Shared/_Sunrise/BlockedTool/BlockedToolComponent.cs @@ -0,0 +1,10 @@ +namespace Content.Shared._Sunrise.BlockedTool; + +/// +/// Я думаю здесь всё ясно +/// +[RegisterComponent] +public sealed partial class BlockedToolComponent : Component +{ + +} diff --git a/Resources/Prototypes/Entities/Stations/base.yml b/Resources/Prototypes/Entities/Stations/base.yml index 686c8e8f70..a7e1fb6959 100644 --- a/Resources/Prototypes/Entities/Stations/base.yml +++ b/Resources/Prototypes/Entities/Stations/base.yml @@ -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 diff --git a/Resources/Prototypes/Entities/Stations/nanotrasen.yml b/Resources/Prototypes/Entities/Stations/nanotrasen.yml index a63df3dd63..d0a7b8fe1d 100644 --- a/Resources/Prototypes/Entities/Stations/nanotrasen.yml +++ b/Resources/Prototypes/Entities/Stations/nanotrasen.yml @@ -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