mirror of
https://gitlab.com/Oreolek/salet-module.git
synced 2024-05-24 11:58:21 +03:00
Fixed the goBack function
This commit is contained in:
parent
36bd3cdf5d
commit
82c30ede15
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "salet",
|
||||
"version": "1.7.4",
|
||||
"version": "1.7.5",
|
||||
"description": "A general client-side framework for cybertext interactive fiction games.",
|
||||
"keywords": ["ifiction", "interactive fiction", "games", "coffee-script", "text", "menu"],
|
||||
"homepage": "https://salet.su",
|
||||
|
|
|
@ -77,9 +77,6 @@ class SaletRoom
|
|||
if salet.rooms[f].exit?
|
||||
salet.rooms[f].exit @name
|
||||
|
||||
if window.history.pushState?
|
||||
window.history.pushState(@name, @title)
|
||||
|
||||
if @enter
|
||||
@enter f
|
||||
|
||||
|
|
|
@ -305,13 +305,10 @@ class Salet
|
|||
# Go back N rooms. It's not an UNDO.
|
||||
# Also, steps = 1 is the current room
|
||||
@goBack = (steps = 2) ->
|
||||
window.history.back()
|
||||
if @progress.path.length <= 1
|
||||
if @progress.path.length <= steps
|
||||
location = @start
|
||||
else if @progress.path.length > steps
|
||||
location = @progress.path[@progress.path.length - steps]
|
||||
else
|
||||
return @goBack(steps - 1)
|
||||
location = @progress.path[@progress.path.length - steps]
|
||||
if location?
|
||||
@processClick(location)
|
||||
|
||||
|
|
Loading…
Reference in a new issue