Sell value on the tooltip !
This commit is contained in:
@@ -105,6 +105,7 @@ export interface ItemJson {
|
||||
tool?: Omit<ToolProperties, "tier" | "speed"> & Partial<ToolProperties>;
|
||||
places?: string;
|
||||
max_stack?: number;
|
||||
base_sell_value?: number;
|
||||
food?: FoodProperties;
|
||||
// how it looks worn on a player
|
||||
worn?: WornProperties;
|
||||
@@ -341,6 +342,7 @@ export function item_to_json(id: string, item: ItemRegistry): ItemJson {
|
||||
if (item.tool !== undefined) json.tool = item.tool;
|
||||
if (item.block_id !== undefined) json.places = item.block_id;
|
||||
if (item.max_stack !== undefined) json.max_stack = item.max_stack;
|
||||
if (item.base_sell_value !== undefined) json.base_sell_value = item.base_sell_value;
|
||||
if (item.food !== undefined) json.food = item.food;
|
||||
if (item.worn !== undefined) json.worn = item.worn;
|
||||
if (item.name !== undefined) json.name = item.name;
|
||||
@@ -355,6 +357,7 @@ export function item_from_json(json: ItemJson): ItemRegistry {
|
||||
if (json.tool !== undefined) item.tool = { tier: 0, speed: 2, ...json.tool };
|
||||
if (json.places !== undefined) item.block_id = json.places;
|
||||
if (json.max_stack !== undefined) item.max_stack = json.max_stack;
|
||||
if (json.base_sell_value !== undefined) item.base_sell_value = json.base_sell_value;
|
||||
if (json.food !== undefined) item.food = json.food;
|
||||
if (json.worn !== undefined) item.worn = json.worn;
|
||||
if (json.name !== undefined) item.name = json.name;
|
||||
@@ -711,6 +714,9 @@ export function validate_item(json: unknown): Problems {
|
||||
if (json.max_stack !== undefined && (!Number.isInteger(json.max_stack) || (json.max_stack as number) < 1)) {
|
||||
problems.push("max_stack must be a positive whole number");
|
||||
}
|
||||
if (json.base_sell_value !== undefined && !is_whole(json.base_sell_value)) {
|
||||
problems.push("base_sell_value must be a whole number of 0 or more");
|
||||
}
|
||||
if (json.tool !== undefined) {
|
||||
const tool = json.tool;
|
||||
if (!is_object(tool) || typeof tool.type !== "string") {
|
||||
|
||||
Reference in New Issue
Block a user