Skip to content

Commit

Permalink
fix: [#3141] Propagate silence warning option on Actor
Browse files Browse the repository at this point in the history
Closes #3141
  • Loading branch information
eonarheim committed Aug 5, 2024
1 parent d4a2200 commit 514dc03
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/engine/Actor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,11 @@ export type ActorArgs = ColliderArgs & {
* Optionally supply a {@apilink CollisionGroup}
*/
collisionGroup?: CollisionGroup;

/**
* Optionally silence excalibur warning warnings
*/
silenceWarnings?: boolean;
};

type ColliderArgs =
Expand Down Expand Up @@ -294,6 +299,7 @@ export class Actor extends Entity implements Eventable, PointerEvents, CanInitia
* {@apilink ActionContext | `Action context`} of the actor.
*/
public actions: ActionsComponent;
private _silenceWarnings: boolean;

/**
* Gets the position vector of the actor in pixels
Expand Down Expand Up @@ -577,7 +583,8 @@ export class Actor extends Entity implements Eventable, PointerEvents, CanInitia
anchor,
offset,
collisionType,
collisionGroup
collisionGroup,
silenceWarnings
} = {
...config
};
Expand All @@ -592,6 +599,7 @@ export class Actor extends Entity implements Eventable, PointerEvents, CanInitia
this.scale = scale ?? vec(1, 1);
this.z = z ?? 0;
this.transform.coordPlane = coordPlane ?? CoordPlane.World;
this._silenceWarnings = silenceWarnings ?? false;

this.pointer = new PointerComponent();
this.addComponent(this.pointer);
Expand Down Expand Up @@ -663,6 +671,7 @@ export class Actor extends Entity implements Eventable, PointerEvents, CanInitia

public clone(): Actor {
const clone = new Actor({
silenceWarnings: this._silenceWarnings,
color: this.color.clone(),
anchor: this.anchor.clone(),
offset: this.offset.clone()
Expand Down

0 comments on commit 514dc03

Please sign in to comment.