gamefic-standard 3.2.4 → 3.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +7 -0
  3. data/Rakefile +5 -2
  4. data/gamefic-standard.gemspec +13 -11
  5. data/lib/gamefic-standard/actions/attack.rb +23 -19
  6. data/lib/gamefic-standard/actions/close.rb +16 -10
  7. data/lib/gamefic-standard/actions/drop.rb +31 -16
  8. data/lib/gamefic-standard/actions/enter.rb +32 -26
  9. data/lib/gamefic-standard/actions/give.rb +41 -0
  10. data/lib/gamefic-standard/actions/go.rb +47 -43
  11. data/lib/gamefic-standard/actions/insert.rb +42 -28
  12. data/lib/gamefic-standard/actions/inventory.rb +13 -8
  13. data/lib/gamefic-standard/actions/leave.rb +44 -37
  14. data/lib/gamefic-standard/actions/lock.rb +22 -16
  15. data/lib/gamefic-standard/actions/look.rb +123 -104
  16. data/lib/gamefic-standard/actions/move.rb +18 -14
  17. data/lib/gamefic-standard/actions/nil.rb +62 -52
  18. data/lib/gamefic-standard/actions/open.rb +34 -24
  19. data/lib/gamefic-standard/actions/place.rb +35 -20
  20. data/lib/gamefic-standard/actions/pronouns.rb +26 -18
  21. data/lib/gamefic-standard/actions/quit.rb +17 -7
  22. data/lib/gamefic-standard/actions/repeat.rb +17 -9
  23. data/lib/gamefic-standard/actions/save-restore-undo.rb +19 -11
  24. data/lib/gamefic-standard/actions/search.rb +31 -21
  25. data/lib/gamefic-standard/actions/take.rb +47 -34
  26. data/lib/gamefic-standard/actions/talk.rb +45 -31
  27. data/lib/gamefic-standard/actions/unlock.rb +31 -21
  28. data/lib/gamefic-standard/actions/wait.rb +15 -5
  29. data/lib/gamefic-standard/actions.rb +33 -0
  30. data/lib/gamefic-standard/articles.rb +45 -37
  31. data/lib/gamefic-standard/enterable.rb +13 -0
  32. data/lib/gamefic-standard/entities/character.rb +3 -0
  33. data/lib/gamefic-standard/entities/container.rb +2 -2
  34. data/lib/gamefic-standard/entities/door.rb +13 -13
  35. data/lib/gamefic-standard/entities/portal.rb +1 -1
  36. data/lib/gamefic-standard/entities/receptacle.rb +1 -1
  37. data/lib/gamefic-standard/entities/room.rb +20 -5
  38. data/lib/gamefic-standard/entities/supporter.rb +1 -1
  39. data/lib/gamefic-standard/entities/thing.rb +1 -5
  40. data/lib/gamefic-standard/introduction.rb +14 -4
  41. data/lib/gamefic-standard/lockable.rb +36 -0
  42. data/lib/gamefic-standard/openable.rb +33 -0
  43. data/lib/gamefic-standard/pathfinder.rb +75 -55
  44. data/lib/gamefic-standard/standardized.rb +65 -0
  45. data/lib/gamefic-standard/version.rb +1 -1
  46. data/lib/gamefic-standard.rb +10 -3
  47. metadata +36 -13
  48. data/lib/gamefic-standard/give.rb +0 -21
  49. data/lib/gamefic-standard/grammar/attributes.rb +0 -37
  50. data/lib/gamefic-standard/grammar/pronoun.rb +0 -101
  51. data/lib/gamefic-standard/grammar.rb +0 -2
  52. data/lib/gamefic-standard/modules/enterable.rb +0 -9
  53. data/lib/gamefic-standard/modules/lockable.rb +0 -34
  54. data/lib/gamefic-standard/modules/openable.rb +0 -19
  55. data/lib/gamefic-standard/modules/standardized.rb +0 -57
  56. data/lib/gamefic-standard/modules.rb +0 -6
  57. data/spec-opal/spec_helper.rb +0 -32
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 26551eefaf59857782cfe3e3037d201d5445211ff9982308bf3dd4dcb49ce8e0
4
- data.tar.gz: 372052d2f4974d266eeb48a624e6740a1f2d21d49577120f628846ece31e42f6
3
+ metadata.gz: 83db9094673ea86b25db1d51bf9c06c62be6fadc7ed938f39c71b9c16cba9566
4
+ data.tar.gz: 579a371ef1c031b2b7bb2bf9d66831e7ce92ad04d3f7ec450dd183b1265e4f80
5
5
  SHA512:
