Explosion now throws affected entities, fixes probability/severi… (#732)

* throwforce and probability fixes for explosions

Applies force to all affected by explosion entities with ItemComponent
Fixes probability issues with explosion related callbacks

* dependency fix, throw helper

* delete TODO

Co-authored-by: gituhabu <48828502+gituhabu@users.noreply.github.com>
This commit is contained in:
Injazz
2020-02-24 07:52:15 +05:00
committed by GitHub
parent 090dd8cee8
commit 15fa417a4f
8 changed files with 123 additions and 47 deletions

View File

@@ -4,6 +4,7 @@ using System.Linq;
using Content.Server.GameObjects.Components.Mobs;
using Content.Server.GameObjects.EntitySystems;
using Content.Shared.Maps;
using Robust.Server.GameObjects;
using Robust.Server.GameObjects.EntitySystems;
using Robust.Server.Interfaces.GameObjects;
using Robust.Server.Interfaces.Player;
@@ -66,7 +67,7 @@ namespace Content.Server.Explosions
}
var exAct = entitySystemManager.GetEntitySystem<ActSystem>();
//exAct.HandleExplosion(Owner, entity, severity);
exAct.HandleExplosion(null, entity, severity);
exAct.HandleExplosion(coords, entity, severity);
}
//Tile damage calculation mockup
@@ -88,9 +89,10 @@ namespace Content.Server.Explosions
{
mapGrid.SetTile(tileLoc, new Tile(tileDefinitionManager[baseTurfs[0]].TileId));
}
else if (distanceFromTile < heavyImpactRange)
{
if (robustRandom.Prob(80))
if (robustRandom.Prob(0.8f))
{
mapGrid.SetTile(tileLoc, new Tile(tileDefinitionManager[baseTurfs[^1]].TileId));
}
@@ -99,9 +101,10 @@ namespace Content.Server.Explosions
mapGrid.SetTile(tileLoc, new Tile(tileDefinitionManager[baseTurfs[0]].TileId));
}
}
else if (distanceFromTile < lightImpactRange)
{
if (robustRandom.Prob(50))
if (robustRandom.Prob(0.5f))
{
mapGrid.SetTile(tileLoc, new Tile(tileDefinitionManager[baseTurfs[^1]].TileId));
}