Explosion refactor (#5230)
* Explosions * fix yaml typo and prevent silly UI inputs * oop * Use modified contains() checks And remove IEnumerable * Buff nuke, nerf meteors * optimize the entity lookup stuff a bit * fix tile (0,0) error forgot to do an initial Enumerator.MoveNext(), so the first tile was always the "null" tile. * remove celebration * byte -> int * remove diag edge tile dict * fix one bug but there is another * fix the other bug turns out dividing a ushort leads to rounding errors. Why TF is the grid tile size even a ushort in the first place. * improve edge map * fix minor bug If the initial-explosion tile had an airtight entity on it, the tile was processed twice. * some reviews (transform queries, eye.mapid, and tilesizes in overlays) * Apply suggestions from code review Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> * is map paused * GetAllTiles ignores space by default * WriteLine -> WriteError * First -> FirstOrDefault() * default prototype const string * entity query * misc review changes * grid edge max distance * fix fire texture defn bad use of type serializer and ioc-resolves * Remove ExplosionLaunched And allow nukes to throw items towards the outer part of an explosion * no hot-reload disclaimer * replace prototype id string with int index * optimise damage a tiiiiny bit. * entity queries * comments * misc mirror comments * cvars * admin logs * move intensity-per-state to prototype * update tile event to ECS event * git mv * Tweak rpg & minibomb also fix merge bug * you don't exist anymore go away * Fix build Co-authored-by: moonheart08 <moonheart08@users.noreply.github.com> Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
This commit is contained in:
@@ -408,6 +408,106 @@ namespace Content.Shared.CCVar
|
||||
public static readonly CVarDef<bool> AdminAnnounceLogout =
|
||||
CVarDef.Create("admin.announce_logout", true, CVar.SERVERONLY);
|
||||
|
||||
/*
|
||||
* Explosions
|
||||
*/
|
||||
|
||||
/// <summary>
|
||||
/// How many tiles the explosion system will process per tick
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Setting this too high will put a large load on a single tick. Setting this too low will lead to
|
||||
/// unnaturally "slow" explosions.
|
||||
/// </remarks>
|
||||
public static readonly CVarDef<int> ExplosionTilesPerTick =
|
||||
CVarDef.Create("explosion.tiles_per_tick", 100, CVar.SERVERONLY);
|
||||
|
||||
/// <summary>
|
||||
/// Upper limit on the size of an explosion before physics-throwing is disabled.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Large nukes tend to generate a lot of shrapnel that flies through space. This can functionally cripple
|
||||
/// the server TPS for a while after an explosion (or even during, if the explosion is processed
|
||||
/// incrementally.
|
||||
/// </remarks>
|
||||
public static readonly CVarDef<int> ExplosionThrowLimit =
|
||||
CVarDef.Create("explosion.throw_limit", 400, CVar.SERVERONLY);
|
||||
|
||||
/// <summary>
|
||||
/// If this is true, explosion processing will pause the NodeGroupSystem to pause updating.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This only takes effect if an explosion needs more than one tick to process (i.e., covers more than <see
|
||||
/// cref="ExplosionTilesPerTick"/> tiles). If this is not enabled, the node-system will rebuild its graph
|
||||
/// every tick as the explosion shreds the station, causing significant slowdown.
|
||||
/// </remarks>
|
||||
public static readonly CVarDef<bool> ExplosionSleepNodeSys =
|
||||
CVarDef.Create("explosion.node_sleep", true, CVar.SERVERONLY);
|
||||
|
||||
/// <summary>
|
||||
/// Upper limit on the total area that an explosion can affect before the neighbor-finding algorithm just
|
||||
/// stops. Defaults to a 60-rile radius explosion.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Actual area may be larger, as it currently doesn't terminate mid neighbor finding. I.e., area may be that of a ~51 tile radius circle instead.
|
||||
/// </remarks>
|
||||
public static readonly CVarDef<int> ExplosionMaxArea =
|
||||
CVarDef.Create("explosion.max_area", (int) 3.14f * 50 * 50, CVar.SERVERONLY);
|
||||
|
||||
/// <summary>
|
||||
/// Upper limit on the number of neighbor finding steps for the explosion system neighbor-finding algorithm.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Effectively places an upper limit on the range that any explosion can have. In the vast majority of
|
||||
/// instances, <see cref="ExplosionMaxArea"/> will likely be hit before this becomes a limiting factor.
|
||||
/// </remarks>
|
||||
public static readonly CVarDef<int> ExplosionMaxIterations =
|
||||
CVarDef.Create("explosion.max_iterations", 150, CVar.SERVERONLY);
|
||||
|
||||
/// <summary>
|
||||
/// Max Time in milliseconds to spend processing explosions every tick.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This time limiting is not perfectly implemented. Firstly, a significant chunk of processing time happens
|
||||
/// due to queued entity deletions, which happen outside of the system update code. Secondly, explosion
|
||||
/// spawning cannot currently be interrupted & resumed, and may lead to exceeding this time limit.
|
||||
/// </remarks>
|
||||
public static readonly CVarDef<float> ExplosionMaxProcessingTime =
|
||||
CVarDef.Create("explosion.max_tick_time", 7f, CVar.SERVERONLY);
|
||||
|
||||
/// <summary>
|
||||
/// If the explosion is being processed incrementally over several ticks, this variable determines whether
|
||||
/// updating the grid tiles should be done incrementally at the end of every tick, or only once the explosion has finished processing.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The most notable consequence of this change is that explosions will only punch a hole in the station &
|
||||
/// create a vacumm once they have finished exploding. So airlocks will no longer slam shut as the explosion
|
||||
/// expands, just suddenly at the end.
|
||||
/// </remarks>
|
||||
public static readonly CVarDef<bool> ExplosionIncrementalTileBreaking =
|
||||
CVarDef.Create("explosion.incremental_tile", false, CVar.SERVERONLY);
|
||||
|
||||
/// <summary>
|
||||
/// Client-side explosion visuals: for how many seconds should an explosion stay on-screen once it has
|
||||
/// finished expanding?
|
||||
/// </summary>
|
||||
public static readonly CVarDef<float> ExplosionPersistence =
|
||||
CVarDef.Create("explosion.persistence", 0.3f, CVar.REPLICATED);
|
||||
|
||||
/// <summary>
|
||||
/// If an explosion covers a larger area than this number, the damaging/processing will always start during
|
||||
/// the next tick, instead of during the same tick that the explosion was generated in.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This value can be used to ensure that for large explosions the area/tile calculation and the explosion
|
||||
/// processing/damaging occurs in separate ticks. This helps reduce the single-tick lag if both <see
|
||||
/// cref="ExplosionMaxProcessingTime"/> and <see cref="ExplosionTilesPerTick"/> are large. I.e., instead of
|
||||
/// a single tick explosion, this cvar allows for a configuration that results in a two-tick explosion,
|
||||
/// though most of the computational cost is still in the second tick.
|
||||
/// </remarks>
|
||||
public static readonly CVarDef<int> ExplosionSingleTickAreaLimit =
|
||||
CVarDef.Create("explosion.single_tick_area_limit", 400, CVar.SERVERONLY);
|
||||
|
||||
/*
|
||||
* Admin logs
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user