Modeling items that have items?
I'm trying to develop the Panic at the Dojo system, and I'm unsure how to implement one feature.
In this system, you create "Stances" by combining a Style and a Form; these then can be assigned to a character, and they can switch between them.
I'm not sure how to model that in Foundry's default systems.
I thought about making Styles/Forms items, but then it's not easy to know which Style+Form makes up a Stance. I also thought about making them Actors, but I'm not sure if it's weird to have sub-actors inside of actors, or even possible.
4 Replies
There is some ongoing talk on the #wiki channel where some people are asking for an example/how-to about this kind of feature.
Foundry doesn't let items own items, and also doesn't let actors own actors.
My recommendation would be to make Style and Form both items, and then have data in the actor model which records which Style+Form are currently part of its Stance. If there's derived stats from that, they could be part of the actor system model, too.
That's essentially what we did for Lancer. Mech Weapon mounts are the prime example - a mech actor has a
weapon_mounts
array in its data. Each mount can have one or two weapons, and each of those weapons can have a weapon mod attached. The weapons and mods are all items owned by the actor, and inside weapon_mounts
there are references to those items. The references are stored as UUID strings server side, and get hydrated to the full item object during actor data preparation client side.
It's certainly complex, lots of logic to write on top of core.
The only other approach I can think of would be if Stance and/or Form were ActiveEffects. But you can also have the items generate active effects to modify the parent actor.@Eranziel Ok, yeah that gives me some ideas! As I look through the foundry API I'm not sure you can tell where things are dragged within a character sheet so it might not know what Stance you're dragging to, but a simple solution would be to just add it to the lowest one that's not assigned yet and then allow some moving them around with some buttons 🤔. I didn't think about active effects but I might try that if this solution doesn't work.
You'd have to add some custom drop handlers to specific elements on your sheet to tell where things are dropped. Quite possible - again, that's what we do in Lancer to tell which mount and slot you're dropping a weapon into.