Skip to content

Commit

Permalink
Check when set_property tries to set a property that doesn't exist on…
Browse files Browse the repository at this point in the history
… the entity
  • Loading branch information
Xterionix authored Feb 10, 2025
1 parent e5cbf4f commit bc3bb0c
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/Lib/Diagnostics/BehaviorPack/Entity/properties.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,17 @@ export function diagnose_entity_property_usage(
parent: "events" | "filter",
diagnoser: DiagnosticsBuilder
): void {
const names = definitions.map(def => def.name)

if (!names.includes(name)) {
diagnoser.add(
`${parent}/${name}`,
`Entity property definition for "${name}" not found`,
DiagnosticSeverity.error,
"behaviorpack.entity.property.unknown_property"
)
}

for (const def of definitions) {
if (def.name === name) {
check_entity_property_usage(def, name, value, parent, diagnoser);
Expand Down

0 comments on commit bc3bb0c

Please sign in to comment.