0
0
Fork 0
mirror of https://gitlab.com/Oreolek/salet-module.git synced 2024-06-16 23:20:54 +03:00

randomElement fix and unitDelimiter for units

This commit is contained in:
Alexander Yakovlev 2017-05-03 19:54:12 +07:00
parent ffbc7174d8
commit 36bd3cdf5d
3 changed files with 6 additions and 3 deletions

View file

@ -1,6 +1,6 @@
{
"name": "salet",
"version": "1.7.3",
"version": "1.7.4",
"description": "A general client-side framework for cybertext interactive fiction games.",
"keywords": ["ifiction", "interactive fiction", "games", "coffee-script", "text", "menu"],
"homepage": "https://salet.su",

View file

@ -44,7 +44,7 @@ class Random
# return a random element from an array
randomElement: (elements) ->
return elements[@rand(elements.length - 1)]
return elements[@rand(elements.length)]
# return odds of a (value + dN) being larger than target, rounded down
odds: (value, target, n) ->

View file

@ -110,6 +110,9 @@ class SaletRoom
if salet.autosave and @canSave
salet.saveGame()
# A string between unit descriptions.
@unitDelimiter = ""
###
An internal function to get the room's description and the descriptions of
every unit in this room.
@ -136,7 +139,7 @@ class SaletRoom
)
for description in unitDescriptions
retval += " "+description.content
retval += @unitDelimiter + description.content
return markdown(retval)