Skip to content

Commit

Permalink
Defect/source actor name not showing (#237)
Browse files Browse the repository at this point in the history
  • Loading branch information
misterpotts authored Nov 17, 2023
1 parent 07f041a commit 7a9dea4
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/_config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
title: Fabricate 0.10.16
title: Fabricate 0.10.17
email: [email protected]
description: >-
End user documentation for the Foundry Virtual Tabletop (VTT) Module, "Fabricate".
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fabricate",
"version": "0.10.16",
"version": "0.10.17",
"description": "A system-agnostic, flexible crafting module for FoundryVT",
"main": "index.js",
"type": "module",
Expand Down
10 changes: 9 additions & 1 deletion src/applications/actorCraftingApp/ActorCraftingApp.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,11 @@
}
}
function handleActorDetailsLoaded(event: CustomEvent<{ targetActorDetails: ActorDetails; sourceActorDetails: ActorDetails }>) {
sourceActorDetails = event.detail.sourceActorDetails;
targetActorDetails = event.detail.targetActorDetails;
}
onMount(load);
</script>
Expand All @@ -155,7 +160,8 @@
<ActorCraftingAppHeader localization={localization}
targetActorDetails={targetActorDetails}
sourceActorDetails={sourceActorDetails}
on:sourceActorChanged={handleSourceActorChanged} />
on:sourceActorChanged={handleSourceActorChanged}
on:actorDetailsLoaded={handleActorDetailsLoaded} />
{#if craftingProcess.isReady}
<RecipeCraftingProcess localization={localization}
bind:craftingProcess={craftingProcess} />
Expand All @@ -168,6 +174,8 @@
<ActorInventoryBrowser localization={localization}
bind:craftingAssessments={craftingAssessments}
bind:salvageAssessments={salvageAssessments}
sourceActorDetails={sourceActorDetails}
targetActorDetails={targetActorDetails}
on:startCraftingProcess={startCraftingProcess}
on:startSalvageProcess={startSalvageProcess} />
{/if}
Expand Down
17 changes: 17 additions & 0 deletions src/applications/actorCraftingApp/ActorCraftingAppHeader.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -74,30 +74,47 @@
}
async function loadActorDetails() {
const sourceActor = await game.actors.get(sourceActorDetails.id);
if (!sourceActor) {
throw new Error(`Fabricate | ActorCraftingApp: Unable to find actor with id ${sourceActorDetails.id}`);
}
sourceActorDetails = new DefaultActorDetails({
id: sourceActorDetails.id,
name: sourceActor.name,
avatarUrl: sourceActor.img,
initials: DefaultActorDetails.getInitialsFromName(sourceActor.name)
});
if (targetActorDetails.id === sourceActorDetails.id) {
targetActorDetails = sourceActorDetails;
dispatch("actorDetailsLoaded", {
sourceActorDetails: sourceActorDetails,
targetActorDetails: targetActorDetails
});
return;
}
const targetActor = await game.actors.get(targetActorDetails.id);
if (!targetActor) {
throw new Error(`Fabricate | ActorCraftingApp: Unable to find actor with id ${targetActorDetails.id}`);
}
targetActorDetails = new DefaultActorDetails({
id: targetActorDetails.id,
name: targetActor.name,
avatarUrl: targetActor.img,
initials: DefaultActorDetails.getInitialsFromName(targetActor.name)
});
dispatch("actorDetailsLoaded", {
sourceActorDetails: sourceActorDetails,
targetActorDetails: targetActorDetails
});
}
async function setSourceActor(value: ActorDetails) {
Expand Down

0 comments on commit 7a9dea4

Please sign in to comment.