6
- metadata.gz: 53a2ae91603d9a4fa76f904957da22154f8570d49f4d3367d828c5d0f6e900041b0574575c8aa40fe47feb8e6bbb82a906d210df9b04ce2ee13dd96afadef6c1
7
- data.tar.gz: bb11ebc79930b52e425dfab9ad6c2a145ab5b9054d927610d7ca350387d2344e66f530ef384ce0e23d05c56a3c1b4a4312d9db4480f19a6e8d68464df32b47f5
6
+ metadata.gz: beffd2638efbb5a61fe6f0605a59e7807045aa67705c1cf5a042c28cd279e8efe8b9146690a9e742a9ebc369db035b4ecefcf0b2ea2cdca288b9a68426f253d9
7
+ data.tar.gz: 324c51c2f6eeec341ee26d81449949521f0cb51063f739fa319faf072abd090b18b31c92ed16e2855934cffadb088f98e6ba3a8a4f05b13e66fbc90b43601b15
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## 3.3.0 - October 5, 2024
2
+ - Include Pronoun and Give in Standard
3
+ - Add gamefic-what
4
+ - Standard::Actions namespace
5
+ - Room#connect accepts additional portal attributes
6
+ - Add gamefic-grammar
7
+
1
8
  ## 3.2.4 - September 10, 2024
2
9
  - Include Articles in Standard
3
10
 
data/Rakefile CHANGED
@@ -7,8 +7,11 @@ RSpec::Core::RakeTask.new(:spec)
7
7
  task :default => :spec
8
8
 
9
9
  Opal::RSpec::RakeTask.new(:opal) do |_, config|
10
- Opal.append_path File.expand_path('../lib', __FILE__)
10
+ Opal.append_path File.join(__dir__, 'lib')
11
11
  Opal.use_gem('gamefic')
12
+ Opal.use_gem('gamefic-grammar')
13
+ Opal.use_gem('gamefic-what')
14
+ config.default_path = 'spec'
12
15
  config.pattern = 'spec/**/*_spec.rb'
13
- config.requires = ['spec_helper']
16
+ config.requires = ['opal_helper']
14
17
  end
@@ -1,17 +1,17 @@
1
- lib = File.expand_path("../lib", __FILE__)
1
+ lib = File.expand_path('lib', __dir__)
2
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
3
  require 'gamefic-standard/version'
4
4
 
5
5
  Gem::Specification.new do |spec|
6
- spec.name = "gamefic-standard"
6
+ spec.name = 'gamefic-standard'
7
7
  spec.version = Gamefic::Standard::VERSION
8
- spec.authors = ["Fred Snyder"]
9
- spec.email = ["fsnyder@castwide.com"]
8
+ spec.authors = ['Fred Snyder']
9
+ spec.email = ['fsnyder@castwide.com']
10
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"
11
+ spec.summary = 'The Gamefic standard script library.'
12
+ spec.description = 'A collection of components for building games and interactive fiction in Gamefic.'
13
+ spec.homepage = 'https://gamefic.com'
14
+ spec.license = 'MIT'
15
15
 
16
16
  # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
17
17
  # to allow pushing to a single host or delete this section to allow pushing to any host.
@@ -28,16 +28,18 @@ Gem::Specification.new do |spec|
28
28
 
29
29
  # Specify which files should be added to the gem when it is released.
30
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
31
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
32
32
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
33
33
  end
34
- spec.bindir = "exe"
34
+ spec.bindir = 'exe'
35
35
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
36
- spec.require_paths = ["lib"]
36
+ spec.require_paths = ['lib']
37
37
 
38
38
  spec.required_ruby_version = '>= 2.7.0'
39
39
 
40
40
  spec.add_dependency 'gamefic', '~> 3.3'
41
+ spec.add_dependency 'gamefic-grammar', '~> 1.0'
42
+ spec.add_dependency 'gamefic-what', '~> 1.0'
41
43
 
42
44
  spec.add_development_dependency 'opal', '~> 1.7'
43
45
  spec.add_development_dependency 'opal-rspec', '~> 1.0'
@@ -2,27 +2,31 @@
2
2
 
3
3
  module Gamefic
4
4
  module Standard
5
- script do
6
- respond :attack do |actor, thing|
7
- actor.tell "Violence is not the answer here."
8
- end
5
+ module Actions
6
+ module Attack
7
+ extend Gamefic::Scriptable
9
8
 
10
- respond :attack, Thing do |actor, _thing|
11
- actor.execute :attack
12
- end
9
+ respond :attack do |actor|
10
+ actor.tell 'Violence is not the answer here.'
11
+ end
13
12
 
14
- interpret 'fight', 'attack'
15
- interpret 'battle', 'attack'
16
- interpret 'kill', 'attack'
17
- interpret 'punch', 'attack'
18
- interpret 'kick', 'attack'
19
- interpret 'hit', 'attack'
20
- interpret 'fight :thing', 'attack :thing'
21
- interpret 'battle :thing', 'attack :thing'
22
- interpret 'kill :thing', 'attack :thing'
23
- interpret 'punch :thing', 'attack :thing'
24
- interpret 'kick :thing', 'attack :thing'
25
- interpret 'hit :thing', 'attack :thing'
13
+ respond :attack, Thing do |actor, _thing|
14
+ actor.execute :attack
15
+ end
16
+
17
+ interpret 'fight', 'attack'
18
+ interpret 'battle', 'attack'
19
+ interpret 'kill', 'attack'
20
+ interpret 'punch', 'attack'
21
+ interpret 'kick', 'attack'
22
+ interpret 'hit', 'attack'
23
+ interpret 'fight :thing', 'attack :thing'
24
+ interpret 'battle :thing', 'attack :thing'
25
+ interpret 'kill :thing', 'attack :thing'
26
+ interpret 'punch :thing', 'attack :thing'
27
+ interpret 'kick :thing', 'attack :thing'
28
+ interpret 'hit :thing', 'attack :thing'
29
+ end
26
30
  end
27
31
  end
28
32
  end
@@ -1,16 +1,22 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Gamefic
2
4
  module Standard
3
- script do
4
- respond :close, available do |actor, thing|
5
- actor.tell "You can't close #{the thing}."
6
- end
5
+ module Actions
6
+ module Close
7
+ extend Gamefic::Scriptable
8
+
9
+ respond :close, available do |actor, thing|
10
+ actor.tell "You can't close #{the thing}."
11
+ end
7
12
 
8
- respond :close, available(Openable) do |actor, thing|
9
- if thing.open?
10
- actor.tell "You close #{the thing}."
11
- thing.open = false
12
- else
13
- actor.tell "#{The thing} is already closed."
13
+ respond :close, available(Openable) do |actor, thing|
14
+ if thing.open?
15
+ actor.tell "You close #{the thing}."
16
+ thing.open = false
17
+ else
18
+ actor.tell "#{The thing} is already closed."
19
+ end
14
20
  end
15
21
  end
16
22
  end
@@ -1,24 +1,39 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Gamefic
2
4
  module Standard
3
- script do
4
- respond :drop, available do |actor, thing|
5
- actor.tell "You're not carrying #{the thing}."
6
- end
5
+ module Actions
6
+ module Drop
7
+ extend Gamefic::Scriptable
7
8
 
8
- respond :drop, children do |actor, thing|
9
- actor.execute :take, thing
10
- next unless thing.parent == actor
11
- thing.parent = actor.parent
12
- actor.tell "You drop #{the thing}."
13
- end
9
+ respond :drop, available do |actor, thing|
10
+ actor.tell "You're not carrying #{the thing}."
11
+ end
14
12
 
15
- respond :drop, children do |actor, thing|
16
- thing.parent = actor.parent
17
- actor.tell "You drop #{the thing}."
18
- end
13
+ respond :drop, children do |actor, thing|
14
+ actor.execute :take, thing
15
+ next unless thing.parent == actor
19
16
 
