Add emag functionality
This commit is contained in:
committed by
Saphire
parent
68eaf6ff25
commit
6e53cd98a4
@@ -117,13 +117,15 @@ public sealed class SingularityGeneratorSystem : EntitySystem
|
|||||||
if (!EntityManager.TryGetComponent<SingularityGeneratorComponent>(args.OtherEntity, out var generatorComp))
|
if (!EntityManager.TryGetComponent<SingularityGeneratorComponent>(args.OtherEntity, out var generatorComp))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (_timing.CurTime < _metadata.GetPauseTime(uid) + generatorComp.NextFailsafe)
|
if (_timing.CurTime < _metadata.GetPauseTime(uid) + generatorComp.NextFailsafe && !generatorComp.FailsafeDisabled)
|
||||||
{
|
{
|
||||||
EntityManager.QueueDeleteEntity(uid);
|
EntityManager.QueueDeleteEntity(uid);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var contained = true;
|
var contained = true;
|
||||||
|
if (!generatorComp.FailsafeDisabled)
|
||||||
|
{
|
||||||
var transform = Transform(args.OtherEntity);
|
var transform = Transform(args.OtherEntity);
|
||||||
var directions = Enum.GetValues<Direction>().Length;
|
var directions = Enum.GetValues<Direction>().Length;
|
||||||
for (var i = 0; i < directions - 1; i += 2) // Skip every other direction, checking only cardinals
|
for (var i = 0; i < directions - 1; i += 2) // Skip every other direction, checking only cardinals
|
||||||
@@ -131,13 +133,15 @@ public sealed class SingularityGeneratorSystem : EntitySystem
|
|||||||
if (!CheckContainmentField((Direction)i, new Entity<SingularityGeneratorComponent>(args.OtherEntity, generatorComp), transform))
|
if (!CheckContainmentField((Direction)i, new Entity<SingularityGeneratorComponent>(args.OtherEntity, generatorComp), transform))
|
||||||
contained = false;
|
contained = false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!contained)
|
if (!contained && !generatorComp.FailsafeDisabled)
|
||||||
{
|
{
|
||||||
generatorComp.NextFailsafe = _timing.CurTime + generatorComp.FailsafeCooldown;
|
generatorComp.NextFailsafe = _timing.CurTime + generatorComp.FailsafeCooldown;
|
||||||
_popupSystem.PopupEntity(Loc.GetString("comp-generator-failsafe", ("target", args.OtherEntity)), args.OtherEntity, PopupType.LargeCaution);
|
_popupSystem.PopupEntity(Loc.GetString("comp-generator-failsafe", ("target", args.OtherEntity)), args.OtherEntity, PopupType.LargeCaution);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
SetPower(
|
SetPower(
|
||||||
args.OtherEntity,
|
args.OtherEntity,
|
||||||
generatorComp.Power + component.State switch
|
generatorComp.Power + component.State switch
|
||||||
@@ -151,6 +155,8 @@ public sealed class SingularityGeneratorSystem : EntitySystem
|
|||||||
},
|
},
|
||||||
generatorComp
|
generatorComp
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
EntityManager.QueueDeleteEntity(uid);
|
EntityManager.QueueDeleteEntity(uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user