RC-110 | Prevent Armour/Shield Equipping based on slots
This commit is contained in:
parent
b33d7b59eb
commit
4ccfc03e59
6 changed files with 94 additions and 18 deletions
19
module/data/Item/Shield.mjs
Normal file
19
module/data/Item/Shield.mjs
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
import { ArmourData } from "./Armour.mjs";
|
||||
import { Logger } from "../../utils/Logger.mjs";
|
||||
|
||||
export class ShieldData extends ArmourData {
|
||||
_canEquip() {
|
||||
const parent = this.parent;
|
||||
if (!parent.isEmbedded || !(parent.parent instanceof Actor)) {
|
||||
Logger.error(`Unable to equip item when it's not embedded`);
|
||||
return false;
|
||||
};
|
||||
|
||||
const shield = parent.parent.system.equippedShield;
|
||||
if (shield) {
|
||||
Logger.error(`Unable to equip multiple shields`);
|
||||
return false;
|
||||
};
|
||||
return true;
|
||||
};
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue