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.
Files changed (126) hide show
  1. checksums.yaml +4 -4
  2. data/html/core/engine.js +89 -0
  3. data/html/core/jquery.js +5 -0
  4. data/html/core/jquery.modal.css +44 -0
  5. data/html/core/jquery.modal.js +225 -0
  6. data/html/core/js.cookie.js +137 -0
  7. data/html/skins/hypertext/compass.png +0 -0
  8. data/html/skins/hypertext/index.html +151 -0
  9. data/html/skins/hypertext/style.css +74 -0
  10. data/html/skins/minimal/index.html.erb +22 -0
  11. data/html/skins/minimal/play.js +36 -0
  12. data/html/skins/minimal/style.css +8 -0
  13. data/html/skins/multimedia/close.png +0 -0
  14. data/html/skins/multimedia/index.html +179 -0
  15. data/html/skins/multimedia/mobile.css +10 -0
  16. data/html/skins/multimedia/spinner.gif +0 -0
  17. data/html/skins/multimedia/style.css +186 -0
  18. data/html/skins/standard/index.html.erb +23 -0
  19. data/html/skins/standard/play.js +68 -0
  20. data/html/skins/standard/style.css +70 -0
  21. data/lib/gamefic-sdk/version.rb +1 -1
  22. data/scripts/ansi.plot.rb +13 -0
  23. data/scripts/autosuggest.plot.rb +171 -0
  24. data/scripts/clothing.plot.rb +2 -0
  25. data/scripts/clothing/actions.plot.rb +4 -0
  26. data/scripts/clothing/actions/doff.plot.rb +12 -0
  27. data/scripts/clothing/actions/drop.plot.rb +8 -0
  28. data/scripts/clothing/actions/inventory.plot.rb +14 -0
  29. data/scripts/clothing/actions/wear.plot.rb +19 -0
  30. data/scripts/clothing/entities.plot.rb +7 -0
  31. data/scripts/clothing/entities/clothing.plot.rb +7 -0
  32. data/scripts/clothing/entities/coat.plot.rb +5 -0
  33. data/scripts/clothing/entities/gloves.plot.rb +5 -0
  34. data/scripts/clothing/entities/hat.plot.rb +5 -0
  35. data/scripts/clothing/entities/pants.plot.rb +5 -0
  36. data/scripts/clothing/entities/shirt.plot.rb +5 -0
  37. data/scripts/clothing/entities/shoes.plot.rb +5 -0
  38. data/scripts/cover.plot.rb +30 -0
  39. data/scripts/debug.plot.rb +0 -0
  40. data/scripts/edible.plot.rb +19 -0
  41. data/scripts/furniture.plot.rb +35 -0
  42. data/scripts/hints.plot.rb +31 -0
  43. data/scripts/hypertext.plot.rb +280 -0
  44. data/scripts/media.plot.rb +17 -0
  45. data/scripts/multimedia.plot.rb +41 -0
  46. data/scripts/questions.plot.rb +17 -0
  47. data/scripts/room-modes.plot.rb +48 -0
  48. data/scripts/rough-sizes.plot.rb +36 -0
  49. data/scripts/save-restore.plot.rb +21 -0
  50. data/scripts/snapshots.plot.rb +14 -0
  51. data/scripts/standard.plot.rb +12 -0
  52. data/scripts/standard/actions.plot.rb +23 -0
  53. data/scripts/standard/actions/close.plot.rb +16 -0
  54. data/scripts/standard/actions/drop.plot.rb +11 -0
  55. data/scripts/standard/actions/enter.plot.rb +31 -0
  56. data/scripts/standard/actions/give.plot.rb +26 -0
  57. data/scripts/standard/actions/go.plot.rb +81 -0
  58. data/scripts/standard/actions/insert.plot.rb +47 -0
  59. data/scripts/standard/actions/inventory.plot.rb +8 -0
  60. data/scripts/standard/actions/leave.plot.rb +41 -0
  61. data/scripts/standard/actions/lock.plot.rb +59 -0
  62. data/scripts/standard/actions/look-under.plot.rb +8 -0
  63. data/scripts/standard/actions/look.plot.rb +102 -0
  64. data/scripts/standard/actions/nil.plot.rb +35 -0
  65. data/scripts/standard/actions/open.plot.rb +34 -0
  66. data/scripts/standard/actions/place.plot.rb +36 -0
  67. data/scripts/standard/actions/quit.plot.rb +11 -0
  68. data/scripts/standard/actions/read.plot.rb +3 -0
  69. data/scripts/standard/actions/search.plot.rb +39 -0
  70. data/scripts/standard/actions/show.plot.rb +13 -0
  71. data/scripts/standard/actions/take.plot.rb +49 -0
  72. data/scripts/standard/actions/talk.plot.rb +31 -0
  73. data/scripts/standard/actions/unlock.plot.rb +77 -0
  74. data/scripts/standard/actions/use.plot.rb +25 -0
  75. data/scripts/standard/actions/wait.plot.rb +3 -0
  76. data/scripts/standard/entities.plot.rb +12 -0
  77. data/scripts/standard/entities/character.plot.rb +9 -0
  78. data/scripts/standard/entities/container.plot.rb +11 -0
  79. data/scripts/standard/entities/door.plot.rb +53 -0
  80. data/scripts/standard/entities/entity.plot.rb +13 -0
  81. data/scripts/standard/entities/exterior.plot.rb +5 -0
  82. data/scripts/standard/entities/fixture.plot.rb +3 -0
  83. data/scripts/standard/entities/item.plot.rb +5 -0
  84. data/scripts/standard/entities/portal.plot.rb +37 -0
  85. data/scripts/standard/entities/receptacle.plot.rb +4 -0
  86. data/scripts/standard/entities/room.plot.rb +47 -0
  87. data/scripts/standard/entities/rubble.plot.rb +11 -0
  88. data/scripts/standard/entities/scenery.plot.rb +5 -0
  89. data/scripts/standard/entities/supporter.plot.rb +10 -0
  90. data/scripts/standard/modules.plot.rb +11 -0
  91. data/scripts/standard/modules/attachable.plot.rb +11 -0
  92. data/scripts/standard/modules/auto_takes.plot.rb +50 -0
  93. data/scripts/standard/modules/darkenable.plot.rb +6 -0
  94. data/scripts/standard/modules/enterable.plot.rb +15 -0
  95. data/scripts/standard/modules/explicit_exits.plot.rb +15 -0
  96. data/scripts/standard/modules/itemizable.plot.rb +18 -0
  97. data/scripts/standard/modules/lockable.plot.rb +25 -0
  98. data/scripts/standard/modules/openable.plot.rb +9 -0
  99. data/scripts/standard/modules/parent-room.plot.rb +9 -0
  100. data/scripts/standard/modules/portable.plot.rb +6 -0
  101. data/scripts/standard/modules/transparent.plot.rb +6 -0
  102. data/scripts/standard/pathfinder.plot.rb +60 -0
  103. data/scripts/standard/plural.plot.rb +2 -0
  104. data/scripts/standard/plural/actions.plot.rb +4 -0
  105. data/scripts/standard/plural/actions/drop.plot.rb +126 -0
  106. data/scripts/standard/plural/actions/insert.plot.rb +68 -0
  107. data/scripts/standard/plural/actions/place.plot.rb +37 -0
  108. data/scripts/standard/plural/actions/take.plot.rb +175 -0
  109. data/scripts/standard/plural/queries.plot.rb +5 -0
  110. data/scripts/standard/plural/queries/ambiguous_visible.plot.rb +13 -0
  111. data/scripts/standard/plural/queries/any_expression.plot.rb +17 -0
  112. data/scripts/standard/plural/queries/many_visible.plot.rb +13 -0
  113. data/scripts/standard/plural/queries/not_expression.plot.rb +16 -0
  114. data/scripts/standard/plural/queries/plural_visible.plot.rb +22 -0
  115. data/scripts/standard/queries.plot.rb +4 -0
  116. data/scripts/standard/queries/from_expression.plot.rb +16 -0
  117. data/scripts/standard/queries/reachable.plot.rb +48 -0
  118. data/scripts/standard/queries/room.plot.rb +17 -0
  119. data/scripts/standard/queries/visible.plot.rb +45 -0
  120. data/scripts/standard/rules.plot.rb +1 -0
  121. data/scripts/standard/rules/has-enough-light.plot.rb +12 -0
  122. data/scripts/standard/test.plot.rb +8 -0
  123. data/scripts/standard/use.plot.rb +29 -0
  124. data/scripts/suggestible.plot.rb +42 -0
  125. data/scripts/undo.plot.rb +11 -0
  126. metadata +149 -25
