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

Check if "trigger" points to a valid entity event #233

Open
Xterionix opened this issue Jul 14, 2024 · 5 comments
Open

Check if "trigger" points to a valid entity event #233

Xterionix opened this issue Jul 14, 2024 · 5 comments

Comments

@Xterionix
Copy link
Contributor

"random_movement": {
	"randomize": [
		{
			"trigger": "switch_to_flight"
		},
		{
			"trigger": "switch_to_ground"
		}
	]
}
@Xterionix
Copy link
Contributor Author

export function behaviorpack_entity_check_events(
  events: SMap<EntityEvent> | EntityEvent[],
  diagnoser: DocumentDiagnosticsBuilder,
  properties: EntityProperty[],
  component_groups?: SMap<Internal.BehaviorPack.EntityComponentContainer>
) {
  if (Array.isArray(events)) {
    events.forEach((event) => behaviorpack_entity_check_event(event, "", diagnoser, properties, component_groups));
  } else {
    SMap.forEach(events, (event, key) =>
      behaviorpack_entity_check_event(event, key, diagnoser, properties, component_groups)
    );
  }
}

Why is events possibly an array? As far as I can tell, it'll always be an object unless events being an array is some old syntax

@DaanV2
Copy link
Contributor

DaanV2 commented Feb 12, 2025

Its very old syntax yeah, can't find examples atm

@Xterionix
Copy link
Contributor Author

Am I safe to remove it or should I leave it in just in case?

@DaanV2
Copy link
Contributor

DaanV2 commented Feb 12, 2025

Shouldn't hurt us to keep it in.

@Xterionix
Copy link
Contributor Author

Fair enough

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants