mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-23 16:23:12 +09:00
Add quality support to subspace storage
This commit is contained in:
1 parent
26269df7d4
commit
4fd123abc1
5 files changed
+182
-117
No files matched your search
@@ -1,25 +1,26 @@
|
||||
import { Type, Static } from "@sinclair/typebox";
|
||||
import * as lib from "@clusterio/lib";
|
||||
import { type } from "os";
|
||||
|
||||
export class Item {
|
||||
constructor(
|
||||
public name: string,
|
||||
public count: number
|
||||
public count: number,
|
||||
public quality: string = "normal"
|
||||
) {
|
||||
}
|
||||
|
||||
static jsonSchema = Type.Tuple([
|
||||
Type.String(),
|
||||
Type.Number(),
|
||||
Type.String(),
|
||||
]);
|
||||
|
||||
toJSON() {
|
||||
return [this.name, this.count];
|
||||
return [this.name, this.count, this.quality];
|
||||
}
|
||||
|
||||
static fromJSON(json: Static<typeof Item.jsonSchema>): Item {
|
||||
return new this(json[0], json[1]);
|
||||
return new this(json[0], json[1], json[2]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user