move TriggerExplosion to shared (#30227)
* move component to shared * add fake systems * update server explosion system and remove duplicate transform query --------- Co-authored-by: deltanedas <@deltanedas:kde.org>
This commit is contained in:
@@ -6,9 +6,10 @@ using Content.Shared.Explosion;
|
||||
using Content.Shared.Explosion.EntitySystems;
|
||||
using Content.Shared.FixedPoint;
|
||||
using Robust.Shared.Map.Components;
|
||||
|
||||
namespace Content.Server.Explosion.EntitySystems;
|
||||
|
||||
public sealed partial class ExplosionSystem : SharedExplosionSystem
|
||||
public sealed partial class ExplosionSystem
|
||||
{
|
||||
[Dependency] private readonly DestructibleSystem _destructibleSystem = default!;
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using Content.Shared.CCVar;
|
||||
using Content.Shared.Explosion.EntitySystems;
|
||||
|
||||
namespace Content.Server.Explosion.EntitySystems;
|
||||
|
||||
public sealed partial class ExplosionSystem : SharedExplosionSystem
|
||||
public sealed partial class ExplosionSystem
|
||||
{
|
||||
public int MaxIterations { get; private set; }
|
||||
public int MaxArea { get; private set; }
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace Content.Server.Explosion.EntitySystems;
|
||||
// A good portion of it is focused around keeping track of what tile-indices on a grid correspond to tiles that border
|
||||
// space. AFAIK no other system currently needs to track these "edge-tiles". If they do, this should probably be a
|
||||
// property of the grid itself?
|
||||
public sealed partial class ExplosionSystem : SharedExplosionSystem
|
||||
public sealed partial class ExplosionSystem
|
||||
{
|
||||
/// <summary>
|
||||
/// Set of tiles of each grid that are directly adjacent to space, along with the directions that face space.
|
||||
|
||||
@@ -22,9 +22,10 @@ using Robust.Shared.Random;
|
||||
using Robust.Shared.Timing;
|
||||
using Robust.Shared.Utility;
|
||||
using TimedDespawnComponent = Robust.Shared.Spawners.TimedDespawnComponent;
|
||||
|
||||
namespace Content.Server.Explosion.EntitySystems;
|
||||
|
||||
public sealed partial class ExplosionSystem : SharedExplosionSystem
|
||||
public sealed partial class ExplosionSystem
|
||||
{
|
||||
[Dependency] private readonly FlammableSystem _flammableSystem = default!;
|
||||
|
||||
@@ -218,7 +219,7 @@ public sealed partial class ExplosionSystem : SharedExplosionSystem
|
||||
// get the entities on a tile. Note that we cannot process them directly, or we get
|
||||
// enumerator-changed-while-enumerating errors.
|
||||
List<(EntityUid, TransformComponent)> list = new();
|
||||
var state = (list, processed, _transformQuery);
|
||||
var state = (list, processed, EntityManager.TransformQuery);
|
||||
|
||||
// get entities:
|
||||
lookup.DynamicTree.QueryAabb(ref state, GridQueryCallback, gridBox, true);
|
||||
@@ -317,7 +318,7 @@ public sealed partial class ExplosionSystem : SharedExplosionSystem
|
||||
var gridBox = Box2.FromDimensions(tile * DefaultTileSize, new Vector2(DefaultTileSize, DefaultTileSize));
|
||||
var worldBox = spaceMatrix.TransformBox(gridBox);
|
||||
var list = new List<(EntityUid, TransformComponent)>();
|
||||
var state = (list, processed, invSpaceMatrix, lookup.Owner, _transformQuery, gridBox, _transformSystem);
|
||||
var state = (list, processed, invSpaceMatrix, lookup.Owner, EntityManager.TransformQuery, gridBox, _transformSystem);
|
||||
|
||||
// get entities:
|
||||
lookup.DynamicTree.QueryAabb(ref state, SpaceQueryCallback, worldBox, true);
|
||||
|
||||
@@ -7,13 +7,13 @@ using Robust.Shared.Map;
|
||||
using Robust.Shared.Map.Components;
|
||||
using Robust.Shared.Physics.Components;
|
||||
using Robust.Shared.Timing;
|
||||
using Content.Shared.Explosion.EntitySystems;
|
||||
|
||||
namespace Content.Server.Explosion.EntitySystems;
|
||||
|
||||
// This partial part of the explosion system has all of the functions used to create the actual explosion map.
|
||||
// I.e, to get the sets of tiles & intensity values that describe an explosion.
|
||||
|
||||
public sealed partial class ExplosionSystem : SharedExplosionSystem
|
||||
public sealed partial class ExplosionSystem
|
||||
{
|
||||
/// <summary>
|
||||
/// This is the main explosion generating function.
|
||||
|
||||
@@ -5,10 +5,11 @@ using Content.Shared.Explosion.EntitySystems;
|
||||
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 : SharedExplosionSystem
|
||||
public sealed partial class ExplosionSystem
|
||||
{
|
||||
public void InitVisuals()
|
||||
{
|
||||
|
||||
@@ -12,6 +12,8 @@ using Content.Shared.CCVar;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.Explosion;
|
||||
using Content.Shared.Explosion.Components;
|
||||
using Content.Shared.Explosion.EntitySystems;
|
||||
using Content.Shared.GameTicking;
|
||||
using Content.Shared.Inventory;
|
||||
using Content.Shared.Projectiles;
|
||||
@@ -53,7 +55,6 @@ public sealed partial class ExplosionSystem : SharedExplosionSystem
|
||||
[Dependency] private readonly SharedTransformSystem _transformSystem = default!;
|
||||
[Dependency] private readonly SharedMapSystem _map = default!;
|
||||
|
||||
private EntityQuery<TransformComponent> _transformQuery;
|
||||
private EntityQuery<FlammableComponent> _flammableQuery;
|
||||
private EntityQuery<PhysicsComponent> _physicsQuery;
|
||||
private EntityQuery<ProjectileComponent> _projectileQuery;
|
||||
@@ -103,7 +104,6 @@ public sealed partial class ExplosionSystem : SharedExplosionSystem
|
||||
InitAirtightMap();
|
||||
InitVisuals();
|
||||
|
||||
_transformQuery = GetEntityQuery<TransformComponent>();
|
||||
_flammableQuery = GetEntityQuery<FlammableComponent>();
|
||||
_physicsQuery = GetEntityQuery<PhysicsComponent>();
|
||||
_projectileQuery = GetEntityQuery<ProjectileComponent>();
|
||||
@@ -141,15 +141,8 @@ public sealed partial class ExplosionSystem : SharedExplosionSystem
|
||||
args.DamageCoefficient *= modifier;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Given an entity with an explosive component, spawn the appropriate explosion.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Also accepts radius or intensity arguments. This is useful for explosives where the intensity is not
|
||||
/// specified in the yaml / by the component, but determined dynamically (e.g., by the quantity of a
|
||||
/// solution in a reaction).
|
||||
/// </remarks>
|
||||
public void TriggerExplosive(EntityUid uid, ExplosiveComponent? explosive = null, bool delete = true, float? totalIntensity = null, float? radius = null, EntityUid? user = null)
|
||||
/// <inheritdoc/>
|
||||
public override void TriggerExplosive(EntityUid uid, ExplosiveComponent? explosive = null, bool delete = true, float? totalIntensity = null, float? radius = null, EntityUid? user = null)
|
||||
{
|
||||
// log missing: false, because some entities (e.g. liquid tanks) attempt to trigger explosions when damaged,
|
||||
// but may not actually be explosive.
|
||||
|
||||
Reference in New Issue
Block a user