Fixes to explosionhelper (#2819)

* Revert "Make handheld explosives affect tiles (#2806)"

This reverts commit 005e142949.

* Fixes tiles being destroyed under walls by an explosion

* Extra imports removed

* Handles explosion in space and different grids

This handle explosions across different grids, and tiles are still protected if there is an entity airtight and currently blocking air on top of them that survived the explosion.

* Some bug fixes

- The way tiles were being protected was silly.
- Big explosions cause a lot of objects to trigger multiple events and at the same time they are destroyed.
- Explosions spawning inside containers like closets work now.

* Range bug fixes

* Explosive

The explosion works even if the entity exploding is inside multiple 'layers' of containers like.
bomb -> survival box -> tool box -> closet

* Explosions are different now

Explosion can't jump over walls now.
Explosions work like rays now, if an explosion breaks a wall it can scatter inside the room.
If entities are behind impassable entities that survive the blast  they are left unscathed.

* Little fix

* Remove the extra lookup of tiles

* Another small change

* Restore the second lookup

I thought this was extra, but this protects the tile under it if there is an Impassable entity on top. None wants anchored girders on top of lattice/space

* Changing order of conditions

IsBlockedTurf is cheaper to run than InRangeUnobstructed.

* Yep
This commit is contained in:
Daniel Castro Razo
2021-01-02 12:03:10 -06:00
committed by GitHub
parent cd9e5a590b
commit cc4669244d
7 changed files with 281 additions and 104 deletions

View File

@@ -1,4 +1,4 @@
using Content.Server.Explosions;
using Content.Server.Explosions;
using Content.Server.GameObjects.EntitySystems;
using Content.Shared.GameObjects.EntitySystems;
using Robust.Shared.GameObjects;
@@ -16,7 +16,7 @@ namespace Content.Server.GameObjects.Components.Explosion
public int LightImpactRange = 0;
public int FlashRange = 0;
private bool _beingExploded = false;
public bool Exploding { get; private set; } = false;
public override void ExposeData(ObjectSerializer serializer)
{
@@ -30,14 +30,17 @@ namespace Content.Server.GameObjects.Components.Explosion
public bool Explosion()
{
//Prevent adjacent explosives from infinitely blowing each other up.
if (_beingExploded) return true;
_beingExploded = true;
Owner.SpawnExplosion(DevastationRange, HeavyImpactRange, LightImpactRange, FlashRange);
Owner.Delete();
return true;
if (Exploding)
{
return false;
}
else
{
Exploding = true;
Owner.SpawnExplosion(DevastationRange, HeavyImpactRange, LightImpactRange, FlashRange);
Owner.Delete();
return true;
}
}
bool ITimerTrigger.Trigger(TimerTriggerEventArgs eventArgs)