Browse Source

Разрешение проблем с таймерами.

post-comp
Alexander Yakovlev 6 years ago
parent
commit
c8801dad4d
  1. 17
      game/begin.coffee
  2. 1
      game/language/ru.coffee
  3. 90
      game/story.coffee
  4. 1
      html/index.html
  5. 2
      html/ru.html

17
game/begin.coffee

@ -10,7 +10,7 @@ i18n.push("ru", require('../../game/language/ru.coffee'))
i18n.push("en", require('../../game/language/en.coffee'))
salet.game_id = "0ee0825d-0c71-4a08-bfe5-730e575df26d"
salet.game_version = "1.0"
salet.game_version = "2.0"
$.holdReady( true )
$.getJSON('game/procgen/'+i18n.lang+'.json', (data) ->
@ -25,11 +25,6 @@ $.getJSON('game/procgen/'+i18n.lang+'.json', (data) ->
)
salet.init = () ->
salet.character.lastBeat = () ->
return salet.progress.sequence.length - salet.character.beat
salet.character.newBeat = () ->
salet.character.beat = salet.progress.sequence.length
salet.character.beat = 0
state.setTag("weather", "warm")
audio = document.getElementById("bgsound")
if audio?
@ -100,15 +95,17 @@ class ImprovModel
setTagIfNotPresent: (tagName, value) ->
if @getTag(tagName) == undefined
@tags.push([tagName, value])
state = new ImprovModel
procgen = (tag) ->
return Improv.gen(tag, state)
cunit = (name, spec) ->
spec.act = () ->
# re-enter the room, reroll the description
salet.view.clearContent()
response = '<em>'+@enact.fcall(this)+'</em>'
r = salet.here()
r.entering(r.name)
return '<em>'+@enact.fcall(this)+'</em>'
return response
return unit(name, spec)
state = new ImprovModel
procgen = (tag) ->
return Improv.gen(tag, state)

1
game/language/ru.coffee

@ -297,3 +297,4 @@ module.exports =
### КОНЕЦ
"""
owindow_opened: "Оно открыто."

90
game/story.coffee

@ -1,40 +1,25 @@
## REAL ROOM
#TODO: после открытия окна нельзя открыть его дважды, пока его не закрыли
room "start",
clear: false
before: (from) ->
if (!from)
# timer every three actions
salet.addTimer("killed", () ->
if (
salet.character.knows_margo and
salet.character.knows_alexey
)
salet.character.killed = true
salet.dropTimer("killed")
salet.goTo("killed")
, true, 3)
return "intro".l()
dsc: () ->
if salet.character.ferret
return "dsc_ferret".l()
return "dsc".l()
afterChoices: () ->
if (
salet.character.lastBeat() > 3 and
salet.character.killed != true and
salet.character.knows_margo and
salet.character.knows_alexey
)
salet.character.killed = true
salet.character.newBeat()
salet.goTo("killed")
if (salet.character.book and salet.character.lastBeat() == 2)
salet.view.write "**"+"reset_book".l()+"**"
if (salet.character.window and salet.character.lastBeat() == 2)
salet.view.write "**"+"reset_window".l()+"**"
if (salet.character.window and salet.character.lastBeat() > 3)
salet.character.window = false
salet.character.newBeat()
salet.view.write "**"+"reset_window_ends".l()+"**"
if (salet.character.book and salet.character.lastBeat() > 3)
salet.character.book = false
salet.character.newBeat()
salet.view.write "**"+"reset_book_ends".l()+"**"
canExit: (to) ->
if salet.character.killed and (to == "margo" or to == "alexey")
salet.view.clearContent()
@ -44,6 +29,8 @@ room "start",
cunit "window",
order: 5
dsc: () ->
if salet.character.ferret
return "\n\n"+"window_end".l()
if salet.character.ferret
return "\n\n"+"window_end".l()
return "\n\n"+"window".l()
@ -52,13 +39,21 @@ room "start",
cunit "owindow",
order: 6
dsc: () ->
if salet.character.window
return "owindow_opened".l()
if salet.character.ferret
return "owindow_end".l()
return "owindow".l()
enact: () ->
if salet.character.killed
salet.addTimer("window", () ->
return "**"+"reset_window".l()+"**"
, false, 2)
salet.addTimer("windowend", () ->
salet.character.window = false
return "**"+"reset_window_ends".l()+"**"
, false, 4)
salet.character.window = true
salet.character.newBeat()
return "window_open".l()
else
return "window_open_no".l()
@ -83,36 +78,39 @@ room "start",
enact: () ->
salet.goTo("margo")
]
###
cunit "debug",
dsc: "<center>{{Skip until the puzzles}}</center>"
order: 666
enact: () ->
state.setTag("weather", "cold")
salet.here().take(book)
salet.here().take(blood)
salet.here().take(ferret)
salet.character.newBeat()
salet.character["knows_alexey"] = true
salet.character["knows_margo"] = true
salet.here().drop("debug")
salet.character.killed = true
return "Done."
###
debug = cunit "debug",
dsc: "<center>{{Skip until the puzzles}}</center>"
order: 666
enact: () ->
state.setTag("weather", "cold")
salet.here().take(book)
salet.here().take(blood)
salet.here().take(ferret)
salet.character["knows_alexey"] = true
salet.character["knows_margo"] = true
salet.here().drop("debug")
salet.dropTimer("killed")
salet.character.killed = true
return "Done."
salet.rooms.start.take(debug)
book = cunit "book",
order: 7
dsc: () ->
if salet.character.book
return "\n\n"+"book_floor".l()
else
return "\n\n"+"book".l()
return "\n\n"+"book".l()
enact: () ->
if salet.character.book
return "book_act_twice".l()
else
salet.addTimer("book", "**"+"reset_book".l()+"**", false, 2)
salet.addTimer("bookend", () ->
salet.character.book = false
return "**"+"reset_book_ends".l()+"**"
, false, 4)
salet.character.book = true
salet.character.newBeat()
return "book_act".l()
blood = cunit "blood",

1
html/index.html

@ -39,6 +39,7 @@
<!-- CDN JS Libraries -->
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/marked/0.3.5/marked.min.js" integrity="sha384-QXBtGc4014gU26HdCwzgy8TVO+FHSSE4+EvPPiSTpdE9w0KyJy1ocfiIbBl1HLq7" crossorigin="anonymous"></script>
<script type="text/javascript" src="https://code.jquery.com/jquery-3.1.1.min.js" crossorigin="anonymous"></script>
<audio id="bgsound" preload="auto" loop="loop"><source src="audio/bgr.mp3" type='audio/mpeg; codecs="mp3"'></audio>
<script type="text/javascript" src="game/bundle.js"></script>
<!-- Piwik -->

2
html/ru.html

@ -40,7 +40,7 @@
<!-- CDN JS Libraries -->
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/marked/0.3.5/marked.min.js" integrity="sha384-QXBtGc4014gU26HdCwzgy8TVO+FHSSE4+EvPPiSTpdE9w0KyJy1ocfiIbBl1HLq7" crossorigin="anonymous"></script>
<script type="text/javascript" src="https://code.jquery.com/jquery-3.1.1.min.js" crossorigin="anonymous"></script>
<!-- <audio id="bgsound" preload="auto" loop="loop"><source src="audio/bgr.mp3" type='audio/mpeg; codecs="mp3"'></audio> -->
<audio id="bgsound" preload="auto" loop="loop"><source src="audio/bgr.mp3" type='audio/mpeg; codecs="mp3"'></audio>
<script type="text/javascript" src="game/bundle.js"></script>
<!-- Piwik -->

Loading…
Cancel
Save