Allow negative item quantities, don't allow negative weights
This commit is contained in:
parent
4c05171e04
commit
cfa352e5e0
1 changed files with 2 additions and 2 deletions
|
|
@ -17,7 +17,6 @@ export class GenericItemData extends foundry.abstract.TypeDataModel {
|
||||||
}),
|
}),
|
||||||
quantity: new fields.NumberField({
|
quantity: new fields.NumberField({
|
||||||
integer: true,
|
integer: true,
|
||||||
min: 0,
|
|
||||||
initial: 1,
|
initial: 1,
|
||||||
}),
|
}),
|
||||||
equipped: new fields.BooleanField({
|
equipped: new fields.BooleanField({
|
||||||
|
|
@ -36,6 +35,7 @@ export class GenericItemData extends foundry.abstract.TypeDataModel {
|
||||||
* rounds the number to the nearest 2 decimal places.
|
* rounds the number to the nearest 2 decimal places.
|
||||||
*/
|
*/
|
||||||
get quantifiedWeight() {
|
get quantifiedWeight() {
|
||||||
return toPrecision(this.weight * this.quantity, 2);
|
const value = this.weight * this.quantity
|
||||||
|
return toPrecision(Math.max(value, 0), 2);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue