Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Actor items not draggable or allowed to be "stashed" #126

Open
tak5haka opened this issue Jul 25, 2024 · 3 comments
Open

Actor items not draggable or allowed to be "stashed" #126

tak5haka opened this issue Jul 25, 2024 · 3 comments

Comments

@tak5haka
Copy link

Once items (gear, weapons, etc) are placed on the Actor sheet, they cannot be dragged off. This prevents the use of a module such as Item Piles where PCs can store items they are not carrying in a vault or container.

If it is too system breaking to enable this function, a simpler solution could be to use a similar function that the armour items have, where there is an icon to click that shows the item is in storage and does not affect encumbrance (like the "stashed" icon on the Fallout 2d20 actor sheet).

@tak5haka
Copy link
Author

tak5haka commented Jul 25, 2024

Looking at the json for weapons, equipment and skill kits, there is a system.equipped and a system.stashed option already there (in the same manner as for armour). I am thinking adjusting the sheet so that this can be used with every item of gear, might be the easiest route to allow players to stash items that they are not carrying with them and manage their weight allowance. However, there is also some code in the ac2d20-compiled.mjs that allows inventory items to be stashed, so that might also be a starting point just to implement this in the inventory partials?

@tak5haka
Copy link
Author

tak5haka commented Aug 1, 2024

I have worked out some solutions to activating the "stashed" option on the actor sheet on my local install of the system, but am not sure of the best way to hand that over to you. Let me know how you would like my suggestions. Thanks!

@tak5haka
Copy link
Author

tak5haka commented Aug 3, 2024

I have done some fiddling around on my local install and this seems to work (at least for me), although you would have to test rigorously as I am not a professional developer (at least not any more) ... I have hooked on to the existing code for stashed items rather than try to introduce anything new in the process.


templates/actor/parts/actor-skillkit.hbs

insert at line 24 (after {{item.name}}):

<a class="item-control item-stash {{#unless item.system.stashed}}item-unstashed{{/unless}}" title='{{localize "AC2D20.TEMPLATES.stashed"}}'>&nbsp;&nbsp;&nbsp;&nbsp;<i class="fas fa-briefcase"></i></a>


templates/actor/parts/actor-weapons.hbs

insert at line 55 (after {{this.name}}):

<a class="item-control item-stash {{#unless this.system.stashed}}item-unstashed{{/unless}}" title='{{localize "AC2D20.TEMPLATES.stashed"}}'>&nbsp;&nbsp;&nbsp;&nbsp;<i class="fas fa-briefcase"></i></a>


templates/actor/parts/actor-equipment.hbs

insert at line 15:

<a class="item-control item-stash {{#unless item.system.stashed}}item-unstashed{{/unless}}" title='{{localize "AC2D20.TEMPLATES.stashed"}}'>&nbsp;&nbsp;&nbsp;&nbsp;<i class="fas fa-briefcase"></i></a>


i18n/en.json (you will have to include localised variants)

insert at line 278:

"AC2D20.TEMPLATES.stashed": "stashed",


src/sheets/ACActorSheet.mjs (I also changed this on ac2d20-compiled.mjs at line 1189, although this is probably done as part of the packaging process?)

replace encumberingItems formula found at line 138 with:

		let encumberingItems = physicalItems.filter(i => {
			if (i.type !== "armor" && !i.system.stashed) {
				return true;
			}
			else if ((i.type === "armor" &&  !i.system.equipped) || (i.type === "armor" && i.system.equipped && i.system.qualities.heavy.value)) {
				return true;
			}
			else {
				return false;
			}
		});

src/sheets/ACActorSheet.mjs (I also changed this on ac2d20-compiled.mjs at line 1595, but I guess that's normally just part of the package process?)

change line 542 to:

await item.update({"system.stashed": !item.system.stashed});


css/ac2d20.css

at line 1409, remove space between .item-control and .item-unstashed

.ac2d20 .item-control.item-unstashed,


As I said, this seems to work fine for me, adjusting the encumbrance depending on whether or not a weapon, skillkit or piece of equipment is stashed or not. Please do test thoroughly though as I tend to use a lot of gaffer tape, glue and sawdust ... :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant