mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-18 23:38:35 +02:00
manMax, oneOf, subsetOf validators
This commit is contained in:
@@ -18,34 +18,16 @@ import { HacknetNodeConstants } from "./data/Constants";
|
||||
|
||||
import { dialogBoxCreate } from "../ui/React/DialogBox";
|
||||
import { Generic_fromJSON, Generic_toJSON, Reviver } from "../utils/JSONReviver";
|
||||
import { ObjectValidator } from "src/utils/Validator";
|
||||
import { ObjectValidator, minMax } from "../utils/Validator";
|
||||
|
||||
export class HacknetNode implements IHacknetNode {
|
||||
|
||||
static validationData: ObjectValidator<HacknetNode> = {
|
||||
cores: {
|
||||
default: 1,
|
||||
min: 1,
|
||||
max: HacknetNodeConstants.MaxCores
|
||||
},
|
||||
level: {
|
||||
default: 1,
|
||||
min: 1,
|
||||
max: HacknetNodeConstants.MaxLevel
|
||||
},
|
||||
ram: {
|
||||
default: 1,
|
||||
min: 1,
|
||||
max: HacknetNodeConstants.MaxRam
|
||||
},
|
||||
onlineTimeSeconds: {
|
||||
default: 0,
|
||||
min: 0
|
||||
},
|
||||
totalMoneyGenerated: {
|
||||
default: 0,
|
||||
min: 0
|
||||
}
|
||||
cores: minMax(1, 1, HacknetNodeConstants.MaxCores),
|
||||
level: minMax(1, 1, HacknetNodeConstants.MaxLevel),
|
||||
ram: minMax(1, 1, HacknetNodeConstants.MaxRam),
|
||||
onlineTimeSeconds: minMax(0, 0, Infinity),
|
||||
totalMoneyGenerated: minMax(0, 0, Infinity)
|
||||
}
|
||||
|
||||
// Node's number of cores
|
||||
|
||||
Reference in New Issue
Block a user