Cherrypicks 4 (#393)
* Immovable Rod changes (#26757) * Adds non randomized rod velocity (#27123) * adds non randomized rod velocity * Adds despawn suffix to despawn rod * make fire spreading scale with mass (#27202) * make fire spreading scale with mass * realer --------- Co-authored-by: deltanedas <@deltanedas:kde.org> * lower max firestacks to 10, refactor flammable (#27159) * lower max firestacks to 10, refactor flammable * fix * uncap fire stack damage, lower fire stack damage * fix fire spread round removal (#27986) * fix a resolve debug assert * rewrite fire spread --------- Co-authored-by: deltanedas <@deltanedas:kde.org> * fire troll fix (#28034) Co-authored-by: deltanedas <@deltanedas:kde.org> * Hide doafters if you're in a container (#29487) * Hide doafters if you're in a container * Out of the loop --------- Co-authored-by: plykiya <plykiya@protonmail.com> * Add ghost role raffles (#26629) * Add ghost role raffles * GRR: Fix dialogue sizing, fix merge * GRR: Add raffle deciders (winner picker) * GRR: Make settings prototype based with option to override * GRR: Use Raffles folder and namespace * GRR: DataFieldify and TimeSpanify * GRR: Don't actually DataFieldify HashSet<ICommonSession>s * GRR: add GetGhostRoleCount() + docs * update engine on branch * Ghost role raffles: docs, fix window size, cleanup, etc * GRR: Admin UI * GRR: Admin UI: Display initial/max/ext of selected raffle settings proto * GRR: Make a ton of roles raffled * Make ERT use short raffle timer (#27830) Co-authored-by: plykiya <plykiya@protonmail.com> * gives loneops a proper ghost role raffle (#27841) * shorten short raffle (#28685) * - fix: Conflicts. * - fix. --------- Co-authored-by: keronshb <54602815+keronshb@users.noreply.github.com> Co-authored-by: deltanedas <39013340+deltanedas@users.noreply.github.com> Co-authored-by: Whisper <121047731+QuietlyWhisper@users.noreply.github.com> Co-authored-by: Plykiya <58439124+Plykiya@users.noreply.github.com> Co-authored-by: plykiya <plykiya@protonmail.com> Co-authored-by: no <165581243+pissdemon@users.noreply.github.com> Co-authored-by: Boaz1111 <149967078+Boaz1111@users.noreply.github.com> Co-authored-by: HS <81934438+HolySSSS@users.noreply.github.com>
This commit is contained in:
@@ -52,12 +52,10 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
[Dependency] private readonly SpellBladeSystem _spellBlade = default!; // WD
|
||||
|
||||
public const float MinimumFireStacks = -10f;
|
||||
public const float MaximumFireStacks = 20f;
|
||||
private const float UpdateTime = 1f;
|
||||
private EntityQuery<PhysicsComponent> _physicsQuery;
|
||||
|
||||
public const float MinIgnitionTemperature = 373.15f;
|
||||
public const string FlammableFixtureID = "flammable";
|
||||
// This should probably be moved to the component, requires a rewrite, all fires tick at the same time
|
||||
private const float UpdateTime = 1f;
|
||||
|
||||
private float _timer;
|
||||
|
||||
@@ -67,6 +65,8 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
{
|
||||
UpdatesAfter.Add(typeof(AtmosphereSystem));
|
||||
|
||||
_physicsQuery = GetEntityQuery<PhysicsComponent>();
|
||||
|
||||
SubscribeLocalEvent<FlammableComponent, MapInitEvent>(OnMapInit);
|
||||
SubscribeLocalEvent<FlammableComponent, InteractUsingEvent>(OnInteractUsing);
|
||||
SubscribeLocalEvent<FlammableComponent, StartCollideEvent>(OnCollide);
|
||||
@@ -141,7 +141,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
if (!TryComp<PhysicsComponent>(uid, out var body))
|
||||
return;
|
||||
|
||||
_fixture.TryCreateFixture(uid, component.FlammableCollisionShape, FlammableFixtureID, hard: false,
|
||||
_fixture.TryCreateFixture(uid, component.FlammableCollisionShape, component.FlammableFixtureID, hard: false,
|
||||
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
|
||||
// which don't collide with one another, shouldn't work here.
|
||||
if (args.OtherFixtureId != FlammableFixtureID && args.OurFixtureId != FlammableFixtureID)
|
||||
if (args.OtherFixtureId != flammable.FlammableFixtureID && args.OurFixtureId != flammable.FlammableFixtureID)
|
||||
return;
|
||||
|
||||
if (!flammable.FireSpread)
|
||||
@@ -211,49 +211,30 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
if (!flammable.OnFire && !otherFlammable.OnFire)
|
||||
return; // Neither are on fire
|
||||
|
||||
// WD START
|
||||
var weHold = _spellBlade.IsHoldingItemWithComponent<FireAspectComponent>(uid);
|
||||
var theyHold = _spellBlade.IsHoldingItemWithComponent<FireAspectComponent>(otherUid);
|
||||
// WD END
|
||||
|
||||
if (flammable.OnFire && otherFlammable.OnFire)
|
||||
// Both are on fire -> equalize fire stacks.
|
||||
// Weight each thing's firestacks by its mass
|
||||
var mass1 = 1f;
|
||||
var mass2 = 1f;
|
||||
if (_physicsQuery.TryComp(uid, out var physics) && _physicsQuery.TryComp(otherUid, out var otherPhys))
|
||||
{
|
||||
if (weHold && !theyHold || theyHold && !weHold) // WD
|
||||
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;
|
||||
mass1 = physics.Mass;
|
||||
mass2 = otherPhys.Mass;
|
||||
}
|
||||
|
||||
// Only one is on fire -> attempt to spread the fire.
|
||||
if (flammable.OnFire)
|
||||
{
|
||||
if (theyHold) // WD
|
||||
return;
|
||||
otherFlammable.FireStacks += flammable.FireStacks / 2;
|
||||
Ignite(otherUid, uid, otherFlammable);
|
||||
if (flammable.CanExtinguish)
|
||||
{
|
||||
flammable.FireStacks /= 2;
|
||||
UpdateAppearance(uid, flammable);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (weHold) // WD
|
||||
return;
|
||||
flammable.FireStacks += otherFlammable.FireStacks / 2;
|
||||
Ignite(uid, otherUid, flammable);
|
||||
if (otherFlammable.CanExtinguish)
|
||||
{
|
||||
otherFlammable.FireStacks /= 2;
|
||||
UpdateAppearance(otherUid, otherFlammable);
|
||||
}
|
||||
}
|
||||
// when the thing on fire is more massive than the other, the following happens:
|
||||
// - the thing on fire loses a small number of firestacks
|
||||
// - 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
|
||||
var total = mass1 + mass2;
|
||||
var avg = (flammable.FireStacks + otherFlammable.FireStacks) / total;
|
||||
|
||||
// swap the entity losing stacks depending on whichever has the most firestack kilos
|
||||
var (src, dest) = flammable.FireStacks * mass1 > otherFlammable.FireStacks * mass2
|
||||
? (-1f, 1f)
|
||||
: (1f, -1f);
|
||||
// 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);
|
||||
}
|
||||
|
||||
private void OnIsHot(EntityUid uid, FlammableComponent flammable, IsHotEvent args)
|
||||
@@ -263,7 +244,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
|
||||
private void OnTileFire(Entity<FlammableComponent> ent, ref TileFireEvent args)
|
||||
{
|
||||
var tempDelta = args.Temperature - MinIgnitionTemperature;
|
||||
var tempDelta = args.Temperature - ent.Comp.MinIgnitionTemperature;
|
||||
|
||||
_fireEvents.TryGetValue(ent, out var maxTemp);
|
||||
|
||||
@@ -291,17 +272,30 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
_appearance.SetData(uid, ToggleableLightVisuals.Enabled, flammable.OnFire, appearance);
|
||||
}
|
||||
|
||||
public void AdjustFireStacks(EntityUid uid, float relativeFireStacks, FlammableComponent? flammable = null)
|
||||
public void AdjustFireStacks(EntityUid uid, float relativeFireStacks, FlammableComponent? flammable = null, bool ignite = false)
|
||||
{
|
||||
if (!Resolve(uid, ref flammable))
|
||||
return;
|
||||
|
||||
flammable.FireStacks = MathF.Min(MathF.Max(MinimumFireStacks, flammable.FireStacks + relativeFireStacks), MaximumFireStacks);
|
||||
SetFireStacks(uid, flammable.FireStacks + relativeFireStacks, flammable, ignite);
|
||||
}
|
||||
|
||||
if (flammable.OnFire && flammable.FireStacks <= 0)
|
||||
public void SetFireStacks(EntityUid uid, float stacks, FlammableComponent? flammable = null, bool ignite = false)
|
||||
{
|
||||
if (!Resolve(uid, ref flammable))
|
||||
return;
|
||||
|
||||
flammable.FireStacks = MathF.Min(MathF.Max(flammable.MinimumFireStacks, stacks), flammable.MaximumFireStacks);
|
||||
|
||||
if (flammable.FireStacks <= 0)
|
||||
{
|
||||
Extinguish(uid, flammable);
|
||||
}
|
||||
else
|
||||
{
|
||||
flammable.OnFire = ignite;
|
||||
UpdateAppearance(uid, flammable);
|
||||
}
|
||||
}
|
||||
|
||||
public void Extinguish(EntityUid uid, FlammableComponent? flammable = null)
|
||||
@@ -450,13 +444,11 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
EnsureComp<IgnitionSourceComponent>(uid);
|
||||
_ignitionSourceSystem.SetIgnited(uid);
|
||||
|
||||
var damageScale = MathF.Min( flammable.FireStacks, 5);
|
||||
|
||||
if (TryComp(uid, out TemperatureComponent? temp))
|
||||
_temperatureSystem.ChangeHeat(uid, 12500 * damageScale, false, temp);
|
||||
_temperatureSystem.ChangeHeat(uid, 12500 * flammable.FireStacks, false, temp);
|
||||
|
||||
if (!_spellBlade.IsHoldingItemWithComponent<FireAspectComponent>(uid)) // WD EDIT
|
||||
_damageableSystem.TryChangeDamage(uid, flammable.Damage * damageScale, interruptsDoAfters: false);
|
||||
_damageableSystem.TryChangeDamage(uid, flammable.Damage * flammable.FireStacks, interruptsDoAfters: false);
|
||||
|
||||
AdjustFireStacks(uid, flammable.FirestackFade * (flammable.Resisting ? 10f : 1f), flammable);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user