Dialogues sample

This commit is contained in:
Alexander Yakovlev 2016-01-17 00:04:00 +07:00
parent 5488736b48
commit 4ca04bb658
2 changed files with 28 additions and 3 deletions

View file

@ -67,17 +67,40 @@ room "lair",
bugg = obj "bugg-shoggog",
dsc: "You see a particularly beautiful slimy {{bugg.}}"
takeable: false
act: () =>
here().drop(@name)
return "You eat the bugg mass. Delicious and raw."
dialogue "Yes", "merchant", "merchant", """
Yes.
"""
room "shop-inside",
ways: ["shop"]
tags: ["merchant"]
optionText: "End the conversation"
title: "Inside the Shop"
content: """
The insides are painted pastel white, honouring The Great Milk Spill of 1985.
"""
objects: {
merchant: obj "merchant",
dsc: "A {{merchant}} eyes you warily."
takeable: false
act: (character, system) =>
undum.processClick("merchdialogue")
return ""
}
lamp = obj "lamp",
dsc: "You see a {{lamp.}}"
takeable: true
lamp.put("shop-inside")
room "merchdialogue",
choices: "#merchant",
content: """
Nice day, isn't it?
"""

View file

@ -10,6 +10,8 @@ way_to = (content, ref) ->
# jQuery was confused by this point where's the context so I did it vanilla-way
print = (content) ->
if content == ""
return
if typeof content == "function"
content = content()
block = document.getElementById("current-situation")
@ -141,7 +143,7 @@ class SaletRoom extends RaconteurSituation
An internal function to get the room's description and the descriptions of
every object in this room.
###
look: (character, system, f) =>
look: (character, system, f) ->
update_ways(@ways, @name)
retval = ""
@ -158,7 +160,6 @@ class SaletRoom extends RaconteurSituation
Puts an object in this room.
###
take: (thing) =>
console.log this
@objects[thing.name] = thing
# BUG: for some really weird reason if the call is made in init function or
# during the initialization, this ALSO puts the thing in the start room.
@ -208,6 +209,7 @@ room = (name, spec) ->
spec ?= {}
spec.name = name
retval = new SaletRoom(spec)
return retval.register()
retval.register()
return retval
module.exports = room