Singularity Shaders and a lot of Shader Stuff (#2517)
* Beginnings of singulo shader * LOTS of changes!! * Minor changes * Singulo stuff * Aesthetic changes to singulo * Combining singulo change * ShaderAura uses IEntities now, not IPlayerSession * Fixes? * Fixes draw order for atmos * using fix * Address reviews * nuget.config whaaa * nuget haha * nuget why are you so dum * happy now * Preparing for omegachange * Merge from seventh level of hell * woork * Ignorecomponents add * mmf * RobustToolbox? * Fixes * Fixes Robust? * adds sprite * Nullables * Crit overlay stuff * Commits Robust
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
using Content.Server.GameObjects.Components.Projectiles;
|
||||
using Content.Server.GameObjects.Components.Projectiles;
|
||||
using Content.Server.GameObjects.Components.Singularity;
|
||||
using Content.Shared.GameObjects.Components;
|
||||
using Content.Shared.Physics;
|
||||
@@ -19,7 +19,7 @@ namespace Content.Server.GameObjects.Components.PA
|
||||
private ParticleAcceleratorPowerState _state;
|
||||
void IStartCollide.CollideWith(IPhysBody ourBody, IPhysBody otherBody, in Manifold manifold)
|
||||
{
|
||||
if (otherBody.Entity.TryGetComponent<SingularityComponent>(out var singularityComponent))
|
||||
if (otherBody.Entity.TryGetComponent<ServerSingularityComponent>(out var singularityComponent))
|
||||
{
|
||||
var multiplier = _state switch
|
||||
{
|
||||
|
||||
@@ -75,7 +75,7 @@ namespace Content.Server.GameObjects.Components.Singularity
|
||||
public bool CanRepell(IEntity toRepell)
|
||||
{
|
||||
var powerNeeded = 1;
|
||||
if (toRepell.TryGetComponent<SingularityComponent>(out var singularityComponent))
|
||||
if (toRepell.TryGetComponent<ServerSingularityComponent>(out var singularityComponent))
|
||||
{
|
||||
powerNeeded += 2*singularityComponent.Level;
|
||||
}
|
||||
|
||||
@@ -1,34 +1,33 @@
|
||||
#nullable enable
|
||||
using Content.Server.GameObjects.Components.Observer;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Content.Server.GameObjects.Components.StationEvents;
|
||||
using Content.Server.GameObjects.Components.Observer;
|
||||
using Content.Shared.GameObjects;
|
||||
using Content.Shared.Physics;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Log;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Physics;
|
||||
using Robust.Shared.Physics.Collision;
|
||||
using Robust.Shared.Physics.Dynamics.Shapes;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Server.GameObjects;
|
||||
using Content.Shared.GameObjects.Components.Singularity;
|
||||
using Robust.Shared.Players;
|
||||
using Robust.Shared.Timing;
|
||||
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Singularity
|
||||
{
|
||||
[RegisterComponent]
|
||||
public class SingularityComponent : Component, IStartCollide
|
||||
public class ServerSingularityComponent : SharedSingularityComponent, IStartCollide
|
||||
{
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
|
||||
public override uint? NetID => ContentNetIDs.SINGULARITY;
|
||||
|
||||
public override string Name => "Singularity";
|
||||
|
||||
public int Energy
|
||||
{
|
||||
@@ -40,8 +39,6 @@ namespace Content.Server.GameObjects.Components.Singularity
|
||||
_energy = value;
|
||||
if (_energy <= 0)
|
||||
{
|
||||
_spriteComponent?.LayerSetVisible(0, false);
|
||||
|
||||
Owner.Delete();
|
||||
return;
|
||||
}
|
||||
@@ -76,10 +73,12 @@ namespace Content.Server.GameObjects.Components.Singularity
|
||||
_spriteComponent?.LayerSetRSI(0, "Constructible/Power/Singularity/singularity_" + _level + ".rsi");
|
||||
_spriteComponent?.LayerSetState(0, "singularity_" + _level);
|
||||
|
||||
if(_collidableComponent != null && _collidableComponent.Fixtures.Any() && _collidableComponent.Fixtures[0].Shape is PhysShapeCircle circle)
|
||||
if (_collidableComponent != null && _collidableComponent.Fixtures.Any() && _collidableComponent.Fixtures[0].Shape is PhysShapeCircle circle)
|
||||
{
|
||||
circle.Radius = _level - 0.5f;
|
||||
}
|
||||
|
||||
Dirty();
|
||||
}
|
||||
}
|
||||
private int _level;
|
||||
@@ -102,6 +101,11 @@ namespace Content.Server.GameObjects.Components.Singularity
|
||||
private AudioSystem _audioSystem = null!;
|
||||
private IPlayingAudioStream? _playingSound;
|
||||
|
||||
public override ComponentState GetComponentState(ICommonSession player)
|
||||
{
|
||||
return new SingularityComponentState(Level);
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
@@ -114,26 +118,14 @@ namespace Content.Server.GameObjects.Components.Singularity
|
||||
_audioSystem.PlayFromEntity("/Audio/Effects/singularity_form.ogg", Owner);
|
||||
Timer.Spawn(5200,() => _playingSound = _audioSystem.PlayFromEntity("/Audio/Effects/singularity.ogg", Owner, audioParams));
|
||||
|
||||
|
||||
if (!Owner.TryGetComponent(out _collidableComponent))
|
||||
{
|
||||
Logger.Error("SingularityComponent was spawned without CollidableComponent");
|
||||
}
|
||||
else
|
||||
{
|
||||
_collidableComponent.Hard = false;
|
||||
}
|
||||
|
||||
if (!Owner.TryGetComponent(out _spriteComponent))
|
||||
{
|
||||
Logger.Error("SingularityComponent was spawned without SpriteComponent");
|
||||
}
|
||||
|
||||
if (!Owner.TryGetComponent(out _radiationPulseComponent))
|
||||
{
|
||||
Logger.Error("SingularityComponent was spawned without RadiationPulseComponent");
|
||||
}
|
||||
|
||||
if (!Owner.TryGetComponent(out _collidableComponent))
|
||||
Logger.Error("SingularityComponent was spawned without CollidableComponent!");
|
||||
else
|
||||
_collidableComponent.Hard = false;
|
||||
Level = 1;
|
||||
}
|
||||
|
||||
@@ -161,7 +153,8 @@ namespace Content.Server.GameObjects.Components.Singularity
|
||||
return;
|
||||
}
|
||||
|
||||
if (otherEntity.IsInContainer()) return;
|
||||
if (otherEntity.IsInContainer())
|
||||
return;
|
||||
|
||||
otherEntity.Delete();
|
||||
Energy++;
|
||||
@@ -1,3 +1,4 @@
|
||||
#nullable enable
|
||||
using System.Collections.Generic;
|
||||
using Content.Server.GameObjects.Components.Mobs;
|
||||
using Content.Shared.GameObjects.EntitySystems;
|
||||
@@ -115,12 +116,12 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
|
||||
// TODO: Merge with the code in FlashableComponent
|
||||
private void Flash(IEntity entity, IEntity user, int flashDuration)
|
||||
{
|
||||
if (entity.TryGetComponent(out FlashableComponent flashable))
|
||||
if (entity.TryGetComponent<FlashableComponent>(out var flashable))
|
||||
{
|
||||
flashable.Flash(flashDuration / 1000d);
|
||||
}
|
||||
|
||||
if (entity.TryGetComponent(out StunnableComponent stunnableComponent))
|
||||
if (entity.TryGetComponent<StunnableComponent>(out var stunnableComponent))
|
||||
{
|
||||
stunnableComponent.Slowdown(flashDuration / 1000f, _slowTo, _slowTo);
|
||||
}
|
||||
|
||||
@@ -7,23 +7,24 @@ namespace Content.Server.GameObjects.EntitySystems
|
||||
[UsedImplicitly]
|
||||
public class SingularitySystem : EntitySystem
|
||||
{
|
||||
private float _updateInterval = 1.0f;
|
||||
private float _accumulator;
|
||||
|
||||
public override void Update(float frameTime)
|
||||
{
|
||||
base.Update(frameTime);
|
||||
|
||||
_accumulator += frameTime;
|
||||
|
||||
while (_accumulator > 1.0f)
|
||||
while (_accumulator > _updateInterval)
|
||||
{
|
||||
_accumulator -= 1.0f;
|
||||
_accumulator -= _updateInterval;
|
||||
|
||||
foreach (var singularity in ComponentManager.EntityQuery<SingularityComponent>())
|
||||
foreach (var singularity in ComponentManager.EntityQuery<ServerSingularityComponent>())
|
||||
{
|
||||
singularity.Update(1);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ namespace Content.Server
|
||||
"RadiatingLight",
|
||||
"Icon",
|
||||
"ClientEntitySpawner",
|
||||
"ToySingularity"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace Content.Server.Physics.Controllers
|
||||
{
|
||||
_pullAccumulator -= 0.5f;
|
||||
|
||||
foreach (var singularity in ComponentManager.EntityQuery<SingularityComponent>())
|
||||
foreach (var singularity in ComponentManager.EntityQuery<ServerSingularityComponent>())
|
||||
{
|
||||
// TODO: Use colliders instead probably yada yada
|
||||
PullEntities(singularity);
|
||||
@@ -45,7 +45,7 @@ namespace Content.Server.Physics.Controllers
|
||||
{
|
||||
_moveAccumulator -= 1.0f;
|
||||
|
||||
foreach (var (singularity, physics) in ComponentManager.EntityQuery<SingularityComponent, PhysicsComponent>())
|
||||
foreach (var (singularity, physics) in ComponentManager.EntityQuery<ServerSingularityComponent, PhysicsComponent>())
|
||||
{
|
||||
if (singularity.Owner.HasComponent<BasicActorComponent>()) continue;
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace Content.Server.Physics.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
private void MoveSingulo(SingularityComponent singularity, PhysicsComponent physics)
|
||||
private void MoveSingulo(ServerSingularityComponent singularity, PhysicsComponent physics)
|
||||
{
|
||||
if (singularity.Level <= 1) return;
|
||||
// TODO: Could try gradual changes instead but for now just try to replicate
|
||||
@@ -70,7 +70,7 @@ namespace Content.Server.Physics.Controllers
|
||||
physics.LinearVelocity = pushVector.Normalized * 2;
|
||||
}
|
||||
|
||||
private void PullEntities(SingularityComponent component)
|
||||
private void PullEntities(ServerSingularityComponent component)
|
||||
{
|
||||
var singularityCoords = component.Owner.Transform.Coordinates;
|
||||
// TODO: Maybe if we have named fixtures needs to pull out the outer circle collider (inner will be for deleting).
|
||||
@@ -89,7 +89,7 @@ namespace Content.Server.Physics.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
private void DestroyTiles(SingularityComponent component)
|
||||
private void DestroyTiles(ServerSingularityComponent component)
|
||||
{
|
||||
if (!component.Owner.TryGetComponent(out PhysicsComponent? physicsComponent)) return;
|
||||
var worldBox = physicsComponent.GetWorldAABB();
|
||||
|
||||
Reference in New Issue
Block a user