20
- interpret "put down :thing", "drop :thing"
21
- interpret "put :thing down", "drop :thing"
17
+ thing.parent = actor.parent
18
+ actor.tell "You drop #{the thing}."
19
+ end
20
+
21
+ respond :drop, children do |actor, thing|
22
+ thing.parent = actor.parent
23
+ actor.tell "You drop #{the thing}."
24
+ end
25
+
26
+ respond :drop, plaintext(/^(all|everything)$/) do |actor, _all|
27
+ if actor.children.empty?
28
+ actor.tell "You're not carrying anything."
29
+ else
30
+ actor.children.each { |item| actor.execute :drop, item }
31
+ end
32
+ end
33
+
34
+ interpret 'put down :thing', 'drop :thing'
35
+ interpret 'put :thing down', 'drop :thing'
36
+ end
22
37
  end
23
38
  end
24
39
  end
@@ -1,36 +1,42 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Gamefic
2
4
  module Standard
3
- script do
4
- respond :enter, siblings do |actor, thing|
5
- actor.tell "#{The thing} can't accommodate you."
6
- end
5
+ module Actions
6
+ module Enter
7
+ extend Gamefic::Scriptable
7
8
 
8
- respond :enter, siblings(Enterable, proc(&:enterable?)) do |actor, supporter|
9
- actor.parent = supporter
10
- actor.tell "You get in #{the supporter}."
11
- end
9
+ respond :enter, siblings do |actor, thing|
10
+ actor.tell "#{The thing} can't accommodate you."
11
+ end
12
12
 
13
- respond :enter, parent do |actor, container|
14
- actor.tell "You're already in #{the container}."
15
- end
13
+ respond :enter, siblings(Enterable, proc(&:enterable?)) do |actor, supporter|
14
+ actor.parent = supporter
15
+ actor.tell "You get in #{the supporter}."
16
+ end
16
17
 
17
- respond :enter, parent(Supporter) do |actor, supporter|
18
- actor.tell "You're inside #{the supporter} already."
19
- end
18
+ respond :enter, parent do |actor, container|
19
+ actor.tell "You're already in #{the container}."
20
+ end
20
21
 
21
- respond :enter, siblings(Container, proc(&:enterable?), proc(&:closed?)) do |actor, container|
22
- actor.tell "#{The container} is closed."
23
- end
22
+ respond :enter, parent(Supporter) do |actor, supporter|
23
+ actor.tell "You're inside #{the supporter} already."
24
+ end
24
25
 
25
- interpret "get on :thing", "enter :thing"
26
- interpret "get in :thing", "enter :thing"
27
- interpret "get inside :thing", "enter :thing"
28
- interpret "sit on :thing", "enter :thing"
29
- interpret "sit in :thing", "enter :thing"
30
- interpret "lie on :thing", "enter :thing"
31
- interpret "lie in :thing", "enter :thing"
32
- interpret "stand on :thing", "enter :thing"
33
- interpret "stand in :thing", "enter :thing"
26
+ respond :enter, siblings(Container, proc(&:enterable?), proc(&:closed?)) do |actor, container|
27
+ actor.tell "#{The container} is closed."
28
+ end
29
+
30
+ interpret 'get on :thing', 'enter :thing'
31
+ interpret 'get in :thing', 'enter :thing'
32
+ interpret 'get inside :thing', 'enter :thing'
33
+ interpret 'sit on :thing', 'enter :thing'
34
+ interpret 'sit in :thing', 'enter :thing'
35
+ interpret 'lie on :thing', 'enter :thing'
36
+ interpret 'lie in :thing', 'enter :thing'
37
+ interpret 'stand on :thing', 'enter :thing'
38
+ interpret 'stand in :thing', 'enter :thing'
39
+ end
34
40
  end
35
41
  end
