gamefic-standard 3.2.4 → 3.3.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/Rakefile +5 -2
- data/gamefic-standard.gemspec +13 -11
- data/lib/gamefic-standard/actions/attack.rb +23 -19
- data/lib/gamefic-standard/actions/close.rb +16 -10
- data/lib/gamefic-standard/actions/drop.rb +31 -16
- data/lib/gamefic-standard/actions/enter.rb +32 -26
- data/lib/gamefic-standard/actions/give.rb +41 -0
- data/lib/gamefic-standard/actions/go.rb +47 -43
- data/lib/gamefic-standard/actions/insert.rb +42 -28
- data/lib/gamefic-standard/actions/inventory.rb +13 -8
- data/lib/gamefic-standard/actions/leave.rb +44 -37
- data/lib/gamefic-standard/actions/lock.rb +22 -16
- data/lib/gamefic-standard/actions/look.rb +123 -104
- data/lib/gamefic-standard/actions/move.rb +18 -14
- data/lib/gamefic-standard/actions/nil.rb +62 -52
- data/lib/gamefic-standard/actions/open.rb +34 -24
- data/lib/gamefic-standard/actions/place.rb +35 -20
- data/lib/gamefic-standard/actions/pronouns.rb +26 -18
- data/lib/gamefic-standard/actions/quit.rb +17 -7
- data/lib/gamefic-standard/actions/repeat.rb +17 -9
- data/lib/gamefic-standard/actions/save-restore-undo.rb +19 -11
- data/lib/gamefic-standard/actions/search.rb +31 -21
- data/lib/gamefic-standard/actions/take.rb +47 -34
- data/lib/gamefic-standard/actions/talk.rb +45 -31
- data/lib/gamefic-standard/actions/unlock.rb +31 -21
- data/lib/gamefic-standard/actions/wait.rb +15 -5
- data/lib/gamefic-standard/actions.rb +33 -0
- data/lib/gamefic-standard/articles.rb +45 -37
- data/lib/gamefic-standard/enterable.rb +13 -0
- data/lib/gamefic-standard/entities/character.rb +3 -0
- data/lib/gamefic-standard/entities/container.rb +2 -2
- data/lib/gamefic-standard/entities/door.rb +13 -13
- data/lib/gamefic-standard/entities/portal.rb +1 -1
- data/lib/gamefic-standard/entities/receptacle.rb +1 -1
- data/lib/gamefic-standard/entities/room.rb +20 -5
- data/lib/gamefic-standard/entities/supporter.rb +1 -1
- data/lib/gamefic-standard/entities/thing.rb +1 -5
- data/lib/gamefic-standard/introduction.rb +14 -4
- data/lib/gamefic-standard/lockable.rb +36 -0
- data/lib/gamefic-standard/openable.rb +33 -0
- data/lib/gamefic-standard/pathfinder.rb +75 -55
- data/lib/gamefic-standard/standardized.rb +65 -0
- data/lib/gamefic-standard/version.rb +1 -1
- data/lib/gamefic-standard.rb +10 -3
- metadata +36 -13
- data/lib/gamefic-standard/give.rb +0 -21
- data/lib/gamefic-standard/grammar/attributes.rb +0 -37
- data/lib/gamefic-standard/grammar/pronoun.rb +0 -101
- data/lib/gamefic-standard/grammar.rb +0 -2
- data/lib/gamefic-standard/modules/enterable.rb +0 -9
- data/lib/gamefic-standard/modules/lockable.rb +0 -34
- data/lib/gamefic-standard/modules/openable.rb +0 -19
- data/lib/gamefic-standard/modules/standardized.rb +0 -57
- data/lib/gamefic-standard/modules.rb +0 -6
- data/spec-opal/spec_helper.rb +0 -32
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 83db9094673ea86b25db1d51bf9c06c62be6fadc7ed938f39c71b9c16cba9566
|
|
4
|
+
data.tar.gz: 579a371ef1c031b2b7bb2bf9d66831e7ce92ad04d3f7ec450dd183b1265e4f80
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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.
|
|
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 = ['
|
|
16
|
+
config.requires = ['opal_helper']
|
|
14
17
|
end
|
data/gamefic-standard.gemspec
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
lib = File.expand_path(
|
|
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 =
|
|
6
|
+
spec.name = 'gamefic-standard'
|
|
7
7
|
spec.version = Gamefic::Standard::VERSION
|
|
8
|
-
spec.authors = [
|
|
9
|
-
spec.email = [
|
|
8
|
+
spec.authors = ['Fred Snyder']
|
|
9
|
+
spec.email = ['fsnyder@castwide.com']
|
|
10
10
|
|
|
11
|
-
spec.summary =
|
|
12
|
-
spec.description =
|
|
13
|
-
spec.homepage =
|
|
14
|
-
spec.license =
|
|
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(
|
|
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 =
|
|
34
|
+
spec.bindir = 'exe'
|
|
35
35
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
36
|
-
spec.require_paths = [
|
|
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
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
end
|
|
5
|
+
module Actions
|
|
6
|
+
module Attack
|
|
7
|
+
extend Gamefic::Scriptable
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
respond :attack do |actor|
|
|
10
|
+
actor.tell 'Violence is not the answer here.'
|
|
11
|
+
end
|
|
13
12
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
end
|
|
5
|
+
module Actions
|
|
6
|
+
module Drop
|
|
7
|
+
extend Gamefic::Scriptable
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
end
|
|
13
|
+
respond :drop, children do |actor, thing|
|
|
14
|
+
actor.execute :take, thing
|
|
15
|
+
next unless thing.parent == actor
|
|
19
16
|
|
|
20
|
-
|
|
21
|
-
|
|
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
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
end
|
|
5
|
+
module Actions
|
|
6
|
+
module Enter
|
|
7
|
+
extend Gamefic::Scriptable
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
end
|
|
9
|
+
respond :enter, siblings do |actor, thing|
|
|
10
|
+
actor.tell "#{The thing} can't accommodate you."
|
|
11
|
+
end
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
-
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
respond :enter, parent do |actor, container|
|
|
19
|
+
actor.tell "You're already in #{the container}."
|
|
20
|
+
end
|
|
20
21
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
respond :enter, parent(Supporter) do |actor, supporter|
|
|
23
|
+
actor.tell "You're inside #{the supporter} already."
|
|
24
|
+
end
|
|
24
25
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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
|
-
|
|
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.
|
|
21
|
+
actor.tell "I don't see any way to go \"#{text}\" from here."
|
|
23
22
|
else
|
|
24
|
-
actor.
|
|
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
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
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
|
-
|
|
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
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
end
|
|
5
|
+
module Actions
|
|
6
|
+
module Insert
|
|
7
|
+
extend Gamefic::Scriptable
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
-
|
|
16
|
-
|
|
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
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
actor.
|
|
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
|