mirror of
https://gitlab.com/Oreolek/salet-module.git
synced 2024-06-26 03:50:49 +03:00
New version finally fixes the effects.
This commit is contained in:
parent
268808bb4f
commit
a9f7ef762a
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "salet",
|
"name": "salet",
|
||||||
"version": "1.5.4",
|
"version": "1.6",
|
||||||
"description": "A general client-side framework for cybertext interactive fiction games.",
|
"description": "A general client-side framework for cybertext interactive fiction games.",
|
||||||
"keywords": ["ifiction", "interactive fiction", "games", "coffee-script", "text", "menu"],
|
"keywords": ["ifiction", "interactive fiction", "games", "coffee-script", "text", "menu"],
|
||||||
"homepage": "http://salet.oreolek.ru",
|
"homepage": "http://salet.oreolek.ru",
|
||||||
|
|
|
@ -39,12 +39,11 @@ class SaletRoom
|
||||||
return true
|
return true
|
||||||
|
|
||||||
###
|
###
|
||||||
Salet's Undum version calls Situation.entering every time a situation is entered, and
|
Salet calls Situation.entering every time a situation is entered, and
|
||||||
passes it a string referencing the previous situation, or null if there is
|
passes it a string referencing the previous situation, or null if there is
|
||||||
none (ie, for the starting situation).
|
none (ie, for the starting situation).
|
||||||
|
|
||||||
My version of `enter` splits the location description from the effects.
|
If f == this.name (we're in the same location) the `before` and `after` callbacks are ignored.
|
||||||
Also if f == this.name (we're in the same location) the `before` and `after` callbacks are ignored.
|
|
||||||
###
|
###
|
||||||
@entering = (f, force = false) =>
|
@entering = (f, force = false) =>
|
||||||
if (
|
if (
|
||||||
|
@ -62,8 +61,6 @@ class SaletRoom
|
||||||
|
|
||||||
if @clear and f?
|
if @clear and f?
|
||||||
salet.view.clearContent()
|
salet.view.clearContent()
|
||||||
else
|
|
||||||
salet.view.removeTransient()
|
|
||||||
|
|
||||||
if f != @name and salet.rooms[f]?
|
if f != @name and salet.rooms[f]?
|
||||||
@visited++
|
@visited++
|
||||||
|
@ -100,6 +97,9 @@ class SaletRoom
|
||||||
if @afterChoices?
|
if @afterChoices?
|
||||||
@afterChoices.fcall(this, f)
|
@afterChoices.fcall(this, f)
|
||||||
|
|
||||||
|
if not @clear
|
||||||
|
salet.view.removeTransient(f)
|
||||||
|
|
||||||
if salet.autosave and @canSave
|
if salet.autosave and @canSave
|
||||||
salet.saveGame()
|
salet.saveGame()
|
||||||
|
|
||||||
|
|
|
@ -120,12 +120,19 @@ class SaletView
|
||||||
text. This can be used to remove action options when an action
|
text. This can be used to remove action options when an action
|
||||||
is no longer available. It is used automatically when you give
|
is no longer available. It is used automatically when you give
|
||||||
a link the 'once' class.
|
a link the 'once' class.
|
||||||
|
|
||||||
|
@param code remove all links to given target (optional)
|
||||||
|
@param container remove all links inside given block (optional)
|
||||||
###
|
###
|
||||||
@clearLinks = (code) ->
|
@clearLinks = (code, container) ->
|
||||||
if code
|
if code
|
||||||
links = $("#page").find("a[href='" + code + "']")
|
unless container?
|
||||||
|
container = "#page"
|
||||||
|
links = $(container).find("a[href='" + code + "']")
|
||||||
else
|
else
|
||||||
links = $("#content").find("a")
|
unless container?
|
||||||
|
container = "#content"
|
||||||
|
links = $(container).find("a")
|
||||||
for a in links
|
for a in links
|
||||||
a = $(a)
|
a = $(a)
|
||||||
if not code and (a.hasClass('sticky') || a.attr("href").match(/[?&]sticky[=&]?/))
|
if not code and (a.hasClass('sticky') || a.attr("href").match(/[?&]sticky[=&]?/))
|
||||||
|
@ -177,14 +184,20 @@ class SaletView
|
||||||
$('.new').removeClass('new')
|
$('.new').removeClass('new')
|
||||||
|
|
||||||
# Removes links and transient sections.
|
# Removes links and transient sections.
|
||||||
@removeTransient = () =>
|
@removeTransient = (room = undefined) =>
|
||||||
contentToHide = $('#content .transient')
|
container = "#content"
|
||||||
contentToHide = contentToHide.add('#content .options')
|
if (room)
|
||||||
contentToHide = contentToHide.add($("#content a").filter(() ->
|
container = ".room-#{room}"
|
||||||
|
|
||||||
|
transientFilter = () ->
|
||||||
return $(this).attr("href").match(/[?&]transient[=&]?/)
|
return $(this).attr("href").match(/[?&]transient[=&]?/)
|
||||||
))
|
contentToHide = $("#{container} .transient")
|
||||||
|
contentToHide = contentToHide.add("#{container} .options")
|
||||||
|
contentToHide = contentToHide.add(
|
||||||
|
$("#{container} a").filter(transientFilter)
|
||||||
|
)
|
||||||
@hideBlock(contentToHide, true)
|
@hideBlock(contentToHide, true)
|
||||||
@clearLinks()
|
@clearLinks(undefined, container)
|
||||||
|
|
||||||
# At last, we scroll the view so that .new objects are in view.
|
# At last, we scroll the view so that .new objects are in view.
|
||||||
@endOutputTransaction = () ->
|
@endOutputTransaction = () ->
|
||||||
|
@ -253,7 +266,7 @@ class SaletView
|
||||||
return block.hide()
|
return block.hide()
|
||||||
|
|
||||||
callback = () ->
|
callback = () ->
|
||||||
block.remove()
|
$(this).remove()
|
||||||
if remove == false
|
if remove == false
|
||||||
callback = undefined
|
callback = undefined
|
||||||
block.finish().fadeTo(500, 0, () ->
|
block.finish().fadeTo(500, 0, () ->
|
||||||
|
|
Loading…
Reference in a new issue