mirror of
https://github.com/RoY7x/worldbuilding.git
synced 2025-04-30 02:31:41 -04:00
Merge pull request #75 from abc-mikey/replace_clamped_with_clamp
replace Math.clamped with Math.clamp due to deprecation warning for V12
This commit is contained in:
commit
01c79e9cdb
2 changed files with 2 additions and 2 deletions
|
@ -256,7 +256,7 @@ export class SimpleActor extends Actor {
|
||||||
if ( !isBar || !isDelta || (current?.dtype !== "Resource") ) {
|
if ( !isBar || !isDelta || (current?.dtype !== "Resource") ) {
|
||||||
return super.modifyTokenAttribute(attribute, value, isDelta, isBar);
|
return super.modifyTokenAttribute(attribute, value, isDelta, isBar);
|
||||||
}
|
}
|
||||||
const updates = {[`system.${attribute}.value`]: Math.clamped(current.value + value, current.min, current.max)};
|
const updates = {[`system.${attribute}.value`]: Math.clamp(current.value + value, current.min, current.max)};
|
||||||
const allowed = Hooks.call("modifyTokenAttribute", {attribute, value, isDelta, isBar}, updates);
|
const allowed = Hooks.call("modifyTokenAttribute", {attribute, value, isDelta, isBar}, updates);
|
||||||
return allowed !== false ? this.update(updates) : this;
|
return allowed !== false ? this.update(updates) : this;
|
||||||
}
|
}
|
||||||
|
|
|
@ -583,7 +583,7 @@ export class EntitySheetHelper {
|
||||||
if ( parts.pop() !== "value" ) continue;
|
if ( parts.pop() !== "value" ) continue;
|
||||||
const current = foundry.utils.getProperty(attrs, parts.join("."));
|
const current = foundry.utils.getProperty(attrs, parts.join("."));
|
||||||
if ( current?.dtype !== "Resource" ) continue;
|
if ( current?.dtype !== "Resource" ) continue;
|
||||||
foundry.utils.setProperty(attrs, attr, Math.clamped(value, current.min || 0, current.max || 0));
|
foundry.utils.setProperty(attrs, attr, Math.clamp(value, current.min || 0, current.max || 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue