gamefic-standard 2.0.0

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 (70) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +13 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +7 -0
  5. data/.vscode/launch.json +20 -0
  6. data/Gemfile +4 -0
  7. data/LICENSE.txt +21 -0
  8. data/README.md +60 -0
  9. data/Rakefile +6 -0
  10. data/bin/console +14 -0
  11. data/bin/setup +8 -0
  12. data/gamefic-standard.gemspec +44 -0
  13. data/lib/gamefic-standard.rb +10 -0
  14. data/lib/gamefic-standard/actions.rb +13 -0
  15. data/lib/gamefic-standard/actions/drop.rb +21 -0
  16. data/lib/gamefic-standard/actions/enter.rb +21 -0
  17. data/lib/gamefic-standard/actions/go.rb +56 -0
  18. data/lib/gamefic-standard/actions/insert.rb +38 -0
  19. data/lib/gamefic-standard/actions/inventory.rb +11 -0
  20. data/lib/gamefic-standard/actions/leave.rb +32 -0
  21. data/lib/gamefic-standard/actions/look.rb +117 -0
  22. data/lib/gamefic-standard/actions/nil.rb +38 -0
  23. data/lib/gamefic-standard/actions/place.rb +43 -0
  24. data/lib/gamefic-standard/actions/quit.rb +14 -0
  25. data/lib/gamefic-standard/actions/take.rb +33 -0
  26. data/lib/gamefic-standard/actions/talk.rb +29 -0
  27. data/lib/gamefic-standard/actions/wait.rb +5 -0
  28. data/lib/gamefic-standard/articles.rb +50 -0
  29. data/lib/gamefic-standard/clothing.rb +4 -0
  30. data/lib/gamefic-standard/clothing/actions.rb +4 -0
  31. data/lib/gamefic-standard/clothing/actions/doff.rb +14 -0
  32. data/lib/gamefic-standard/clothing/actions/drop.rb +10 -0
  33. data/lib/gamefic-standard/clothing/actions/inventory.rb +16 -0
  34. data/lib/gamefic-standard/clothing/actions/wear.rb +22 -0
  35. data/lib/gamefic-standard/clothing/entities.rb +7 -0
  36. data/lib/gamefic-standard/clothing/entities/clothing.rb +5 -0
  37. data/lib/gamefic-standard/clothing/entities/coat.rb +3 -0
  38. data/lib/gamefic-standard/clothing/entities/gloves.rb +3 -0
  39. data/lib/gamefic-standard/clothing/entities/hat.rb +3 -0
  40. data/lib/gamefic-standard/clothing/entities/pants.rb +3 -0
  41. data/lib/gamefic-standard/clothing/entities/shirt.rb +3 -0
  42. data/lib/gamefic-standard/clothing/entities/shoes.rb +3 -0
  43. data/lib/gamefic-standard/container.rb +27 -0
  44. data/lib/gamefic-standard/direction.rb +55 -0
  45. data/lib/gamefic-standard/edible.rb +23 -0
  46. data/lib/gamefic-standard/entities.rb +10 -0
  47. data/lib/gamefic-standard/entities/character.rb +11 -0
  48. data/lib/gamefic-standard/entities/fixture.rb +3 -0
  49. data/lib/gamefic-standard/entities/item.rb +5 -0
  50. data/lib/gamefic-standard/entities/portal.rb +44 -0
  51. data/lib/gamefic-standard/entities/receptacle.rb +3 -0
  52. data/lib/gamefic-standard/entities/room.rb +79 -0
  53. data/lib/gamefic-standard/entities/rubble.rb +11 -0
  54. data/lib/gamefic-standard/entities/scenery.rb +7 -0
  55. data/lib/gamefic-standard/entities/supporter.rb +7 -0
  56. data/lib/gamefic-standard/entities/thing.rb +72 -0
  57. data/lib/gamefic-standard/give.rb +27 -0
  58. data/lib/gamefic-standard/grammar.rb +2 -0
  59. data/lib/gamefic-standard/grammar/attributes.rb +37 -0
  60. data/lib/gamefic-standard/grammar/pronoun.rb +101 -0
  61. data/lib/gamefic-standard/lockable.rb +93 -0
  62. data/lib/gamefic-standard/modules.rb +7 -0
  63. data/lib/gamefic-standard/modules/enterable.rb +19 -0
  64. data/lib/gamefic-standard/modules/use.rb +45 -0
  65. data/lib/gamefic-standard/openable.rb +49 -0
  66. data/lib/gamefic-standard/pathfinder.rb +65 -0
  67. data/lib/gamefic-standard/queries.rb +25 -0
  68. data/lib/gamefic-standard/test.rb +36 -0
  69. data/lib/gamefic-standard/version.rb +5 -0
  70. metadata +182 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 19ce8e79ae8e8b3a1a23e5a2636fc722e8359e690cf67d02ad96233a9f6da94d