36
42
  end
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Gamefic
4
+ module Standard
5
+ module Actions
6
+ module Give
7
+ extend Gamefic::Scriptable
8
+
9
+ include Gamefic::What
10
+
11
+ script do
12
+ respond :give, available, children do |actor, _character, _gift|
13
+ actor.tell 'Nothing happens.'
14
+ end
15
+
16
+ respond :give, available(Character), available do |actor, character, gift|
17
+ actor.tell "#{The character} has no use for #{the gift}."
18
+ end
19
+
20
+ respond :give, available(Character), available do |actor, _character, gift|
21
+ actor.execute :take, gift if gift.parent != actor
22
+
23
+ actor.proceed if gift.parent == actor
24
+ end
25
+
26
+ respond :give, Thing do |actor, thing|
27
+ actor.tell "Who do you want to give #{the thing} to?"
28
+ actor.ask_for_what "give #{thing} to __what__"
29
+ end
30
+
31
+ respond :give, Character do |actor, character|
32
+ actor.tell "What do you want to give to #{the character}?"
33
+ actor.ask_for_what "give __what__ to #{character}"
34
+ end
35
+
36
+ interpret 'give :gift to :character', 'give :character :gift'
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
@@ -1,59 +1,63 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Gamefic
2
4
  module Standard
3
- script do
4
- respond :go, siblings(Portal) do |actor, portal|
5
- if portal.destination.nil?
6
- actor.tell "That portal leads nowhere."
7
- else
8
- actor.parent = portal.destination
9
- if !portal.direction.nil?
10
- actor.tell "You go #{portal.direction}."
5
+ module Actions
6
+ module Go
7
+ extend Gamefic::Scriptable
8
+
9
+ respond :go, siblings(Portal) do |actor, portal|
10
+ if portal.destination.nil?
11
+ actor.tell 'That portal leads nowhere.'
12
+ else
13
+ actor.parent = portal.destination
14
+ actor.tell "You go #{portal.direction}." unless portal.direction.nil?
15
+ actor.execute :look
11
16
  end
12
- actor.execute :look
13
17
  end
14
- end
15
18
 
16
- respond :go, plaintext do |actor, text|
17
- if actor.parent == actor.room
18
- actor.tell "I don't see any way to go \"#{text}\" from here."
19
- else
20
- actor.execute :leave
19
+ respond :go, plaintext do |actor, text|
21
20
  if actor.parent == actor.room
22
- actor.perform "go #{text}"
21
+ actor.tell "I don't see any way to go \"#{text}\" from here."
23
22
  else
24
- actor.proceed
23
+ actor.execute :leave
24
+ if actor.parent == actor.room
25
+ actor.perform "go #{text}"
26
+ else
27
+ actor.proceed
28
+ end
25
29
  end
26
30
  end
27
- end
28
31
 
29
- respond :go, available(Door) do |actor, door|
30
- actor.execute :open, door unless door.open?
31
- actor.proceed if door.open?
32
- end
32
+ respond :go, available(Door) do |actor, door|
33
+ actor.execute :open, door unless door.open?
34
+ actor.proceed if door.open?
35
+ end
33
36
 
34
- interpret "north", "go north"
35
- interpret "south", "go south"
36
- interpret "west", "go west"
37
- interpret "east", "go east"
38
- interpret "up", "go up"
39
- interpret "down", "go down"
40
- interpret "northwest", "go northwest"
41
- interpret "northeast", "go northeast"
42
- interpret "southwest", "go southwest"
43
- interpret "southeast", "go southeast"
37
+ interpret 'north', 'go north'
38
+ interpret 'south', 'go south'
39
+ interpret 'west', 'go west'
40
+ interpret 'east', 'go east'
41
+ interpret 'up', 'go up'
42
+ interpret 'down', 'go down'
43
+ interpret 'northwest', 'go northwest'
44
+ interpret 'northeast', 'go northeast'
45
+ interpret 'southwest', 'go southwest'
46
+ interpret 'southeast', 'go southeast'
44
47
 
45
- interpret "n", "go north"
46
- interpret "s", "go south"
47
- interpret "w", "go west"
48
- interpret "e", "go east"
49
- interpret "u", "go up"
50
- interpret "d", "go down"
51
- interpret "nw", "go northwest"
52
- interpret "ne", "go northeast"
53
- interpret "sw", "go southwest"
54
- interpret "se", "go southeast"
48
+ interpret 'n', 'go north'
49
+ interpret 's', 'go south'
50
+ interpret 'w', 'go west'
51
+ interpret 'e', 'go east'
52
+ interpret 'u', 'go up'
53
+ interpret 'd', 'go down'
54
+ interpret 'nw', 'go northwest'
55
+ interpret 'ne', 'go northeast'
56
+ interpret 'sw', 'go southwest'
57
+ interpret 'se', 'go southeast'
55
58
 
