From 6bdd27f2e42d09fd3ce11623ed89f54d8331d865 Mon Sep 17 00:00:00 2001
From: Ed <96445749+TheShuEd@users.noreply.github.com>
Date: Mon, 28 Oct 2024 14:13:47 +0300
Subject: [PATCH] map floor occluder sys
---
.../Systems/SharedFloorOcclusionSystem.cs | 4 ++-
.../Movement/CP14FloorOcclusionSystem.Maps.cs | 31 +++++++++++++++++++
.../Movement/CP14MapFloorOccluderComponent.cs | 12 +++++++
Resources/Maps/_CP14/island.yml | 19 ++++++++++++
4 files changed, 65 insertions(+), 1 deletion(-)
create mode 100644 Content.Shared/_CP14/Movement/CP14FloorOcclusionSystem.Maps.cs
create mode 100644 Content.Shared/_CP14/Movement/CP14MapFloorOccluderComponent.cs
diff --git a/Content.Shared/Movement/Systems/SharedFloorOcclusionSystem.cs b/Content.Shared/Movement/Systems/SharedFloorOcclusionSystem.cs
index 6b7023a1c6..c04422bf76 100644
--- a/Content.Shared/Movement/Systems/SharedFloorOcclusionSystem.cs
+++ b/Content.Shared/Movement/Systems/SharedFloorOcclusionSystem.cs
@@ -6,11 +6,13 @@ namespace Content.Shared.Movement.Systems;
///
/// Applies an occlusion shader for any relevant entities.
///
-public abstract class SharedFloorOcclusionSystem : EntitySystem
+public abstract partial class SharedFloorOcclusionSystem : EntitySystem //CP14 partial
{
public override void Initialize()
{
base.Initialize();
+ CP14InitializeMapOccluder(); //CP14
+
SubscribeLocalEvent(OnStartCollide);
SubscribeLocalEvent(OnEndCollide);
}
diff --git a/Content.Shared/_CP14/Movement/CP14FloorOcclusionSystem.Maps.cs b/Content.Shared/_CP14/Movement/CP14FloorOcclusionSystem.Maps.cs
new file mode 100644
index 0000000000..70867b38a4
--- /dev/null
+++ b/Content.Shared/_CP14/Movement/CP14FloorOcclusionSystem.Maps.cs
@@ -0,0 +1,31 @@
+using Content.Shared.Movement.Components;
+
+namespace Content.Shared.Movement.Systems;
+
+public abstract partial class SharedFloorOcclusionSystem
+{
+ [Dependency] private readonly SharedTransformSystem _transform = default!;
+ private void CP14InitializeMapOccluder()
+ {
+ SubscribeLocalEvent(OnParentChanged);
+ }
+
+ private void OnParentChanged(Entity ent, ref EntParentChangedMessage args)
+ {
+ if (args.OldParent == null || TerminatingOrDeleted(ent))
+ return;
+
+ if (ent.Comp.Colliding.Contains(args.OldParent.Value))
+ ent.Comp.Colliding.Remove(args.OldParent.Value);
+
+ var newParent = _transform.GetParentUid(ent);
+ if (HasComp(newParent))
+ {
+ if (!ent.Comp.Colliding.Contains(newParent))
+ ent.Comp.Colliding.Add(newParent);
+ }
+
+ Dirty(ent);
+ SetEnabled(ent);
+ }
+}
diff --git a/Content.Shared/_CP14/Movement/CP14MapFloorOccluderComponent.cs b/Content.Shared/_CP14/Movement/CP14MapFloorOccluderComponent.cs
new file mode 100644
index 0000000000..61e523c384
--- /dev/null
+++ b/Content.Shared/_CP14/Movement/CP14MapFloorOccluderComponent.cs
@@ -0,0 +1,12 @@
+using Robust.Shared.GameStates;
+
+namespace Content.Shared.Movement.Components;
+
+///
+/// Applies floor occlusion to any that reparent to this map entity.
+///
+[RegisterComponent, NetworkedComponent]
+public sealed partial class CP14MapFloorOccluderComponent : Component
+{
+
+}
diff --git a/Resources/Maps/_CP14/island.yml b/Resources/Maps/_CP14/island.yml
index 3afabacd07..3b2e87b6b3 100644
--- a/Resources/Maps/_CP14/island.yml
+++ b/Resources/Maps/_CP14/island.yml
@@ -27,6 +27,25 @@ entities:
- type: CP14CloudShadows
- type: CP14MapFloorOccluder
- type: MapLight
+ - type: MapAtmosphere
+ space: False
+ mixture:
+ volume: 2500
+ immutable: True
+ temperature: 293.15
+ moles:
+ - 21.82478
+ - 82.10312
+ - 0
+ - 0
+ - 0
+ - 0
+ - 0
+ - 0
+ - 0
+ - 0
+ - 0
+ - 0
- type: CP14DayCycle
timeEntries:
- duration: 80