Skip to content

Commit

Permalink
Fix AI display when there is no root task.
Browse files Browse the repository at this point in the history
  • Loading branch information
Damnae committed Feb 1, 2024
1 parent 3cc423a commit d88485a
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/gamecore/AnyTask.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import { taskTypeToComponentName, } from '@/common/common';
const props = defineProps<{node:GamecoreTask, withComponentName?:string}>()
const taskName = props.withComponentName ?? taskTypeToComponentName(props.node.$type)
const taskName = props.withComponentName ?? taskTypeToComponentName(props.node?.$type ?? 'MissingTask')
const taskComponent = defineAsyncComponent({
loader: async () =>
{
Expand All @@ -25,7 +25,7 @@
</script>

<template>
<component :is="taskComponent" :node="node" :class="inversibleNode.Inverse || inversibleNode.InverseResultFlag ? 'inverted' : ''" />
<component :is="taskComponent" :node="node" :class="inversibleNode?.Inverse || inversibleNode?.InverseResultFlag ? 'inverted' : ''" />
</template>

<style scoped>
Expand Down
2 changes: 1 addition & 1 deletion src/gamecore/MissingTask.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<template>
<BlockLayout :source="node">
<span class="notimplemented">{{ cleanupTaskName(node.$type) }}</span>
<span class="notimplemented">{{ cleanupTaskName(node?.$type ?? "No Task") }}</span>
</BlockLayout>
</template>

Expand Down
2 changes: 1 addition & 1 deletion src/sources/characterai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export interface AIDecision
DecisionName:string
ScoreEvaluatorType:string
ConsiderAxisList:GamecoreTask[]
RootTask:GamecoreTask
RootTask?:GamecoreTask
}

export interface CharacterAI
Expand Down
2 changes: 1 addition & 1 deletion src/views/aside/MonsterAI.vue
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
<div v-for="axis in decision.ConsiderAxisList">
<AnyTask :node="axis" />
</div>
<AnyTask :node="decision.RootTask" />
<AnyTask v-if="decision.RootTask != undefined" :node="decision.RootTask" />
</div>

<template v-if="skillSequence.length > 0">
Expand Down

0 comments on commit d88485a

Please sign in to comment.