Add the data model for structures and prevent them from being embedded in most actors.
This commit is contained in:
parent
5286f403a1
commit
762b297895
4 changed files with 50 additions and 2 deletions
|
|
@ -1,11 +1,13 @@
|
|||
import AspectItem from "./Aspect.mjs";
|
||||
import SpellItem from "./Spell.mjs";
|
||||
import StructureItem from "./Structure.mjs";
|
||||
|
||||
/** @extends {Item} */
|
||||
export class ItemHandler extends Item {
|
||||
proxyTargets = {
|
||||
aspect: AspectItem,
|
||||
spell: SpellItem
|
||||
spell: SpellItem,
|
||||
structure: StructureItem,
|
||||
};
|
||||
|
||||
constructor(data, ctx) {
|
||||
|
|
|
|||
23
module/documents/Item/Structure.mjs
Normal file
23
module/documents/Item/Structure.mjs
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
import { ItemHandler } from "./Handler.mjs";
|
||||
|
||||
/** @this {ItemHandler} */
|
||||
async function _preCreate() {
|
||||
if (this.isEmbedded) {
|
||||
let actor = this.actor;
|
||||
if (actor.type === "settlement") {
|
||||
return await actor.preItemEmbed(this);
|
||||
};
|
||||
ui.notifications.error(
|
||||
game.i18n.format(
|
||||
`dotdungeon.notification.error.cant-embed-item`,
|
||||
{ item: this, actor }
|
||||
),
|
||||
{ console: false, }
|
||||
);
|
||||
return false;
|
||||
};
|
||||
};
|
||||
|
||||
export default {
|
||||
_preCreate,
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue