Major Tesla tweaks (#23235)
* add ignore chance * twekas * add damaging and repairing * grounding rod undestructable by tesla
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using Content.Server.Explosion.EntitySystems;
|
||||
using Content.Server.Lightning;
|
||||
using Content.Server.Lightning.Components;
|
||||
using Content.Shared.Damage;
|
||||
|
||||
namespace Content.Server.Tesla.EntitySystems;
|
||||
|
||||
@@ -9,6 +10,7 @@ namespace Content.Server.Tesla.EntitySystems;
|
||||
/// </summary>
|
||||
public sealed class LightningTargetSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly DamageableSystem _damageable = default!;
|
||||
[Dependency] private readonly ExplosionSystem _explosionSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
@@ -20,15 +22,18 @@ public sealed class LightningTargetSystem : EntitySystem
|
||||
|
||||
private void OnHitByLightning(Entity<LightningTargetComponent> uid, ref HitByLightningEvent args)
|
||||
{
|
||||
DamageSpecifier damage = new();
|
||||
damage.DamageDict.Add("Structural", uid.Comp.DamageFromLightning);
|
||||
_damageable.TryChangeDamage(uid, damage, true);
|
||||
|
||||
if (!uid.Comp.LightningExplode)
|
||||
return;
|
||||
|
||||
_explosionSystem.QueueExplosion(
|
||||
Transform(uid).MapPosition,
|
||||
uid.Comp.ExplosionPrototype,
|
||||
uid.Comp.TotalIntensity, uid.Comp.Dropoff,
|
||||
uid.Comp.MaxTileIntensity,
|
||||
canCreateVacuum: false);
|
||||
if (uid.Comp.LightningExplode)
|
||||
{
|
||||
_explosionSystem.QueueExplosion(
|
||||
Transform(uid).MapPosition,
|
||||
uid.Comp.ExplosionPrototype,
|
||||
uid.Comp.TotalIntensity, uid.Comp.Dropoff,
|
||||
uid.Comp.MaxTileIntensity,
|
||||
canCreateVacuum: false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user