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:
Andrew (Atropos) 2025-03-22 11:53:11 -04:00 committed by GitHub
commit 01c79e9cdb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View file

@ -256,7 +256,7 @@ export class SimpleActor extends Actor {
if ( !isBar || !isDelta || (current?.dtype !== "Resource") ) {
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);
return allowed !== false ? this.update(updates) : this;
}

View file

@ -583,7 +583,7 @@ export class EntitySheetHelper {
if ( parts.pop() !== "value" ) continue;
const current = foundry.utils.getProperty(attrs, parts.join("."));
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));
}
}