This commit is contained in:
Vigers Ray 2025-08-18 01:57:00 +03:00
parent c440db7d57
commit 24f224ef50
4 changed files with 78 additions and 99 deletions

View file

@ -1,11 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Content.Shared.Atmos;
using Content.Shared.Atmos;
using Content.Shared.FixedPoint;
using Robust.Shared.Physics;
namespace Content.Server.Starlight.Energy.Supermatter;
internal static class Const
@ -31,13 +25,13 @@ internal static class Const
];
public static float MinPressure = 33f;
public static float MaxPressure = 363.9f;
public static float MaxPressure = 303.9f;
public static float MaxTemperature = Atmospherics.T0C + 200;
public static float MaxTemperature = Atmospherics.T0C + 150;
public static float EvaporationCompensation = 10;
public static FixedPoint2 MaxDamagePerSecond = (100f / 180f) + RegenerationPerSecond; // Ensures it takes at least 3 minutes to deplete
public static FixedPoint2 MaxDamagePerSecond = (100f / 120f) + RegenerationPerSecond; // Ensures it takes at least 2 minutes to deplete
public static FixedPoint2 RegenerationPerSecond = 0.3f;
public static string[] AudioCrack = ["/Audio/_Starlight/Effects/supermatter/crystal_crack_1.ogg", "/Audio/_Starlight/Effects/supermatter/crystal_crack_2.ogg"];

View file

@ -1,17 +1,6 @@
using System;
using System.Linq;
using Content.Server.Atmos.EntitySystems;
using Content.Server.Chat.Managers;
using Content.Server.Lightning;
using Content.Server.Radio.EntitySystems;
using Content.Server.Starlight.Energy.Supermatter;
using Content.Shared.Abilities.Goliath;
using Content.Shared.Atmos;
using Content.Shared.Coordinates.Helpers;
using Content.Shared.Directions;
using Content.Shared.Maps;
using Content.Shared.Physics;
using Content.Shared.Random.Helpers;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
using Robust.Shared.Random;
@ -24,7 +13,7 @@ public sealed class SupermatterCascadeSystem : EntitySystem
[Dependency] private readonly SharedTransformSystem _transform = default!;
[Dependency] private readonly SharedMapSystem _map = default!;
[Dependency] private readonly EntityLookupSystem _lookup = default!;
[Dependency] private readonly TurfSystem _turfSystem = default!;
[Dependency] private readonly TurfSystem _turf = default!;
private readonly LinkedList<Branch> _branches = [];
private LinkedListNode<Branch>? node;
@ -85,7 +74,7 @@ public sealed class SupermatterCascadeSystem : EntitySystem
if (_transform.GetGrid(branch.Coordinates) is not { } grid
|| !TryComp<MapGridComponent>(grid, out var gridComp)
|| !_map.TryGetTileRef(grid, gridComp, branch.Coordinates, out var tileRef)
|| _turfSystem.IsSpace(tileRef))
|| _turf.IsSpace(tileRef))
{
_branches.Remove(node);
node = nextNode;
@ -93,6 +82,9 @@ public sealed class SupermatterCascadeSystem : EntitySystem
}
branch.Coordinates = branch.Coordinates.SnapToGrid(gridComp);
foreach (var entity in _lookup.GetEntitiesIntersecting(branch.Coordinates))
QueueDel(entity);
SpawnAttachedTo(_random.Pick(_prototypes), branch.Coordinates);
node = nextNode;

View file

@ -1,16 +1,12 @@
using System;
using System.Linq;
using Content.Server.Atmos.EntitySystems;
using Content.Server.Chat.Managers;
using Content.Server.Explosion.EntitySystems;
using Content.Server.Lightning;
using Content.Server.Radio.EntitySystems;
using Content.Server.Starlight.Energy.Supermatter;
using Content.Shared.Abilities.Goliath;
using Content.Shared.Atmos;
using Content.Shared.Damage;
using Content.Shared.Damage.Prototypes;
using Content.Shared.FixedPoint;
using Content.Shared.Ghost;
using Content.Shared.Interaction;
using Content.Shared.Projectiles;
@ -18,13 +14,11 @@ using Content.Shared.Radiation.Components;
using Content.Shared.Radio;
using Content.Shared.Singularity.Components;
using Content.Shared.Starlight.Energy.Supermatter;
using Microsoft.CodeAnalysis;
using Robust.Server.Audio;
using Robust.Shared.Physics;
using Robust.Shared.Physics.Events;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
using Robust.Shared.Toolshed.TypeParsers;
namespace Content.Server.Starlight.Energy.Supermatter;
@ -39,7 +33,6 @@ public sealed class SupermatterSystem : AccUpdateEntitySystem
[Dependency] private readonly IChatManager _chat = default!;
[Dependency] private readonly IPrototypeManager _prototypes = default!;
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly ExplosionSystem _explosion = default!;
private readonly Dictionary<EntityUid, Entity<SupermatterComponent>> _supermatters = [];
private DamageGroupPrototype? _brute;
@ -113,7 +106,7 @@ public sealed class SupermatterSystem : AccUpdateEntitySystem
private void Cascad(Entity<SupermatterComponent> supermatter)
{
if (supermatter.Comp.Durability > 0.01) return;
_explosion.QueueExplosion(supermatter, ExplosionSystem.DefaultExplosionPrototypeId, 150, 3, 20);
_cascade.StartCascade(Transform(supermatter.Owner).Coordinates);
QueueDel(supermatter.Owner);
}
@ -184,7 +177,7 @@ public sealed class SupermatterSystem : AccUpdateEntitySystem
radiationStability += prop.RadiationStability * percent;
}
supermatter.Comp.RadiationStability = MathHelper.Clamp(radiationStability, 1.1, 10);
supermatter.Comp.RadiationStability = MathHelper.Clamp(radiationStability, 1, 10);
ProcessHeat(supermatter, gas, heatTransfer, heatModifier);
TryCompensateDamage(supermatter, gas);
@ -239,6 +232,6 @@ public sealed class SupermatterSystem : AccUpdateEntitySystem
supermatter.Comp.AccBreak = MathHelper.Clamp(supermatter.Comp.AccBreak + (trueDamage * Const.BreakPercent), 0, 9999);
supermatter.Comp.AccHeat = MathHelper.Clamp(supermatter.Comp.AccHeat + (trueDamage * Const.HeatPercent), 0, 9999);
supermatter.Comp.AccLighting = MathHelper.Clamp(supermatter.Comp.AccLighting + (trueDamage * Const.LightingPercent), 0, 25);
supermatter.Comp.AccRadiation = MathHelper.Clamp(supermatter.Comp.AccRadiation + (trueDamage * Const.RadiationPercent), 0, 50);
supermatter.Comp.AccRadiation = MathHelper.Clamp(supermatter.Comp.AccRadiation + (trueDamage * Const.RadiationPercent), 0, 100);
}
}

View file

@ -24,9 +24,9 @@
density: 190
friction: 0.8
mask:
- FullTileMask
- FullTileMask
layer:
- FullTileLayer
- FullTileLayer
- type: Pullable
- type: Sprite
sprite: _Starlight/Objects/Specific/supermatter.rsi
@ -42,8 +42,8 @@
- type: Damageable
damageModifierSet: RGlass
damageContainer: StructuralInorganic
# - type: LightningTarget Tesla needs to interact too.
# priority: 1
# - type: LightningTarget Tesla needs to interact too.
# priority: 1
- type: entity
@ -53,90 +53,90 @@
placement:
mode: SnapgridCenter
components:
- type: Damageable
damageContainer: StructuralInorganic
damageModifierSet: Glass
- type: Destructible
thresholds:
- trigger:
!type:DamageTrigger
damage: 80
behaviors:
- !type:DoActsBehavior
acts: [ "Destruction" ]
- !type:PlaySoundBehavior
sound:
collection: GlassBreak
- type: Sprite
drawdepth: Walls
sprite: _Starlight/Objects/Specific/supermatter_cascade.rsi
layers:
- state: cascade_1
- type: Icon
sprite: _Starlight/Objects/Specific/supermatter_cascade.rsi
state: cascade_1
- type: Physics
bodyType: Static
- type: Fixtures
fixtures:
fix1:
shape:
!type:PhysShapeAabb
bounds: "-0.5,-0.5,0.5,0.5"
layer:
- GlassLayer
- type: Damageable
damageContainer: StructuralInorganic
damageModifierSet: Glass
- type: Destructible
thresholds:
- trigger:
!type:DamageTrigger
damage: 80
behaviors:
- !type:DoActsBehavior
acts: [ "Destruction" ]
- !type:PlaySoundBehavior
sound:
collection: GlassBreak
- type: Sprite
drawdepth: Walls
sprite: _Starlight/Objects/Specific/supermatter_cascade.rsi
layers:
- state: cascade_1
- type: Icon
sprite: _Starlight/Objects/Specific/supermatter_cascade.rsi
state: cascade_1
- type: Physics
bodyType: Static
- type: Fixtures
fixtures:
fix1:
shape:
!type:PhysShapeAabb
bounds: "-0.5,-0.5,0.5,0.5"
layer:
- GlassLayer
- type: entity
id: Cascad2
parent: Cascad1
components:
- type: Sprite
layers:
- state: cascade_2
- type: Icon
sprite: _Starlight/Objects/Specific/supermatter_cascade.rsi
state: cascade_2
- type: Sprite
layers:
- state: cascade_2
- type: Icon
sprite: _Starlight/Objects/Specific/supermatter_cascade.rsi
state: cascade_2
- type: entity
id: Cascad3
parent: Cascad1
components:
- type: Sprite
layers:
- state: cascade_3
- type: Icon
sprite: _Starlight/Objects/Specific/supermatter_cascade.rsi
state: cascade_3
- type: Sprite
layers:
- state: cascade_3
- type: Icon
sprite: _Starlight/Objects/Specific/supermatter_cascade.rsi
state: cascade_3
- type: entity
id: Cascad4
parent: Cascad1
components:
- type: Sprite
layers:
- state: cascade_4
- type: Icon
sprite: _Starlight/Objects/Specific/supermatter_cascade.rsi
state: cascade_4
- type: Sprite
layers:
- state: cascade_4
- type: Icon
sprite: _Starlight/Objects/Specific/supermatter_cascade.rsi
state: cascade_4
- type: entity
id: Cascad5
parent: Cascad1
components:
- type: Sprite
layers:
- state: cascade_5
- type: Icon
sprite: _Starlight/Objects/Specific/supermatter_cascade.rsi
state: cascade_5
- type: Sprite
layers:
- state: cascade_5
- type: Icon
sprite: _Starlight/Objects/Specific/supermatter_cascade.rsi
state: cascade_5
- type: entity
id: Cascad6
parent: Cascad1
components:
- type: Sprite
layers:
- state: cascade_6
- type: Icon
sprite: _Starlight/Objects/Specific/supermatter_cascade.rsi
state: cascade_6
- type: Sprite
layers:
- state: cascade_6
- type: Icon
sprite: _Starlight/Objects/Specific/supermatter_cascade.rsi
state: cascade_6