15 lines
598 B
Lua
15 lines
598 B
Lua
-- Dialogable: a mixin that makes any Entity subclass talkable. `include` it and
|
|
-- give the entity a `self.book` (an Ink book); bumping the entity then opens the
|
|
-- modal Dialogue. npcs, signs, artifacts — anything you can talk to — are just
|
|
-- Dialogables. For now an entity carries one book; later it can swap books as it
|
|
-- progresses. All it does is route a bump to the dialogue manager.
|
|
Dialogable = {}
|
|
|
|
function Dialogable:onBump()
|
|
if self.book then
|
|
local wasOpen = Dialogue.isOpen()
|
|
Dialogue.open(self.book)
|
|
if Sound and not wasOpen then Sound.jabber() end
|
|
end
|
|
return true
|
|
end
|