1
0
Fork 0
mirror of https://gitlab.com/Oreolek/salet.git synced 2024-07-07 01:04:25 +03:00

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", bugg = obj "bugg-shoggog",
dsc: "You see a particularly beautiful slimy {{bugg.}}" dsc: "You see a particularly beautiful slimy {{bugg.}}"
takeable: false
act: () => act: () =>
here().drop(@name) here().drop(@name)
return "You eat the bugg mass. Delicious and raw." return "You eat the bugg mass. Delicious and raw."
dialogue "Yes", "merchant", "merchant", """
Yes.
"""
room "shop-inside", room "shop-inside",
ways: ["shop"] ways: ["shop"]
tags: ["merchant"]
optionText: "End the conversation"
title: "Inside the Shop" title: "Inside the Shop"
content: """ content: """
The insides are painted pastel white, honouring The Great Milk Spill of 1985. 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", lamp = obj "lamp",
dsc: "You see a {{lamp.}}" dsc: "You see a {{lamp.}}"
takeable: true 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 # jQuery was confused by this point where's the context so I did it vanilla-way
print = (content) -> print = (content) ->
if content == ""
return
if typeof content == "function" if typeof content == "function"
content = content() content = content()
block = document.getElementById("current-situation") 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 An internal function to get the room's description and the descriptions of
every object in this room. every object in this room.
### ###
look: (character, system, f) => look: (character, system, f) ->
update_ways(@ways, @name) update_ways(@ways, @name)
retval = "" retval = ""
@ -158,7 +160,6 @@ class SaletRoom extends RaconteurSituation
Puts an object in this room. Puts an object in this room.
### ###
take: (thing) => take: (thing) =>
console.log this
@objects[thing.name] = thing @objects[thing.name] = thing
# BUG: for some really weird reason if the call is made in init function or # 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. # during the initialization, this ALSO puts the thing in the start room.
@ -208,6 +209,7 @@ room = (name, spec) ->
spec ?= {} spec ?= {}
spec.name = name spec.name = name
retval = new SaletRoom(spec) retval = new SaletRoom(spec)
return retval.register() retval.register()
return retval
module.exports = room module.exports = room