Singularity Engine: Containment field emitters emit soft light (#3004)
* Singularity Engine: Containment field emitters emit light, making use of soft shadows * Singularity Engine Containment Emitter Lights: Clean up component dependencies & remove now-useless point light enable check
This commit is contained in:
@@ -7,6 +7,7 @@ using Content.Server.Utility;
|
|||||||
using Content.Shared.Physics;
|
using Content.Shared.Physics;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.GameObjects.Components;
|
using Robust.Shared.GameObjects.Components;
|
||||||
|
using Robust.Shared.GameObjects.ComponentDependencies;
|
||||||
using Robust.Shared.Interfaces.GameObjects;
|
using Robust.Shared.Interfaces.GameObjects;
|
||||||
using Robust.Shared.Interfaces.Physics;
|
using Robust.Shared.Interfaces.Physics;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
@@ -14,6 +15,7 @@ using Robust.Shared.Log;
|
|||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
using Robust.Shared.Physics;
|
using Robust.Shared.Physics;
|
||||||
using Robust.Shared.ViewVariables;
|
using Robust.Shared.ViewVariables;
|
||||||
|
using Robust.Server.GameObjects;
|
||||||
|
|
||||||
namespace Content.Server.GameObjects.Components.Singularity
|
namespace Content.Server.GameObjects.Components.Singularity
|
||||||
{
|
{
|
||||||
@@ -63,7 +65,8 @@ namespace Content.Server.GameObjects.Components.Singularity
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private PhysicsComponent? _collidableComponent;
|
[ComponentDependency] private readonly PhysicsComponent? _collidableComponent = default;
|
||||||
|
[ComponentDependency] private readonly PointLightComponent? _pointLightComponent = default;
|
||||||
|
|
||||||
private Tuple<Direction, ContainmentFieldConnection>? _connection1;
|
private Tuple<Direction, ContainmentFieldConnection>? _connection1;
|
||||||
private Tuple<Direction, ContainmentFieldConnection>? _connection2;
|
private Tuple<Direction, ContainmentFieldConnection>? _connection2;
|
||||||
@@ -71,16 +74,6 @@ namespace Content.Server.GameObjects.Components.Singularity
|
|||||||
public bool CanRepell(IEntity toRepell) => _connection1?.Item2?.CanRepell(toRepell) == true ||
|
public bool CanRepell(IEntity toRepell) => _connection1?.Item2?.CanRepell(toRepell) == true ||
|
||||||
_connection2?.Item2?.CanRepell(toRepell) == true;
|
_connection2?.Item2?.CanRepell(toRepell) == true;
|
||||||
|
|
||||||
public override void Initialize()
|
|
||||||
{
|
|
||||||
base.Initialize();
|
|
||||||
if (!Owner.TryGetComponent(out _collidableComponent))
|
|
||||||
{
|
|
||||||
Logger.Error("ContainmentFieldGeneratorComponent created with no CollidableComponent");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void HandleMessage(ComponentMessage message, IComponent? component)
|
public override void HandleMessage(ComponentMessage message, IComponent? component)
|
||||||
{
|
{
|
||||||
base.HandleMessage(message, component);
|
base.HandleMessage(message, component);
|
||||||
@@ -168,7 +161,7 @@ namespace Content.Server.GameObjects.Components.Singularity
|
|||||||
{
|
{
|
||||||
Logger.Error("When trying to connect two Containmentfieldgenerators, the second one already had two connection but the check didn't catch it");
|
Logger.Error("When trying to connect two Containmentfieldgenerators, the second one already had two connection but the check didn't catch it");
|
||||||
}
|
}
|
||||||
|
UpdateConnectionLights();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -180,9 +173,12 @@ namespace Content.Server.GameObjects.Components.Singularity
|
|||||||
if (_connection1?.Item2 == connection)
|
if (_connection1?.Item2 == connection)
|
||||||
{
|
{
|
||||||
_connection1 = null;
|
_connection1 = null;
|
||||||
}else if (_connection2?.Item2 == connection)
|
UpdateConnectionLights();
|
||||||
|
}
|
||||||
|
else if (_connection2?.Item2 == connection)
|
||||||
{
|
{
|
||||||
_connection2 = null;
|
_connection2 = null;
|
||||||
|
UpdateConnectionLights();
|
||||||
}
|
}
|
||||||
else if(connection != null)
|
else if(connection != null)
|
||||||
{
|
{
|
||||||
@@ -198,6 +194,15 @@ namespace Content.Server.GameObjects.Components.Singularity
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void UpdateConnectionLights()
|
||||||
|
{
|
||||||
|
if (_pointLightComponent != null)
|
||||||
|
{
|
||||||
|
bool hasAnyConnection = (_connection1 != null) || (_connection2 != null);
|
||||||
|
_pointLightComponent.Enabled = hasAnyConnection;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public override void OnRemove()
|
public override void OnRemove()
|
||||||
{
|
{
|
||||||
_connection1?.Item2.Dispose();
|
_connection1?.Item2.Dispose();
|
||||||
|
|||||||
@@ -85,6 +85,12 @@
|
|||||||
- type: ContainmentFieldGenerator
|
- type: ContainmentFieldGenerator
|
||||||
- type: Anchorable
|
- type: Anchorable
|
||||||
- type: Pullable
|
- type: Pullable
|
||||||
|
- type: PointLight
|
||||||
|
enabled: false
|
||||||
|
color: "#4080FF"
|
||||||
|
radius: 32
|
||||||
|
energy: 2.0
|
||||||
|
softness: 32.0
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
name: Containment Field
|
name: Containment Field
|
||||||
|
|||||||
Reference in New Issue
Block a user