@@ -0,0 +1,2 @@
1
+ script 'clothing/entities'
2
+ script 'clothing/actions'
@@ -0,0 +1,4 @@
1
+ script 'clothing/actions/doff'
2
+ script 'clothing/actions/drop'
3
+ script 'clothing/actions/inventory'
4
+ script 'clothing/actions/wear'
@@ -0,0 +1,12 @@
1
+ respond :doff, Query::Children.new(Clothing) do |actor, clothing|
2
+ if !clothing.attached?
3
+ actor.tell "You're not wearing #{the clothing}."
4
+ else
5
+ clothing.attached = false
6
+ actor.tell "You take off #{the clothing}."
7
+ end
8
+ end
9
+
10
+ xlate "remove :clothing", "doff :clothing"
11
+ xlate "take off :clothing", "doff :clothing"
12
+ xlate "take :clothing off", "doff :clothing"
@@ -0,0 +1,8 @@
1
+ respond :drop, Query::Children.new(Clothing) do |actor, clothing|
2
+ if clothing.attached?
3
+ actor.perform :doff, clothing
4
+ end
5
+ if !clothing.attached?
6
+ actor.proceed
7
+ end
8
+ end
@@ -0,0 +1,14 @@
1
+ respond :inventory do |actor|
2
+ if actor.children.length > 0
3
+ carried = actor.children.that_are_not(:attached?)
4
+ worn = actor.children.that_are(:attached?)
5
+ if carried.length > 0
6
+ actor.tell "You are carrying #{carried.join_and}."
7
+ end
8
+ if worn.length > 0
9
+ actor.tell "You are wearing #{worn.join_and}."
10
+ end
11
+ else
12
+ actor.tell "You aren't carrying anything."
13
+ end
14
+ end
@@ -0,0 +1,19 @@
1
+ respond :wear, Query::Reachable.new(Clothing) do |actor, clothing|
2
+ if actor.auto_takes?(clothing)
3
+ if clothing.attached?
4
+ actor.tell "You're already wearing #{the clothing}."
5
+ else
6
+ already = actor.children.that_are(clothing.class).that_are(:attached?)
7
+ if already.length == 0
8
+ clothing.attached = true
9
+ actor.tell "You put on #{the clothing}."
10
+ else
11
+ actor.tell "You're already wearing #{an already[0]}."
12
+ end
13
+ end
14
+ end
15
+ end
16
+
17
+ xlate "put on :clothing", "wear :clothing"
18
+ xlate "put :clothing on", "wear :clothing"
19
+ xlate "don :clothing", "wear :clothing"
@@ -0,0 +1,7 @@
1
+ script 'clothing/entities/clothing'
2
+ script 'clothing/entities/coat'
3
+ script 'clothing/entities/gloves'
4
+ script 'clothing/entities/hat'
5
+ script 'clothing/entities/pants'
6
+ script 'clothing/entities/shirt'
7
+ script 'clothing/entities/shoes'
@@ -0,0 +1,7 @@
1
+ script 'standard/entities/item'
2
+
3
+ class Gamefic::Clothing < Gamefic::Item
4
+ def worn?
5
+ self.parent.kind_of?(Character) and self.attached?
6
+ end
7
+ end
@@ -0,0 +1,5 @@
1
+ script 'clothing/entities/clothing'
2
+
3
+ class Gamefic::Coat < Gamefic::Clothing
4
+
5
+ end
@@ -0,0 +1,5 @@
1
+ script 'clothing/entities/clothing'
2
+
3
+ class Gamefic::Gloves < Gamefic::Clothing
4
+
5
+ end
@@ -0,0 +1,5 @@
1
+ script 'clothing/entities/clothing'
2
+
3
+ class Gamefic::Hat < Gamefic::Clothing
4
+
5
+ end
@@ -0,0 +1,5 @@
1
+ script 'clothing/entities/clothing'
2
+
3
+ class Gamefic::Pants < Gamefic::Clothing
4
+
5
+ end
@@ -0,0 +1,5 @@
1
+ script 'clothing/entities/clothing'
2
+
3
+ class Gamefic::Shirt < Gamefic::Clothing
4
+
5
+ end
@@ -0,0 +1,5 @@
1
+ script 'clothing/entities/clothing'
2
+
3
+ class Gamefic::Shoes < Gamefic::Clothing
4
+
5
+ end
@@ -0,0 +1,30 @@
1
+ script 'media'
2
+
3
+ module Gamefic::CoverImageViewer
4
+ attr_accessor :cover_image
5
+ end
6
+
7
+ class Gamefic::Character
8
+ include CoverImageViewer
9
+ end
10
+
11
+ on_player_update do |actor|
12
+ if !actor.cover_image.nil?
13
+ actor.stream "<figure class=\"cover\"><img src=\"media/#{actor.cover_image}\" /></figure>"
14
+ end
15
+ actor.cover_image = nil
16
+ end
17
+
18
+ respond :look, Use.room do |actor, room|
19
+ if !room.image.nil?
20
+ actor.cover_image = room.image
21
+ end
22
+ actor.proceed
23
+ end
24
+
25
+ respond :look, Use.reachable do |actor, thing|
26
+ if !thing.image.nil?
27
+ actor.cover_image = thing.image
28
+ end
29
+ actor.proceed
30
+ end
File without changes
@@ -0,0 +1,19 @@
1
+ module Edibility
2
+ attr_writer :edible
3
+ def edible?
4
+ @edible ||= false
5
+ end
6
+ end
7
+
8
+ class Gamefic::Entity
9
+ include Edibility
10
+ end
11
+
12
+ respond :eat, Use.reachable do |actor, item|
13
+ actor.tell "You can't eat #{the item}."
14
+ end
15
+
16
+ respond :eat, Use.reachable(:edible?) do |actor, item|
17
+ actor.tell "You eat #{the item}."
18
+ item.destroy
19
+ end
@@ -0,0 +1,35 @@
1
+ class Gamefic::Seat < Gamefic::Entity
2
+ include Enterable
3
+ def initialize plot, args = {}
4
+ self.enterable = true
5
+ self.enter_verb = "sit on"
6
+ self.leave_verb = "stand up from"
7
+ self.inside_verb = "be sitting on"
8
+ super
9
+ end
10
+ end
11
+
12
+ respond :sit do |actor|
13
+ seats = Use.reachable.context_from(actor).that_are(Seat)
14
+ if seats.length == 1
15
+ actor.perform :enter, seats[0]
16
+ elsif seats.length > 1
17
+ actor.tell "I don't know where you want to sit: #{seats.join_or}"
18
+ else
19
+ actor.tell "There's nowhere to sit here."
20
+ end
21
+ end
22
+
23
+ respond :stand do |actor|
24
+ if actor.parent == actor.room
25
+ actor.tell "You're already standing."
26
+ else
27
+ actor.perform :leave, actor.parent
28
+ end
29
+ end
30
+
31
+ interpret "sit :seat", "enter :seat"
32
+ interpret "sit on :seat", "enter :seat"
33
+ interpret "stand up from :seat", "leave :seat"
34
+ interpret "sit down", "sit"
35
+ interpret "stand up", "stand"
@@ -0,0 +1,31 @@
1
+ class Character
2
+ def hints
3
+ @hints ||= []
4
+ end
5
+ def hint message
6
+ hints.push message
7
+ if self.is? :strongly_guided
8
+ self.stream "<p class=\"hint\">#{message}</p>"
9
+ end
10
+ end
11
+ end
12
+
13
+ options Character, :lightly_guided, :strongly_guided, :never_guided
14
+
15
+ finish_action :reset_hints do |actor|
16
+ actor.hints.clear
17
+ end
18
+
19
+ meta :hint do |actor|
20
+ if !actor.is? :never_guided
21
+ if actor.hints.length > 0
22
+ actor.hints.each { |hint|
23
+ actor.tell hint
24
+ }
25
+ else
26
+ actor.tell "There are no hints available right now."
27
+ end
28
+ else
29
+ actor.tell "There are no hints available in this game."
30
+ end
31
+ end
@@ -0,0 +1,280 @@
1
+ script 'clothing'
2
+
3
+ module Gamefic::Hypertext
4
+ def self.link command, text = nil
5
+ "<a rel=\"gamefic\" href=\"#\" data-command=\"#{command}\">#{text || command}</a>"
6
+ end
7
+ end
8
+
9
+ class Gamefic::Entity
10
+ attr_writer :default_command
11
+ def default_command
12
+ @default_command || "examine #{definitely}"
13
+ end
14
+ end
15
+
16
+ class Gamefic::Character
17
+ def suggest command, text = nil
18
+ stream "<nav class=\"suggestions\"><p>#{Hypertext.link(command, text)}</p></nav>"
19
+ end
20
+ end
21
+
22
+ assert_action :clear_room_mode do |actor, action|
23
+ actor[:looking_at_room] = false
24
+ actor[:checking_inventory] = false
25
+ true
26
+ end
27
+
28
+ respond :look, Query::Room.new(Room) do |actor, room|
29
+ actor.tell "<strong>#{room.name.cap_first}</strong>"
30
+ actor.tell room.description
31
+ with_locales = []
32
+ chars = room.children.that_are(Character) - [actor]
33
+ charsum = []
34
+ chars.each { |char|
35
+ if char.locale_description != ""
36
+ with_locales.push char
37
+ else
38
+ if charsum.length == 0
39
+ charsum.push Hypertext.link char.default_command, char.indefinitely.cap_first
40
+ else
41
+ charsum.push Hypertext.link char.default_command, char.indefinitely
42
+ end
43
+ end
44
+ }
45
+ if charsum.length > 0
46
+ actor.tell "#{charsum.join_and} #{charsum.length == 1 ? 'is' : 'are'} here."
47
+ end
48
+ items = room.children.that_are(:itemized) - [actor] - room.children.that_are(Character)
49
+ itemsum = []
50
+ items.each { |item|
51
+ if item.locale_description != ""
52
+ with_locales.push item
53
+ else
54
+ itemsum.push Hypertext.link item.default_command, item.indefinitely
55
+ end
56
+ }
57
+ if itemsum.length > 0
58
+ actor.tell "You see #{itemsum.join_and}."
59
+ end
60
+ with_locales.each { |entity|
61
+ actor.tell entity.locale_description
62
+ }
63
+ if room.is? :explicit_with_exits
64
+ portals = room.children.that_are(Portal)
65
+ if portals.length > 0
66
+ if portals.length == 1
67
+ actor.tell "There is an exit #{Hypertext.link portals[0].default_command, portals[0].direction}."
68
+ else
69
+ dirs = []
70
+ portals.each { |p|
71
+ dirs.push Hypertext.link p.default_command, p.direction
72
+ }
73
+ actor.tell "There are exits #{dirs.join_and(', ')}."
74
+ end
75
+ end
76
+ end
77
+ if actor.is? :supported
78
+ actor.tell "You are on #{the actor.parent}."
79
+ actor.parent.children.that_are(:supported).that_are_not(actor).each { |s|
80
+ actor.tell "#{Hypertext.link s.default_command, s.indefinitely.cap_first} is on #{the actor.parent}."
81
+ }
82
+ end
83
+ actor[:looking_at_room] = true
84
+ end
85
+
86
+ respond :look, Query::Visible.new(Character) do |actor, character|
87
+ actor.proceed
88
+ actor.suggest "talk to #{the character}"
89
+ end
90
+
91
+ respond :look, Query::Visible.new do |actor, thing|
92
+ actor.proceed
93
+ if thing.is? :portable
94
+ if thing.parent == actor
95
+ actor.suggest "drop #{the thing}"
96
+ else
97
+ actor.suggest "take #{the thing}"
98
+ end
99
+ end
100
+ objects = thing.children.that_are(:attached)
101
+ actor.stream '<nav class="objects">'
102
+ objects.each { |object|
103
+ actor.tell Hypertext.link "look #{object}", object
104
+ }
105
+ actor.stream '</nav>'
106
+ end
107
+
108
+ respond :look, Query::Visible.new(Container) do |actor, container|
109
+ actor.tell container.description
110
+ container.children.that_are(:attached).that_are(:itemized).each { |item|
111
+ actor.tell "#{An item} is attached to #{the container}."
112
+ }
113
+ if container.is? :openable
114
+ actor.tell "#{The container} is #{container.is?(:open) ? 'open' : 'closed'}."
115
+ end
116
+ if container.is? :open
117
+ contents = container.children.that_are(:contained)
118
+ if contents.length > 0
119
+ array = []
120
+ contents.each { |entity|
121
+ array.push Hypertext.link entity.default_command, entity.indefinitely
122
+ }
123
+ actor.tell "You see #{array.join_and} inside #{the container}."
124
+ end
125
+ end
126
+ if container.is?(:lockable) and container.is?(:locked)
127
+ actor.suggest "unlock #{the container}"
128
+ elsif container.is?(:openable) and container.is?(:closed)
129
+ actor.suggest "open #{the container}"
130
+ else
131
+ if container.is?(:openable) and container.is?(:open)
132
+ actor.suggest "close #{the container}"
133
+ end
134
+ if container.is?(:open)
135
+ actor.stream '<nav class="objects">'
136
+ objects = container.children.that_are(:itemized)
137
+ objects.each { |object|
138
+ actor.stream Hypertext.link "look #{object}", object
139
+ }
140
+ actor.stream '</nav>'
141
+ end
142
+ end
143
+ if container.is?(:enterable)
144
+ actor.suggest "enter #{the container}"
145
+ end
146
+ end
147
+
148
+ respond :look, Query::Children.new(Clothing) do |actor, clothing|
149
+ actor.proceed
150
+ if clothing.is?(:worn)
151
+ actor.suggest "remove #{the clothing}"
152
+ else
153
+ actor.suggest "wear #{the clothing}"
154
+ end
155
+ end
156
+
157
+ respond :open, Query::Visible.new(Container) do |actor, container|
158
+ actor.proceed
159
+ if container.is? :open
160
+ actor.perform :look, container
161
+ end
162
+ end
163
+
164
+ #respond :look, Query::Visible.new(Device) do |actor, device|
165
+ # actor.proceed
166
+ # if device.is? :on
167
+ # actor.suggest "turn on #{the device}"
168
+ # else
169
+ # actor.suggest "turn off #{the device}"
170
+ # end
171
+ #end
172
+
173
+ respond :inventory do |actor|
174
+ if actor.children.length > 0
175
+ carried = actor.children.that_are_not(:worn)
176
+ worn = actor.children.that_are(:worn)
177
+ if carried.length > 0
178
+ array = []
179
+ carried.each { |entity|
180
+ array << "#{Hypertext.link(entity.default_command, entity.indefinitely)}"
181
+ }
182
+ actor.tell "You are carrying #{array.join_and}."
183
+ end
184
+ if worn.length > 0
185
+ array = []
186
+ worn.each { |entity|
187
+ array << "#{Hypertext.link(entity.default_command, entity.indefinitely)}"
188
+ }
189
+ actor.tell "You are wearing #{array.join_and}."
190
+ end
191
+ actor.stream '<nav class="objects">'
192
+ actor.children.each { |object|
193
+ actor.tell Hypertext.link "look #{object}", object.definitely
194
+ }
195
+ actor.stream '</nav>'
196
+ else
197
+ actor.tell "You aren't carrying anything."
198
+ end
199
+ actor[:checking_inventory] = true
200
+ end
201
+
202
+ respond :go, Query::Reachable.new(Door, :locked) do |actor, door|
203
+ actor.proceed
204
+ if door.is? :locked
205
+ actor.suggest "unlock #{the door}"
206
+ end
207
+ end
208
+
209
+ respond :unlock, Query::Reachable.new(:lockable) do |actor, container|
210
+ actor.proceed
211
+ if container.is?(:closed)
212
+ actor.suggest "open #{the container}"
213
+ end
214
+ end
215
+
216
+ respond :take, Query::Reachable.new(Clothing) do |actor, clothing|
217
+ actor.proceed
218
+ if clothing.parent == actor
219
+ actor.suggest "wear #{the clothing}"
220
+ end
221
+ end
222
+
223
+ on_player_update do |actor|
224
+ if actor.scene.key != :active and actor.scene.kind_of?(Gamefic::ActiveScene) == false
225
+ next
226
+ end
227
+ if actor.parent != actor.room
228
+ if actor.parent.kind_of?(Container)
229
+ actor.suggest "exit", "leave #{the actor.parent}"
230
+ else
231
+ actor.suggest "exit", "get off #{the actor.parent}"
232
+ end
233
+ end
234
+ if actor[:looking_at_room] != true
235
+ actor.suggest "look around"
236
+ end
237
+ if actor[:checking_inventory] != true
238
+ actor.suggest "inventory"
239
+ end
240
+ entities = Query::Siblings.new.context_from(actor)
241
+ portals = entities.that_are(Portal)
242
+ if portals.length > 0
243
+ actor.stream '<nav class="portals">'
244
+ actor.stream "Exits: "
245
+ portals.each { |portal|
246
+ actor.stream Hypertext.link("go #{portal.direction}", "#{portal.direction}") + " "
247
+ }
248
+ actor.stream '</nav>'
249
+ end
250
+ if actor.room.is? :dark
251
+ next
252
+ end
253
+ characters = entities.that_are(Character) - [actor]
254
+ if characters.length > 0
255
+ actor.stream '<nav class="characters">'
256
+ actor.stream "Characters: "
257
+ characters.each { |entity|
258
+ actor.stream Hypertext.link("examine #{the entity}", "#{the entity}") + " "
259
+ }
260
+ actor.stream '</nav>'
261
+ end
262
+ objects = entities.that_are(:itemized) - characters - [actor] - portals
263
+ if objects.length > 0
264
+ actor.stream '<nav class="objects">'
265
+ actor.stream "Objects: "
266
+ objects.each { |entity|
267
+ actor.stream Hypertext.link(entity.default_command, "#{the entity}") + " "
268
+ }
269
+ actor.stream '</nav>'
270
+ end
271
+ extras = entities.that_are(:not_itemized) - characters - [actor] - portals
272
+ if extras.length > 0
273
+ actor.stream '<nav class="incidentals">'
274
+ actor.stream "Incidentals: "
275
+ extras.each { |entity|
276
+ actor.stream Hypertext.link("examine #{the entity}", "#{the entity}") + " "
277
+ }
278
+ actor.stream '</nav>'
279
+ end
280
+ end