Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent fly-by fixture from powering containment field generator #29225

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ public override void Update(float frameTime)
/// </summary>
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);
generator.Comp.Accumulator = 0f;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,13 @@ public int PowerBuffer
[DataField("idTag", customTypeSerializer: typeof(PrototypeIdSerializer<TagPrototype>))]
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]
arimah marked this conversation as resolved.
Show resolved Hide resolved
public string SourceFixtureId = "projectile";

/// <summary>
/// Is the generator toggled on?
/// </summary>
Expand Down
Loading