Explosion refactor TEST MERG (#6995)
* Explosions * fix yaml typo and prevent silly UI inputs * oop Co-authored-by: ElectroJr <leonsfriedrich@gmail.com>
This commit is contained in:
39
Content.Server/Administration/UI/SpawnExplosionEui.cs
Normal file
39
Content.Server/Administration/UI/SpawnExplosionEui.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using Content.Server.EUI;
|
||||
using Content.Server.Explosion.EntitySystems;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Eui;
|
||||
using JetBrains.Annotations;
|
||||
|
||||
namespace Content.Server.Administration.UI;
|
||||
|
||||
/// <summary>
|
||||
/// Admin Eui for spawning and preview-ing explosions
|
||||
/// </summary>
|
||||
[UsedImplicitly]
|
||||
public sealed class SpawnExplosionEui : BaseEui
|
||||
{
|
||||
public override void HandleMessage(EuiMessageBase msg)
|
||||
{
|
||||
if (msg is SpawnExplosionEuiMsg.Close)
|
||||
{
|
||||
Close();
|
||||
return;
|
||||
}
|
||||
|
||||
if (msg is not SpawnExplosionEuiMsg.PreviewRequest request)
|
||||
return;
|
||||
|
||||
if (request.TotalIntensity <= 0 || request.IntensitySlope <= 0)
|
||||
return;
|
||||
|
||||
var explosion = EntitySystem.Get<ExplosionSystem>().GenerateExplosionPreview(request);
|
||||
|
||||
if (explosion == null)
|
||||
{
|
||||
Logger.Error("Failed to generate explosion preview.");
|
||||
return;
|
||||
}
|
||||
|
||||
SendMessage(new SpawnExplosionEuiMsg.PreviewData(explosion, request.IntensitySlope, request.TotalIntensity));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user