Smithing table
This commit is contained in:
+18
-2
@@ -78,7 +78,15 @@ export type RecipeJson =
|
||||
result: { id: string; count: number };
|
||||
}
|
||||
| { type: "furnace"; input: string; output: { id: string; count: number }; cook_time: number }
|
||||
| { type: "fuel"; item: string; burn_time: number };
|
||||
| { type: "fuel"; item: string; burn_time: number }
|
||||
// upgrades a tool at a smithing table, with some of a material and maybe one more item
|
||||
| {
|
||||
type: "smithing";
|
||||
tool: string;
|
||||
material: { id: string; count: number };
|
||||
addition?: string;
|
||||
result: string;
|
||||
};
|
||||
|
||||
// the crafting grid's format, see server/game/crafting.ts
|
||||
export interface GridRecipe {
|
||||
@@ -447,8 +455,16 @@ export function validate_recipe(json: unknown): Problems {
|
||||
problems.push("burn_time must be a positive number of ticks");
|
||||
}
|
||||
break;
|
||||
case "smithing":
|
||||
problems.push(
|
||||
...validate_id(json.tool, "tool"),
|
||||
...validate_stack(json.material, "material"),
|
||||
...validate_id(json.result, "result"),
|
||||
);
|
||||
if (json.addition !== undefined) problems.push(...validate_id(json.addition, "addition"));
|
||||
break;
|
||||
default:
|
||||
problems.push('type must be "shaped", "furnace" or "fuel"');
|
||||
problems.push('type must be "shaped", "furnace", "fuel" or "smithing"');
|
||||
}
|
||||
return problems;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user