gamefic-sdk 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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,8 @@
|
|
1
|
+
respond :inventory do |actor|
|
2
|
+
if actor.children.length > 0
|
3
|
+
actor.tell "#{you.pronoun.Subj} #{you.verb.be} carrying #{actor.children.join_and}."
|
4
|
+
else
|
5
|
+
actor.tell "#{you.pronoun.Subj} #{you.contract you.verb.be + ' not'} carrying anything."
|
6
|
+
end
|
7
|
+
end
|
8
|
+
xlate "i", "inventory"
|
@@ -0,0 +1,41 @@
|
|
1
|
+
respond :leave, Use.parent(Container, :enterable?) do |actor, container|
|
2
|
+
if container.open?
|
3
|
+
actor.proceed
|
4
|
+
else
|
5
|
+
actor.tell "#{The container} is closed."
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
respond :leave, Use.parent do |actor, thing|
|
10
|
+
actor.tell "There's no way out of #{the thing}."
|
11
|
+
end
|
12
|
+
|
13
|
+
respond :leave, Use.parent(Enterable, :enterable?) do |actor, thing|
|
14
|
+
actor.tell "#{you.pronoun.Subj} #{you.verb[thing.leave_verb]} #{the thing}."
|
15
|
+
actor.parent = thing.parent
|
16
|
+
end
|
17
|
+
|
18
|
+
respond :leave, Query::Parent.new(Room) do |actor, room|
|
19
|
+
portals = room.children.that_are(Portal)
|
20
|
+
if portals.length == 0
|
21
|
+
actor.tell "#{you.pronoun.Subj} #{you.contract you.verb.do + ' not'} see any obvious exits."
|
22
|
+
elsif portals.length == 1
|
23
|
+
actor.perform :go, portals[0]
|
24
|
+
else
|
25
|
+
actor.tell "I don't know which way you want to go: #{portals.join_or}."
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
respond :leave do |actor|
|
30
|
+
actor.perform :leave, actor.parent
|
31
|
+
end
|
32
|
+
|
33
|
+
xlate "exit", "leave"
|
34
|
+
xlate "exit :supporter", "leave :supporter"
|
35
|
+
xlate "get off :supporter", "leave :supporter"
|
36
|
+
xlate "get up from :supporter", "leave :supporter"
|
37
|
+
xlate "get up", "leave"
|
38
|
+
xlate "get off", "leave"
|
39
|
+
xlate "get out :container", "leave :container"
|
40
|
+
xlate "get out of :container", "leave :container"
|
41
|
+
#xlate "out", "leave"
|
@@ -0,0 +1,59 @@
|
|
1
|
+
respond :lock, 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 :lock, Query::Reachable.new() do |actor, thing|
|
6
|
+
actor.tell "#{you.pronoun.Subj} #{you.contract you.verb.can + ' not'} lock #{the thing}."
|
7
|
+
end
|
8
|
+
|
9
|
+
respond :lock, Query::Reachable.new(Lockable, :has_lock_key?) do |actor, container|
|
10
|
+
# Portable containers need to be picked up before they are locked.
|
11
|
+
if container.portable? and container.parent != actor
|
12
|
+
actor.perform :take, container
|
13
|
+
if container.parent != actor
|
14
|
+
break
|
15
|
+
end
|
16
|
+
end
|
17
|
+
if container.locked?
|
18
|
+
actor.tell "It's already locked."
|
19
|
+
else
|
20
|
+
#if container.is?(:auto_lockable)
|
21
|
+
key = nil
|
22
|
+
if container.lock_key.nil? == false
|
23
|
+
if container.lock_key.parent == actor
|
24
|
+
key = container.lock_key
|
25
|
+
end
|
26
|
+
end
|
27
|
+
if key.nil?
|
28
|
+
actor.tell "#{you.pronoun.Subj} #{you.contract you.verb.do + ' not'} have any way to lock #{the container}."
|
29
|
+
else
|
30
|
+
actor.tell "#{you.pronoun.Subj} #{you.verb.lock} #{the container} with #{the key}."
|
31
|
+
container.locked = true
|
32
|
+
end
|
33
|
+
#else
|
34
|
+
# actor.tell "What do you want to lock #{the container} with?"
|
35
|
+
#end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
respond :lock, Query::Reachable.new(Lockable, :has_lock_key?), Query::Children.new do |actor, container, key|
|
40
|
+
if container.locked == false
|
41
|
+
if container.lock_key == key
|
42
|
+
#if container.is?(:not_auto_lockable)
|
43
|
+
# container.is :auto_lockable
|
44
|
+
# actor.perform :lock, container
|
45
|
+
# container.is :not_auto_lockable
|
46
|
+
#else
|
47
|
+
# actor.perform :lock, container
|
48
|
+
#end
|
49
|
+
actor.tell "#{you.pronoun.Subj} #{you.verb.lock} #{the container} with #{the key}."
|
50
|
+
container.locked = true
|
51
|
+
else
|
52
|
+
actor.tell "#{you.pronoun.Subj} #{you.contract you.verb.can + ' not'} lock #{the container} with #{the key}."
|
53
|
+
end
|
54
|
+
else
|
55
|
+
actor.tell "It's already locked."
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
xlate "lock :container with :key", "lock :container :key"
|
@@ -0,0 +1,8 @@
|
|
1
|
+
script 'standard/actions/look'
|
2
|
+
|
3
|
+
respond :look_under, Query::Reachable.new() do |actor, thing|
|
4
|
+
actor.tell "There's nothing to see under #{the thing}."
|
5
|
+
end
|
6
|
+
|
7
|
+
interpret "look beneath :thing", "look under :thing"
|
8
|
+
interpret "look below :thing", "look under :thing"
|
@@ -0,0 +1,102 @@
|
|
1
|
+
respond :look, Use.parent(Supporter) do |actor, supporter|
|
2
|
+
actor.tell supporter.description
|
3
|
+
actor.tell "#{you.pronoun.Subj} are currently on #{the supporter}."
|
4
|
+
end
|
5
|
+
|
6
|
+
respond :look, Query::Self.new do |actor, _|
|
7
|
+
actor.tell actor.description
|
8
|
+
actor.perform :inventory
|
9
|
+
end
|
10
|
+
|
11
|
+
respond :look, Use.room do |actor, room|
|
12
|
+
actor.tell "<strong>#{room.name.cap_first}</strong>"
|
13
|
+
actor.tell room.description
|
14
|
+
with_locales = []
|
15
|
+
chars = room.children.that_are(Character).that_are(:itemized?) - [actor]
|
16
|
+
charsum = []
|
17
|
+
chars.each { |char|
|
18
|
+
if char.locale_description != ""
|
19
|
+
with_locales.push char
|
20
|
+
else
|
21
|
+
charsum.push char
|
22
|
+
end
|
23
|
+
}
|
24
|
+
if charsum.length > 0
|
25
|
+
actor.tell "#{charsum.join_and.cap_first} #{charsum.length == 1 ? 'is' : 'are'} here."
|
26
|
+
end
|
27
|
+
items = room.children.that_are(:itemized?) - [actor] - room.children.that_are(Character) - room.children.that_are(Portal)
|
28
|
+
itemsum = []
|
29
|
+
items.each { |item|
|
30
|
+
if item.locale_description != ""
|
31
|
+
with_locales.push item
|
32
|
+
else
|
33
|
+
itemsum.push item
|
34
|
+
end
|
35
|
+
}
|
36
|
+
if itemsum.length > 0
|
37
|
+
actor.tell "#{you.pronoun.Subj} #{you.verb.see} #{itemsum.join_and}."
|
38
|
+
end
|
39
|
+
with_locales.each { |entity|
|
40
|
+
actor.tell entity.locale_description
|
41
|
+
}
|
42
|
+
if room.explicit_exits?
|
43
|
+
portals = room.children.that_are(Portal).that_are(:itemized?)
|
44
|
+
if portals.length > 0
|
45
|
+
if portals.length == 1
|
46
|
+
actor.tell "There is an exit #{portals[0].direction}."
|
47
|
+
else
|
48
|
+
dirs = []
|
49
|
+
portals.each { |p|
|
50
|
+
dirs.push (p.direction || p.name)
|
51
|
+
}
|
52
|
+
actor.tell "There are exits #{dirs.join_and(', ')}."
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
if actor.parent.kind_of?(Supporter)
|
57
|
+
actor.tell "#{you.pronoun.Subj} #{you.verb.be} on #{the actor.parent}."
|
58
|
+
actor.parent.children.that_are_not(actor).each { |s|
|
59
|
+
actor.tell "#{A s} is on #{the actor.parent}."
|
60
|
+
}
|
61
|
+
end
|
62
|
+
end
|
63
|
+
xlate "look", "look around"
|
64
|
+
xlate "l", "look around"
|
65
|
+
|
66
|
+
respond :look, Query::Visible.new() do |actor, thing|
|
67
|
+
actor.tell thing.description
|
68
|
+
thing.children.that_are(:attached?).that_are(:itemized?).each { |item|
|
69
|
+
actor.tell "#{An item} is attached to #{the thing}."
|
70
|
+
}
|
71
|
+
end
|
72
|
+
|
73
|
+
respond :look, Use.text do |actor, string|
|
74
|
+
actor.tell "You don't see any \"#{string}\" here."
|
75
|
+
end
|
76
|
+
|
77
|
+
respond :look, Use.reachable(Receptacle) do |actor, receptacle|
|
78
|
+
if receptacle.has_description?
|
79
|
+
actor.tell receptacle.description
|
80
|
+
end
|
81
|
+
actor.perform :search, receptacle
|
82
|
+
end
|
83
|
+
|
84
|
+
respond :look, Query::Visible.new(Supporter) do |actor, supporter|
|
85
|
+
actor.proceed
|
86
|
+
supported = supporter.children.that_are_not(:attached?)
|
87
|
+
if supported.length > 0
|
88
|
+
actor.tell "You see #{supported.join_and} sitting there."
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
respond :look, Query::Reachable.new(Door) do |actor, door|
|
93
|
+
if door.has_description?
|
94
|
+
actor.proceed
|
95
|
+
end
|
96
|
+
actor.tell "#{The door} is " + (door.open? ? 'open' : 'closed') + '.'
|
97
|
+
end
|
98
|
+
|
99
|
+
interpret "look at :thing", "look :thing"
|
100
|
+
interpret "l :thing", "look :thing"
|
101
|
+
interpret "examine :thing", "look :thing"
|
102
|
+
interpret "x :thing", "look :thing"
|
@@ -0,0 +1,35 @@
|
|
1
|
+
meta nil, Query::Text.new() do |actor, string|
|
2
|
+
words = string.split_words
|
3
|
+
if commandwords.include?(words[0])
|
4
|
+
if words.length > 1
|
5
|
+
actor.tell "I recognize '#{words[0]}' as a verb but could not understand the rest of your sentence."
|
6
|
+
else
|
7
|
+
actor.tell "I recognize '#{words[0]}' as a verb but could not understand it in this context."
|
8
|
+
end
|
9
|
+
else
|
10
|
+
found = []
|
11
|
+
commandwords.each { |c|
|
12
|
+
next if c.include?('_')
|
13
|
+
if c.length > words[0].length and c.start_with?(words[0])
|
14
|
+
found.push c
|
15
|
+
end
|
16
|
+
}
|
17
|
+
if found.length == 1
|
18
|
+
words[0] = found[0]
|
19
|
+
actor.perform words.join(' ')
|
20
|
+
elsif found.length > 1 and words[0].length > 2
|
21
|
+
actor.tell "I'm not sure if #{words[0]} means #{found.join_and(', ', ' or ')}."
|
22
|
+
else
|
23
|
+
actor.tell "I don't recognize '#{words[0]}' as a verb."
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
meta nil, Query::Text.new("it") do |actor, string|
|
29
|
+
words = string.split_words
|
30
|
+
if commandwords.include?(words[0])
|
31
|
+
actor.tell "I'm not sure what you mean by \"it.\""
|
32
|
+
else
|
33
|
+
actor.proceed
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
respond :open, Use.text do |actor, string|
|
2
|
+
actor.tell "#{you.pronoun.Subj} #{you.contract(you.verb.do + ' not')} see any \"#{string}\" here."
|
3
|
+
end
|
4
|
+
|
5
|
+
respond :open, Use.reachable() do |actor, thing|
|
6
|
+
actor.tell "#{you.pronoun.Subj} #{you.contract(you.verb.can + ' not')} open #{the thing}."
|
7
|
+
end
|
8
|
+
|
9
|
+
respond :open, Use.reachable(Openable) do |actor, container|
|
10
|
+
# Portable containers need to be picked up before they are opened.
|
11
|
+
if container.portable? and container.parent != actor
|
12
|
+
actor.perform :take, container
|
13
|
+
if container.parent != actor
|
14
|
+
break
|
15
|
+
end
|
16
|
+
end
|
17
|
+
if !container.open?
|
18
|
+
actor.tell "#{you.pronoun.Subj} #{you.verb.open} #{the container}."
|
19
|
+
container.open = true
|
20
|
+
if container.children.that_are_not(:attached?).length > 0
|
21
|
+
actor.perform :search, container
|
22
|
+
end
|
23
|
+
else
|
24
|
+
actor.tell "It's already open."
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
respond :open, Use.reachable(Openable, Lockable) do |actor, container|
|
29
|
+
if container.locked?
|
30
|
+
actor.tell "#{The container} is locked."
|
31
|
+
else
|
32
|
+
actor.proceed
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
respond :place, Use.children, Use.reachable do |actor, thing, supporter|
|
2
|
+
actor.tell "#{you.pronoun.Subj} #{you.contract(you.verb.can + ' not')} put #{the thing} on #{the supporter}."
|
3
|
+
end
|
4
|
+
|
5
|
+
respond :place, Use.visible, Use.reachable(Supporter) do |actor, thing, supporter|
|
6
|
+
if thing.parent != actor
|
7
|
+
actor.perform :take, thing
|
8
|
+
end
|
9
|
+
if thing.parent == actor
|
10
|
+
actor.perform :place, thing
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
respond :place, Use.children, Use.reachable(Supporter) do |actor, thing, supporter|
|
15
|
+
thing.parent = supporter
|
16
|
+
actor.tell "#{you.pronoun.Subj} #{you.verb.put} #{the thing} on #{the supporter}."
|
17
|
+
end
|
18
|
+
|
19
|
+
respond :place, Use.visible, Use.text do |actor, thing, supporter|
|
20
|
+
actor.tell "#{you.pronoun.Subj} #{you.contract(you.verb.do + ' not')} see anything called \"#{supporter}\" here."
|
21
|
+
end
|
22
|
+
|
23
|
+
respond :place, Use.text, Use.visible do |actor, thing, supporter|
|
24
|
+
actor.tell "#{you.pronoun.Subj} #{you.contract(you.verb.do + ' not')} see anything called \"#{thing}\" here."
|
25
|
+
end
|
26
|
+
|
27
|
+
respond :place, Use.text, Use.text do |actor, thing, supporter|
|
28
|
+
actor.tell "I don't know what you mean by \"#{thing}\" or \"#{supporter}.\""
|
29
|
+
end
|
30
|
+
|
31
|
+
xlate "put :thing on :supporter", "place :thing :supporter"
|
32
|
+
xlate "put :thing down on :supporter", "place :thing :supporter"
|
33
|
+
xlate "set :thing on :supporter", "place :thing :supporter"
|
34
|
+
xlate "set :thing down on :supporter", "place :thing :supporter"
|
35
|
+
xlate "drop :thing on :supporter", "place :thing :supporter"
|
36
|
+
xlate "place :thing on :supporter", "place :thing :supporter"
|
@@ -0,0 +1,39 @@
|
|
1
|
+
respond :search, Use.reachable(Receptacle) do |actor, receptacle|
|
2
|
+
# TODO Show the contents of the receptacle
|
3
|
+
contents = receptacle.children.that_are_not(:attached?)
|
4
|
+
if contents.length > 0
|
5
|
+
actor.tell "Inside #{contents.length > 1 ? 'are' : 'is'} #{contents.join_and}."
|
6
|
+
else
|
7
|
+
actor.tell "#{The receptacle} #{receptacle.verb.be} empty."
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
respond :search, Use.reachable(Container) do |actor, container|
|
12
|
+
if container.open? or container.transparent?
|
13
|
+
actor.proceed
|
14
|
+
else
|
15
|
+
actor.tell "#{The container} #{container.verb.be} closed."
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
respond :search, Use.reachable do |actor, thing|
|
20
|
+
actor.perform :look, thing
|
21
|
+
end
|
22
|
+
|
23
|
+
respond :search, Use.room do |actor, room|
|
24
|
+
actor.perform :look, room
|
25
|
+
end
|
26
|
+
|
27
|
+
respond :search, Use.reachable do |actor, entity|
|
28
|
+
attached = entity.children.that_are(:attached?).that_are(Container)
|
29
|
+
if attached.length > 1
|
30
|
+
actor.tell "#{you.pronoun.Subj} #{you.verb.can} search #{attached.join_or}"
|
31
|
+
elsif attached.length == 1
|
32
|
+
actor.perform :search, attached[0]
|
33
|
+
else
|
34
|
+
actor.proceed
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
interpret "look in :thing", "search :thing"
|
39
|
+
interpret "look inside :thing", "search :thing"
|
@@ -0,0 +1,13 @@
|
|
1
|
+
respond :show, Use.reachable(Character), Use.children do |actor, character, thing|
|
2
|
+
actor.tell "#{The character} isn't interested in #{the thing}."
|
3
|
+
end
|
4
|
+
|
5
|
+
respond :show, Use.reachable, Use.children do |actor, witness, thing|
|
6
|
+
actor.tell "Nothing happens."
|
7
|
+
end
|
8
|
+
|
9
|
+
respond :show, Use.children, Use.text do |actor, thing, text|
|
10
|
+
actor.tell "#{you.pronoun.Subj} #{you.contract you.verb.do + ' not'} see any \"#{text}\" here."
|
11
|
+
end
|
12
|
+
|
13
|
+
interpret "show :thing to :character", "show :character :thing"
|
@@ -0,0 +1,49 @@
|
|
1
|
+
respond :take, Use.reachable do |actor, thing|
|
2
|
+
actor.tell "#{you.pronoun.Subj} #{you.contract you.verb.can + ' not'} take #{the thing}."
|
3
|
+
end
|
4
|
+
|
5
|
+
respond :take, Use.visible do |actor, thing|
|
6
|
+
if thing.parent == actor.parent
|
7
|
+
actor.proceed
|
8
|
+
elsif thing.parent.kind_of?(Container) and !thing.parent.open?
|
9
|
+
actor.tell "#{The thing} is inside #{the thing.parent}, which is closed."
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
respond :take, Use.visible do |actor, thing|
|
14
|
+
if actor.parent.kind_of?(Supporter) and actor.parent != thing.parent and actor.parent != thing.parent.parent
|
15
|
+
actor.tell "#{you.pronoun.Subj} can't reach it from #{the actor.parent}."
|
16
|
+
else
|
17
|
+
actor.proceed
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
respond :take, Use.reachable(:attached?) do |actor, thing|
|
22
|
+
actor.tell "#{The thing} is attached to #{the thing.parent}."
|
23
|
+
end
|
24
|
+
|
25
|
+
respond :take, Use.reachable(Entity, :portable?) do |actor, thing|
|
26
|
+
if thing.parent == actor
|
27
|
+
actor.tell "#{you.contract(you.pronoun.subj + ' are').cap_first} already carrying #{the thing}."
|
28
|
+
else
|
29
|
+
if actor.parent != thing.parent
|
30
|
+
actor.tell "#{you.pronoun.Subj} #{you.verb.take} #{the thing} from #{the thing.parent}."
|
31
|
+
else
|
32
|
+
actor.tell "#{you.pronoun.Subj} #{you.verb.take} #{the thing}."
|
33
|
+
end
|
34
|
+
thing.parent = actor
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
respond :take, Use.reachable(Gamefic::Rubble) do |actor, rubble|
|
39
|
+
actor.tell "#{you.pronoun.Subj} #{you.contract(you.verb.do + ' not')} have any use for #{the rubble}."
|
40
|
+
end
|
41
|
+
|
42
|
+
respond :take, Use.text do |actor, text|
|
43
|
+
actor.tell "#{you.pronoun.Subj} #{you.contract(you.verb.do + ' not')} see any \"#{text}\" here."
|
44
|
+
end
|
45
|
+
|
46
|
+
interpret "get :thing", "take :thing"
|
47
|
+
interpret "pick up :thing", "take :thing"
|
48
|
+
interpret "pick :thing up", "take :thing"
|
49
|
+
interpret "carry :thing", "take :thing"
|