4
+ data.tar.gz: 205bb6b6be8854bca3ac924d6d69b4ca1298392efa6edcb7b6f741db684b65fd
5
+ SHA512:
6
+ metadata.gz: 94ea55f35e275f08ef95795e42c087692095f457d2ccae6968a837fe6b3397c993081a6df0e7e3bd0f5e9c159cece48b07d43936a403f4f370bf1617144cb56e
7
+ data.tar.gz: 27d37ab19bf8ef41da80320b9d1f804906decc2bc98509b34b6f07b56c2ef7e1e14312c2a96722cf9a9a3eea3638a193a07f5b4f493d6e284f425ea75e0ddee6
@@ -0,0 +1,13 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
12
+
13
+ Gemfile.lock
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --require spec_helper
@@ -0,0 +1,7 @@
1
+ ---
2
+ sudo: false
3
+ language: ruby
4
+ cache: bundler
5
+ rvm:
6
+ - 2.5.3
7
+ before_install: gem install bundler -v 2.0.1
@@ -0,0 +1,20 @@
1
+ {
2
+ // Use IntelliSense to learn about possible attributes.
3
+ // Hover to view descriptions of existing attributes.
4
+ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5
+ "version": "0.2.0",
6
+ "configurations": [
7
+ {
8
+ "type": "ruby-debug",
9
+ "request": "launch",
10
+ "name": "RSpec (Active File)",
11
+ "program": "rspec",
12
+ "programArgs": [
13
+ "-I",
14
+ "${workspaceFolder}",
15
+ "${file}"
16
+ ],
17
+ "useBundler": true
18
+ }
19
+ ]
20
+ }
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in gamefic-standard.gemspec
4
+ gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019 Fred Snyder
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,60 @@
1
+ # Gamefic Standard
2
+
3
+ The standard library for the Gamefic interactive fiction framework.
4
+
5
+ Gamefic Standard provides common useful components for adventure games. [Inform](http://inform7.com/)
6
+ developers should find it similar to Inform's Standard Rules. It defines common
7
+ components like Rooms and Characters, along with in-game commands like `GO`,
8
+ `GET`, and `DROP` to enable basic interactivity.
9
+
10
+ ## Installation
11
+
12
+ Add this line to your application's Gemfile:
13
+
14
+ ```ruby
15
+ gem 'gamefic-standard'
16
+ ```
17
+
18
+ And then execute:
19
+
20
+ $ bundle
21
+
22
+ Or install it yourself as:
23
+
24
+ $ gem install gamefic-standard
25
+
26
+ ## Usage
27
+
28
+ Require the library in your game scripts:
29
+
30
+ ```ruby
31
+ require 'gamefic'
32
+ require 'gamefic-standard'
33
+
34
+ Gamefic.script do
35
+ @office = make Room, name: 'office'
36
+ @desk = make Fixture, name: 'desk', parent: @office
37
+
38
+ introduction do |actor|
39
+ actor.parent = @office
40
+ actor.tell "You're in an office."
41
+ end
42
+ end
43
+ ```
44
+
45
+ Go to the [Gamefic website](https://gamefic.com) or the [SDK repo](https://github.com/castwide/gamefic-sdk)
46
+ for more information about using Gamefic.
47
+
48
+ ## Development
49
+
50
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
51
+
52
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
53
+
54
+ ## Contributing
55
+
56
+ Bug reports and pull requests are welcome on GitHub at https://github.com/castwide/gamefic-standard.
57
+
58
+ ## License
59
+
60
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "gamefic/standard"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,44 @@
1
+ lib = File.expand_path("../lib", __FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require 'gamefic-standard/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "gamefic-standard"
7
+ spec.version = Gamefic::Standard::VERSION
8
+ spec.authors = ["Fred Snyder"]
9
+ spec.email = ["fsnyder@castwide.com"]
10
+
11
+ spec.summary = %q{The Gamefic standard script library.}
12
+ spec.description = %q{A collection of components for building games and interactive fiction in Gamefic.}
13
+ spec.homepage = "http://gamefic.com"
14
+ spec.license = "MIT"
15
+
16
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
17
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
18
+ # if spec.respond_to?(:metadata)
19
+ # spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
20
+
21
+ # spec.metadata["homepage_uri"] = spec.homepage
22
+ # spec.metadata["source_code_uri"] = "TODO: Put your gem's public repo URL here."
23
+ # spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
24
+ # else
25
+ # raise "RubyGems 2.0 or newer is required to protect against " \
26
+ # "public gem pushes."
27
+ # end
28
+
29
+ # Specify which files should be added to the gem when it is released.
30
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
31
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
32
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
33
+ end
34
+ spec.bindir = "exe"
35
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
36
+ spec.require_paths = ["lib"]
37
+
38
+ spec.add_dependency 'gamefic', '~> 2.0'
39
+
40
+ spec.add_development_dependency 'bundler', '~> 2.0'
41
+ spec.add_development_dependency 'rake', '~> 10.0'
42
+ spec.add_development_dependency 'rspec', '~> 3.0'
43
+ spec.add_development_dependency 'simplecov', '~> 0.14'
44
+ end
@@ -0,0 +1,10 @@
1
+ require 'gamefic'
2
+
3
+ require 'gamefic-standard/version'
4
+ require 'gamefic-standard/grammar'
5
+ require 'gamefic-standard/articles'
6
+ require 'gamefic-standard/queries'
7
+ require 'gamefic-standard/modules'
8
+ require 'gamefic-standard/direction'
9
+ require 'gamefic-standard/entities'
10
+ require 'gamefic-standard/actions'
@@ -0,0 +1,13 @@
1
+ require 'gamefic-standard/actions/nil'
2
+ require 'gamefic-standard/actions/drop'
3
+ require 'gamefic-standard/actions/enter'
4
+ require 'gamefic-standard/actions/go'
5
+ require 'gamefic-standard/actions/insert'
6
+ require 'gamefic-standard/actions/inventory'
7
+ require 'gamefic-standard/actions/leave'
8
+ require 'gamefic-standard/actions/look'
9
+ require 'gamefic-standard/actions/place'
10
+ require 'gamefic-standard/actions/quit'
11
+ require 'gamefic-standard/actions/take'
12
+ require 'gamefic-standard/actions/talk'
13
+ require 'gamefic-standard/actions/wait'
@@ -0,0 +1,21 @@
1
+ Gamefic.script do
2
+ respond :drop, Use.family() do |actor, thing|
3
+ if thing.parent != actor
4
+ actor.tell "You're not carrying #{the thing}."
5
+ else
6
+ actor.proceed
7
+ end
8
+ end
9
+
10
+ respond :drop, Use.children do |actor, thing|
11
+ if thing.sticky?
12
+ actor.tell thing.sticky_message || "You need to keep #{the thing} for now."
13
+ else
14
+ thing.parent = actor.parent
15
+ actor.tell "You drop #{the thing}."
16
+ end
17
+ end
18
+
19
+ interpret "put down :thing", "drop :thing"
20
+ interpret "put :thing down", "drop :thing"
21
+ end
@@ -0,0 +1,21 @@
1
+ Gamefic.script do
2
+ respond :enter, Use.siblings do |actor, thing|
3
+ actor.tell "#{The thing} can't accommodate you."
4
+ end
5
+
6
+ respond :enter, Use.siblings(Enterable, :enterable?) do |actor, supporter|
7
+ actor.parent = supporter
8
+ actor.tell "You get in #{the supporter}."
9
+ end
10
+
11
+ respond :enter, Use.parent do |actor, container|
12
+ actor.tell "You're already in #{the container}."
13
+ end
14
+
15
+ respond :enter, Use.parent(Supporter) do |actor, supporter|
16
+ actor.tell "You're inside #{the supporter} already."
17
+ end
18
+
19
+ interpret "get on :thing", "enter :thing"
20
+ interpret "get in :thing", "enter :thing"
21
+ end
@@ -0,0 +1,56 @@
1
+ Gamefic.script do
2
+ respond :go, Use.siblings(Portal) do |actor, portal|
3
+ if actor.parent != actor.room
4
+ actor.perform :leave
5
+ end
6
+ if actor.parent == actor.room
7
+ if portal.destination.nil?
8
+ actor.tell "That portal leads nowhere."
9
+ else
10
+ actor.parent = portal.destination
11
+ if !portal.direction.nil?
12
+ actor.tell "You go #{portal.direction}."
13
+ end
14
+ actor.tell "<strong>#{actor.room.name.cap_first}</strong>"
15
+ actor.execute :_describe_destination
16
+ actor.execute :_itemize_room
17
+ end
18
+ end
19
+ end
20
+
21
+ meta :_describe_destination do |actor|
22
+ actor.tell actor.room.description if actor.room.has_description?
23
+ end
24
+
25
+ respond :go, Use.text do |actor, string|
26
+ actor.tell "You don't see any exit \"#{string}\" from here."
27
+ end
28
+
29
+ respond :go do |actor|
30
+ actor.tell "Where do you want to go?"
31
+ end
32
+
33
+ xlate "north", "go north"
34
+ xlate "south", "go south"
35
+ xlate "west", "go west"
36
+ xlate "east", "go east"
37
+ xlate "up", "go up"
38
+ xlate "down", "go down"
39
+ xlate "northwest", "go northwest"
40
+ xlate "northeast", "go northeast"
41
+ xlate "southwest", "go southwest"
42
+ xlate "southeast", "go southeast"
43
+
44
+ xlate "n", "go north"
45
+ xlate "s", "go south"
46
+ xlate "w", "go west"
47
+ xlate "e", "go east"
48
+ xlate "u", "go up"
49
+ xlate "d", "go down"
50
+ xlate "nw", "go northwest"
51
+ xlate "ne", "go northeast"
52
+ xlate "sw", "go southwest"
53
+ xlate "se", "go southeast"
54
+
55
+ interpret "go to :place", "go :place"
56
+ end
@@ -0,0 +1,38 @@
1
+ # script 'standard'
2
+ Gamefic.script do
3
+ respond :insert, Use.available, Use.available do |actor, thing, target|
4
+ actor.tell "You can't put #{the thing} inside #{the target}."
5
+ end
6
+
7
+ respond :insert, Use.children, Use.available(Receptacle) do |actor, thing, receptacle|
8
+ if thing.sticky?
9
+ actor.tell thing.sticky_message || "You need to keep #{the thing} for now."
10
+ else
11
+ actor.tell "You put #{the thing} in #{the receptacle}."
12
+ thing.parent = receptacle
13
+ end
14
+ end
15
+
16
+ respond :insert, Use.available, Use.available(Receptacle) do |actor, thing, receptacle|
17
+ if thing.parent == actor
18
+ actor.proceed
19
+ else
20
+ actor.tell "You don't have #{the thing}."
21
+ end
22
+ end
23
+
24
+ interpret "drop :item in :container", "insert :item :container"
25
+ interpret "put :item in :container", "insert :item :container"
26
+ interpret "place :item in :container", "insert :item :container"
27
+ interpret "insert :item in :container", "insert :item :container"
28
+
29
+ interpret "drop :item inside :container", "insert :item :container"
30
+ interpret "put :item inside :container", "insert :item :container"
31
+ interpret "place :item inside :container", "insert :item :container"
32
+ interpret "insert :item inside :container", "insert :item :container"
33
+
34
+ interpret "drop :item into :container", "insert :item :container"
35
+ interpret "put :item into :container", "insert :item :container"
36
+ interpret "place :item into :container", "insert :item :container"
37
+ interpret "insert :item into :container", "insert :item :container"
38
+ end
@@ -0,0 +1,11 @@
1
+ Gamefic.script do
2
+ respond :inventory do |actor|
3
+ if actor.children.length > 0
4
+ actor.tell "You are carrying #{actor.children.join_and}."
5
+ else
6
+ actor.tell "You aren't carrying anything."
7
+ end
8
+ end
9
+
10
+ interpret "i", "inventory"
11
+ end
@@ -0,0 +1,32 @@
1
+ Gamefic.script do
2
+ respond :leave, Use.parent do |actor, thing|
3
+ actor.tell "There's no way out of #{the thing}."
4
+ end
5
+
6
+ respond :leave, Use.parent(Enterable, :enterable?) do |actor, thing|
7
+ actor.tell "You leave #{the thing}."
8
+ actor.parent = thing.parent
9
+ end
10
+
11
+ respond :leave, Use.room do |actor, room|
12
+ portals = room.children.that_are(Portal)
13
+ if portals.length == 0
14
+ actor.tell "You don't see any obvious exits."
15
+ elsif portals.length == 1
16
+ actor.perform :go, portals[0]
17
+ else
18
+ actor.tell "I don't know which way you want to go: #{portals.join_or}."
19
+ end
20
+ end
21
+
22
+ respond :leave do |actor|
23
+ actor.perform :leave, actor.parent
24
+ end
25
+
26
+ interpret "exit", "leave"
27
+ interpret "exit :supporter", "leave :supporter"
28
+ interpret "get on :supporter", "enter :supporter"
29
+ interpret "get off :supporter", "leave :supporter"
30
+ interpret "get out :container", "leave :container"
31
+ interpret "get out of :container", "leave :container"
32
+ end
@@ -0,0 +1,117 @@
1
+ Gamefic.script do
2
+ respond :look, Use.text do |actor, string|
3
+ if string == 'around'
4
+ actor.perform :look, actor.room
5
+ elsif string =~ /self|myself|me/
6
+ actor.tell actor.description
7
+ actor.perform :inventory
8
+ else
9
+ actor.tell "You don't see any \"#{string}\" here."
10
+ end
11
+ end
12
+
13
+ respond :look, Use.itself do |actor, thing|
14
+ actor.tell actor.description
15
+ actor.perform :inventory
16
+ end
17
+
18
+ respond :look, Use.available(Thing) do |actor, thing|
19
+ actor.tell thing.description
20
+ thing.children.that_are(:attached?).that_are(:itemized?).each { |item|
21
+ actor.tell "#{An item} is attached to #{the thing}."
22
+ }
23
+ end
24
+
25
+ respond :look, Use.available(Supporter) do |actor, thing|
26
+ if thing.accessible?
27
+ itemized = thing.children.that_are_not(:attached?).that_are(:itemized?)
28
+ # If the supporter does not have a description but it does contain
29
+ # itemized things, avoid saying there's nothing special about it.
30
+ actor.proceed if thing.has_description? or itemized.empty?
31
+ actor.tell "You see #{itemized.join_and} on #{the thing}." unless itemized.empty?
32
+ else
33
+ actor.proceed
34
+ end
35
+ end
36
+
37
+ respond :look, Use.available(Receptacle) do |actor, thing|
38
+ actor.proceed
39
+ if thing.accessible?
40
+ itemized = thing.children.that_are_not(:attached?).that_are(:itemized?)
41
+ actor.tell "You see #{itemized.join_and} in #{the thing}." unless itemized.empty?
42
+ end
43
+ end
44
+
45
+ respond :look, Use.parent(Supporter, :enterable?) do |actor, supporter|
46
+ actor.proceed
47
+ actor.tell "You are currently on #{the supporter}."
48
+ end
49
+
50
+ respond :look, Use.room do |actor, room|
51
+ actor.tell "<strong>#{room.name.cap_first}</strong>"
52
+ actor.tell room.description if room.has_description?
53
+ actor.execute :_itemize_room
54
+ end
55
+
56
+ meta :_itemize_room do |actor|
57
+ room = actor.room
58
+ next if room.nil?
59
+ with_locales = []
60
+ chars = room.children.that_are(Character).that_are(:itemized?) - [actor]
61
+ charsum = []
62
+ chars.each { |char|
63
+ if char.locale_description.nil?
64
+ charsum.push char
65
+ else
66
+ with_locales.push char
67
+ end
68
+ }
69
+ if charsum.length > 0
70
+ actor.tell "#{charsum.join_and.cap_first} #{charsum.length == 1 ? 'is' : 'are'} here."
71
+ end
72
+ items = room.children.that_are(:itemized?) - [actor] - room.children.that_are(Character) - room.children.that_are(Portal)
73
+ itemsum = []
74
+ items.each { |item|
75
+ if item.locale_description.nil?
76
+ itemsum.push item
77
+ else
78
+ with_locales.push item
79
+ end
80
+ }
81
+ if itemsum.length > 0
82
+ actor.tell "You see #{itemsum.join_and}."
83
+ end
84
+ with_locales.each { |entity|
85
+ actor.tell entity.locale_description
86
+ }
87
+ if room.explicit_exits?
88
+ portals = room.children.that_are(Portal).that_are(:itemized?)
89
+ if portals.length > 0
90
+ if portals.length == 1
91
+ p = portals[0]
92
+ actor.tell "There is an exit #{p.instruction}."
93
+ else
94
+ dirs = []
95
+ portals.each { |p|
96
+ dirs.push p.instruction
97
+ }
98
+ actor.tell "There are exits #{dirs.join_and(', ')}."
99
+ end
100
+ end
101
+ end
102
+ if actor.parent.kind_of?(Supporter)
103
+ actor.tell "You are on #{the actor.parent}."
104
+ actor.parent.children.that_are_not(actor).each { |s|
105
+ actor.tell "#{A s} is on #{the actor.parent}."
106
+ }
107
+ end
108
+ end
109
+
110
+ interpret "look", "look around"
111
+ interpret "l", "look around"
112
+
113
+ interpret "look at :thing", "look :thing"
114
+ interpret "l :thing", "look :thing"
115
+ interpret "examine :thing", "look :thing"
116
+ interpret "x :thing", "look :thing"
117
+ end