Major Tesla tweaks (#23235)

* add ignore chance

* twekas

* add damaging and repairing

* grounding rod undestructable by tesla
This commit is contained in:
Ed
2024-01-01 10:33:48 +03:00
committed by GitHub
parent 2b01899d63
commit 5e1fcfc63e
14 changed files with 135 additions and 25 deletions

View File

@@ -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);
}
}
}