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:
@@ -107,7 +107,7 @@ namespace Content.Server.Explosion.EntitySystems
|
||||
|
||||
_transformSystem.AnchorEntity(uid, xform);
|
||||
|
||||
if(component.RemoveOnTrigger)
|
||||
if (component.RemoveOnTrigger)
|
||||
RemCompDeferred<AnchorOnTriggerComponent>(uid);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user