feat(data): organize strings by entity, script, signal and verb
BREAKING CHANGE: this renames almost all of the strings in the game. This new naming follows a conventional based on the entity type, script type, and signal or verb. All worlds need to be updated.
This commit is contained in:
parent
ee5c9bb8e0
commit
2430188984
|
@ -18,19 +18,19 @@ config:
|
|||
meta:
|
||||
create: 'created new world {{state.name}} ({{state.id}}) from {{world}} with seed of {{seed}} and room depth of {{depth}}'
|
||||
debug:
|
||||
none: 'no world state to debug'
|
||||
missing: 'no world state to debug'
|
||||
graph:
|
||||
none: 'no world state to graph'
|
||||
missing: 'no world state to graph'
|
||||
help: 'available verbs: {{verbs}}'
|
||||
load:
|
||||
none: 'no world states loaded from {{-path}}'
|
||||
missing: 'no world states loaded from {{-path}}'
|
||||
state: 'loaded world state {{meta.id}} from {{-path}}'
|
||||
quit: 'quitting'
|
||||
quit: 'exiting the game'
|
||||
save:
|
||||
none: 'no world state to save'
|
||||
missing: 'no world state to save'
|
||||
state: 'saved world state {{meta.id}} from {{-path}}'
|
||||
step:
|
||||
none: 'please create a world before using any verbs'
|
||||
missing: 'please create a world before using any verbs'
|
||||
world: '{{name}} ({{id}})'
|
||||
verbs:
|
||||
common:
|
||||
|
@ -99,6 +99,7 @@ config:
|
|||
- verbs.common.hit
|
||||
- verbs.common.look
|
||||
- verbs.common.move
|
||||
- verbs.common.open
|
||||
- verbs.common.take
|
||||
- verbs.common.use
|
||||
- verbs.common.wait
|
||||
|
|
121
data/demo.yml
121
data/demo.yml
|
@ -142,34 +142,53 @@ worlds:
|
|||
en:
|
||||
articles: []
|
||||
prepositions: []
|
||||
verbs:
|
||||
- verbs.world.slog
|
||||
- verbs.world.swing
|
||||
strings:
|
||||
actor:
|
||||
get:
|
||||
player: |-
|
||||
You have picked up a {{item.meta.name}}: {{item.meta.desc}} ({{item.meta.id}}).
|
||||
hit:
|
||||
dead: '{{actor.meta.name}} has died!'
|
||||
health: '{{actor.meta.name}} took {{damage}} damage and has {{health}} health left.'
|
||||
hit: |-
|
||||
{{attacker.meta.name}} ({{attacker.meta.id}}) has hit {{actor.meta.name}} ({{actor.meta.id}}) with a {{item.meta.name}}!
|
||||
step:
|
||||
command:
|
||||
signal:
|
||||
get:
|
||||
item: |-
|
||||
You have picked up a {{item.meta.name}}: {{item.meta.desc}}.
|
||||
hit:
|
||||
dead: |-
|
||||
{{actor.meta.name}} has died!
|
||||
health: |-
|
||||
{{actor.meta.name}} took {{damage}} damage and has {{health}} health left.
|
||||
item: |-
|
||||
{{attacker.meta.name}} has hit {{actor.meta.name}} with a {{item.meta.name}}!
|
||||
look:
|
||||
dead: |-
|
||||
The {{actor.meta.name}} is dead!
|
||||
health: |-
|
||||
You have {{health}} health.
|
||||
item: |-
|
||||
You are holding a {{item.meta.name}}: {{item.meta.desc}}.
|
||||
seen: |-
|
||||
A {{actor.meta.name}} is in the room: {{actor.meta.desc}}.
|
||||
self: |-
|
||||
You are a {{actor.meta.name}}: {{actor.meta.desc}}.
|
||||
step:
|
||||
dead: |-
|
||||
You are dead!
|
||||
player:
|
||||
verb: |-
|
||||
{{actor.meta.name}} will $t({{command.verb}}) the next turn.
|
||||
verb:
|
||||
missing: |-
|
||||
{{actor.meta.name}} does not know how to $t({{command.verb}})!
|
||||
player: |-
|
||||
You will $t({{command.verb}}) the next turn.
|
||||
target: |-
|
||||
{{actor.meta.name}} will $t({{command.verb}}) the {{command.targets}}.
|
||||
unknown: |-
|
||||
{{actor.meta.name}} does not know how to $t({{command.verb}})!
|
||||
verb:
|
||||
drop:
|
||||
owner: |-
|
||||
You are not holding {{item.meta.name}}!
|
||||
type: |-
|
||||
{{command.targets}} is not an item!
|
||||
equip:
|
||||
item: |-
|
||||
You equip the {{item.meta.name}} in your {{slot}}.
|
||||
none: |-
|
||||
missing: |-
|
||||
{{command.targets}} is not an item!
|
||||
slot: |-
|
||||
You are not able to equip {{item.meta.name}} in {{slot}}!
|
||||
|
@ -181,30 +200,11 @@ worlds:
|
|||
type: |-
|
||||
{{command.targets}} is not an actor!
|
||||
look:
|
||||
none: |-
|
||||
missing: |-
|
||||
You see nothing.
|
||||
room:
|
||||
you: |-
|
||||
You are a {{actor.meta.name}}: {{actor.meta.desc}} ({{actor.meta.id}}).
|
||||
health: |-
|
||||
You have {{health}} health.
|
||||
seen: |-
|
||||
You are in a {{room.meta.name}}: {{room.meta.desc}} ({{room.meta.id}}).
|
||||
inventory: |-
|
||||
You are holding a {{item.meta.name}}: {{item.meta.desc}} ({{item.meta.id}}).
|
||||
portal: |-
|
||||
A {{portal.meta.name}} leads to the {{portal.group.source}} ({{portal.meta.id}}).
|
||||
dest: |-
|
||||
You catch a glimpse of a {{room.meta.name}} ({{portal.dest}}) through the {{portal.meta.name}}.
|
||||
actor:
|
||||
seen: |-
|
||||
A {{actor.meta.name}} is in the room: {{actor.meta.desc}} ({{actor.meta.id}}).
|
||||
dead: |-
|
||||
The {{actor.meta.name}} is dead!
|
||||
item:
|
||||
seen: |-
|
||||
You see a {{item.meta.name}}: {{item.meta.desc}} ({{item.meta.id}}).
|
||||
move:
|
||||
locked: |-
|
||||
{{portal.meta.name}} is locked!
|
||||
missing: |-
|
||||
{{command.targets}} is not a portal!
|
||||
portal: |-
|
||||
|
@ -213,23 +213,42 @@ worlds:
|
|||
type: |-
|
||||
{{command.targets}} is not an item!
|
||||
use:
|
||||
target: |-
|
||||
You cannot use items on {{command.targets}}!
|
||||
type: |-
|
||||
{{command.targets}} is not a usable item!
|
||||
item:
|
||||
use:
|
||||
any: |-
|
||||
{{item.meta.name}} has been used on {{target.meta.name}}!
|
||||
signal:
|
||||
look:
|
||||
held: |-
|
||||
You are holding a {{item.meta.name}}: {{item.meta.desc}}.
|
||||
seen: |-
|
||||
You see a {{item.meta.name}}: {{item.meta.desc}}.
|
||||
verb:
|
||||
use:
|
||||
self: |-
|
||||
You have used {{item.meta.name}} on yourself!
|
||||
portal:
|
||||
signal:
|
||||
look:
|
||||
closed: |-
|
||||
The {{portal.meta.name}} is closed.
|
||||
dest:
|
||||
missing: |-
|
||||
There is nothing on the other side.
|
||||
room: |-
|
||||
You catch a glimpse of a {{room.meta.name}} through the {{portal.meta.name}}.
|
||||
seen: |-
|
||||
A {{portal.meta.name}} leads to the {{portal.group.source}}.
|
||||
room:
|
||||
signal:
|
||||
look:
|
||||
seen: |-
|
||||
You are in a {{room.meta.name}}: {{room.meta.desc}}.
|
||||
verbs:
|
||||
any: |-
|
||||
{{item.meta.name}} has been used on {{target.meta.name}}!
|
||||
world:
|
||||
slog: slog
|
||||
swing: swing
|
||||
verbs:
|
||||
- verbs.common.equip
|
||||
- verbs.common.open
|
||||
- verbs.world.slog
|
||||
- verbs.world.swing
|
||||
world:
|
||||
slog: slog
|
||||
swing: swing
|
||||
meta:
|
||||
id: test
|
||||
name:
|
||||
|
|
|
@ -130,34 +130,50 @@ worlds:
|
|||
en:
|
||||
articles: []
|
||||
prepositions: []
|
||||
verbs:
|
||||
- verbs.world.push
|
||||
strings:
|
||||
actor:
|
||||
get:
|
||||
player: |-
|
||||
You have picked up a {{item.meta.name}}: {{item.meta.desc}} ({{item.meta.id}}).
|
||||
hit:
|
||||
dead: '{{actor.meta.name}} has died!'
|
||||
health: '{{actor.meta.name}} took {{damage}} damage and has {{health}} health left.'
|
||||
hit: |-
|
||||
{{attacker.meta.name}} ({{attacker.meta.id}}) has hit {{actor.meta.name}} ({{actor.meta.id}}) with a {{item.meta.name}}!
|
||||
step:
|
||||
command:
|
||||
signal:
|
||||
get:
|
||||
item: |-
|
||||
You have picked up a {{item.meta.name}}: {{item.meta.desc}}.
|
||||
hit:
|
||||
dead: |-
|
||||
{{actor.meta.name}} has died!
|
||||
health: |-
|
||||
{{actor.meta.name}} took {{damage}} damage and has {{health}} health left.
|
||||
item: |-
|
||||
{{attacker.meta.name}} has hit {{actor.meta.name}} with a {{item.meta.name}}!
|
||||
look:
|
||||
dead: |-
|
||||
The {{actor.meta.name}} is dead!
|
||||
health: |-
|
||||
You have {{health}} health.
|
||||
item: |-
|
||||
You are holding a {{item.meta.name}}: {{item.meta.desc}}.
|
||||
seen: |-
|
||||
A {{actor.meta.name}} is in the room: {{actor.meta.desc}}.
|
||||
self: |-
|
||||
You are a {{actor.meta.name}}: {{actor.meta.desc}}.
|
||||
step:
|
||||
dead: |-
|
||||
You are dead!
|
||||
player:
|
||||
verb: |-
|
||||
{{actor.meta.name}} will $t({{command.verb}}) the next turn.
|
||||
verb:
|
||||
missing: |-
|
||||
{{actor.meta.name}} does not know how to $t({{command.verb}})!
|
||||
player: |-
|
||||
You will $t({{command.verb}}) the next turn.
|
||||
target: |-
|
||||
{{actor.meta.name}} will $t({{command.verb}}) the {{command.targets}}.
|
||||
unknown: |-
|
||||
{{actor.meta.name}} does not know how to $t({{command.verb}})!
|
||||
verb:
|
||||
drop:
|
||||
type: |-
|
||||
{{command.targets}} is not an item!
|
||||
equip:
|
||||
item: |-
|
||||
You equip the {{item.meta.name}} in your {{slot}}.
|
||||
none: |-
|
||||
missing: |-
|
||||
{{command.targets}} is not an item!
|
||||
slot: |-
|
||||
You are not able to equip {{item.meta.name}} in {{slot}}!
|
||||
|
@ -169,30 +185,11 @@ worlds:
|
|||
type: |-
|
||||
{{command.targets}} is not an actor!
|
||||
look:
|
||||
none: |-
|
||||
missing: |-
|
||||
You see nothing.
|
||||
room:
|
||||
you: |-
|
||||
You are a {{actor.meta.name}}: {{actor.meta.desc}} ({{actor.meta.id}}).
|
||||
health: |-
|
||||
You have {{health}} health.
|
||||
seen: |-
|
||||
You are in a {{room.meta.name}}: {{room.meta.desc}} ({{room.meta.id}}).
|
||||
inventory: |-
|
||||
You are holding a {{item.meta.name}}: {{item.meta.desc}} ({{item.meta.id}}).
|
||||
portal: |-
|
||||
A {{portal.meta.name}} leads to the {{portal.group.source}} ({{portal.meta.id}}).
|
||||
dest: |-
|
||||
You catch a glimpse of a {{room.meta.name}} ({{portal.dest}}) through the {{portal.meta.name}}.
|
||||
actor:
|
||||
seen: |-
|
||||
A {{actor.meta.name}} is in the room: {{actor.meta.desc}} ({{actor.meta.id}}).
|
||||
dead: |-
|
||||
The {{actor.meta.name}} is dead!
|
||||
item:
|
||||
seen: |-
|
||||
You see a {{item.meta.name}}: {{item.meta.desc}} ({{item.meta.id}}).
|
||||
move:
|
||||
locked: |-
|
||||
{{portal.meta.name}} is locked!
|
||||
missing: |-
|
||||
{{command.targets}} is not a portal!
|
||||
portal: |-
|
||||
|
@ -201,17 +198,41 @@ worlds:
|
|||
type: |-
|
||||
{{command.targets}} is not an item!
|
||||
use:
|
||||
target: |-
|
||||
You cannot use items on {{command.targets}}!
|
||||
type: |-
|
||||
{{command.targets}} is not a usable item!
|
||||
item:
|
||||
use:
|
||||
any: |-
|
||||
{{item.meta.name}} has been used by {{actor.meta.name}}!
|
||||
signal:
|
||||
look:
|
||||
held: |-
|
||||
You are holding a {{item.meta.name}}: {{item.meta.desc}}.
|
||||
seen: |-
|
||||
You see a {{item.meta.name}}: {{item.meta.desc}}.
|
||||
verb:
|
||||
use:
|
||||
self: |-
|
||||
You have used {{item.meta.name}} on yourself!
|
||||
portal:
|
||||
signal:
|
||||
look:
|
||||
closed: |-
|
||||
The {{portal.meta.name}} is closed.
|
||||
dest:
|
||||
missing: |-
|
||||
There is nothing on the other side.
|
||||
room: |-
|
||||
You catch a glimpse of a {{room.meta.name}} through the {{portal.meta.name}}.
|
||||
seen: |-
|
||||
A {{portal.meta.name}} leads to the {{portal.group.source}}.
|
||||
room:
|
||||
signal:
|
||||
look:
|
||||
seen: |-
|
||||
You are in a {{room.meta.name}}: {{room.meta.desc}}.
|
||||
verbs:
|
||||
world:
|
||||
push: push
|
||||
verbs:
|
||||
- verbs.world.push
|
||||
meta:
|
||||
id: sample-alice
|
||||
name:
|
||||
|
|
|
@ -130,34 +130,49 @@ worlds:
|
|||
en:
|
||||
articles: []
|
||||
prepositions: []
|
||||
verbs: []
|
||||
strings:
|
||||
actor:
|
||||
get:
|
||||
player: |-
|
||||
You have picked up a {{item.meta.name}}: {{item.meta.desc}} ({{item.meta.id}}).
|
||||
hit:
|
||||
dead: '{{actor.meta.name}} has died!'
|
||||
health: '{{actor.meta.name}} took {{damage}} damage and has {{health}} health left.'
|
||||
hit: |-
|
||||
{{attacker.meta.name}} ({{attacker.meta.id}}) has hit {{actor.meta.name}} ({{actor.meta.id}}) with a {{item.meta.name}}!
|
||||
step:
|
||||
command:
|
||||
signal:
|
||||
get:
|
||||
item: |-
|
||||
You have picked up a {{item.meta.name}}: {{item.meta.desc}}.
|
||||
hit:
|
||||
dead: |-
|
||||
{{actor.meta.name}} has died!
|
||||
health: |-
|
||||
{{actor.meta.name}} took {{damage}} damage and has {{health}} health left.
|
||||
item: |-
|
||||
{{attacker.meta.name}} has hit {{actor.meta.name}} with a {{item.meta.name}}!
|
||||
look:
|
||||
dead: |-
|
||||
The {{actor.meta.name}} is dead!
|
||||
health: |-
|
||||
You have {{health}} health.
|
||||
item: |-
|
||||
You are holding a {{item.meta.name}}: {{item.meta.desc}}.
|
||||
seen: |-
|
||||
A {{actor.meta.name}} is in the room: {{actor.meta.desc}}.
|
||||
self: |-
|
||||
You are a {{actor.meta.name}}: {{actor.meta.desc}}.
|
||||
step:
|
||||
dead: |-
|
||||
You are dead!
|
||||
player:
|
||||
verb: |-
|
||||
{{actor.meta.name}} will $t({{command.verb}}) the next turn.
|
||||
verb:
|
||||
missing: |-
|
||||
{{actor.meta.name}} does not know how to $t({{command.verb}})!
|
||||
player: |-
|
||||
You will $t({{command.verb}}) the next turn.
|
||||
target: |-
|
||||
{{actor.meta.name}} will $t({{command.verb}}) the {{command.targets}}.
|
||||
unknown: |-
|
||||
{{actor.meta.name}} does not know how to $t({{command.verb}})!
|
||||
verb:
|
||||
drop:
|
||||
type: |-
|
||||
{{command.targets}} is not an item!
|
||||
equip:
|
||||
item: |-
|
||||
You equip the {{item.meta.name}} in your {{slot}}.
|
||||
none: |-
|
||||
missing: |-
|
||||
{{command.targets}} is not an item!
|
||||
slot: |-
|
||||
You are not able to equip {{item.meta.name}} in {{slot}}!
|
||||
|
@ -169,30 +184,11 @@ worlds:
|
|||
type: |-
|
||||
{{command.targets}} is not an actor!
|
||||
look:
|
||||
none: |-
|
||||
missing: |-
|
||||
You see nothing.
|
||||
room:
|
||||
you: |-
|
||||
You are a {{actor.meta.name}}: {{actor.meta.desc}} ({{actor.meta.id}}).
|
||||
health: |-
|
||||
You have {{health}} health.
|
||||
seen: |-
|
||||
You are in a {{room.meta.name}}: {{room.meta.desc}} ({{room.meta.id}}).
|
||||
inventory: |-
|
||||
You are holding a {{item.meta.name}}: {{item.meta.desc}} ({{item.meta.id}}).
|
||||
portal: |-
|
||||
A {{portal.meta.name}} leads to the {{portal.group.source}} ({{portal.meta.id}}).
|
||||
dest: |-
|
||||
You catch a glimpse of a {{room.meta.name}} ({{portal.dest}}) through the {{portal.meta.name}}.
|
||||
actor:
|
||||
seen: |-
|
||||
A {{actor.meta.name}} is in the room: {{actor.meta.desc}} ({{actor.meta.id}}).
|
||||
dead: |-
|
||||
The {{actor.meta.name}} is dead!
|
||||
item:
|
||||
seen: |-
|
||||
You see a {{item.meta.name}}: {{item.meta.desc}} ({{item.meta.id}}).
|
||||
move:
|
||||
locked: |-
|
||||
{{portal.meta.name}} is locked!
|
||||
missing: |-
|
||||
{{command.targets}} is not a portal!
|
||||
portal: |-
|
||||
|
@ -201,13 +197,38 @@ worlds:
|
|||
type: |-
|
||||
{{command.targets}} is not an item!
|
||||
use:
|
||||
target: |-
|
||||
You cannot use items on {{command.targets}}!
|
||||
type: |-
|
||||
{{command.targets}} is not a usable item!
|
||||
item:
|
||||
use:
|
||||
any: |-
|
||||
{{item.meta.name}} has been used by {{actor.meta.name}}!
|
||||
verbs: []
|
||||
signal:
|
||||
look:
|
||||
held: |-
|
||||
You are holding a {{item.meta.name}}: {{item.meta.desc}}.
|
||||
seen: |-
|
||||
You see a {{item.meta.name}}: {{item.meta.desc}}.
|
||||
verb:
|
||||
use:
|
||||
self: |-
|
||||
You have used {{item.meta.name}} on yourself!
|
||||
portal:
|
||||
signal:
|
||||
look:
|
||||
closed: |-
|
||||
The {{portal.meta.name}} is closed.
|
||||
dest:
|
||||
missing: |-
|
||||
There is nothing on the other side.
|
||||
room: |-
|
||||
You catch a glimpse of a {{room.meta.name}} through the {{portal.meta.name}}.
|
||||
seen: |-
|
||||
A {{portal.meta.name}} leads to the {{portal.group.source}}.
|
||||
room:
|
||||
signal:
|
||||
look:
|
||||
seen: |-
|
||||
You are in a {{room.meta.name}}: {{room.meta.desc}}.
|
||||
meta:
|
||||
id: sample-dracula
|
||||
name:
|
||||
|
|
|
@ -128,34 +128,51 @@ worlds:
|
|||
locale:
|
||||
languages:
|
||||
en:
|
||||
articles: []
|
||||
prepositions: []
|
||||
verbs: []
|
||||
strings:
|
||||
actor:
|
||||
get:
|
||||
player: |-
|
||||
You have picked up a {{item.meta.name}}: {{item.meta.desc}} ({{item.meta.id}}).
|
||||
hit:
|
||||
dead: '{{actor.meta.name}} has died!'
|
||||
health: '{{actor.meta.name}} took {{damage}} damage and has {{health}} health left.'
|
||||
hit: |-
|
||||
{{attacker.meta.name}} ({{attacker.meta.id}}) has hit {{actor.meta.name}} ({{actor.meta.id}}) with a {{item.meta.name}}!
|
||||
step:
|
||||
command:
|
||||
signal:
|
||||
get:
|
||||
item: |-
|
||||
You have picked up a {{item.meta.name}}: {{item.meta.desc}}.
|
||||
hit:
|
||||
dead: |-
|
||||
{{actor.meta.name}} has died!
|
||||
health: |-
|
||||
{{actor.meta.name}} took {{damage}} damage and has {{health}} health left.
|
||||
item: |-
|
||||
{{attacker.meta.name}} has hit {{actor.meta.name}} with a {{item.meta.name}}!
|
||||
look:
|
||||
dead: |-
|
||||
The {{actor.meta.name}} is dead!
|
||||
health: |-
|
||||
You have {{health}} health.
|
||||
item: |-
|
||||
You are holding a {{item.meta.name}}: {{item.meta.desc}}.
|
||||
seen: |-
|
||||
A {{actor.meta.name}} is in the room: {{actor.meta.desc}}.
|
||||
self: |-
|
||||
You are a {{actor.meta.name}}: {{actor.meta.desc}}.
|
||||
step:
|
||||
dead: |-
|
||||
You are dead!
|
||||
player:
|
||||
verb: |-
|
||||
{{actor.meta.name}} will $t({{command.verb}}) the next turn.
|
||||
verb:
|
||||
missing: |-
|
||||
{{actor.meta.name}} does not know how to $t({{command.verb}})!
|
||||
player: |-
|
||||
You will $t({{command.verb}}) the next turn.
|
||||
target: |-
|
||||
{{actor.meta.name}} will $t({{command.verb}}) the {{command.targets}}.
|
||||
unknown: |-
|
||||
{{actor.meta.name}} does not know how to $t({{command.verb}})!
|
||||
verb:
|
||||
drop:
|
||||
type: |-
|
||||
{{command.targets}} is not an item!
|
||||
equip:
|
||||
item: |-
|
||||
You equip the {{item.meta.name}} in your {{slot}}.
|
||||
none: |-
|
||||
missing: |-
|
||||
{{command.targets}} is not an item!
|
||||
slot: |-
|
||||
You are not able to equip {{item.meta.name}} in {{slot}}!
|
||||
|
@ -167,30 +184,11 @@ worlds:
|
|||
type: |-
|
||||
{{command.targets}} is not an actor!
|
||||
look:
|
||||
none: |-
|
||||
missing: |-
|
||||
You see nothing.
|
||||
room:
|
||||
you: |-
|
||||
You are a {{actor.meta.name}}: {{actor.meta.desc}} ({{actor.meta.id}}).
|
||||
health: |-
|
||||
You have {{health}} health.
|
||||
seen: |-
|
||||
You are in a {{room.meta.name}}: {{room.meta.desc}} ({{room.meta.id}}).
|
||||
inventory: |-
|
||||
You are holding a {{item.meta.name}}: {{item.meta.desc}} ({{item.meta.id}}).
|
||||
portal: |-
|
||||
A {{portal.meta.name}} leads to the {{portal.group.source}} ({{portal.meta.id}}).
|
||||
dest: |-
|
||||
You catch a glimpse of a {{room.meta.name}} ({{portal.dest}}) through the {{portal.meta.name}}.
|
||||
actor:
|
||||
seen: |-
|
||||
A {{actor.meta.name}} is in the room: {{actor.meta.desc}} ({{actor.meta.id}}).
|
||||
dead: |-
|
||||
The {{actor.meta.name}} is dead!
|
||||
item:
|
||||
seen: |-
|
||||
You see a {{item.meta.name}}: {{item.meta.desc}} ({{item.meta.id}}).
|
||||
move:
|
||||
locked: |-
|
||||
{{portal.meta.name}} is locked!
|
||||
missing: |-
|
||||
{{command.targets}} is not a portal!
|
||||
portal: |-
|
||||
|
@ -199,16 +197,38 @@ worlds:
|
|||
type: |-
|
||||
{{command.targets}} is not an item!
|
||||
use:
|
||||
target: |-
|
||||
You cannot use items on {{command.targets}}!
|
||||
type: |-
|
||||
{{command.targets}} is not a usable item!
|
||||
item:
|
||||
use:
|
||||
any: |-
|
||||
{{item.meta.name}} has been used by {{actor.meta.name}}!
|
||||
articles: []
|
||||
prepositions: []
|
||||
verbs: []
|
||||
|
||||
signal:
|
||||
look:
|
||||
held: |-
|
||||
You are holding a {{item.meta.name}}: {{item.meta.desc}}.
|
||||
seen: |-
|
||||
You see a {{item.meta.name}}: {{item.meta.desc}}.
|
||||
verb:
|
||||
use:
|
||||
self: |-
|
||||
You have used {{item.meta.name}} on yourself!
|
||||
portal:
|
||||
signal:
|
||||
look:
|
||||
closed: |-
|
||||
The {{portal.meta.name}} is closed.
|
||||
dest:
|
||||
missing: |-
|
||||
There is nothing on the other side.
|
||||
room: |-
|
||||
You catch a glimpse of a {{room.meta.name}} through the {{portal.meta.name}}.
|
||||
seen: |-
|
||||
A {{portal.meta.name}} leads to the {{portal.group.source}}.
|
||||
room:
|
||||
signal:
|
||||
look:
|
||||
seen: |-
|
||||
You are in a {{room.meta.name}}: {{room.meta.desc}}.
|
||||
meta:
|
||||
id: sample-hansel-and-gretel
|
||||
name:
|
||||
|
|
|
@ -121,88 +121,109 @@ worlds:
|
|||
name:
|
||||
base: signal-room-step
|
||||
locale:
|
||||
bundles:
|
||||
languages:
|
||||
en:
|
||||
actor:
|
||||
get:
|
||||
player: |-
|
||||
You have picked up a {{item.meta.name}}: {{item.meta.desc}} ({{item.meta.id}}).
|
||||
hit:
|
||||
dead: '{{actor.meta.name}} has died!'
|
||||
health: '{{actor.meta.name}} took {{damage}} damage and has {{health}} health left.'
|
||||
hit: |-
|
||||
{{attacker.meta.name}} ({{attacker.meta.id}}) has hit {{actor.meta.name}} ({{actor.meta.id}}) with a {{item.meta.name}}!
|
||||
step:
|
||||
command:
|
||||
dead: |-
|
||||
You are dead!
|
||||
player:
|
||||
verb: |-
|
||||
{{actor.meta.name}} will $t({{command.verb}}) the next turn.
|
||||
target: |-
|
||||
{{actor.meta.name}} will $t({{command.verb}}) the {{command.targets}}.
|
||||
unknown: |-
|
||||
{{actor.meta.name}} does not know how to $t({{command.verb}})!
|
||||
drop:
|
||||
type: |-
|
||||
{{command.targets}} is not an item!
|
||||
equip:
|
||||
item: |-
|
||||
You equip the {{item.meta.name}} in your {{slot}}.
|
||||
none: |-
|
||||
{{command.targets}} is not an item!
|
||||
slot: |-
|
||||
You are not able to equip {{item.meta.name}} in {{slot}}!
|
||||
hit:
|
||||
item: |-
|
||||
You cannot hit {{target.meta.name}}, you are not holding anything!
|
||||
self: |-
|
||||
You cannot hit yourself!
|
||||
type: |-
|
||||
{{command.targets}} is not an actor!
|
||||
look:
|
||||
none: |-
|
||||
You see nothing.
|
||||
room:
|
||||
you: |-
|
||||
You are a {{actor.meta.name}}: {{actor.meta.desc}} ({{actor.meta.id}}).
|
||||
articles: []
|
||||
prepositions: []
|
||||
verbs: []
|
||||
strings:
|
||||
actor:
|
||||
signal:
|
||||
get:
|
||||
item: |-
|
||||
You have picked up a {{item.meta.name}}: {{item.meta.desc}}.
|
||||
hit:
|
||||
dead: |-
|
||||
{{actor.meta.name}} has died!
|
||||
health: |-
|
||||
You have {{health}} health.
|
||||
seen: |-
|
||||
You are in a {{room.meta.name}}: {{room.meta.desc}} ({{room.meta.id}}).
|
||||
inventory: |-
|
||||
You are holding a {{item.meta.name}}: {{item.meta.desc}} ({{item.meta.id}}).
|
||||
portal: |-
|
||||
A {{portal.meta.name}} leads to the {{portal.group.source}} ({{portal.meta.id}}).
|
||||
dest: |-
|
||||
You catch a glimpse of a {{room.meta.name}} ({{portal.dest}}) through the {{portal.meta.name}}.
|
||||
actor:
|
||||
seen: |-
|
||||
A {{actor.meta.name}} is in the room: {{actor.meta.desc}} ({{actor.meta.id}}).
|
||||
{{actor.meta.name}} took {{damage}} damage and has {{health}} health left.
|
||||
item: |-
|
||||
{{attacker.meta.name}} has hit {{actor.meta.name}} with a {{item.meta.name}}!
|
||||
look:
|
||||
dead: |-
|
||||
The {{actor.meta.name}} is dead!
|
||||
item:
|
||||
health: |-
|
||||
You have {{health}} health.
|
||||
item: |-
|
||||
You are holding a {{item.meta.name}}: {{item.meta.desc}}.
|
||||
seen: |-
|
||||
You see a {{item.meta.name}}: {{item.meta.desc}} ({{item.meta.id}}).
|
||||
move:
|
||||
missing: |-
|
||||
{{command.targets}} is not a portal!
|
||||
portal: |-
|
||||
{{actor.meta.name}} moved through the {{portal.group.source}} {{portal.meta.name}}.
|
||||
take:
|
||||
type: |-
|
||||
{{command.targets}} is not an item!
|
||||
use:
|
||||
type: |-
|
||||
{{command.targets}} is not a usable item!
|
||||
item:
|
||||
use:
|
||||
any: |-
|
||||
{{item.meta.name}} has been used by {{actor.meta.name}}!
|
||||
words:
|
||||
articles: []
|
||||
prepositions: []
|
||||
verbs: []
|
||||
A {{actor.meta.name}} is in the room: {{actor.meta.desc}}.
|
||||
self: |-
|
||||
You are a {{actor.meta.name}}: {{actor.meta.desc}}.
|
||||
step:
|
||||
dead: |-
|
||||
You are dead!
|
||||
verb:
|
||||
missing: |-
|
||||
{{actor.meta.name}} does not know how to $t({{command.verb}})!
|
||||
player: |-
|
||||
You will $t({{command.verb}}) the next turn.
|
||||
target: |-
|
||||
{{actor.meta.name}} will $t({{command.verb}}) the {{command.targets}}.
|
||||
verb:
|
||||
drop:
|
||||
type: |-
|
||||
{{command.targets}} is not an item!
|
||||
equip:
|
||||
item: |-
|
||||
You equip the {{item.meta.name}} in your {{slot}}.
|
||||
missing: |-
|
||||
{{command.targets}} is not an item!
|
||||
slot: |-
|
||||
You are not able to equip {{item.meta.name}} in {{slot}}!
|
||||
hit:
|
||||
item: |-
|
||||
You cannot hit {{target.meta.name}}, you are not holding anything!
|
||||
self: |-
|
||||
You cannot hit yourself!
|
||||
type: |-
|
||||
{{command.targets}} is not an actor!
|
||||
look:
|
||||
missing: |-
|
||||
You see nothing.
|
||||
move:
|
||||
locked: |-
|
||||
{{portal.meta.name}} is locked!
|
||||
missing: |-
|
||||
{{command.targets}} is not a portal!
|
||||
portal: |-
|
||||
{{actor.meta.name}} moved through the {{portal.group.source}} {{portal.meta.name}}.
|
||||
take:
|
||||
type: |-
|
||||
{{command.targets}} is not an item!
|
||||
use:
|
||||
target: |-
|
||||
You cannot use items on {{command.targets}}!
|
||||
type: |-
|
||||
{{command.targets}} is not a usable item!
|
||||
item:
|
||||
signal:
|
||||
look:
|
||||
held: |-
|
||||
You are holding a {{item.meta.name}}: {{item.meta.desc}}.
|
||||
seen: |-
|
||||
You see a {{item.meta.name}}: {{item.meta.desc}}.
|
||||
verb:
|
||||
use:
|
||||
self: |-
|
||||
You have used {{item.meta.name}} on yourself!
|
||||
portal:
|
||||
signal:
|
||||
look:
|
||||
closed: |-
|
||||
The {{portal.meta.name}} is closed.
|
||||
dest:
|
||||
missing: |-
|
||||
There is nothing on the other side.
|
||||
room: |-
|
||||
You catch a glimpse of a {{room.meta.name}} through the {{portal.meta.name}}.
|
||||
seen: |-
|
||||
A {{portal.meta.name}} leads to the {{portal.group.source}}.
|
||||
room:
|
||||
signal:
|
||||
look:
|
||||
seen: |-
|
||||
You are in a {{room.meta.name}}: {{room.meta.desc}}.
|
||||
meta:
|
||||
id: sample-red-riding-hood
|
||||
name:
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
# Locale
|
||||
|
||||
## Contents
|
||||
|
||||
## Conventions
|
||||
|
||||
- `type.verb`
|
||||
- `actor`
|
||||
- `item`
|
||||
- `portal`
|
||||
- `room`
|
||||
|
||||
Subkeys:
|
||||
|
||||
- `dead`: entity is dead and cannot act
|
||||
- `missing`: target was not found
|
||||
- `seen`
|
||||
- `self`: entity is or belongs to current actor
|
||||
- `type`: incorrect entity type
|
|
@ -498,19 +498,19 @@ languages:
|
|||
meta:
|
||||
create: 'created new world {{state.name}} ({{state.id}}) from {{world}} with seed of {{seed}} and room depth of {{depth}}'
|
||||
debug:
|
||||
none: 'no world state to debug'
|
||||
missing: 'no world state to debug'
|
||||
graph:
|
||||
none: 'no world state to graph'
|
||||
missing: 'no world state to graph'
|
||||
help: 'available verbs: {{verbs}}'
|
||||
load:
|
||||
none: 'no world states loaded from {{-path}}'
|
||||
missing: 'no world states loaded from {{-path}}'
|
||||
state: 'loaded world state {{meta.id}} from {{-path}}'
|
||||
quit: 'quitting'
|
||||
save:
|
||||
none: 'no world state to save'
|
||||
missing: 'no world state to save'
|
||||
state: 'saved world state {{meta.id}} from {{-path}}'
|
||||
step:
|
||||
none: 'please create a world before using any verbs'
|
||||
missing: 'please create a world before using any verbs'
|
||||
world: '{{name}} ({{id}})'
|
||||
```
|
||||
|
||||
|
|
|
@ -73,19 +73,19 @@ config:
|
|||
meta:
|
||||
create: 'created new world {{state.name}} ({{state.id}}) from {{world}} with seed of {{seed}} and room depth of {{depth}}'
|
||||
debug:
|
||||
none: 'no world state to debug'
|
||||
missing: 'no world state to debug'
|
||||
graph:
|
||||
none: 'no world state to graph'
|
||||
missing: 'no world state to graph'
|
||||
help: 'available verbs: {{verbs}}'
|
||||
load:
|
||||
none: 'no world states loaded from {{-path}}'
|
||||
missing: 'no world states loaded from {{-path}}'
|
||||
state: 'loaded world state {{meta.id}} from {{-path}}'
|
||||
quit: 'quitting'
|
||||
save:
|
||||
none: 'no world state to save'
|
||||
missing: 'no world state to save'
|
||||
state: 'saved world state {{meta.id}} from {{-path}}'
|
||||
step:
|
||||
none: 'please create a world before using any verbs'
|
||||
missing: 'please create a world before using any verbs'
|
||||
world: '{{name}} ({{id}})'
|
||||
verbs:
|
||||
common:
|
||||
|
|
|
@ -5,8 +5,6 @@ import { argv } from 'process';
|
|||
import { main } from './main';
|
||||
|
||||
main(argv).then((exitCode: number) => {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('main exited %s', exitCode);
|
||||
process.exitCode = exitCode;
|
||||
}).catch((err) => {
|
||||
// eslint-disable-next-line no-console
|
||||
|
|
|
@ -11,6 +11,6 @@ export async function SignalActorGet(this: ScriptTarget, context: ScriptContext)
|
|||
|
||||
if (this.source === ActorSource.PLAYER) {
|
||||
const item = mustExist(context.item);
|
||||
await context.state.show(context.source, 'actor.get.player', { item });
|
||||
await context.state.show(context.source, 'actor.signal.get.item', { item });
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ export async function SignalActorHit(this: ScriptTarget, context: ScriptContext)
|
|||
const attacker = mustExist(context.actor);
|
||||
const item = mustExist(context.item);
|
||||
|
||||
await context.state.show(context.source, 'actor.hit.hit', {
|
||||
await context.state.show(context.source, 'actor.signal.hit.item', {
|
||||
actor: this,
|
||||
attacker,
|
||||
item,
|
||||
|
@ -27,7 +27,7 @@ export async function SignalActorHit(this: ScriptTarget, context: ScriptContext)
|
|||
await context.state.update(this, { stats });
|
||||
|
||||
if (health > 0) {
|
||||
await context.state.show(context.source, 'actor.hit.health', { actor: this, damage, health });
|
||||
await context.state.show(context.source, 'actor.signal.hit.health', { actor: this, damage, health });
|
||||
} else {
|
||||
// drop inventory
|
||||
const room = mustExist(context.room);
|
||||
|
@ -38,6 +38,6 @@ export async function SignalActorHit(this: ScriptTarget, context: ScriptContext)
|
|||
target: room,
|
||||
}, context);
|
||||
}
|
||||
await context.state.show(context.source, 'actor.hit.dead', { actor: this, damage });
|
||||
await context.state.show(context.source, 'actor.signal.hit.dead', { actor: this, damage });
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,16 +2,30 @@ import { ScriptTargetError } from '../../../error/ScriptTargetError';
|
|||
import { isActor } from '../../../model/entity/Actor';
|
||||
import { ScriptContext, ScriptTarget } from '../../../service/script';
|
||||
import { getKey } from '../../../util/collection/map';
|
||||
import { STAT_HEALTH } from '../../../util/constants';
|
||||
import { SIGNAL_LOOK, STAT_HEALTH } from '../../../util/constants';
|
||||
|
||||
export async function SignalActorLook(this: ScriptTarget, context: ScriptContext): Promise<void> {
|
||||
if (!isActor(this)) {
|
||||
throw new ScriptTargetError('script target must be an actor');
|
||||
}
|
||||
|
||||
await context.state.show(context.source, 'actor.step.look.actor.seen', { actor: this });
|
||||
const health = getKey(this.stats, STAT_HEALTH, 0);
|
||||
|
||||
if (this === context.actor) {
|
||||
await context.state.show(context.source, 'actor.signal.look.self', { actor: this });
|
||||
|
||||
if (health > 0) {
|
||||
await context.state.show(context.source, 'actor.signal.look.health', { actor: this, health });
|
||||
}
|
||||
|
||||
for (const item of this.items) {
|
||||
await context.script.invoke(item, SIGNAL_LOOK, context);
|
||||
}
|
||||
} else {
|
||||
await context.state.show(context.source, 'actor.signal.look.seen', { actor: this });
|
||||
}
|
||||
|
||||
if (health <= 0) {
|
||||
await context.state.show(context.source, 'actor.step.look.actor.dead', { actor: this });
|
||||
await context.state.show(context.source, 'actor.signal.look.dead', { actor: this });
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ export async function SignalActorStep(this: ScriptTarget, context: ScriptContext
|
|||
const health = getKey(this.stats, STAT_HEALTH, 0);
|
||||
if (health <= 0) {
|
||||
if (this.source === ActorSource.PLAYER) {
|
||||
await context.state.show(context.source, 'actor.step.command.dead', { actor: this });
|
||||
await context.state.show(context.source, 'actor.signal.step.dead', { actor: this });
|
||||
await context.state.quit('quit.dead', { actor: this }, [STAT_SCORE]);
|
||||
}
|
||||
return;
|
||||
|
@ -41,16 +41,15 @@ export async function SignalActorStep(this: ScriptTarget, context: ScriptContext
|
|||
|
||||
const scripts = getVerbScripts(source);
|
||||
if (scripts.has(command.verb) === false) {
|
||||
await context.state.show(context.source, 'actor.step.command.unknown', showContext);
|
||||
context.logger.warn({ command }, 'unknown verb');
|
||||
return;
|
||||
return context.state.show(context.source, 'actor.signal.step.verb.missing', showContext);
|
||||
}
|
||||
|
||||
if (this.source === ActorSource.PLAYER) {
|
||||
if (command.targets.length > 0) {
|
||||
await context.state.show(context.source, 'actor.step.command.player.target', showContext);
|
||||
await context.state.show(context.source, 'actor.signal.step.verb.target', showContext);
|
||||
} else {
|
||||
await context.state.show(context.source, 'actor.step.command.player.verb', showContext);
|
||||
await context.state.show(context.source, 'actor.signal.step.verb.player', showContext);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -15,15 +15,15 @@ export async function SignalActorLookLucy(this: WorldEntity, context: ScriptCont
|
|||
throw new ScriptTargetError('script target must be an actor');
|
||||
}
|
||||
|
||||
await context.state.show(context.source, 'actor.step.look.actor.seen', { actor: this });
|
||||
await context.state.show(context.source, 'actor.signal.look.seen', { actor: this });
|
||||
|
||||
const health = getKey(this.stats, STAT_HEALTH, 0);
|
||||
switch (true) {
|
||||
case (health <= 0):
|
||||
return context.state.show(context.source, 'actor.step.look.actor.dead', { actor: this });
|
||||
return context.state.show(context.source, 'actor.signal.look.dead', { actor: this });
|
||||
case (health <= 10):
|
||||
return context.state.show(context.source, 'actor.step.look.actor.pale', { actor: this });
|
||||
return context.state.show(context.source, 'actor.signal.look.pale', { actor: this });
|
||||
default:
|
||||
return context.state.show(context.source, 'actor.step.look.actor.healthy', { actor: this });
|
||||
return context.state.show(context.source, 'actor.signal.look.healthy', { actor: this });
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,8 +19,8 @@ export async function SignalActorLookMaid(this: ScriptTarget, context: ScriptCon
|
|||
|
||||
const turn = getKey(this.stats, 'awaken', 10);
|
||||
if (context.step.turn <= turn) {
|
||||
return context.state.show(context.source, 'actor.step.look.actor.asleep', { actor: this });
|
||||
return context.state.show(context.source, 'actor.signal.look.asleep', { actor: this });
|
||||
} else {
|
||||
return context.state.show(context.source, 'actor.step.look.actor.awake', { actor: this });
|
||||
return context.state.show(context.source, 'actor.signal.look.awake', { actor: this });
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import { doesExist } from '@apextoaster/js-utils';
|
||||
|
||||
import { ScriptTargetError } from '../../../error/ScriptTargetError';
|
||||
import { isItem } from '../../../model/entity/Item';
|
||||
import { ScriptContext, ScriptTarget } from '../../../service/script';
|
||||
|
@ -7,5 +9,9 @@ export async function SignalItemLook(this: ScriptTarget, context: ScriptContext)
|
|||
throw new ScriptTargetError('script target must be an item');
|
||||
}
|
||||
|
||||
await context.state.show(context.source, 'actor.step.look.item.seen', { item: this });
|
||||
if (doesExist(context.actor) && context.actor.items.includes(this)) {
|
||||
await context.state.show(context.source, 'item.signal.look.held', { item: this });
|
||||
} else {
|
||||
await context.state.show(context.source, 'item.signal.look.seen', { item: this });
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ export async function SignalItemReplace(this: ScriptTarget, context: ScriptConte
|
|||
|
||||
const replaceStr = this.flags.get('replace');
|
||||
if (isNil(replaceStr)) {
|
||||
return context.state.show(context.source, 'item.replace.none', { item: this });
|
||||
return context.state.show(context.source, 'item.replace.missing', { item: this });
|
||||
}
|
||||
|
||||
// TODO: use join helper and respect normal ordering of and/or groups
|
||||
|
|
|
@ -10,16 +10,15 @@ export async function SignalPortalLook(this: ScriptTarget, context: ScriptContex
|
|||
throw new ScriptTargetError('script target must be a portal');
|
||||
}
|
||||
|
||||
await context.state.show(context.source, 'actor.step.look.room.portal', { portal: this });
|
||||
await context.state.show(context.source, 'portal.signal.look.seen', { portal: this });
|
||||
|
||||
if (this.dest.length === 0) {
|
||||
await context.state.show(context.source, 'actor.step.look.room.abyss', { portal: this });
|
||||
return;
|
||||
return context.state.show(context.source, 'portal.signal.look.dest.missing', { portal: this });
|
||||
}
|
||||
|
||||
const closed = getKey(this.stats, STAT_CLOSED, 0);
|
||||
if (closed > 0) {
|
||||
await context.state.show(context.source, 'actor.step.look.room.closed', { portal: this });
|
||||
await context.state.show(context.source, 'portal.signal.look.closed', { portal: this });
|
||||
}
|
||||
|
||||
const [room] = await context.state.find({
|
||||
|
@ -28,5 +27,6 @@ export async function SignalPortalLook(this: ScriptTarget, context: ScriptContex
|
|||
},
|
||||
type: ROOM_TYPE,
|
||||
});
|
||||
await context.state.show(context.source, 'actor.step.look.room.dest', { portal: this, room });
|
||||
|
||||
return context.state.show(context.source, 'portal.signal.look.dest.room', { portal: this, room });
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ export async function SignalRoomLook(this: ScriptTarget, context: ScriptContext)
|
|||
throw new ScriptTargetError('script target must be a room');
|
||||
}
|
||||
|
||||
await context.state.show(context.source, 'actor.step.look.room.seen', { room: this });
|
||||
await context.state.show(context.source, 'room.signal.look.seen', { room: this });
|
||||
|
||||
for (const actor of this.actors) {
|
||||
if (actor === context.actor) {
|
||||
|
|
|
@ -30,11 +30,14 @@ export async function VerbActorDrop(this: ScriptTarget, context: ScriptContext):
|
|||
|
||||
const moving = indexEntity(results, command.index, isItem);
|
||||
if (isNil(moving)) {
|
||||
await context.state.show(context.source, 'actor.step.drop.type', { command });
|
||||
return;
|
||||
return context.state.show(context.source, 'actor.verb.drop.type', { command });
|
||||
}
|
||||
|
||||
await context.state.move({
|
||||
if (this.items.includes(moving) === false) {
|
||||
return context.state.show(context.source, 'actor.verb.drop.owner', { command, item: moving });
|
||||
}
|
||||
|
||||
return context.state.move({
|
||||
moving,
|
||||
source: this,
|
||||
target: room,
|
||||
|
|
|
@ -28,8 +28,7 @@ export async function VerbActorEquip(this: ScriptTarget, context: ScriptContext)
|
|||
|
||||
const item = indexEntity(results, command.index, isItem);
|
||||
if (isNil(item)) {
|
||||
await context.state.show(context.source, 'actor.step.equip.none', { command });
|
||||
return;
|
||||
return context.state.show(context.source, 'actor.verb.equip.missing', { command });
|
||||
}
|
||||
|
||||
// use the requested slot or default to the item's preferred slot
|
||||
|
@ -39,8 +38,8 @@ export async function VerbActorEquip(this: ScriptTarget, context: ScriptContext)
|
|||
if (this.slots.has(slot)) {
|
||||
const slots = setKey(this.slots, slot, item.meta.id);
|
||||
await context.state.update(this, { slots });
|
||||
await context.state.show(context.source, 'actor.step.equip.item', { item, slot });
|
||||
await context.state.show(context.source, 'actor.verb.equip.item', { item, slot });
|
||||
} else {
|
||||
await context.state.show(context.source, 'actor.step.equip.slot', { item, slot });
|
||||
await context.state.show(context.source, 'actor.verb.equip.slot', { item, slot });
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,24 +30,21 @@ export async function VerbActorHit(this: ScriptTarget, context: ScriptContext):
|
|||
const target = indexEntity(results, command.index, isActor);
|
||||
|
||||
if (isNil(target)) {
|
||||
await context.state.show(context.source, 'actor.step.hit.type', { command });
|
||||
return;
|
||||
return context.state.show(context.source, 'actor.verb.hit.type', { command });
|
||||
}
|
||||
|
||||
if (this === target) {
|
||||
await context.state.show(context.source, 'actor.step.hit.self', { command });
|
||||
return;
|
||||
return context.state.show(context.source, 'actor.verb.hit.self', { command });
|
||||
}
|
||||
|
||||
const [slot] = findActorSlots(this, 'weapon');
|
||||
const item = findSlotItem(actor, slot);
|
||||
|
||||
if (isNil(item)) {
|
||||
await context.state.show(context.source, 'actor.step.hit.item', { target });
|
||||
return;
|
||||
return context.state.show(context.source, 'actor.verb.hit.item', { target });
|
||||
}
|
||||
|
||||
await context.script.invoke(target, SIGNAL_HIT, {
|
||||
return context.script.invoke(target, SIGNAL_HIT, {
|
||||
...context,
|
||||
actor,
|
||||
item,
|
||||
|
|
|
@ -4,8 +4,7 @@ import { ScriptTargetError } from '../../../error/ScriptTargetError';
|
|||
import { isActor } from '../../../model/entity/Actor';
|
||||
import { ScriptContext, ScriptTarget } from '../../../service/script';
|
||||
import { head } from '../../../util/collection/array';
|
||||
import { getKey } from '../../../util/collection/map';
|
||||
import { SIGNAL_LOOK, STAT_HEALTH } from '../../../util/constants';
|
||||
import { SIGNAL_LOOK } from '../../../util/constants';
|
||||
import { createFuzzyMatcher } from '../../../util/entity/match';
|
||||
|
||||
export async function VerbActorLook(this: ScriptTarget, context: ScriptContext): Promise<void> {
|
||||
|
@ -21,14 +20,7 @@ export async function VerbActorLook(this: ScriptTarget, context: ScriptContext):
|
|||
|
||||
const command = mustExist(context.command);
|
||||
if (command.targets.length === 0) {
|
||||
const health = getKey(this.stats, STAT_HEALTH, 0);
|
||||
await context.state.show(context.source, 'actor.step.look.room.you', { actor: this });
|
||||
await context.state.show(context.source, 'actor.step.look.room.health', { actor: this, health });
|
||||
|
||||
for (const item of this.items) {
|
||||
await context.script.invoke(item, SIGNAL_LOOK, sourceContext);
|
||||
}
|
||||
|
||||
await context.script.invoke(this, SIGNAL_LOOK, sourceContext);
|
||||
return context.script.invoke(room, SIGNAL_LOOK, sourceContext);
|
||||
}
|
||||
|
||||
|
@ -45,5 +37,5 @@ export async function VerbActorLook(this: ScriptTarget, context: ScriptContext):
|
|||
return context.script.invoke(target, SIGNAL_LOOK, sourceContext);
|
||||
}
|
||||
|
||||
return context.state.show(context.source, 'actor.step.look.none');
|
||||
return context.state.show(context.source, 'actor.verb.look.missing');
|
||||
}
|
||||
|
|
|
@ -30,12 +30,12 @@ export async function VerbActorMove(this: ScriptTarget, context: ScriptContext):
|
|||
const targetPortal = indexEntity(portals, command.index, isPortal);
|
||||
|
||||
if (isNil(targetPortal)) {
|
||||
return context.state.show(context.source, 'actor.step.move.missing', { command });
|
||||
return context.state.show(context.source, 'actor.verb.move.missing', { command });
|
||||
}
|
||||
|
||||
const locked = getKey(targetPortal.stats, STAT_LOCKED, 0);
|
||||
if (locked > 0) {
|
||||
return context.state.show(context.source, 'actor.step.move.locked', { command, portal: targetPortal });
|
||||
return context.state.show(context.source, 'actor.verb.move.locked', { command, portal: targetPortal });
|
||||
}
|
||||
|
||||
const rooms = await context.state.find({
|
||||
|
@ -51,7 +51,7 @@ export async function VerbActorMove(this: ScriptTarget, context: ScriptContext):
|
|||
throw new NotFoundError('destination room not found');
|
||||
}
|
||||
|
||||
await context.state.show(context.source, 'actor.step.move.portal', {
|
||||
await context.state.show(context.source, 'actor.verb.move.portal', {
|
||||
actor: this,
|
||||
portal: targetPortal,
|
||||
});
|
||||
|
|
|
@ -24,18 +24,16 @@ export async function VerbActorOpen(this: ScriptTarget, context: ScriptContext):
|
|||
});
|
||||
|
||||
if (!isPortal(portal)) {
|
||||
await context.state.show(context.source, 'actor.open.missing', { command });
|
||||
return;
|
||||
return context.state.show(context.source, 'actor.open.missing', { command });
|
||||
}
|
||||
|
||||
const closed = getKey(portal.stats, STAT_CLOSED, 0);
|
||||
if (closed === 0) {
|
||||
await context.state.show(context.source, 'actor.open.already', { portal });
|
||||
return;
|
||||
return context.state.show(context.source, 'actor.open.already', { portal });
|
||||
}
|
||||
|
||||
const stats = setKey(portal.stats, STAT_CLOSED, 0);
|
||||
await context.state.update(portal, { stats });
|
||||
|
||||
await context.state.show(context.source, 'actor.open.opened', { portal });
|
||||
return context.state.show(context.source, 'actor.open.opened', { portal });
|
||||
}
|
||||
|
|
|
@ -41,8 +41,7 @@ export async function VerbActorTake(this: ScriptTarget, context: ScriptContext):
|
|||
const moving = indexEntity(results, command.index, isItem);
|
||||
|
||||
if (isNil(moving)) {
|
||||
await context.state.show(context.source, 'actor.step.take.type', { command });
|
||||
return;
|
||||
return context.state.show(context.source, 'actor.verb.take.type', { command });
|
||||
}
|
||||
|
||||
await context.state.move({
|
||||
|
|
|
@ -29,14 +29,12 @@ export async function VerbActorUse(this: ScriptTarget, context: ScriptContext):
|
|||
const item = indexEntity(itemResults, command.index, isItem);
|
||||
|
||||
if (!isItem(item)) {
|
||||
await context.state.show(context.source, 'actor.step.use.type', { command });
|
||||
return;
|
||||
return context.state.show(context.source, 'actor.verb.use.type', { command });
|
||||
}
|
||||
|
||||
const target = await getUseTarget(this, context);
|
||||
if (isNil(target)) {
|
||||
await context.state.show(context.source, 'actor.step.use.target', { command });
|
||||
return;
|
||||
return context.state.show(context.source, 'actor.verb.use.target', { command });
|
||||
}
|
||||
|
||||
await context.script.invoke(target, SIGNAL_USE, {
|
||||
|
|
|
@ -116,7 +116,7 @@ export class ScriptRender {
|
|||
return catchAndLog(defer(next.time).then(() => this.queueInput({
|
||||
...next,
|
||||
time: 0,
|
||||
})), this.logger, 'error queueing time deferred input');
|
||||
})), this.logger, 'error queueing time input');
|
||||
}
|
||||
|
||||
if (doesExist(next.step) && next.step > 0) {
|
||||
|
@ -124,7 +124,7 @@ export class ScriptRender {
|
|||
return catchAndLog(onceEvent(this.events, EVENT_STATE_STEP).then(() => this.queueInput({
|
||||
...next,
|
||||
step: nextStep,
|
||||
})), this.logger, 'error queueing step deferred input');
|
||||
})), this.logger, 'error queueing step input');
|
||||
}
|
||||
|
||||
this.events.emit(EVENT_RENDER_INPUT, {
|
||||
|
|
|
@ -316,7 +316,7 @@ export class LocalStateService implements StateService {
|
|||
public async doDebug(): Promise<void> {
|
||||
if (isNil(this.state)) {
|
||||
this.event.emit(EVENT_STATE_OUTPUT, {
|
||||
line: 'meta.debug.none',
|
||||
line: 'meta.debug.missing',
|
||||
step: zeroStep(),
|
||||
volume: ShowVolume.WORLD,
|
||||
});
|
||||
|
@ -340,7 +340,7 @@ export class LocalStateService implements StateService {
|
|||
public async doGraph(event: ActorCommandEvent): Promise<void> {
|
||||
if (isNil(this.state)) {
|
||||
this.event.emit(EVENT_STATE_OUTPUT, {
|
||||
line: 'meta.graph.none',
|
||||
line: 'meta.graph.missing',
|
||||
step: zeroStep(),
|
||||
volume: ShowVolume.WORLD,
|
||||
});
|
||||
|
@ -416,7 +416,7 @@ export class LocalStateService implements StateService {
|
|||
context: {
|
||||
path,
|
||||
},
|
||||
line: 'meta.load.none',
|
||||
line: 'meta.load.missing',
|
||||
step: zeroStep(),
|
||||
volume: ShowVolume.WORLD,
|
||||
});
|
||||
|
@ -458,13 +458,13 @@ export class LocalStateService implements StateService {
|
|||
* Leave the state step loop.
|
||||
*/
|
||||
public async doQuit(): Promise<void> {
|
||||
return this.stepQuit('quit.meta', {}, [STAT_SCORE]);
|
||||
return this.stepQuit('meta.quit', {}, [STAT_SCORE]);
|
||||
}
|
||||
|
||||
public async doSave(event: ActorCommandEvent): Promise<void> {
|
||||
if (isNil(this.state)) {
|
||||
this.event.emit(EVENT_STATE_OUTPUT, {
|
||||
line: 'meta.save.none',
|
||||
line: 'meta.save.missing',
|
||||
step: zeroStep(),
|
||||
volume: ShowVolume.WORLD,
|
||||
});
|
||||
|
@ -509,7 +509,7 @@ export class LocalStateService implements StateService {
|
|||
// if there is no world state, there won't be an actor, but this error is more informative
|
||||
if (isNil(actor) || isNil(this.state)) {
|
||||
this.event.emit(EVENT_STATE_OUTPUT, {
|
||||
line: 'meta.step.none',
|
||||
line: 'meta.step.missing',
|
||||
step: zeroStep(),
|
||||
volume: ShowVolume.WORLD,
|
||||
});
|
||||
|
|
|
@ -37,7 +37,7 @@ describe('actor get signal', () => {
|
|||
});
|
||||
await SignalActorGet.call(actor, context);
|
||||
|
||||
expect(state.show).to.have.been.calledWithMatch(match.object, 'actor.get.player');
|
||||
expect(state.show).to.have.been.calledWithMatch(match.object, 'actor.signal.get.item');
|
||||
});
|
||||
|
||||
it('should only show the item to player actors', async () => {
|
||||
|
|
|
@ -61,8 +61,8 @@ describe('actor hit signal', () => {
|
|||
await SignalActorHit.call(actor, context);
|
||||
|
||||
const showStub = stateHelper.show as SinonStub;
|
||||
expect(showStub.getCall(0)).to.have.been.calledWithMatch(match.object, 'actor.hit.hit');
|
||||
expect(showStub.getCall(1)).to.have.been.calledWithMatch(match.object, 'actor.hit.health');
|
||||
expect(showStub.getCall(0)).to.have.been.calledWithMatch(match.object, 'actor.signal.hit.item');
|
||||
expect(showStub.getCall(1)).to.have.been.calledWithMatch(match.object, 'actor.signal.hit.health');
|
||||
});
|
||||
|
||||
it('should note when the target dies', async () => {
|
||||
|
@ -81,7 +81,7 @@ describe('actor hit signal', () => {
|
|||
await SignalActorHit.call(actor, context);
|
||||
|
||||
const showStub = stateHelper.show as SinonStub;
|
||||
expect(showStub.getCall(0)).to.have.been.calledWithMatch(match.object, 'actor.hit.hit');
|
||||
expect(showStub.getCall(1)).to.have.been.calledWithMatch(match.object, 'actor.hit.dead');
|
||||
expect(showStub.getCall(0)).to.have.been.calledWithMatch(match.object, 'actor.signal.hit.item');
|
||||
expect(showStub.getCall(1)).to.have.been.calledWithMatch(match.object, 'actor.signal.hit.dead');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -39,7 +39,7 @@ describe('actor look signal', () => {
|
|||
actor.stats.set(STAT_HEALTH, 1);
|
||||
await SignalActorLook.call(actor, context);
|
||||
|
||||
expect(state.show).to.have.been.calledWithMatch(match.object, 'actor.step.look.actor.seen');
|
||||
expect(state.show).to.have.been.calledWithMatch(match.object, 'actor.signal.look.seen');
|
||||
});
|
||||
|
||||
it('should note if the actor is dead', async () => {
|
||||
|
@ -53,6 +53,6 @@ describe('actor look signal', () => {
|
|||
|
||||
await SignalActorLook.call(makeTestActor('', '', ''), context);
|
||||
|
||||
expect(state.show).to.have.been.calledWithMatch(match.object, 'actor.step.look.actor.seen');
|
||||
expect(state.show).to.have.been.calledWithMatch(match.object, 'actor.signal.look.seen');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -121,7 +121,7 @@ describe('actor step signal', () => {
|
|||
});
|
||||
await SignalActorStep.call(player, context);
|
||||
|
||||
expect(stateHelper.show).to.have.callCount(1).and.have.been.calledWithMatch(match.object, 'actor.step.command.player.verb');
|
||||
expect(stateHelper.show).to.have.callCount(1).and.have.been.calledWithMatch(match.object, 'actor.signal.step.verb.player');
|
||||
});
|
||||
|
||||
it('should show the targets to player actors', async () => {
|
||||
|
@ -145,7 +145,7 @@ describe('actor step signal', () => {
|
|||
});
|
||||
await SignalActorStep.call(player, context);
|
||||
|
||||
expect(stateHelper.show).to.have.callCount(1).and.have.been.calledWithMatch(match.object, 'actor.step.command.player.target');
|
||||
expect(stateHelper.show).to.have.callCount(1).and.have.been.calledWithMatch(match.object, 'actor.signal.step.verb.target');
|
||||
});
|
||||
|
||||
it('should not invoke any scripts without a command', async () => {
|
||||
|
@ -199,6 +199,6 @@ describe('actor step signal', () => {
|
|||
await SignalActorStep.call(player, context);
|
||||
|
||||
expect(script.invoke).to.have.callCount(0);
|
||||
expect(state.show).to.have.callCount(1).and.have.been.calledWithMatch(match.object, 'actor.step.command.unknown');
|
||||
expect(state.show).to.have.callCount(1).and.have.been.calledWithMatch(match.object, 'actor.signal.step.verb.missing');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -44,22 +44,22 @@ describe('actor look signal for Lucy character', () => {
|
|||
|
||||
lucy.stats.set(STAT_HEALTH, 20);
|
||||
await SignalActorLookLucy.call(lucy, context);
|
||||
expect(showStub).to.have.been.calledWith(context.source, 'actor.step.look.actor.healthy');
|
||||
expect(showStub).to.have.been.calledWith(context.source, 'actor.signal.look.healthy');
|
||||
showStub.resetHistory();
|
||||
|
||||
lucy.stats.set(STAT_HEALTH, 10);
|
||||
await SignalActorLookLucy.call(lucy, context);
|
||||
expect(showStub).to.have.been.calledWith(context.source, 'actor.step.look.actor.pale');
|
||||
expect(showStub).to.have.been.calledWith(context.source, 'actor.signal.look.pale');
|
||||
showStub.resetHistory();
|
||||
|
||||
lucy.stats.set(STAT_HEALTH, 5);
|
||||
await SignalActorLookLucy.call(lucy, context);
|
||||
expect(showStub).to.have.been.calledWith(context.source, 'actor.step.look.actor.pale');
|
||||
expect(showStub).to.have.been.calledWith(context.source, 'actor.signal.look.pale');
|
||||
showStub.resetHistory();
|
||||
|
||||
lucy.stats.set(STAT_HEALTH, 0);
|
||||
await SignalActorLookLucy.call(lucy, context);
|
||||
expect(showStub).to.have.been.calledWith(context.source, 'actor.step.look.actor.dead');
|
||||
expect(showStub).to.have.been.calledWith(context.source, 'actor.signal.look.dead');
|
||||
showStub.resetHistory();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -41,7 +41,7 @@ describe('actor look signal for maid characters', () => {
|
|||
|
||||
maid.stats.set('awaken', 20);
|
||||
await SignalActorLookMaid.call(maid, context);
|
||||
expect(showStub).to.have.been.calledWith(context.source, 'actor.step.look.actor.asleep');
|
||||
expect(showStub).to.have.been.calledWith(context.source, 'actor.signal.look.asleep');
|
||||
showStub.resetHistory();
|
||||
|
||||
maid.stats.set('awaken', 0);
|
||||
|
@ -52,7 +52,7 @@ describe('actor look signal for maid characters', () => {
|
|||
turn: 10,
|
||||
},
|
||||
});
|
||||
expect(showStub).to.have.been.calledWith(context.source, 'actor.step.look.actor.awake');
|
||||
expect(showStub).to.have.been.calledWith(context.source, 'actor.signal.look.awake');
|
||||
showStub.resetHistory();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -31,6 +31,6 @@ describe('item look signal', () => {
|
|||
|
||||
await SignalItemLook.call(makeTestItem('', '', ''), context);
|
||||
|
||||
expect(state.show).to.have.been.calledWithMatch(match.object, 'actor.step.look.item.seen');
|
||||
expect(state.show).to.have.been.calledWithMatch(match.object, 'item.signal.look.seen');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -51,6 +51,6 @@ describe('item replace signal', () => {
|
|||
const item = makeTestItem('', '', '');
|
||||
await SignalItemReplace.call(item, context);
|
||||
|
||||
expect(state.show).to.have.been.calledWith(context.source, 'item.replace.none');
|
||||
expect(state.show).to.have.been.calledWith(context.source, 'item.replace.missing');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -30,7 +30,7 @@ describe('portal look scripts', () => {
|
|||
|
||||
await SignalPortalLook.call(makeTestPortal('', '', '', '', ''), context);
|
||||
|
||||
expect(state.show).to.have.been.calledWithMatch(match.object, 'actor.step.look.room.portal');
|
||||
expect(state.show).to.have.been.calledWithMatch(match.object, 'portal.signal.look.seen');
|
||||
});
|
||||
|
||||
it('should describe the portal destination room for open portals', async () => {
|
||||
|
@ -48,7 +48,7 @@ describe('portal look scripts', () => {
|
|||
|
||||
await SignalPortalLook.call(portal, context);
|
||||
|
||||
expect(state.show).to.have.been.calledWithMatch(match.object, 'actor.step.look.room.portal');
|
||||
expect(state.show).to.have.been.calledWithMatch(match.object, 'portal.signal.look.dest.room');
|
||||
});
|
||||
|
||||
it('should show a message for closed portals', async () => {
|
||||
|
@ -68,6 +68,6 @@ describe('portal look scripts', () => {
|
|||
|
||||
await SignalPortalLook.call(portal, context);
|
||||
|
||||
expect(state.show).to.have.been.calledWithMatch(match.object, 'actor.step.look.room.closed');
|
||||
expect(state.show).to.have.been.calledWithMatch(match.object, 'portal.signal.look.closed');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -31,7 +31,7 @@ describe('portal look scripts for oven door', () => {
|
|||
|
||||
await SignalPortalLookHGOven.call(makeTestPortal('', '', '', '', ''), context);
|
||||
|
||||
expect(state.show).to.have.been.calledWithMatch(match.object, 'actor.step.look.room.portal');
|
||||
expect(state.show).to.have.been.calledWithMatch(match.object, 'portal.signal.look.seen');
|
||||
});
|
||||
|
||||
it('should describe actors in the portal destination room', async () => {
|
||||
|
|
|
@ -32,7 +32,7 @@ describe('room look signal', () => {
|
|||
|
||||
await SignalRoomLook.call(room, context);
|
||||
|
||||
expect(stateHelper.show).to.have.been.calledWithMatch(match.object, 'actor.step.look.room.seen');
|
||||
expect(stateHelper.show).to.have.been.calledWithMatch(match.object, 'room.signal.look.seen');
|
||||
});
|
||||
|
||||
it('should describe actors in the room', async () => {
|
||||
|
|
|
@ -39,7 +39,7 @@ describe('actor equip verb', () => {
|
|||
await VerbActorEquip.call(actor, context);
|
||||
|
||||
expect(actor.slots.get(slot)).to.equal(item.meta.id);
|
||||
expect(state.show).to.have.been.calledWithMatch(match.object, 'actor.step.equip.item');
|
||||
expect(state.show).to.have.been.calledWithMatch(match.object, 'actor.verb.equip.item');
|
||||
});
|
||||
|
||||
it('should show a message when the slot does not exist', async () => {
|
||||
|
@ -62,7 +62,7 @@ describe('actor equip verb', () => {
|
|||
|
||||
await VerbActorEquip.call(actor, context);
|
||||
|
||||
expect(state.show).to.have.been.calledWithMatch(match.object, 'actor.step.equip.slot');
|
||||
expect(state.show).to.have.been.calledWithMatch(match.object, 'actor.verb.equip.slot');
|
||||
});
|
||||
|
||||
it('should show a message when the item does not exist', async () => {
|
||||
|
@ -81,7 +81,7 @@ describe('actor equip verb', () => {
|
|||
|
||||
await VerbActorEquip.call(actor, context);
|
||||
|
||||
expect(state.show).to.have.been.calledWithMatch(match.object, 'actor.step.equip.none');
|
||||
expect(state.show).to.have.been.calledWithMatch(match.object, 'actor.verb.equip.missing');
|
||||
});
|
||||
|
||||
xit('should equip items into the target slot');
|
||||
|
|
|
@ -79,7 +79,7 @@ describe('actor hit verb', () => {
|
|||
await VerbActorHit.call(actor, context);
|
||||
|
||||
expect(script.invoke).to.have.callCount(0);
|
||||
expect(state.show).to.have.callCount(1).and.been.calledWithMatch(match.object, 'actor.step.hit.self');
|
||||
expect(state.show).to.have.callCount(1).and.been.calledWithMatch(match.object, 'actor.verb.hit.self');
|
||||
});
|
||||
|
||||
it('should show an error if the actor does not have any items', async () => {
|
||||
|
@ -99,6 +99,6 @@ describe('actor hit verb', () => {
|
|||
await VerbActorHit.call(makeTestActor('', '', ''), context);
|
||||
|
||||
expect(script.invoke).to.have.callCount(0);
|
||||
expect(state.show).to.have.callCount(1).and.been.calledWithMatch(match.object, 'actor.step.hit.item');
|
||||
expect(state.show).to.have.callCount(1).and.been.calledWithMatch(match.object, 'actor.verb.hit.item');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -2,12 +2,13 @@ import { expect } from 'chai';
|
|||
import { createStubInstance, match, SinonStub } from 'sinon';
|
||||
|
||||
import { ScriptTargetError } from '../../../../src/error/ScriptTargetError';
|
||||
import { CoreModule } from '../../../../src/lib';
|
||||
import { makeCommand } from '../../../../src/model/Command';
|
||||
import { VerbActorLook } from '../../../../src/script/verb/actor/ActorLook';
|
||||
import { LocalScriptService } from '../../../../src/service/script/LocalScript';
|
||||
import { SIGNAL_LOOK, VERB_LOOK } from '../../../../src/util/constants';
|
||||
import { SIGNAL_LOOK, STAT_HEALTH, VERB_LOOK } from '../../../../src/util/constants';
|
||||
import { makeTestActor, makeTestItem, makeTestRoom } from '../../../entity';
|
||||
import { createTestContext, getStubHelper } from '../../../helper';
|
||||
import { createTestContext, getStubHelper, getTestContainer } from '../../../helper';
|
||||
|
||||
describe('actor look verb', () => {
|
||||
describe('actor look verb without a target', () => {
|
||||
|
@ -37,6 +38,38 @@ describe('actor look verb', () => {
|
|||
|
||||
expect(script.invoke).to.have.been.calledWithMatch(room, SIGNAL_LOOK, match.object);
|
||||
});
|
||||
|
||||
it('should not include the player', async () => {
|
||||
const container = await getTestContainer(new CoreModule());
|
||||
const state = getStubHelper();
|
||||
|
||||
const actor = makeTestActor('', '', '');
|
||||
actor.scripts.set(SIGNAL_LOOK, {
|
||||
data: new Map(),
|
||||
name: 'signal-actor-look',
|
||||
});
|
||||
actor.stats.set(STAT_HEALTH, 5);
|
||||
|
||||
const room = makeTestRoom('', '', '', [actor], []);
|
||||
room.scripts.set(SIGNAL_LOOK, {
|
||||
data: new Map(),
|
||||
name: 'signal-room-look',
|
||||
});
|
||||
|
||||
const context = createTestContext({
|
||||
command: makeCommand(VERB_LOOK),
|
||||
room,
|
||||
state,
|
||||
script: await container.create(LocalScriptService),
|
||||
});
|
||||
|
||||
await VerbActorLook.call(actor, context);
|
||||
|
||||
expect(state.show).to.have.callCount(3);
|
||||
expect(state.show).to.have.been.calledWithMatch(match.object, 'actor.signal.look.self');
|
||||
expect(state.show).to.have.been.calledWithMatch(match.object, 'actor.signal.look.health');
|
||||
expect(state.show).to.have.been.calledWithMatch(match.object, 'room.signal.look.seen');
|
||||
});
|
||||
});
|
||||
|
||||
describe('actor look verb with target', () => {
|
||||
|
@ -77,25 +110,8 @@ describe('actor look verb', () => {
|
|||
|
||||
await VerbActorLook.call(actor, context);
|
||||
|
||||
expect(state.show).to.have.been.calledWithMatch(match.object, 'actor.step.look.none');
|
||||
expect(state.show).to.have.been.calledWithMatch(match.object, 'actor.verb.look.missing');
|
||||
expect(script.invoke).to.have.callCount(0);
|
||||
});
|
||||
|
||||
it('should not include the player', async () => {
|
||||
const state = getStubHelper();
|
||||
|
||||
const actor = makeTestActor('', '', '');
|
||||
const context = createTestContext({
|
||||
command: makeCommand(VERB_LOOK),
|
||||
room: makeTestRoom('', '', '', [actor], []),
|
||||
state,
|
||||
});
|
||||
|
||||
await VerbActorLook.call(actor, context);
|
||||
|
||||
expect(state.show).to.have.callCount(2);
|
||||
expect(state.show).to.have.been.calledWithMatch(match.object, 'actor.step.look.room.you');
|
||||
expect(state.show).to.have.been.calledWithMatch(match.object, 'actor.step.look.room.health');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -47,7 +47,7 @@ describe('actor move verb', () => {
|
|||
},
|
||||
type: ROOM_TYPE,
|
||||
});
|
||||
expect(state.show).to.have.been.calledWithMatch(match.object, 'actor.step.move.portal');
|
||||
expect(state.show).to.have.been.calledWithMatch(match.object, 'actor.verb.move.portal');
|
||||
});
|
||||
|
||||
it('should target portals by source group', async () => {
|
||||
|
@ -74,7 +74,7 @@ describe('actor move verb', () => {
|
|||
},
|
||||
type: ROOM_TYPE,
|
||||
});
|
||||
expect(state.show).to.have.been.calledWithMatch(match.object, 'actor.step.move.portal');
|
||||
expect(state.show).to.have.been.calledWithMatch(match.object, 'actor.verb.move.portal');
|
||||
});
|
||||
|
||||
it('should target portals by source group and name', async () => {
|
||||
|
@ -101,7 +101,7 @@ describe('actor move verb', () => {
|
|||
},
|
||||
type: ROOM_TYPE,
|
||||
});
|
||||
expect(state.show).to.have.been.calledWithMatch(match.object, 'actor.step.move.portal');
|
||||
expect(state.show).to.have.been.calledWithMatch(match.object, 'actor.verb.move.portal');
|
||||
});
|
||||
|
||||
it('should show a message if the portal cannot be found', async () => {
|
||||
|
@ -119,7 +119,7 @@ describe('actor move verb', () => {
|
|||
|
||||
await VerbActorMove.call(actor, context);
|
||||
|
||||
expect(state.show).to.have.been.calledWithMatch(match.object, 'actor.step.move.missing');
|
||||
expect(state.show).to.have.been.calledWithMatch(match.object, 'actor.verb.move.missing');
|
||||
});
|
||||
|
||||
it('should throw an error if the target room cannot be found', async () => {
|
||||
|
@ -181,7 +181,7 @@ describe('actor move verb', () => {
|
|||
|
||||
await VerbActorMove.call(actor, context);
|
||||
|
||||
expect(state.show).to.have.been.calledWithMatch(match.object, 'actor.step.move.locked');
|
||||
expect(state.show).to.have.been.calledWithMatch(match.object, 'actor.verb.move.locked');
|
||||
});
|
||||
|
||||
it('should leave breadcrumbs when the leader flag is set', async () => {
|
||||
|
|
|
@ -33,7 +33,7 @@ describe('actor take verb', () => {
|
|||
|
||||
await VerbActorTake.call(makeTestActor('', '', ''), context);
|
||||
|
||||
expect(state.show).to.have.callCount(1).and.been.calledWithMatch(match.object, 'actor.step.take.type');
|
||||
expect(state.show).to.have.callCount(1).and.been.calledWithMatch(match.object, 'actor.verb.take.type');
|
||||
});
|
||||
|
||||
it('should transfer items from the target room', async () => {
|
||||
|
@ -85,6 +85,6 @@ describe('actor take verb', () => {
|
|||
state,
|
||||
}));
|
||||
|
||||
expect(showStub, 'from other actor inventory').to.have.callCount(1).and.been.calledWithMatch(match.object, 'actor.step.take.type');
|
||||
expect(showStub, 'from other actor inventory').to.have.callCount(1).and.been.calledWithMatch(match.object, 'actor.verb.take.type');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -33,7 +33,7 @@ describe('actor use verb', () => {
|
|||
|
||||
await VerbActorUse.call(makeTestActor('', '', ''), context);
|
||||
|
||||
expect(stateHelper.show).to.have.callCount(1).and.been.calledWithMatch(match.object, 'actor.step.use.type');
|
||||
expect(stateHelper.show).to.have.callCount(1).and.been.calledWithMatch(match.object, 'actor.verb.use.type');
|
||||
});
|
||||
|
||||
it('should invoke the use signal on the item', async () => {
|
||||
|
@ -96,6 +96,6 @@ describe('actor use verb', () => {
|
|||
const actor = makeTestActor('', '', '');
|
||||
await VerbActorUse.call(actor, context);
|
||||
|
||||
expect(state.show).to.have.callCount(1).and.been.calledWithMatch(match.object, 'actor.step.use.target');
|
||||
expect(state.show).to.have.callCount(1).and.been.calledWithMatch(match.object, 'actor.verb.use.target');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -421,7 +421,7 @@ describe('local state service', () => {
|
|||
});
|
||||
const output = await pending;
|
||||
|
||||
expect(output.line).to.equal('meta.debug.none');
|
||||
expect(output.line).to.equal('meta.debug.missing');
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -471,7 +471,7 @@ describe('local state service', () => {
|
|||
});
|
||||
|
||||
const output = await pending;
|
||||
expect(output.line).to.equal('meta.graph.none');
|
||||
expect(output.line).to.equal('meta.graph.missing');
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -592,7 +592,7 @@ describe('local state service', () => {
|
|||
});
|
||||
|
||||
const output = await pendingOutput;
|
||||
expect(output.line).to.equal('meta.load.none');
|
||||
expect(output.line).to.equal('meta.load.missing');
|
||||
expect(loadStub).to.have.callCount(0);
|
||||
});
|
||||
});
|
||||
|
@ -672,7 +672,7 @@ describe('local state service', () => {
|
|||
});
|
||||
|
||||
await expect(pendingOutput).to.eventually.deep.include({
|
||||
line: 'meta.save.none',
|
||||
line: 'meta.save.missing',
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -723,7 +723,7 @@ describe('local state service', () => {
|
|||
});
|
||||
|
||||
const output = await pending;
|
||||
expect(output.line).to.equal('meta.step.none');
|
||||
expect(output.line).to.equal('meta.step.missing');
|
||||
});
|
||||
|
||||
it('should error without state', async () => {
|
||||
|
@ -741,7 +741,7 @@ describe('local state service', () => {
|
|||
});
|
||||
|
||||
const output = await pending;
|
||||
expect(output.line).to.equal('meta.step.none');
|
||||
expect(output.line).to.equal('meta.step.missing');
|
||||
});
|
||||
|
||||
xit('should step after all actors have submitted a command');
|
||||
|
|
Loading…
Reference in New Issue