diff --git a/game/1_maze.coffee b/game/1_maze.coffee
index e82dd20..b9aba9c 100644
--- a/game/1_maze.coffee
+++ b/game/1_maze.coffee
@@ -77,7 +77,9 @@ class Maze
describe: (x, y, improv) ->
model = @data[x][y]
model = setAdjacent(model)
- return '
'+model.loctitle+"
\n"+improv.gen('description', model)+"\n\n"+improv.gen('directions', model)
+ return ''+model.loctitle+"
\n"+improv.gen('description', model)+"\n\n"#+improv.gen('directions', model)
+ # Я хотел сделать дополнительные ссылки в тексте, но это жутко муторно
+ # писать кучу кода для Improv на разбор, какие направления доступны.
isEast: (x, y) -> return (x+1) <= (@width - 1)
isWest: (x, y) -> return (x-1) >= 0
isNorth: (x, y) -> return (y-1) >= 0
@@ -98,6 +100,13 @@ class Maze
if @isSouth(x, y)
return @at(x+1, y+1)
return false
+ getDirection: (direction, x, y) ->
+ switch direction
+ when "north" then return @getNorth(x,y)
+ when "south" then return @getSouth(x,y)
+ when "east" then return @getEast(x,y)
+ when "west" then return @getWest(x,y)
+ else return false
log: () ->
map = ""
for y in [0..(@height-1)]
diff --git a/game/2_model.coffee b/game/2_model.coffee
index db8cca2..d7a1d8c 100644
--- a/game/2_model.coffee
+++ b/game/2_model.coffee
@@ -44,11 +44,11 @@ croom = (name, spec) ->
spec.optionText ?= () ->
retval = """
-
#{spec.title.fcall()}
+
#{spec.title.fcall(spec)}
"""
- if (spec.subtitle?)
+ if spec.subtitle?
retval += """
-
#{spec.subtitle.fcall()}
+
#{spec.subtitle.fcall(spec)}
"""
retval += '
'
spec.dsc ?= () -> name.l()
@@ -168,6 +168,7 @@ window.set_volume = (value) ->
else
volume.css('background-position', '0 -75px')
+###
update_paths = (character) ->
x = character.x
y = character.y
@@ -209,6 +210,7 @@ update_paths = (character) ->
else
$("#south").html("")
return
+###
typeIsArray = ( value ) ->
value and
@@ -264,10 +266,14 @@ setAdjacent = (model) ->
if adjacent.indexOf(type) != -1 # уже есть сосед этого типа
continue
adjacent.push(type)
- model.loctitle_north = cells["north"].loctitle
- model.loctitle_east = cells["east"].loctitle
- model.loctitle_west = cells["west"].loctitle
- model.loctitle_south = cells["south"].loctitle
+ if cells["north"]?
+ model.loctitle_north = cells["north"].loctitle
+ if cells["east"]?
+ model.loctitle_east = cells["east"].loctitle
+ if cells["west"]?
+ model.loctitle_west = cells["west"].loctitle
+ if cells["south"]?
+ model.loctitle_south = cells["south"].loctitle
model.tags.push(["adjacent", adjacent])
return model
diff --git a/game/3_engine.coffee b/game/3_engine.coffee
index 904a81f..411ac5a 100644
--- a/game/3_engine.coffee
+++ b/game/3_engine.coffee
@@ -150,9 +150,26 @@ $(document).on('init', () ->
)
direction_room = (name, varname, plus) ->
- room(name,
+ return croom(name,
+ # I'm sure it can be optimized but not now
+ title: () ->
+ cell = salet.character.maze.getDirection(@name, salet.character.x, salet.character.y)
+ if cell != false and cell != undefined and cell.loctitle != undefined
+ return cell.loctitle
+ else
+ return "no_direction".l()
+ canView: () ->
+ cell = salet.character.maze.getDirection(name, salet.character.x, salet.character.y)
+ if cell != false and cell != undefined and cell.loctitle != undefined
+ return true
+ else
+ return false
+ subtitle: () ->
+ return "#{name}_direction".l()
varname: varname,
add: plus
+ tags: ["direction"]
+ dsc: false
enter: () ->
salet.character[@varname] = salet.character[@varname] + @add
salet.goTo("maze")
diff --git a/game/4_plot.coffee b/game/4_plot.coffee
index 2b6e3d3..171e165 100644
--- a/game/4_plot.coffee
+++ b/game/4_plot.coffee
@@ -20,6 +20,7 @@ room "maze",
clear: false
priority: -10
showTransition: true
+ choices: '#direction'
before: (from) ->
if @showTransition == false
@showTransition = true
@@ -50,7 +51,7 @@ room "maze",
salet.character.past_y = salet.character.y
return salet.character.improv.gen('transition', model)
dsc: () ->
- update_paths(salet.character)
+ #update_paths(salet.character)
salet.character.describe()
canExit: (to) ->
model = []
diff --git a/game/translations/ru.coffee b/game/translations/ru.coffee
index 6ccf656..6a17eef 100644
--- a/game/translations/ru.coffee
+++ b/game/translations/ru.coffee
@@ -18,5 +18,10 @@ strings =
night: "Ночной режим"
multiplayer: "Режим мультиплеера"
erase_message: "Вы точно хотите стереть сохранение и начать игру заново?"
+ no_direction: "Конец города"
+ north_direction: "Идти на север"
+ south_direction: "Идти на юг"
+ west_direction: "Идти на запад"
+ east_direction: "Идти на восток"
window.i18n.push("ru", strings)
diff --git a/html/index.html b/html/index.html
index 9ef7462..fbf785d 100644
--- a/html/index.html
+++ b/html/index.html
@@ -36,6 +36,7 @@
+