Skip to content

Commit

Permalink
feat: Add new equipped states (#19)
Browse files Browse the repository at this point in the history
* fix: error when selecting multiple actors

* fix: add new equipped states and remove unneeded asyncs

* fix: multiple actors

* fix: update versions
  • Loading branch information
marvin9257 authored Dec 5, 2023
1 parent a6771fd commit 6d080db
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 16 deletions.
12 changes: 6 additions & 6 deletions module.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
],
"url": "https://github.com/marvin9257/fvtt-token-action-hud-twodsix",
"flags": {},
"version": "1.2.7",
"version": "1.3.0",
"compatibility": {
"minimum": "11",
"verified": "11.315"
Expand Down Expand Up @@ -59,8 +59,8 @@
"type": "system",
"compatibility": [
{
"minimum": "4.0.2",
"verified": "4.2.0"
"minimum": "4.8.0",
"verified": "4.8.0"
}
]
}
Expand All @@ -73,7 +73,7 @@
{
"minimum": "1.5.0",
"maximum": "1.5",
"verified": "1.5.0"
"verified": "1.5.2"
}
]
}
Expand All @@ -84,8 +84,8 @@
}
},
"socket": false,
"manifest": "https://raw.githubusercontent.com/marvin9257/fvtt-token-action-hud-twodsix/v1.2.7/module.json",
"download": "https://github.com/marvin9257/fvtt-token-action-hud-twodsix/releases/download/v1.2.7/module.zip",
"manifest": "https://raw.githubusercontent.com/marvin9257/fvtt-token-action-hud-twodsix/v1.3.0/module.json",
"download": "https://github.com/marvin9257/fvtt-token-action-hud-twodsix/releases/download/v1.3.0/module.zip",
"readme": "https://github.com/marvin9257/fvtt-token-action-hud-twodsix#readme",
"protected": false,
"coreTranslation": false,
Expand Down
16 changes: 8 additions & 8 deletions scripts/action-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Hooks.once('tokenActionHudCoreApiReady', async (coreModule) => {
* Build inventory
* @private
*/
async #buildInventory () {
#buildInventory () {
if (this.items.size === 0) return

const actionTypeId = 'item'
Expand Down Expand Up @@ -105,7 +105,7 @@ Hooks.once('tokenActionHudCoreApiReady', async (coreModule) => {
})

// TAH Core method to add actions to the action list
await this.addActions(actions, groupData)
this.addActions(actions, groupData)
}
}

Expand All @@ -115,14 +115,14 @@ Hooks.once('tokenActionHudCoreApiReady', async (coreModule) => {
* @returns {object}
*/
_getActors () {
return this.actors?.[0]
return this.actors?.[0] ?? undefined
}

/**
* Build characteristics
* @private
*/
async #buildCharacteristics () {
#buildCharacteristics () {
const actionTypeId = 'characteristics'
const groupData = { id: 'characteristics', type: 'system' }
// const charShown = game.settings.get('twodsix', 'showAlternativeCharacteristics')
Expand All @@ -145,14 +145,14 @@ Hooks.once('tokenActionHudCoreApiReady', async (coreModule) => {
}
}
// TAH Core method to add actions to the action list
await this.addActions(actions, groupData)
this.addActions(actions, groupData)
}

/**
* Build ship positions
* @private
*/
async #buildShipPositions () {
#buildShipPositions () {
const actionTypeId = 'ship_position'
const parentGroupData = { id: 'shipPosition', type: 'system' }
// Get positions
Expand All @@ -163,7 +163,7 @@ Hooks.once('tokenActionHudCoreApiReady', async (coreModule) => {
listName: `Group: ${position.name}`,
type: 'system-derived'
}
await this.addGroup(newPosition, parentGroupData)
this.addGroup(newPosition, parentGroupData)
const actions = []
for (const shipActionId of Object.keys(position.system.actions)) {
const action = position.system.actions[shipActionId]
Expand All @@ -174,7 +174,7 @@ Hooks.once('tokenActionHudCoreApiReady', async (coreModule) => {
encodedValue: [actionTypeId, position.id, shipActionId].join(this.delimiter)
})
}
await this.addActions(actions, newPosition)
this.addActions(actions, newPosition)
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions scripts/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ export const GROUP = {
consumable: { id: 'consumable', name: 'TYPES.Item.consumablePl', type: 'system' },
backpack: { id: 'backpack', name: 'TWODSIX.Actor.Items.LocationState.backpack', type: 'system' },
ship: { id: 'ship', name: 'TWODSIX.Actor.Items.LocationState.ship', type: 'system' },
base: { id: 'base', name: 'TWODSIX.Actor.Items.LocationState.base', type: 'system' },
vehicle: { id: 'vehicle', name: 'TWODSIX.Actor.Items.LocationState.vehicle', type: 'system' },
skills: { id: 'skills', name: 'TYPES.Item.skillPl', type: 'system' },
spell: { id: 'spell', name: 'TYPES.Item.spellPl', type: 'system' },
weapons: { id: 'weapons', name: 'TYPES.Item.weaponPl', type: 'system' },
Expand All @@ -61,6 +63,8 @@ export const ITEM_TYPE = {
computer: { groupId: 'equipment' },
equipment: { groupId: 'equipment' },
ship: { groupId: 'ship' },
vehicle: { groupId: 'vehicle' },
base: { groupId: 'base' },
skills: { groupId: 'skills' },
spell: { groupId: 'spell' },
treasure: { groupId: 'treasure' },
Expand Down
4 changes: 3 additions & 1 deletion scripts/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ Hooks.once('tokenActionHudCoreApiReady', async (coreModule) => {
{ ...groups.consumable, nestId: 'inventory_consumable' },
{ ...groups.tool, nestId: 'inventory_tool' },
{ ...groups.backpack, nestId: 'inventory_backpack' },
{ ...groups.ship, nestId: 'inventory_ship' }
{ ...groups.vehicle, nestId: 'inventory_vehicle' },
{ ...groups.ship, nestId: 'inventory_ship' },
{ ...groups.base, nestId: 'inventory_base' }
]
},
{
Expand Down
Loading

0 comments on commit 6d080db

Please sign in to comment.