Fix some oopsies

This commit is contained in:
Carter Penterman 2024-04-24 01:23:24 -05:00
parent a8c9b1490d
commit 85c12d034a

View File

@ -166,8 +166,9 @@ async function validateMapAsset(assetId, game) {
errors.push(`The root part of your model is a \`${root.ClassName}\`, it needs to be a \`Model\` instead.`);
}
else {
if ((game === "bhop" || game === "surf") && !root.Name.startsWith(game + "_")) {
errors.push(`Your root model's name is \`${root.Name}\`, its name must start with \`${game}_\`.`);
const prefix = (game === "deathrun") ? "dr" : game;
if (!root.Name.startsWith(prefix + "_")) {
errors.push(`Your root model's name is \`${root.Name}\`, its name must start with \`${prefix}_\`.`);
}
if (!/^[a-z0-9_]*$/.test(root.Name)) {
errors.push(`Your root model's name is \`${root.Name}\` which contains invalid characters. It must only contain lowercase alphanumeric characters separated by underscores.`);
@ -207,8 +208,8 @@ async function validateMapAsset(assetId, game) {
}
// Why does ModuleScript not inherit from Script, and/or why does BaseScript not have a Source property?
const illegalScript = root.FindFirstChildOfClass("Script", (script) => sourceHasIllegalKeywords(script.Source));
const illegalModuleScript = root.FindFirstChildOfClass("ModuleScript", (script) => sourceHasIllegalKeywords(script.Source));
const illegalScript = root.FindFirstDescendantOfClass("Script", (script) => sourceHasIllegalKeywords(script.Source));
const illegalModuleScript = root.FindFirstDescendantOfClass("ModuleScript", (script) => sourceHasIllegalKeywords(script.Source));
if (illegalScript || illegalModuleScript) {
errors.push("Your map has a `Script` that contains the keyword `getfenv` or `require`. You must remove these.");
}