Add validation for player start max speed and bunny hop settings in scene document validation
This commit is contained in:
@@ -1195,6 +1195,17 @@ function validatePlayerStartEntity(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!isNonNegativeFiniteNumber(entity.movementTemplate?.maxSpeed)) {
|
||||||
|
diagnostics.push(
|
||||||
|
createDiagnostic(
|
||||||
|
"error",
|
||||||
|
"invalid-player-start-max-speed",
|
||||||
|
"Player Start max speed must remain a finite number zero or greater.",
|
||||||
|
`${path}.movementTemplate.maxSpeed`
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (typeof entity.movementTemplate?.capabilities?.jump !== "boolean") {
|
if (typeof entity.movementTemplate?.capabilities?.jump !== "boolean") {
|
||||||
diagnostics.push(
|
diagnostics.push(
|
||||||
createDiagnostic(
|
createDiagnostic(
|
||||||
@@ -1291,6 +1302,30 @@ function validatePlayerStartEntity(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!isBoolean(entity.movementTemplate?.jump?.bunnyHop)) {
|
||||||
|
diagnostics.push(
|
||||||
|
createDiagnostic(
|
||||||
|
"error",
|
||||||
|
"invalid-player-start-bunny-hop",
|
||||||
|
"Player Start bunny hop setting must be a boolean.",
|
||||||
|
`${path}.movementTemplate.jump.bunnyHop`
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
!isNonNegativeFiniteNumber(entity.movementTemplate?.jump?.bunnyHopBoost)
|
||||||
|
) {
|
||||||
|
diagnostics.push(
|
||||||
|
createDiagnostic(
|
||||||
|
"error",
|
||||||
|
"invalid-player-start-bunny-hop-boost",
|
||||||
|
"Player Start bunny hop boost must remain a finite number zero or greater.",
|
||||||
|
`${path}.movementTemplate.jump.bunnyHopBoost`
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
!isFiniteNumber(entity.movementTemplate?.sprint?.speedMultiplier) ||
|
!isFiniteNumber(entity.movementTemplate?.sprint?.speedMultiplier) ||
|
||||||
(entity.movementTemplate?.sprint?.speedMultiplier ?? 0) <= 0
|
(entity.movementTemplate?.sprint?.speedMultiplier ?? 0) <= 0
|
||||||
|
|||||||
Reference in New Issue
Block a user