MrPrimate / tokenizer

Tiny yet capable in-game token editor for Foundry VTT
MIT License
28 stars 25 forks source link

Suggestion for Forbidden Lands Support and My Hack Revealed #142

Closed SmokeRaven667 closed 8 months ago

SmokeRaven667 commented 8 months ago

I noticed that Tokenizer cannot determine diff between PC and NPC with the Forbidden Lands system. I put a hack in place manually (and probably not in all the places it needs to be, but it works for my immediate purpose). The sheet for Forbidden Lands have a subtype property that is "npc" is the NPC sheet is chosen, so I updated main.js as shown below. Any clues as to other places I can/should update it and I'd be glad to submit PR; or if you want to add support for Forbidden Lands good karma awaits! Thanks much!

function tokenizeActor(actor) {
  let sheetType = ["character", "pc"].includes(actor.type) ? "pc" : "npc";
    if(actor.system.subtype?.type == "npc") {
      sheetType = "npc";
  }

  const options = {
    actor: actor,
    name: actor.name,
    type: sheetType,
    disposition: actor.prototypeToken.disposition,
    avatarFilename: getAvatarPath(actor),
    tokenFilename: actor.prototypeToken.texture.src,
    isWildCard: actor.prototypeToken.randomImg,
  };
  launchTokenizer(options, updateActor);
}
MrPrimate commented 8 months ago

Thanks for this, this confused me a little bit, but a fix will be in the next release!