mirror of
https://gitlab.com/Oreolek/salet.git
synced 2024-07-02 06:45:06 +03:00
Resolved #2: forbid leaving a room
You can use `@exit()` to set `canExit` and print the "YOU SHALL NOT LEAVE" message.
This commit is contained in:
parent
4412081800
commit
e3e17eb295
|
@ -24,6 +24,7 @@ class SaletRoom
|
|||
@priority = 1
|
||||
@displayOrder = 1
|
||||
@canSave = true
|
||||
@canExit = true
|
||||
@tags = []
|
||||
@choices = ""
|
||||
@optionText = "Choice"
|
||||
|
@ -63,6 +64,14 @@ class SaletRoom
|
|||
Also if f == this.name (we're in the same location) the `before` and `after` callbacks are ignored.
|
||||
###
|
||||
@entering = (system, f) =>
|
||||
if (
|
||||
f != @name and
|
||||
f? and
|
||||
system.rooms[f].canExit? and
|
||||
system.rooms[f].canExit == false
|
||||
)
|
||||
return system.goTo(f, f)
|
||||
|
||||
if @clear and f?
|
||||
system.view.clearContent()
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue