map floor occluder sys
This commit is contained in:
@@ -6,11 +6,13 @@ namespace Content.Shared.Movement.Systems;
|
||||
/// <summary>
|
||||
/// Applies an occlusion shader for any relevant entities.
|
||||
/// </summary>
|
||||
public abstract class SharedFloorOcclusionSystem : EntitySystem
|
||||
public abstract partial class SharedFloorOcclusionSystem : EntitySystem //CP14 partial
|
||||
{
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
CP14InitializeMapOccluder(); //CP14
|
||||
|
||||
SubscribeLocalEvent<FloorOccluderComponent, StartCollideEvent>(OnStartCollide);
|
||||
SubscribeLocalEvent<FloorOccluderComponent, EndCollideEvent>(OnEndCollide);
|
||||
}
|
||||
|
||||
@@ -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<FloorOcclusionComponent, EntParentChangedMessage>(OnParentChanged);
|
||||
}
|
||||
|
||||
private void OnParentChanged(Entity<FloorOcclusionComponent> 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<CP14MapFloorOccluderComponent>(newParent))
|
||||
{
|
||||
if (!ent.Comp.Colliding.Contains(newParent))
|
||||
ent.Comp.Colliding.Add(newParent);
|
||||
}
|
||||
|
||||
Dirty(ent);
|
||||
SetEnabled(ent);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using Robust.Shared.GameStates;
|
||||
|
||||
namespace Content.Shared.Movement.Components;
|
||||
|
||||
/// <summary>
|
||||
/// Applies floor occlusion to any <see cref="FloorOcclusionComponent"/> that reparent to this map entity.
|
||||
/// </summary>
|
||||
[RegisterComponent, NetworkedComponent]
|
||||
public sealed partial class CP14MapFloorOccluderComponent : Component
|
||||
{
|
||||
|
||||
}
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user