- fix: Revert flammable changes. (#408)
This commit is contained in:
@@ -152,7 +152,7 @@ public sealed partial class AdminVerbSystem
|
|||||||
Act = () =>
|
Act = () =>
|
||||||
{
|
{
|
||||||
// Fuck you. Burn Forever.
|
// Fuck you. Burn Forever.
|
||||||
flammable.FireStacks = flammable.MaximumFireStacks;
|
flammable.FireStacks = FlammableSystem.MaximumFireStacks;
|
||||||
_flammableSystem.Ignite(args.Target, args.User);
|
_flammableSystem.Ignite(args.Target, args.User);
|
||||||
var xform = Transform(args.Target);
|
var xform = Transform(args.Target);
|
||||||
_popupSystem.PopupEntity(Loc.GetString("admin-smite-set-alight-self"), args.Target,
|
_popupSystem.PopupEntity(Loc.GetString("admin-smite-set-alight-self"), args.Target,
|
||||||
|
|||||||
@@ -11,65 +11,49 @@ namespace Content.Server.Atmos.Components
|
|||||||
|
|
||||||
[ViewVariables(VVAccess.ReadWrite)]
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
[DataField]
|
[DataField]
|
||||||
public bool OnFire;
|
public bool OnFire { get; set; }
|
||||||
|
|
||||||
[ViewVariables(VVAccess.ReadWrite)]
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
[DataField]
|
[DataField]
|
||||||
public float FireStacks;
|
public float FireStacks { get; set; }
|
||||||
|
|
||||||
[ViewVariables(VVAccess.ReadWrite)]
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
[DataField]
|
[DataField("fireSpread")]
|
||||||
public float MaximumFireStacks = 10f;
|
|
||||||
|
|
||||||
[ViewVariables(VVAccess.ReadWrite)]
|
|
||||||
[DataField]
|
|
||||||
public float MinimumFireStacks = -10f;
|
|
||||||
|
|
||||||
[ViewVariables(VVAccess.ReadWrite)]
|
|
||||||
[DataField]
|
|
||||||
public string FlammableFixtureID = "flammable";
|
|
||||||
|
|
||||||
[ViewVariables(VVAccess.ReadWrite)]
|
|
||||||
[DataField]
|
|
||||||
public float MinIgnitionTemperature = 373.15f;
|
|
||||||
|
|
||||||
[ViewVariables(VVAccess.ReadWrite)]
|
|
||||||
[DataField]
|
|
||||||
public bool FireSpread { get; private set; } = false;
|
public bool FireSpread { get; private set; } = false;
|
||||||
|
|
||||||
[ViewVariables(VVAccess.ReadWrite)]
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
[DataField]
|
[DataField("canResistFire")]
|
||||||
public bool CanResistFire { get; private set; } = false;
|
public bool CanResistFire { get; private set; } = false;
|
||||||
|
|
||||||
[DataField(required: true)]
|
[DataField("damage", required: true)]
|
||||||
[ViewVariables(VVAccess.ReadWrite)]
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
public DamageSpecifier Damage = new(); // Empty by default, we don't want any funny NREs.
|
public DamageSpecifier Damage = new(); // Empty by default, we don't want any funny NREs.
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Used for the fixture created to handle passing firestacks when two flammable objects collide.
|
/// Used for the fixture created to handle passing firestacks when two flammable objects collide.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataField]
|
[DataField("flammableCollisionShape")]
|
||||||
public IPhysShape FlammableCollisionShape = new PhysShapeCircle(0.35f);
|
public IPhysShape FlammableCollisionShape = new PhysShapeCircle(0.35f);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Should the component be set on fire by interactions with isHot entities
|
/// Should the component be set on fire by interactions with isHot entities
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ViewVariables(VVAccess.ReadWrite)]
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
[DataField]
|
[DataField("alwaysCombustible")]
|
||||||
public bool AlwaysCombustible = false;
|
public bool AlwaysCombustible = false;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Can the component anyhow lose its FireStacks?
|
/// Can the component anyhow lose its FireStacks?
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ViewVariables(VVAccess.ReadWrite)]
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
[DataField]
|
[DataField("canExtinguish")]
|
||||||
public bool CanExtinguish = true;
|
public bool CanExtinguish = true;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// How many firestacks should be applied to component when being set on fire?
|
/// How many firestacks should be applied to component when being set on fire?
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ViewVariables(VVAccess.ReadWrite)]
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
[DataField]
|
[DataField("firestacksOnIgnite")]
|
||||||
public float FirestacksOnIgnite = 2.0f;
|
public float FirestacksOnIgnite = 2.0f;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -52,11 +52,13 @@ namespace Content.Server.Atmos.EntitySystems
|
|||||||
[Dependency] private readonly IRobustRandom _random = default!;
|
[Dependency] private readonly IRobustRandom _random = default!;
|
||||||
[Dependency] private readonly SpellBladeSystem _spellBlade = default!; // WD
|
[Dependency] private readonly SpellBladeSystem _spellBlade = default!; // WD
|
||||||
|
|
||||||
private EntityQuery<PhysicsComponent> _physicsQuery;
|
public const float MinimumFireStacks = -10f;
|
||||||
|
public const float MaximumFireStacks = 20f;
|
||||||
// This should probably be moved to the component, requires a rewrite, all fires tick at the same time
|
|
||||||
private const float UpdateTime = 1f;
|
private const float UpdateTime = 1f;
|
||||||
|
|
||||||
|
public const float MinIgnitionTemperature = 373.15f;
|
||||||
|
public const string FlammableFixtureID = "flammable";
|
||||||
|
|
||||||
private float _timer;
|
private float _timer;
|
||||||
|
|
||||||
private readonly Dictionary<Entity<FlammableComponent>, float> _fireEvents = new();
|
private readonly Dictionary<Entity<FlammableComponent>, float> _fireEvents = new();
|
||||||
@@ -65,8 +67,6 @@ namespace Content.Server.Atmos.EntitySystems
|
|||||||
{
|
{
|
||||||
UpdatesAfter.Add(typeof(AtmosphereSystem));
|
UpdatesAfter.Add(typeof(AtmosphereSystem));
|
||||||
|
|
||||||
_physicsQuery = GetEntityQuery<PhysicsComponent>();
|
|
||||||
|
|
||||||
SubscribeLocalEvent<FlammableComponent, MapInitEvent>(OnMapInit);
|
SubscribeLocalEvent<FlammableComponent, MapInitEvent>(OnMapInit);
|
||||||
SubscribeLocalEvent<FlammableComponent, InteractUsingEvent>(OnInteractUsing);
|
SubscribeLocalEvent<FlammableComponent, InteractUsingEvent>(OnInteractUsing);
|
||||||
SubscribeLocalEvent<FlammableComponent, StartCollideEvent>(OnCollide);
|
SubscribeLocalEvent<FlammableComponent, StartCollideEvent>(OnCollide);
|
||||||
@@ -141,7 +141,7 @@ namespace Content.Server.Atmos.EntitySystems
|
|||||||
if (!TryComp<PhysicsComponent>(uid, out var body))
|
if (!TryComp<PhysicsComponent>(uid, out var body))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_fixture.TryCreateFixture(uid, component.FlammableCollisionShape, component.FlammableFixtureID, hard: false,
|
_fixture.TryCreateFixture(uid, component.FlammableCollisionShape, FlammableFixtureID, hard: false,
|
||||||
collisionMask: (int) CollisionGroup.FullTileLayer, body: body);
|
collisionMask: (int) CollisionGroup.FullTileLayer, body: body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -199,7 +199,7 @@ namespace Content.Server.Atmos.EntitySystems
|
|||||||
|
|
||||||
// Normal hard collisions, though this isn't generally possible since most flammable things are mobs
|
// Normal hard collisions, though this isn't generally possible since most flammable things are mobs
|
||||||
// which don't collide with one another, shouldn't work here.
|
// which don't collide with one another, shouldn't work here.
|
||||||
if (args.OtherFixtureId != flammable.FlammableFixtureID && args.OurFixtureId != flammable.FlammableFixtureID)
|
if (args.OtherFixtureId != FlammableFixtureID && args.OurFixtureId != FlammableFixtureID)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!flammable.FireSpread)
|
if (!flammable.FireSpread)
|
||||||
@@ -211,30 +211,49 @@ namespace Content.Server.Atmos.EntitySystems
|
|||||||
if (!flammable.OnFire && !otherFlammable.OnFire)
|
if (!flammable.OnFire && !otherFlammable.OnFire)
|
||||||
return; // Neither are on fire
|
return; // Neither are on fire
|
||||||
|
|
||||||
// Both are on fire -> equalize fire stacks.
|
// WD START
|
||||||
// Weight each thing's firestacks by its mass
|
var weHold = _spellBlade.IsHoldingItemWithComponent<FireAspectComponent>(uid);
|
||||||
var mass1 = 1f;
|
var theyHold = _spellBlade.IsHoldingItemWithComponent<FireAspectComponent>(otherUid);
|
||||||
var mass2 = 1f;
|
// WD END
|
||||||
if (_physicsQuery.TryComp(uid, out var physics) && _physicsQuery.TryComp(otherUid, out var otherPhys))
|
|
||||||
|
if (flammable.OnFire && otherFlammable.OnFire)
|
||||||
{
|
{
|
||||||
mass1 = physics.Mass;
|
if (weHold && !theyHold || theyHold && !weHold) // WD
|
||||||
mass2 = otherPhys.Mass;
|
return;
|
||||||
|
// Both are on fire -> equalize fire stacks.
|
||||||
|
var avg = (flammable.FireStacks + otherFlammable.FireStacks) / 2;
|
||||||
|
flammable.FireStacks = flammable.CanExtinguish ? avg : Math.Max(flammable.FireStacks, avg);
|
||||||
|
otherFlammable.FireStacks = otherFlammable.CanExtinguish ? avg : Math.Max(otherFlammable.FireStacks, avg);
|
||||||
|
UpdateAppearance(uid, flammable);
|
||||||
|
UpdateAppearance(otherUid, otherFlammable);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// when the thing on fire is more massive than the other, the following happens:
|
// Only one is on fire -> attempt to spread the fire.
|
||||||
// - the thing on fire loses a small number of firestacks
|
if (flammable.OnFire)
|
||||||
// - the other thing gains a large number of firestacks
|
{
|
||||||
// so a person on fire engulfs a mouse, but an engulfed mouse barely does anything to a person
|
if (theyHold) // WD
|
||||||
var total = mass1 + mass2;
|
return;
|
||||||
var avg = (flammable.FireStacks + otherFlammable.FireStacks) / total;
|
otherFlammable.FireStacks += flammable.FireStacks / 2;
|
||||||
|
Ignite(otherUid, uid, otherFlammable);
|
||||||
// swap the entity losing stacks depending on whichever has the most firestack kilos
|
if (flammable.CanExtinguish)
|
||||||
var (src, dest) = flammable.FireStacks * mass1 > otherFlammable.FireStacks * mass2
|
{
|
||||||
? (-1f, 1f)
|
flammable.FireStacks /= 2;
|
||||||
: (1f, -1f);
|
UpdateAppearance(uid, flammable);
|
||||||
// bring each entity to the same firestack mass, firestacks being scaled by the other's mass
|
}
|
||||||
AdjustFireStacks(uid, src * avg * mass2, flammable, ignite: true);
|
}
|
||||||
AdjustFireStacks(otherUid, dest * avg * mass1, otherFlammable, ignite: true);
|
else
|
||||||
|
{
|
||||||
|
if (weHold) // WD
|
||||||
|
return;
|
||||||
|
flammable.FireStacks += otherFlammable.FireStacks / 2;
|
||||||
|
Ignite(uid, otherUid, flammable);
|
||||||
|
if (otherFlammable.CanExtinguish)
|
||||||
|
{
|
||||||
|
otherFlammable.FireStacks /= 2;
|
||||||
|
UpdateAppearance(otherUid, otherFlammable);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnIsHot(EntityUid uid, FlammableComponent flammable, IsHotEvent args)
|
private void OnIsHot(EntityUid uid, FlammableComponent flammable, IsHotEvent args)
|
||||||
@@ -244,7 +263,7 @@ namespace Content.Server.Atmos.EntitySystems
|
|||||||
|
|
||||||
private void OnTileFire(Entity<FlammableComponent> ent, ref TileFireEvent args)
|
private void OnTileFire(Entity<FlammableComponent> ent, ref TileFireEvent args)
|
||||||
{
|
{
|
||||||
var tempDelta = args.Temperature - ent.Comp.MinIgnitionTemperature;
|
var tempDelta = args.Temperature - MinIgnitionTemperature;
|
||||||
|
|
||||||
_fireEvents.TryGetValue(ent, out var maxTemp);
|
_fireEvents.TryGetValue(ent, out var maxTemp);
|
||||||
|
|
||||||
@@ -272,30 +291,17 @@ namespace Content.Server.Atmos.EntitySystems
|
|||||||
_appearance.SetData(uid, ToggleableLightVisuals.Enabled, flammable.OnFire, appearance);
|
_appearance.SetData(uid, ToggleableLightVisuals.Enabled, flammable.OnFire, appearance);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AdjustFireStacks(EntityUid uid, float relativeFireStacks, FlammableComponent? flammable = null, bool ignite = false)
|
public void AdjustFireStacks(EntityUid uid, float relativeFireStacks, FlammableComponent? flammable = null)
|
||||||
{
|
{
|
||||||
if (!Resolve(uid, ref flammable))
|
if (!Resolve(uid, ref flammable))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SetFireStacks(uid, flammable.FireStacks + relativeFireStacks, flammable, ignite);
|
flammable.FireStacks = MathF.Min(MathF.Max(MinimumFireStacks, flammable.FireStacks + relativeFireStacks), MaximumFireStacks);
|
||||||
}
|
|
||||||
|
|
||||||
public void SetFireStacks(EntityUid uid, float stacks, FlammableComponent? flammable = null, bool ignite = false)
|
if (flammable.OnFire && flammable.FireStacks <= 0)
|
||||||
{
|
|
||||||
if (!Resolve(uid, ref flammable))
|
|
||||||
return;
|
|
||||||
|
|
||||||
flammable.FireStacks = MathF.Min(MathF.Max(flammable.MinimumFireStacks, stacks), flammable.MaximumFireStacks);
|
|
||||||
|
|
||||||
if (flammable.FireStacks <= 0)
|
|
||||||
{
|
|
||||||
Extinguish(uid, flammable);
|
Extinguish(uid, flammable);
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
flammable.OnFire = ignite;
|
|
||||||
UpdateAppearance(uid, flammable);
|
UpdateAppearance(uid, flammable);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Extinguish(EntityUid uid, FlammableComponent? flammable = null)
|
public void Extinguish(EntityUid uid, FlammableComponent? flammable = null)
|
||||||
@@ -444,11 +450,13 @@ namespace Content.Server.Atmos.EntitySystems
|
|||||||
EnsureComp<IgnitionSourceComponent>(uid);
|
EnsureComp<IgnitionSourceComponent>(uid);
|
||||||
_ignitionSourceSystem.SetIgnited(uid);
|
_ignitionSourceSystem.SetIgnited(uid);
|
||||||
|
|
||||||
|
var damageScale = MathF.Min( flammable.FireStacks, 5);
|
||||||
|
|
||||||
if (TryComp(uid, out TemperatureComponent? temp))
|
if (TryComp(uid, out TemperatureComponent? temp))
|
||||||
_temperatureSystem.ChangeHeat(uid, 12500 * flammable.FireStacks, false, temp);
|
_temperatureSystem.ChangeHeat(uid, 12500 * damageScale, false, temp);
|
||||||
|
|
||||||
if (!_spellBlade.IsHoldingItemWithComponent<FireAspectComponent>(uid)) // WD EDIT
|
if (!_spellBlade.IsHoldingItemWithComponent<FireAspectComponent>(uid)) // WD EDIT
|
||||||
_damageableSystem.TryChangeDamage(uid, flammable.Damage * flammable.FireStacks, interruptsDoAfters: false);
|
_damageableSystem.TryChangeDamage(uid, flammable.Damage * damageScale, interruptsDoAfters: false);
|
||||||
|
|
||||||
AdjustFireStacks(uid, flammable.FirestackFade * (flammable.Resisting ? 10f : 1f), flammable);
|
AdjustFireStacks(uid, flammable.FirestackFade * (flammable.Resisting ? 10f : 1f), flammable);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user