gamefic-sdk 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/html/core/engine.js +89 -0
- data/html/core/jquery.js +5 -0
- data/html/core/jquery.modal.css +44 -0
- data/html/core/jquery.modal.js +225 -0
- data/html/core/js.cookie.js +137 -0
- data/html/skins/hypertext/compass.png +0 -0
- data/html/skins/hypertext/index.html +151 -0
- data/html/skins/hypertext/style.css +74 -0
- data/html/skins/minimal/index.html.erb +22 -0
- data/html/skins/minimal/play.js +36 -0
- data/html/skins/minimal/style.css +8 -0
- data/html/skins/multimedia/close.png +0 -0
- data/html/skins/multimedia/index.html +179 -0
- data/html/skins/multimedia/mobile.css +10 -0
- data/html/skins/multimedia/spinner.gif +0 -0
- data/html/skins/multimedia/style.css +186 -0
- data/html/skins/standard/index.html.erb +23 -0
- data/html/skins/standard/play.js +68 -0
- data/html/skins/standard/style.css +70 -0
- data/lib/gamefic-sdk/version.rb +1 -1
- data/scripts/ansi.plot.rb +13 -0
- data/scripts/autosuggest.plot.rb +171 -0
- data/scripts/clothing.plot.rb +2 -0
- data/scripts/clothing/actions.plot.rb +4 -0
- data/scripts/clothing/actions/doff.plot.rb +12 -0
- data/scripts/clothing/actions/drop.plot.rb +8 -0
- data/scripts/clothing/actions/inventory.plot.rb +14 -0
- data/scripts/clothing/actions/wear.plot.rb +19 -0
- data/scripts/clothing/entities.plot.rb +7 -0
- data/scripts/clothing/entities/clothing.plot.rb +7 -0
- data/scripts/clothing/entities/coat.plot.rb +5 -0
- data/scripts/clothing/entities/gloves.plot.rb +5 -0
- data/scripts/clothing/entities/hat.plot.rb +5 -0
- data/scripts/clothing/entities/pants.plot.rb +5 -0
- data/scripts/clothing/entities/shirt.plot.rb +5 -0
- data/scripts/clothing/entities/shoes.plot.rb +5 -0
- data/scripts/cover.plot.rb +30 -0
- data/scripts/debug.plot.rb +0 -0
- data/scripts/edible.plot.rb +19 -0
- data/scripts/furniture.plot.rb +35 -0
- data/scripts/hints.plot.rb +31 -0
- data/scripts/hypertext.plot.rb +280 -0
- data/scripts/media.plot.rb +17 -0
- data/scripts/multimedia.plot.rb +41 -0
- data/scripts/questions.plot.rb +17 -0
- data/scripts/room-modes.plot.rb +48 -0
- data/scripts/rough-sizes.plot.rb +36 -0
- data/scripts/save-restore.plot.rb +21 -0
- data/scripts/snapshots.plot.rb +14 -0
- data/scripts/standard.plot.rb +12 -0
- data/scripts/standard/actions.plot.rb +23 -0
- data/scripts/standard/actions/close.plot.rb +16 -0
- data/scripts/standard/actions/drop.plot.rb +11 -0
- data/scripts/standard/actions/enter.plot.rb +31 -0
- data/scripts/standard/actions/give.plot.rb +26 -0
- data/scripts/standard/actions/go.plot.rb +81 -0
- data/scripts/standard/actions/insert.plot.rb +47 -0
- data/scripts/standard/actions/inventory.plot.rb +8 -0
- data/scripts/standard/actions/leave.plot.rb +41 -0
- data/scripts/standard/actions/lock.plot.rb +59 -0
- data/scripts/standard/actions/look-under.plot.rb +8 -0
- data/scripts/standard/actions/look.plot.rb +102 -0
- data/scripts/standard/actions/nil.plot.rb +35 -0
- data/scripts/standard/actions/open.plot.rb +34 -0
- data/scripts/standard/actions/place.plot.rb +36 -0
- data/scripts/standard/actions/quit.plot.rb +11 -0
- data/scripts/standard/actions/read.plot.rb +3 -0
- data/scripts/standard/actions/search.plot.rb +39 -0
- data/scripts/standard/actions/show.plot.rb +13 -0
- data/scripts/standard/actions/take.plot.rb +49 -0
- data/scripts/standard/actions/talk.plot.rb +31 -0
- data/scripts/standard/actions/unlock.plot.rb +77 -0
- data/scripts/standard/actions/use.plot.rb +25 -0
- data/scripts/standard/actions/wait.plot.rb +3 -0
- data/scripts/standard/entities.plot.rb +12 -0
- data/scripts/standard/entities/character.plot.rb +9 -0
- data/scripts/standard/entities/container.plot.rb +11 -0
- data/scripts/standard/entities/door.plot.rb +53 -0
- data/scripts/standard/entities/entity.plot.rb +13 -0
- data/scripts/standard/entities/exterior.plot.rb +5 -0
- data/scripts/standard/entities/fixture.plot.rb +3 -0
- data/scripts/standard/entities/item.plot.rb +5 -0
- data/scripts/standard/entities/portal.plot.rb +37 -0
- data/scripts/standard/entities/receptacle.plot.rb +4 -0
- data/scripts/standard/entities/room.plot.rb +47 -0
- data/scripts/standard/entities/rubble.plot.rb +11 -0
- data/scripts/standard/entities/scenery.plot.rb +5 -0
- data/scripts/standard/entities/supporter.plot.rb +10 -0
- data/scripts/standard/modules.plot.rb +11 -0
- data/scripts/standard/modules/attachable.plot.rb +11 -0
- data/scripts/standard/modules/auto_takes.plot.rb +50 -0
- data/scripts/standard/modules/darkenable.plot.rb +6 -0
- data/scripts/standard/modules/enterable.plot.rb +15 -0
- data/scripts/standard/modules/explicit_exits.plot.rb +15 -0
- data/scripts/standard/modules/itemizable.plot.rb +18 -0
- data/scripts/standard/modules/lockable.plot.rb +25 -0
- data/scripts/standard/modules/openable.plot.rb +9 -0
- data/scripts/standard/modules/parent-room.plot.rb +9 -0
- data/scripts/standard/modules/portable.plot.rb +6 -0
- data/scripts/standard/modules/transparent.plot.rb +6 -0
- data/scripts/standard/pathfinder.plot.rb +60 -0
- data/scripts/standard/plural.plot.rb +2 -0
- data/scripts/standard/plural/actions.plot.rb +4 -0
- data/scripts/standard/plural/actions/drop.plot.rb +126 -0
- data/scripts/standard/plural/actions/insert.plot.rb +68 -0
- data/scripts/standard/plural/actions/place.plot.rb +37 -0
- data/scripts/standard/plural/actions/take.plot.rb +175 -0
- data/scripts/standard/plural/queries.plot.rb +5 -0
- data/scripts/standard/plural/queries/ambiguous_visible.plot.rb +13 -0
- data/scripts/standard/plural/queries/any_expression.plot.rb +17 -0
- data/scripts/standard/plural/queries/many_visible.plot.rb +13 -0
- data/scripts/standard/plural/queries/not_expression.plot.rb +16 -0
- data/scripts/standard/plural/queries/plural_visible.plot.rb +22 -0
- data/scripts/standard/queries.plot.rb +4 -0
- data/scripts/standard/queries/from_expression.plot.rb +16 -0
- data/scripts/standard/queries/reachable.plot.rb +48 -0
- data/scripts/standard/queries/room.plot.rb +17 -0
- data/scripts/standard/queries/visible.plot.rb +45 -0
- data/scripts/standard/rules.plot.rb +1 -0
- data/scripts/standard/rules/has-enough-light.plot.rb +12 -0
- data/scripts/standard/test.plot.rb +8 -0
- data/scripts/standard/use.plot.rb +29 -0
- data/scripts/suggestible.plot.rb +42 -0
- data/scripts/undo.plot.rb +11 -0
- metadata +149 -25
@@ -0,0 +1,17 @@
|
|
1
|
+
module Gamefic::Image
|
2
|
+
attr_accessor :image
|
3
|
+
end
|
4
|
+
|
5
|
+
class Gamefic::Entity
|
6
|
+
include Image
|
7
|
+
end
|
8
|
+
|
9
|
+
module Gamefic::ImageViewer
|
10
|
+
def show_image filename
|
11
|
+
tell "<figure><img src=\"media/#{filename}\" /></figure>"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
class Gamefic::Character
|
16
|
+
include ImageViewer
|
17
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
class Gamefic::Entity
|
2
|
+
attr_accessor :image
|
3
|
+
def has_image?
|
4
|
+
(@image.to_s != '')
|
5
|
+
end
|
6
|
+
end
|
7
|
+
|
8
|
+
class Gamefic::Character
|
9
|
+
attr_writer :sees_image
|
10
|
+
def sees_image?
|
11
|
+
(@sees_image != false)
|
12
|
+
end
|
13
|
+
def show_image(filename)
|
14
|
+
stream "<img src=\"#{filename}\" />";
|
15
|
+
@sees_image = true
|
16
|
+
end
|
17
|
+
def play_sound(filename, loop = false)
|
18
|
+
# TODO: Implement
|
19
|
+
end
|
20
|
+
def play_ambient(filename, loop = false)
|
21
|
+
# TODO: Implement
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
assert_action :clear_last_image do |actor, action|
|
26
|
+
actor.sees_image = false
|
27
|
+
true
|
28
|
+
end
|
29
|
+
|
30
|
+
respond :look, Query::Visible.new() do |actor, subject|
|
31
|
+
actor.proceed
|
32
|
+
if subject.has_image?
|
33
|
+
actor.show_image subject.image
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
on_player_update do |actor|
|
38
|
+
if !actor.sees_image? and actor.room.has_image?
|
39
|
+
actor.show_image actor.room.image
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
respond :what, Query::Text.new do |actor, question|
|
2
|
+
actor.tell "It looks like you're asking a question. Try giving a command instead. Use HELP for more information."
|
3
|
+
end
|
4
|
+
|
5
|
+
respond :what, Query::Reachable.new do |actor, thing|
|
6
|
+
actor.tell "It looks like you want information about #{the thing}. Try looking at it."
|
7
|
+
end
|
8
|
+
|
9
|
+
xlate "where :question", "what :question"
|
10
|
+
xlate "when :question", "what :question"
|
11
|
+
xlate "why :question", "what :question"
|
12
|
+
xlate "who :question", "what :question"
|
13
|
+
|
14
|
+
xlate "what is :thing", "look :thing"
|
15
|
+
xlate "what's :thing", "look :thing"
|
16
|
+
xlate "who is :thing", "look :thing"
|
17
|
+
xlate "who's :thing", "look :thing"
|
@@ -0,0 +1,48 @@
|
|
1
|
+
module RoomModes
|
2
|
+
attr_writer :description_mode
|
3
|
+
def description_seen
|
4
|
+
@description_seen ||= Array.new
|
5
|
+
end
|
6
|
+
def description_seen=(value)
|
7
|
+
if value.kind_of?(Array)
|
8
|
+
@description_seen = value
|
9
|
+
else
|
10
|
+
raise "Character#description_seen must be an Array"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
def description_mode
|
14
|
+
@description_mode ||= "verbose"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
class Character
|
19
|
+
include RoomModes
|
20
|
+
end
|
21
|
+
|
22
|
+
respond :go, Query::Siblings.new(Portal) do |actor, portal|
|
23
|
+
actor.tell "You go #{portal.name}."
|
24
|
+
actor.parent = portal.destination
|
25
|
+
if actor.description_mode == "superbrief" or (actor.description_mode == "brief" and actor.description_seen.include?(actor.parent))
|
26
|
+
actor.tell actor.parent.name.cap_first
|
27
|
+
else
|
28
|
+
actor.perform "look"
|
29
|
+
end
|
30
|
+
if actor.description_seen.include?(actor.parent) == false
|
31
|
+
actor.description_seen.push actor.parent
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
meta :brief do |actor|
|
36
|
+
actor.description_mode = "brief"
|
37
|
+
actor.tell "You are now in BRIEF mode. Detailed descriptions of rooms will only be displayed the first time you visit them. Other options are SUPERBRIEF and VERBOSE."
|
38
|
+
end
|
39
|
+
|
40
|
+
meta :verbose do |actor|
|
41
|
+
actor.description_mode = "verbose"
|
42
|
+
actor.tell "You are now in VERBOSE mode. Detailed descriptions will be displayed every time you enter a room. Other options are BRIEF and SUPERBRIEF."
|
43
|
+
end
|
44
|
+
|
45
|
+
meta :superbrief do |actor|
|
46
|
+
actor.description_mode = "superbrief"
|
47
|
+
actor.tell "You are now in SUPERBRIEF mode. Detailed room descriptions will never be displayed unless you LOOK AROUND. Other options are BRIEF and VERBOSE."
|
48
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module Roughly
|
2
|
+
XSMALL = 1
|
3
|
+
SMALL = 2
|
4
|
+
MEDIUM = 3
|
5
|
+
LARGE = 4
|
6
|
+
XLARGE = 5
|
7
|
+
end
|
8
|
+
|
9
|
+
class Entity
|
10
|
+
attr_writer :size
|
11
|
+
def size
|
12
|
+
@size ||= (is?(:portable) ? Roughly::SMALL : Roughly::MEDIUM)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
class Room
|
17
|
+
def size
|
18
|
+
@size ||= Roughly::XLARGE
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
respond :drop_in, Query::Children.new(), Query::Reachable.new(Container) do |actor, thing, container|
|
23
|
+
if container.size <= thing.size
|
24
|
+
actor.tell "#{The thing} can't fit in #{the container}."
|
25
|
+
else
|
26
|
+
actor.proceed
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
respond :drop_on, Query::Children.new(), Query::Reachable.new(Supporter) do |actor, thing, supporter|
|
31
|
+
if supporter.size < thing.size
|
32
|
+
actor.tell "#{The supporter} can't accommodate #{the thing}."
|
33
|
+
else
|
34
|
+
actor.proceed
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
script 'snapshots'
|
2
|
+
|
3
|
+
meta :save do |actor|
|
4
|
+
actor.perform :save, "game.sav"
|
5
|
+
end
|
6
|
+
|
7
|
+
meta :save, Query::Text.new() do |actor, filename|
|
8
|
+
actor.user.save filename, save
|
9
|
+
end
|
10
|
+
|
11
|
+
meta :restore do |actor|
|
12
|
+
actor.perform :restore, "game.sav"
|
13
|
+
end
|
14
|
+
|
15
|
+
meta :restore, Query::Text.new() do |actor, filename|
|
16
|
+
data = actor.user.restore(filename)
|
17
|
+
if !data.nil?
|
18
|
+
restore data
|
19
|
+
actor.tell "Game restored."
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Snapshots
|
2
|
+
def self.history
|
3
|
+
@history ||= []
|
4
|
+
end
|
5
|
+
end
|
6
|
+
|
7
|
+
last_snapshot = nil
|
8
|
+
|
9
|
+
on_player_ready do |actor|
|
10
|
+
if (actor.last_order.nil? or !actor.last_order.action.meta?) and !last_snapshot.nil?
|
11
|
+
Snapshots.history.push last_snapshot
|
12
|
+
end
|
13
|
+
last_snapshot = save
|
14
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# @gamefic.script standard
|
2
|
+
# A general-purpose library that provides common actions and entities for
|
3
|
+
# interactive fiction. Designed to be suitable for parser-based text
|
4
|
+
# adventures, but easily extensible for other formats.
|
5
|
+
|
6
|
+
script 'standard/use'
|
7
|
+
script 'standard/modules'
|
8
|
+
script 'standard/entities'
|
9
|
+
script 'standard/queries'
|
10
|
+
script 'standard/actions'
|
11
|
+
script 'standard/rules'
|
12
|
+
script 'standard/pathfinder'
|
@@ -0,0 +1,23 @@
|
|
1
|
+
script 'standard/actions/close'
|
2
|
+
script 'standard/actions/drop'
|
3
|
+
script 'standard/actions/enter'
|
4
|
+
script 'standard/actions/give'
|
5
|
+
script 'standard/actions/go'
|
6
|
+
script 'standard/actions/insert'
|
7
|
+
script 'standard/actions/inventory'
|
8
|
+
script 'standard/actions/leave'
|
9
|
+
script 'standard/actions/lock'
|
10
|
+
script 'standard/actions/look-under'
|
11
|
+
script 'standard/actions/look'
|
12
|
+
script 'standard/actions/nil'
|
13
|
+
script 'standard/actions/open'
|
14
|
+
script 'standard/actions/place'
|
15
|
+
script 'standard/actions/quit'
|
16
|
+
script 'standard/actions/read'
|
17
|
+
script 'standard/actions/search'
|
18
|
+
script 'standard/actions/show'
|
19
|
+
script 'standard/actions/take'
|
20
|
+
script 'standard/actions/talk'
|
21
|
+
script 'standard/actions/unlock'
|
22
|
+
script 'standard/actions/use'
|
23
|
+
script 'standard/actions/wait'
|
@@ -0,0 +1,16 @@
|
|
1
|
+
respond :close, Query::Text.new() do |actor, string|
|
2
|
+
actor.tell "#{you.pronoun.Subj} #{you.contract you.verb.do + ' not'} see any \"#{string}\" here."
|
3
|
+
end
|
4
|
+
|
5
|
+
respond :close, Query::Reachable.new() do |actor, thing|
|
6
|
+
actor.tell "#{you.pronoun.Subj} #{you.contract you.verb.can + ' not'} close #{the thing}."
|
7
|
+
end
|
8
|
+
|
9
|
+
respond :close, Query::Reachable.new(Gamefic::Openable) do |actor, container|
|
10
|
+
if !container.open?
|
11
|
+
actor.tell "It's already closed."
|
12
|
+
else
|
13
|
+
actor.tell "#{you.pronoun.Subj} close #{the container}."
|
14
|
+
container.open = false
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
respond :drop, Query::Visible.new() do |actor, thing|
|
2
|
+
actor.tell "#{you.contract you.pronoun.Subj + ' ' + you.verb.be} not carrying #{the thing}."
|
3
|
+
end
|
4
|
+
|
5
|
+
respond :drop, Query::Children.new() do |actor, thing|
|
6
|
+
thing.parent = actor.parent
|
7
|
+
actor.tell "#{you.pronoun.Subj} drop #{the thing}."
|
8
|
+
end
|
9
|
+
|
10
|
+
interpret "put down :thing", "drop :thing"
|
11
|
+
interpret "put :thing down", "drop :thing"
|
@@ -0,0 +1,31 @@
|
|
1
|
+
respond :enter, Use.siblings(Enterable, :enterable?) do |actor, supporter|
|
2
|
+
actor.parent = supporter
|
3
|
+
actor.tell "#{you.pronoun.Subj} #{you.verb[supporter.enter_verb]} #{the supporter}."
|
4
|
+
end
|
5
|
+
|
6
|
+
respond :enter, Use.siblings(Enterable, Openable, :enterable?) do |actor, container|
|
7
|
+
if container.open?
|
8
|
+
actor.proceed
|
9
|
+
else
|
10
|
+
actor.tell "#{The container} is closed."
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
respond :enter, Use.siblings do |actor, thing|
|
15
|
+
actor.tell "#{The thing} #{you.contract "can not"} accommodate #{you.pronoun.obj}."
|
16
|
+
end
|
17
|
+
|
18
|
+
respond :enter, Use.parent do |actor, container|
|
19
|
+
actor.tell "#{you.contract(you.pronoun.subj + ' ' + you.verb.be).cap_first} already in #{the container}."
|
20
|
+
end
|
21
|
+
|
22
|
+
respond :enter, Use.parent(Supporter) do |actor, supporter|
|
23
|
+
actor.tell "#{you.pronoun.Subj} #{you.verb[supporter.enter_verb]} #{the supporter} already."
|
24
|
+
end
|
25
|
+
|
26
|
+
respond :enter, Use.text do |actor, text|
|
27
|
+
actor.tell "#{you.pronoun.Subj} #{you.contract(you.verb.do + ' not')} see any \"#{text}\" here."
|
28
|
+
end
|
29
|
+
|
30
|
+
interpret "get on :thing", "enter :thing"
|
31
|
+
interpret "get in :thing", "enter :thing"
|
@@ -0,0 +1,26 @@
|
|
1
|
+
respond :give, Query::Reachable.new(Character), Query::Reachable.new do |actor, character, gift|
|
2
|
+
if gift.parent != actor
|
3
|
+
actor.perform :take, gift
|
4
|
+
end
|
5
|
+
if gift.parent == actor
|
6
|
+
actor.perform :give, character, gift
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
respond :give, Query::Reachable.new, Query::Children.new do |actor, character, gift|
|
11
|
+
actor.tell "Nothing happens."
|
12
|
+
end
|
13
|
+
|
14
|
+
respond :give, Query::Reachable.new, Query::Reachable.new do |actor, character, gift|
|
15
|
+
actor.tell "#{you.pronoun.Subj} #{you.contract(you.verb.do + ' not')} have #{the gift}."
|
16
|
+
end
|
17
|
+
|
18
|
+
respond :give, Query::Reachable.new(Character), Query::Children.new do |actor, character, gift|
|
19
|
+
actor.tell "#{The character} doesn't want #{the gift}."
|
20
|
+
end
|
21
|
+
|
22
|
+
respond :give, Query::Text.new, Query::Children.new do |actor, character, gift|
|
23
|
+
actor.tell "#{you.pronoun.Subj} #{you.contract(you.verb.do + ' not')} see any \"#{character}\" here."
|
24
|
+
end
|
25
|
+
|
26
|
+
xlate "give :gift to :character", "give :character :gift"
|
@@ -0,0 +1,81 @@
|
|
1
|
+
respond :go, Query::Reachable.new(Portal) do |actor, portal|
|
2
|
+
if actor.parent != actor.room
|
3
|
+
actor.perform :leave
|
4
|
+
end
|
5
|
+
if actor.parent == actor.room
|
6
|
+
if portal.destination.nil?
|
7
|
+
actor.tell "That portal leads nowhere."
|
8
|
+
else
|
9
|
+
actor.parent = portal.destination
|
10
|
+
if !portal.direction.nil?
|
11
|
+
actor.tell "#{you.pronoun.Subj} go #{portal.direction}"
|
12
|
+
end
|
13
|
+
actor.perform :look, actor.room
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
respond :go, Query::Reachable.new(Door, :locked?) do |actor, door|
|
19
|
+
actor.tell "#{The door} is locked."
|
20
|
+
end
|
21
|
+
|
22
|
+
respond :go, Query::Reachable.new(Door, :closed?) do |actor, door|
|
23
|
+
if door.automatic?
|
24
|
+
actor.perform :open, door
|
25
|
+
if door.open?
|
26
|
+
actor.proceed
|
27
|
+
end
|
28
|
+
else
|
29
|
+
actor.tell "#{The door} is closed."
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
respond :go, Query::Text.new() do |actor, string|
|
34
|
+
actor.tell "#{you.pronoun.Subj} #{you.contract(you.verb.do + ' not')} see any exit \"#{string}\" from here."
|
35
|
+
end
|
36
|
+
|
37
|
+
respond :go, Use.text do |actor, text|
|
38
|
+
# This version of the Go action identifies portals by their destinations.
|
39
|
+
portals = actor.room.children.that_are(Portal)
|
40
|
+
destinations = []
|
41
|
+
d_map = {}
|
42
|
+
portals.each { |portal|
|
43
|
+
next if portal.destination.nil?
|
44
|
+
destinations.push portal.destination
|
45
|
+
d_map[portal.destination] = portal
|
46
|
+
}
|
47
|
+
matches = Query::Base.new.execute(destinations, text)
|
48
|
+
if matches.objects.length == 1
|
49
|
+
actor.perform :go, d_map[matches.objects[0]]
|
50
|
+
else
|
51
|
+
actor.proceed
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
respond :go do |actor|
|
56
|
+
actor.tell "Where do you want to go?"
|
57
|
+
end
|
58
|
+
|
59
|
+
xlate "north", "go north"
|
60
|
+
xlate "south", "go south"
|
61
|
+
xlate "west", "go west"
|
62
|
+
xlate "east", "go east"
|
63
|
+
xlate "up", "go up"
|
64
|
+
xlate "down", "go down"
|
65
|
+
xlate "northwest", "go northwest"
|
66
|
+
xlate "northeast", "go northeast"
|
67
|
+
xlate "southwest", "go southwest"
|
68
|
+
xlate "southeast", "go southeast"
|
69
|
+
|
70
|
+
xlate "n", "go north"
|
71
|
+
xlate "s", "go south"
|
72
|
+
xlate "w", "go west"
|
73
|
+
xlate "e", "go east"
|
74
|
+
xlate "u", "go up"
|
75
|
+
xlate "d", "go down"
|
76
|
+
xlate "nw", "go northwest"
|
77
|
+
xlate "ne", "go northeast"
|
78
|
+
xlate "sw", "go southwest"
|
79
|
+
xlate "se", "go southeast"
|
80
|
+
|
81
|
+
interpret "go to :place", "go :place"
|
@@ -0,0 +1,47 @@
|
|
1
|
+
script 'standard'
|
2
|
+
|
3
|
+
respond :insert, Use.visible, Use.reachable do |actor, thing, target|
|
4
|
+
actor.tell "#{you.pronoun.Subj} #{you.contract you.verb.can + ' not'} put #{the thing} inside #{the target}."
|
5
|
+
end
|
6
|
+
|
7
|
+
respond :insert, Use.visible, Use.reachable(Receptacle) do |actor, thing, receptacle|
|
8
|
+
if actor.auto_takes?(thing)
|
9
|
+
actor.tell "#{you.pronoun.Subj} put #{the thing} in #{the receptacle}."
|
10
|
+
thing.parent = receptacle
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
respond :insert, Use.visible, Use.reachable(Container) do |actor, thing, container|
|
15
|
+
if container.open?
|
16
|
+
actor.proceed
|
17
|
+
else
|
18
|
+
actor.tell "#{The container} is closed."
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
respond :insert, Use.visible, Use.text do |actor, thing, container|
|
23
|
+
actor.tell "#{you.pronoun.Subj} #{you.contract you.verb.do + ' not'} see anything called \"#{container}\" here."
|
24
|
+
end
|
25
|
+
|
26
|
+
respond :insert, Use.text, Use.visible do |actor, thing, container|
|
27
|
+
actor.tell "#{you.pronoun.Subj} #{you.contract you.verb.do + ' not'} see anything called \"#{thing}\" here."
|
28
|
+
end
|
29
|
+
|
30
|
+
respond :insert, Use.text, Use.text do |actor, thing, container|
|
31
|
+
actor.tell "I don't know what you mean by \"#{thing}\" or \"#{container}.\""
|
32
|
+
end
|
33
|
+
|
34
|
+
interpret "drop :item in :container", "insert :item :container"
|
35
|
+
interpret "put :item in :container", "insert :item :container"
|
36
|
+
interpret "place :item in :container", "insert :item :container"
|
37
|
+
interpret "insert :item in :container", "insert :item :container"
|
38
|
+
|
39
|
+
interpret "drop :item inside :container", "insert :item :container"
|
40
|
+
interpret "put :item inside :container", "insert :item :container"
|
41
|
+
interpret "place :item inside :container", "insert :item :container"
|
42
|
+
interpret "insert :item inside :container", "insert :item :container"
|
43
|
+
|
44
|
+
interpret "drop :item into :container", "insert :item :container"
|
45
|
+
interpret "put :item into :container", "insert :item :container"
|
46
|
+
interpret "place :item into :container", "insert :item :container"
|
47
|
+
interpret "insert :item into :container", "insert :item :container"
|