Flare gun 1984 (#15807)

This commit is contained in:
metalgearsloth
2023-05-04 12:46:02 +10:00
committed by GitHub
parent 6408e69fe7
commit 06efff2b2d
4 changed files with 82 additions and 40 deletions

View File

@@ -13,6 +13,7 @@ using Content.Shared.Physics;
using Content.Shared.Popups;
using Content.Shared.Rejuvenate;
using Content.Shared.Temperature;
using Content.Shared.Throwing;
using Content.Shared.Weapons.Melee.Events;
using Robust.Server.GameObjects;
using Robust.Shared.Physics;
@@ -58,7 +59,10 @@ namespace Content.Server.Atmos.EntitySystems
SubscribeLocalEvent<FlammableComponent, IsHotEvent>(OnIsHot);
SubscribeLocalEvent<FlammableComponent, TileFireEvent>(OnTileFire);
SubscribeLocalEvent<FlammableComponent, RejuvenateEvent>(OnRejuvenate);
SubscribeLocalEvent<IgniteOnCollideComponent, StartCollideEvent>(IgniteOnCollide);
SubscribeLocalEvent<IgniteOnCollideComponent, LandEvent>(OnIgniteLand);
SubscribeLocalEvent<IgniteOnMeleeHitComponent, MeleeHitEvent>(OnMeleeHit);
}
@@ -74,15 +78,27 @@ namespace Content.Server.Atmos.EntitySystems
}
}
private void OnIgniteLand(EntityUid uid, IgniteOnCollideComponent component, ref LandEvent args)
{
RemCompDeferred<IgniteOnCollideComponent>(uid);
}
private void IgniteOnCollide(EntityUid uid, IgniteOnCollideComponent component, ref StartCollideEvent args)
{
var otherFixture = args.OtherFixture.Body.Owner;
if (!args.OtherFixture.Hard || component.Count == 0)
return;
if (!EntityManager.TryGetComponent(otherFixture, out FlammableComponent? flammable))
var otherEnt = args.OtherEntity;
if (!EntityManager.TryGetComponent(otherEnt, out FlammableComponent? flammable))
return;
flammable.FireStacks += component.FireStacks;
Ignite(otherFixture, flammable);
Ignite(otherEnt, flammable);
component.Count--;
if (component.Count == 0)
RemCompDeferred<IgniteOnCollideComponent>(uid);
}
private void OnMapInit(EntityUid uid, FlammableComponent component, MapInitEvent args)