Hot Fix of Gravity Grenades (#19414)

* Supermatter grenade fix

* taking out the trash

* Removing debug Console.Log() in twostage

* More fixes

* Better to put LoadComponents on Update, else it will modify list of other untriggered components
This commit is contained in:
AlexMorgan3817
2023-09-04 19:23:48 +07:00
committed by GitHub
parent 91cfabd6f6
commit 61b0e6abcd
4 changed files with 21 additions and 17 deletions

View File

@@ -107,7 +107,7 @@ namespace Content.Server.Explosion.EntitySystems
_transformSystem.AnchorEntity(uid, xform);
if(component.RemoveOnTrigger)
if (component.RemoveOnTrigger)
RemCompDeferred<AnchorOnTriggerComponent>(uid);
}

View File

@@ -33,7 +33,7 @@ public sealed class TwoStageTriggerSystem : EntitySystem
component.NextTriggerTime = _timing.CurTime + component.TriggerDelay;
}
public void LoadComponents(EntityUid uid, TwoStageTriggerComponent component)
private void LoadComponents(EntityUid uid, TwoStageTriggerComponent component)
{
foreach (var (name, entry) in component.SecondStageComponents)
{
@@ -47,6 +47,7 @@ public sealed class TwoStageTriggerSystem : EntitySystem
_serializationManager.CopyTo(entry.Component, ref temp);
EntityManager.AddComponent(uid, comp);
}
component.ComponentsIsLoaded = true;
}
public override void Update(float frameTime)
@@ -54,17 +55,18 @@ public sealed class TwoStageTriggerSystem : EntitySystem
base.Update(frameTime);
var enumerator = EntityQueryEnumerator<TwoStageTriggerComponent>();
while (enumerator.MoveNext(out var uid, out var component))
{
if (component.NextTriggerTime == null)
if (!component.Triggered)
continue;
if (!component.ComponentsIsLoaded)
LoadComponents(uid, component);
if (_timing.CurTime < component.NextTriggerTime)
continue;
component.NextTriggerTime = null;
LoadComponents(uid, component);
_triggerSystem.Trigger(uid);
}
}