* Moves FlashComponent.cs, FlashOnTriggerComponent.cs, and SmokeOnTriggerComponent.cs to Shared * Moves ExplodeOnTriggerComponent.cs, OnUseTimerTriggerComponent.cs, ActiveTimerTriggerComponent.cs, and SmokeOnTriggerComponent.cs to Shared * Delete .run/Content Server+Client.run.xml HOW DID THIS GET IN HERE ITS NOT AHHHH * Update Content.Client/Explosion/SmokeOnTriggerSystem.cs Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com> * Update Content.Shared/Explosion/Components/ActiveTimerTriggerComponent.cs Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com> * Update Content.Shared/Explosion/Components/OnUseTimerTriggerComponent.cs Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com> * Update Content.Shared/Explosion/Components/OnUseTimerTriggerComponent.cs Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com> * Update Content.Shared/Explosion/EntitySystems/SharedTriggerSystem.cs Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com> * Update Content.Shared/Explosion/EntitySystems/SharedSmokeOnTriggerSystem.cs Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com> * Update ExplodeOnTriggerComponent.cs * Revert "Delete .run/Content Server+Client.run.xml" This reverts commit 29ee05f57de60eab5c92158d8eba5e3acba483c2. * Fix? * cannot figure out how to get this to go back please forgive * Fixes a network issue * leftovers * Fixes --------- Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com> Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
66 lines
2.5 KiB
C#
66 lines
2.5 KiB
C#
using Content.Shared.Explosion;
|
|
using Content.Shared.Explosion.Components;
|
|
using Robust.Server.GameObjects;
|
|
using Robust.Shared.GameStates;
|
|
using Robust.Shared.Map;
|
|
|
|
namespace Content.Server.Explosion.EntitySystems;
|
|
|
|
// This part of the system handled send visual / overlay data to clients.
|
|
public sealed partial class ExplosionSystem : EntitySystem
|
|
{
|
|
public void InitVisuals()
|
|
{
|
|
SubscribeLocalEvent<ExplosionVisualsComponent, ComponentGetState>(OnGetState);
|
|
}
|
|
|
|
private void OnGetState(EntityUid uid, ExplosionVisualsComponent component, ref ComponentGetState args)
|
|
{
|
|
Dictionary<NetEntity, Dictionary<int, List<Vector2i>>> tileLists = new();
|
|
foreach (var (grid, data) in component.Tiles)
|
|
{
|
|
tileLists.Add(GetNetEntity(grid), data);
|
|
}
|
|
|
|
args.State = new ExplosionVisualsState(
|
|
component.Epicenter,
|
|
component.ExplosionType,
|
|
component.Intensity,
|
|
component.SpaceTiles,
|
|
tileLists,
|
|
component.SpaceMatrix,
|
|
component.SpaceTileSize);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Constructor for the shared <see cref="ExplosionEvent"/> using the server-exclusive explosion classes.
|
|
/// </summary>
|
|
private EntityUid CreateExplosionVisualEntity(MapCoordinates epicenter, string prototype, Matrix3 spaceMatrix, ExplosionSpaceTileFlood? spaceData, IEnumerable<ExplosionGridTileFlood> gridData, List<float> iterationIntensity)
|
|
{
|
|
var explosionEntity = Spawn(null, MapCoordinates.Nullspace);
|
|
var comp = AddComp<ExplosionVisualsComponent>(explosionEntity);
|
|
|
|
foreach (var grid in gridData)
|
|
{
|
|
comp.Tiles.Add(grid.Grid.Owner, grid.TileLists);
|
|
}
|
|
|
|
comp.SpaceTiles = spaceData?.TileLists;
|
|
comp.Epicenter = epicenter;
|
|
comp.ExplosionType = prototype;
|
|
comp.Intensity = iterationIntensity;
|
|
comp.SpaceMatrix = spaceMatrix;
|
|
comp.SpaceTileSize = spaceData?.TileSize ?? DefaultTileSize;
|
|
Dirty(explosionEntity, comp);
|
|
|
|
// Light, sound & visuals may extend well beyond normal PVS range. In principle, this should probably still be
|
|
// restricted to something like the same map, but whatever.
|
|
_pvsSys.AddGlobalOverride(GetNetEntity(explosionEntity));
|
|
|
|
var appearance = AddComp<AppearanceComponent>(explosionEntity);
|
|
_appearance.SetData(explosionEntity, ExplosionAppearanceData.Progress, 1, appearance);
|
|
|
|
return explosionEntity;
|
|
}
|
|
}
|