RC-40 | Weapon | Range
This commit is contained in:
parent
40ce88ebf4
commit
0e9218fbd3
2 changed files with 17 additions and 0 deletions
|
|
@ -1,3 +1,5 @@
|
||||||
|
import { optionalInteger } from "../helpers.mjs";
|
||||||
|
|
||||||
const { fields } = foundry.data;
|
const { fields } = foundry.data;
|
||||||
|
|
||||||
export class WeaponData extends foundry.abstract.TypeDataModel {
|
export class WeaponData extends foundry.abstract.TypeDataModel {
|
||||||
|
|
@ -14,6 +16,10 @@ export class WeaponData extends foundry.abstract.TypeDataModel {
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
range: new fields.SchemaField({
|
||||||
|
short: optionalInteger(),
|
||||||
|
long: optionalInteger(),
|
||||||
|
}),
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,3 +18,14 @@ export function barAttribute(min, initial, max = undefined) {
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export function optionalInteger({min, initial = null, max} = {}) {
|
||||||
|
return new fields.NumberField({
|
||||||
|
min,
|
||||||
|
initial,
|
||||||
|
max,
|
||||||
|
required: true,
|
||||||
|
nullable: true,
|
||||||
|
integer: true,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue