Prevent fly-by fixture from powering containment field generator (#29225)
* Prevent fly-by fixture from powering containment field generator * Update according to review
This commit is contained in:
committed by
GitHub
parent
67cc089dd0
commit
2b92ec79f7
@@ -65,7 +65,8 @@ public sealed class ContainmentFieldGeneratorSystem : EntitySystem
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void HandleGeneratorCollide(Entity<ContainmentFieldGeneratorComponent> generator, ref StartCollideEvent args)
|
private void HandleGeneratorCollide(Entity<ContainmentFieldGeneratorComponent> generator, ref StartCollideEvent args)
|
||||||
{
|
{
|
||||||
if (_tags.HasTag(args.OtherEntity, generator.Comp.IDTag))
|
if (args.OtherFixtureId == generator.Comp.SourceFixtureId &&
|
||||||
|
_tags.HasTag(args.OtherEntity, generator.Comp.IDTag))
|
||||||
{
|
{
|
||||||
ReceivePower(generator.Comp.PowerReceived, generator);
|
ReceivePower(generator.Comp.PowerReceived, generator);
|
||||||
generator.Comp.Accumulator = 0f;
|
generator.Comp.Accumulator = 0f;
|
||||||
|
|||||||
@@ -69,6 +69,13 @@ public sealed partial class ContainmentFieldGeneratorComponent : Component
|
|||||||
[DataField("idTag", customTypeSerializer: typeof(PrototypeIdSerializer<TagPrototype>))]
|
[DataField("idTag", customTypeSerializer: typeof(PrototypeIdSerializer<TagPrototype>))]
|
||||||
public string IDTag = "EmitterBolt";
|
public string IDTag = "EmitterBolt";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Which fixture ID should test collision with from the entity that powers the generator?
|
||||||
|
/// Prevents the generator from being powered by fly-by fixtures.
|
||||||
|
/// </summary>
|
||||||
|
[DataField]
|
||||||
|
public string SourceFixtureId = "projectile";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Is the generator toggled on?
|
/// Is the generator toggled on?
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user