UseDelay + ItemCooldown merge (#22502)

This commit is contained in:
AJCM-git
2024-01-03 21:33:09 -04:00
committed by GitHub
parent 42ec9b2967
commit 9c522c8b19
80 changed files with 324 additions and 589 deletions

View File

@@ -1,6 +1,5 @@
using Content.Server.Administration.Logs;
using Content.Server.Atmos.Components;
using Content.Server.Explosion.EntitySystems;
using Content.Server.IgnitionSource;
using Content.Server.Stunnable;
using Content.Server.Temperature.Components;
@@ -12,7 +11,6 @@ using Content.Shared.Atmos.Components;
using Content.Shared.Damage;
using Content.Shared.Database;
using Content.Shared.Interaction;
using Content.Shared.Interaction.Events;
using Content.Shared.Physics;
using Content.Shared.Popups;
using Content.Shared.Rejuvenate;
@@ -22,7 +20,6 @@ using Content.Shared.Timing;
using Content.Shared.Toggleable;
using Content.Shared.Weapons.Melee.Events;
using Robust.Server.Audio;
using Robust.Server.GameObjects;
using Robust.Shared.Physics.Components;
using Robust.Shared.Physics.Events;
using Robust.Shared.Physics.Systems;
@@ -39,9 +36,7 @@ namespace Content.Server.Atmos.EntitySystems
[Dependency] private readonly IgnitionSourceSystem _ignitionSourceSystem = default!;
[Dependency] private readonly DamageableSystem _damageableSystem = default!;
[Dependency] private readonly AlertsSystem _alertsSystem = default!;
[Dependency] private readonly TransformSystem _transformSystem = default!;
[Dependency] private readonly FixtureSystem _fixture = default!;
[Dependency] private readonly EntityLookupSystem _lookup = default!;
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
[Dependency] private readonly SharedPopupSystem _popup = default!;
@@ -59,7 +54,6 @@ namespace Content.Server.Atmos.EntitySystems
private float _timer;
private readonly Dictionary<Entity<FlammableComponent>, float> _fireEvents = new();
private readonly List<EntityUid> _toRemove = new();
public override void Initialize()
{
@@ -157,10 +151,11 @@ namespace Content.Server.Atmos.EntitySystems
args.Handled = true;
if (!_useDelay.BeginDelay(uid))
if (!TryComp(uid, out UseDelayComponent? useDelay) || !_useDelay.TryResetDelay((uid, useDelay), true))
return;
_audio.PlayPvs(component.ExtinguishAttemptSound, uid);
if (_random.Prob(component.Probability))
{
AdjustFireStacks(uid, component.StackDelta, flammable);
@@ -170,6 +165,7 @@ namespace Content.Server.Atmos.EntitySystems
_popup.PopupEntity(Loc.GetString(component.ExtinguishFailed), uid);
}
}
private void OnCollide(EntityUid uid, FlammableComponent flammable, ref StartCollideEvent args)
{
var otherUid = args.OtherEntity;
@@ -364,7 +360,7 @@ namespace Content.Server.Atmos.EntitySystems
// TODO: This needs cleanup to take off the crust from TemperatureComponent and shit.
var query = EntityQueryEnumerator<FlammableComponent, TransformComponent>();
while (query.MoveNext(out var uid, out var flammable, out var transform))
while (query.MoveNext(out var uid, out var flammable, out _))
{
// Slowly dry ourselves off if wet.
if (flammable.FireStacks < 0)
@@ -394,7 +390,7 @@ namespace Content.Server.Atmos.EntitySystems
EnsureComp<IgnitionSourceComponent>(uid);
_ignitionSourceSystem.SetIgnited(uid);
var damageScale = MathF.Min(flammable.FireStacks, 5);
var damageScale = MathF.Min( flammable.FireStacks, 5);
if (TryComp(uid, out TemperatureComponent? temp))
_temperatureSystem.ChangeHeat(uid, 12500 * damageScale, false, temp);