56
- interpret "go to :place", "go :place"
59
+ interpret 'go to :place', 'go :place'
60
+ end
57
61
  end
58
62
  end
59
63
  end
@@ -1,39 +1,53 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Gamefic
2
4
  module Standard
3
- script do
4
- respond :insert, available, available do |actor, thing, target|
5
- actor.tell "You can't put #{the thing} inside #{the target}."
6
- end
5
+ module Actions
6
+ module Insert
7
+ extend Gamefic::Scriptable
7
8
 
8
- respond :insert, available, available(Receptacle) do |actor, thing, receptacle|
9
- actor.execute :take, thing unless thing.parent == actor
10
- next unless thing.parent == actor
11
- thing.parent = receptacle
12
- actor.tell "You put #{the thing} in #{the receptacle}."
13
- end
9
+ respond :insert, available, available do |actor, thing, target|
10
+ actor.tell "You can't put #{the thing} inside #{the target}."
11
+ end
12
+
13
+ respond :insert, available, available(Receptacle) do |actor, thing, receptacle|
14
+ actor.execute :take, thing unless thing.parent == actor
15
+ next unless thing.parent == actor
14
16
 
15
- respond :insert, available, available(Container) do |actor, _thing, container|
16
- if container.open?
17
- actor.proceed
18
- else
19
- actor.tell "#{The container} is closed."
17
+ thing.parent = receptacle
18
+ actor.tell "You put #{the thing} in #{the receptacle}."
20
19
  end
21
- end
22
20
 
23
- interpret "drop :item in :container", "insert :item :container"
24
- interpret "put :item in :container", "insert :item :container"
25
- interpret "place :item in :container", "insert :item :container"
26
- interpret "insert :item in :container", "insert :item :container"
21
+ respond :insert, available, available(Container) do |actor, _thing, container|
22
+ if container.open?
23
+ actor.proceed
24
+ else
25
+ actor.tell "#{The container} is closed."
26
+ end
27
+ end
28
+
29
+ respond :insert, children, room do |actor, thing|
30
+ actor.execute :drop, thing
31
+ end
27
32
 
28
- interpret "drop :item inside :container", "insert :item :container"
29
- interpret "put :item inside :container", "insert :item :container"
30
- interpret "place :item inside :container", "insert :item :container"
31
- interpret "insert :item inside :container", "insert :item :container"
33
+ interpret 'drop :item in :container', 'insert :item :container'
34
+ interpret 'put :item in :container', 'insert :item :container'
35
+ interpret 'place :item in :container', 'insert :item :container'
36
+ interpret 'set :item in :container', 'insert :item :container'
37
+ interpret 'insert :item in :container', 'insert :item :container'
32
38
 
33
- interpret "drop :item into :container", "insert :item :container"
34
- interpret "put :item into :container", "insert :item :container"
35
- interpret "place :item into :container", "insert :item :container"
36
- interpret "insert :item into :container", "insert :item :container"
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 'set :item inside :container', 'insert :item :container'
43
+ interpret 'insert :item inside :container', 'insert :item :container'
44
+
45
+ interpret 'drop :item into :container', 'insert :item :container'
46
+ interpret 'put :item into :container', 'insert :item :container'
47
+ interpret 'place :item into :container', 'insert :item :container'
48
+ interpret 'set :item into :container', 'insert :item :container'
49
+ interpret 'insert :item into :container', 'insert :item :container'
50
+ end
37
51
  end
38
52
  end
39
53
  end
@@ -1,15 +1,20 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Gamefic
2
4
  module Standard
3
- script do
4
- respond :inventory do |actor|
5
- if actor.children.length > 0
6
- actor.tell "You are carrying #{actor.children.join_and}."
7
- else
8
- actor.tell "You aren't carrying anything."
5
+ module Actions
6
+ module Inventory
7
+ extend Gamefic::Scriptable
8
+
9
+ respond :inventory do |actor|
10
+ if actor.children.length > 0
11
+ actor.tell "You are carrying #{actor.children.join_and}."
12
+ else
13
+ actor.tell "You aren't carrying anything."
14
+ end
9
15
  end
16
+ interpret 'i', 'inventory'
10
17
  end
11
-
12
- interpret "i", "inventory"
13
18
  end
14
19
  end
15
20
  end