CCVars.Explosion.cs 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. using Robust.Shared.Configuration;
  2. namespace Content.Shared.CCVar;
  3. public sealed partial class CCVars
  4. {
  5. /// <summary>
  6. /// How many tiles the explosion system will process per tick
  7. /// </summary>
  8. /// <remarks>
  9. /// Setting this too high will put a large load on a single tick. Setting this too low will lead to
  10. /// unnaturally "slow" explosions.
  11. /// </remarks>
  12. public static readonly CVarDef<int> ExplosionTilesPerTick =
  13. CVarDef.Create("explosion.tiles_per_tick", 100, CVar.SERVERONLY);
  14. /// <summary>
  15. /// Upper limit on the size of an explosion before physics-throwing is disabled.
  16. /// </summary>
  17. /// <remarks>
  18. /// Large nukes tend to generate a lot of shrapnel that flies through space. This can functionally cripple
  19. /// the server TPS for a while after an explosion (or even during, if the explosion is processed
  20. /// incrementally.
  21. /// </remarks>
  22. public static readonly CVarDef<int> ExplosionThrowLimit =
  23. CVarDef.Create("explosion.throw_limit", 400, CVar.SERVERONLY);
  24. /// <summary>
  25. /// If this is true, explosion processing will pause the NodeGroupSystem to pause updating.
  26. /// </summary>
  27. /// <remarks>
  28. /// This only takes effect if an explosion needs more than one tick to process (i.e., covers more than <see
  29. /// cref="ExplosionTilesPerTick"/> tiles). If this is not enabled, the node-system will rebuild its graph
  30. /// every tick as the explosion shreds the station, causing significant slowdown.
  31. /// </remarks>
  32. public static readonly CVarDef<bool> ExplosionSleepNodeSys =
  33. CVarDef.Create("explosion.node_sleep", true, CVar.SERVERONLY);
  34. /// <summary>
  35. /// Upper limit on the total area that an explosion can affect before the neighbor-finding algorithm just
  36. /// stops. Defaults to a 60-rile radius explosion.
  37. /// </summary>
  38. /// <remarks>
  39. /// 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.
  40. /// </remarks>
  41. public static readonly CVarDef<int> ExplosionMaxArea =
  42. CVarDef.Create("explosion.max_area", (int)3.14f * 256 * 256, CVar.SERVERONLY);
  43. /// <summary>
  44. /// Upper limit on the number of neighbor finding steps for the explosion system neighbor-finding algorithm.
  45. /// </summary>
  46. /// <remarks>
  47. /// Effectively places an upper limit on the range that any explosion can have. In the vast majority of
  48. /// instances, <see cref="ExplosionMaxArea"/> will likely be hit before this becomes a limiting factor.
  49. /// </remarks>
  50. public static readonly CVarDef<int> ExplosionMaxIterations =
  51. CVarDef.Create("explosion.max_iterations", 500, CVar.SERVERONLY);
  52. /// <summary>
  53. /// Max Time in milliseconds to spend processing explosions every tick.
  54. /// </summary>
  55. /// <remarks>
  56. /// This time limiting is not perfectly implemented. Firstly, a significant chunk of processing time happens
  57. /// due to queued entity deletions, which happen outside of the system update code. Secondly, explosion
  58. /// spawning cannot currently be interrupted & resumed, and may lead to exceeding this time limit.
  59. /// </remarks>
  60. public static readonly CVarDef<float> ExplosionMaxProcessingTime =
  61. CVarDef.Create("explosion.max_tick_time", 7f, CVar.SERVERONLY);
  62. /// <summary>
  63. /// If the explosion is being processed incrementally over several ticks, this variable determines whether
  64. /// updating the grid tiles should be done incrementally at the end of every tick, or only once the explosion has finished processing.
  65. /// </summary>
  66. /// <remarks>
  67. /// The most notable consequence of this change is that explosions will only punch a hole in the station &
  68. /// create a vacumm once they have finished exploding. So airlocks will no longer slam shut as the explosion
  69. /// expands, just suddenly at the end.
  70. /// </remarks>
  71. public static readonly CVarDef<bool> ExplosionIncrementalTileBreaking =
  72. CVarDef.Create("explosion.incremental_tile", false, CVar.SERVERONLY);
  73. /// <summary>
  74. /// This determines for how many seconds an explosion should stay visible once it has finished expanding.
  75. /// </summary>
  76. public static readonly CVarDef<float> ExplosionPersistence =
  77. CVarDef.Create("explosion.persistence", 1.0f, CVar.SERVERONLY);
  78. /// <summary>
  79. /// If an explosion covers a larger area than this number, the damaging/processing will always start during
  80. /// the next tick, instead of during the same tick that the explosion was generated in.
  81. /// </summary>
  82. /// <remarks>
  83. /// This value can be used to ensure that for large explosions the area/tile calculation and the explosion
  84. /// processing/damaging occurs in separate ticks. This helps reduce the single-tick lag if both <see
  85. /// cref="ExplosionMaxProcessingTime"/> and <see cref="ExplosionTilesPerTick"/> are large. I.e., instead of
  86. /// a single tick explosion, this cvar allows for a configuration that results in a two-tick explosion,
  87. /// though most of the computational cost is still in the second tick.
  88. /// </remarks>
  89. public static readonly CVarDef<int> ExplosionSingleTickAreaLimit =
  90. CVarDef.Create("explosion.single_tick_area_limit", 400, CVar.SERVERONLY);
  91. /// <summary>
  92. /// Whether or not explosions are allowed to create tiles that have
  93. /// <see cref="ContentTileDefinition.MapAtmosphere"/> set to true.
  94. /// </summary>
  95. public static readonly CVarDef<bool> ExplosionCanCreateVacuum =
  96. CVarDef.Create("explosion.can_create_vacuum", true, CVar.SERVERONLY);
  97. }