gamefic-sdk 1.6.0 → 1.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/html/core/engine.js +89 -20
- data/html/sinatra/engine.js +27 -13
- data/html/skins/hypertext/index.html +0 -2
- data/html/skins/standard/play.js +0 -66
- data/lib/gamefic-sdk.rb +2 -1
- data/lib/gamefic-sdk/build.rb +11 -19
- data/lib/gamefic-sdk/config.rb +126 -0
- data/lib/gamefic-sdk/platform.rb +12 -0
- data/lib/gamefic-sdk/platform/base.rb +35 -33
- data/lib/gamefic-sdk/platform/gfic.rb +5 -18
- data/lib/gamefic-sdk/platform/sinatra.rb +29 -31
- data/lib/gamefic-sdk/platform/web.rb +72 -65
- data/lib/gamefic-sdk/platform/web/app_config.rb +48 -48
- data/lib/gamefic-sdk/platform/web/engine.rb +10 -7
- data/lib/gamefic-sdk/platform/web/user.rb +3 -3
- data/lib/gamefic-sdk/server.rb +17 -19
- data/lib/gamefic-sdk/shell.rb +68 -16
- data/lib/gamefic-sdk/shell/init.rb +3 -19
- data/lib/gamefic-sdk/shell/test.rb +9 -14
- data/lib/gamefic-sdk/version.rb +1 -1
- data/scripts/save-restore-undo.plot.rb +25 -0
- data/scripts/snapshots.plot.rb +16 -14
- data/scripts/standard.plot.rb +3 -5
- data/scripts/standard/actions.plot.rb +1 -11
- data/scripts/standard/actions/drop.plot.rb +1 -1
- data/scripts/standard/actions/enter.plot.rb +4 -16
- data/scripts/standard/actions/go.plot.rb +2 -36
- data/scripts/standard/actions/insert.plot.rb +7 -21
- data/scripts/standard/actions/inventory.plot.rb +2 -1
- data/scripts/standard/actions/leave.plot.rb +7 -18
- data/scripts/standard/actions/look.plot.rb +45 -44
- data/scripts/standard/actions/nil.plot.rb +1 -1
- data/scripts/standard/actions/take.plot.rb +10 -28
- data/scripts/standard/actions/talk.plot.rb +9 -13
- data/scripts/standard/clothing.plot.rb +4 -0
- data/scripts/standard/clothing/actions.plot.rb +4 -0
- data/scripts/{clothing → standard/clothing}/actions/doff.plot.rb +0 -0
- data/scripts/{clothing → standard/clothing}/actions/drop.plot.rb +8 -8
- data/scripts/{clothing → standard/clothing}/actions/inventory.plot.rb +14 -14
- data/scripts/standard/clothing/actions/wear.plot.rb +20 -0
- data/scripts/standard/clothing/entities.plot.rb +7 -0
- data/scripts/{clothing → standard/clothing}/entities/clothing.plot.rb +0 -2
- data/scripts/standard/clothing/entities/coat.plot.rb +3 -0
- data/scripts/standard/clothing/entities/gloves.plot.rb +3 -0
- data/scripts/standard/clothing/entities/hat.plot.rb +3 -0
- data/scripts/standard/clothing/entities/pants.plot.rb +3 -0
- data/scripts/standard/clothing/entities/shirt.plot.rb +3 -0
- data/scripts/standard/clothing/entities/shoes.plot.rb +3 -0
- data/scripts/standard/container.plot.rb +28 -0
- data/scripts/{debug.plot.rb → standard/container/actions.plot.rb} +0 -0
- data/scripts/standard/container/entities.plot.rb +5 -0
- data/scripts/standard/direction.plot.rb +1 -2
- data/scripts/{edible.plot.rb → standard/edible.plot.rb} +5 -3
- data/scripts/standard/entities.plot.rb +3 -3
- data/scripts/standard/entities/character.plot.rb +9 -6
- data/scripts/standard/entities/fixture.plot.rb +1 -1
- data/scripts/standard/entities/item.plot.rb +2 -4
- data/scripts/standard/entities/portal.plot.rb +9 -5
- data/scripts/standard/entities/receptacle.plot.rb +1 -1
- data/scripts/standard/entities/room.plot.rb +5 -5
- data/scripts/standard/entities/scenery.plot.rb +2 -4
- data/scripts/standard/entities/supporter.plot.rb +4 -7
- data/scripts/standard/entities/thing.plot.rb +7 -0
- data/scripts/standard/{actions/give.plot.rb → give.plot.rb} +27 -25
- data/scripts/standard/lockable.plot.rb +79 -0
- data/scripts/standard/modules.plot.rb +2 -4
- data/scripts/standard/modules/attachable.plot.rb +1 -0
- data/scripts/standard/modules/locale_description.plot.rb +20 -0
- data/scripts/standard/{use.plot.rb → modules/use.plot.rb} +51 -47
- data/scripts/standard/openable.plot.rb +43 -0
- data/scripts/standard/pathfinder.plot.rb +11 -6
- data/scripts/standard/test.plot.rb +2 -0
- data/scripts/undo.plot.rb +13 -11
- metadata +30 -65
- data/lib/gamefic-sdk/plot_config.rb +0 -25
- data/scripts/ansi.plot.rb +0 -13
- data/scripts/autosuggest.plot.rb +0 -165
- data/scripts/clothing.plot.rb +0 -2
- data/scripts/clothing/actions.plot.rb +0 -4
- data/scripts/clothing/actions/wear.plot.rb +0 -19
- data/scripts/clothing/entities.plot.rb +0 -7
- data/scripts/clothing/entities/coat.plot.rb +0 -5
- data/scripts/clothing/entities/gloves.plot.rb +0 -5
- data/scripts/clothing/entities/hat.plot.rb +0 -5
- data/scripts/clothing/entities/pants.plot.rb +0 -5
- data/scripts/clothing/entities/shirt.plot.rb +0 -5
- data/scripts/clothing/entities/shoes.plot.rb +0 -5
- data/scripts/cover.plot.rb +0 -30
- data/scripts/furniture.plot.rb +0 -35
- data/scripts/hints.plot.rb +0 -31
- data/scripts/hypertext.plot.rb +0 -280
- data/scripts/media.plot.rb +0 -17
- data/scripts/multimedia.plot.rb +0 -41
- data/scripts/questions.plot.rb +0 -17
- data/scripts/room-modes.plot.rb +0 -48
- data/scripts/rough-sizes.plot.rb +0 -36
- data/scripts/save-restore.plot.rb +0 -22
- data/scripts/standard/actions/close.plot.rb +0 -16
- data/scripts/standard/actions/lock.plot.rb +0 -59
- data/scripts/standard/actions/look-under.plot.rb +0 -8
- data/scripts/standard/actions/open.plot.rb +0 -34
- data/scripts/standard/actions/read.plot.rb +0 -3
- data/scripts/standard/actions/search.plot.rb +0 -40
- data/scripts/standard/actions/show.plot.rb +0 -13
- data/scripts/standard/actions/unlock.plot.rb +0 -77
- data/scripts/standard/actions/use.plot.rb +0 -25
- data/scripts/standard/entities/container.plot.rb +0 -8
- data/scripts/standard/entities/door.plot.rb +0 -51
- data/scripts/standard/entities/entity.plot.rb +0 -12
- data/scripts/standard/entities/exterior.plot.rb +0 -5
- data/scripts/standard/modules/darkenable.plot.rb +0 -6
- data/scripts/standard/modules/lockable.plot.rb +0 -25
- data/scripts/standard/modules/openable.plot.rb +0 -15
- data/scripts/standard/modules/transparent.plot.rb +0 -6
- data/scripts/standard/plural.plot.rb +0 -2
- data/scripts/standard/plural/actions.plot.rb +0 -4
- data/scripts/standard/plural/actions/drop.plot.rb +0 -126
- data/scripts/standard/plural/actions/insert.plot.rb +0 -60
- data/scripts/standard/plural/actions/place.plot.rb +0 -37
- data/scripts/standard/plural/actions/take.plot.rb +0 -175
- data/scripts/standard/plural/queries.plot.rb +0 -5
- data/scripts/standard/plural/queries/ambiguous_visible.plot.rb +0 -13
- data/scripts/standard/plural/queries/any_expression.plot.rb +0 -17
- data/scripts/standard/plural/queries/many_visible.plot.rb +0 -13
- data/scripts/standard/plural/queries/not_expression.plot.rb +0 -16
- data/scripts/standard/plural/queries/plural_visible.plot.rb +0 -22
- data/scripts/suggestible.plot.rb +0 -54
@@ -1,25 +0,0 @@
|
|
1
|
-
respond :use, Use.family do |actor, tool|
|
2
|
-
actor.tell "I don't know how to use #{the tool}. (A more specific command might work.)"
|
3
|
-
end
|
4
|
-
|
5
|
-
respond :use, Gamefic::Query::Text.new do |actor, thing|
|
6
|
-
actor.tell "#{you.pronoun.Subj} #{you.contract you.verb.do + ' not'} see any '#{thing}' #{you.pronoun.subj} can use here."
|
7
|
-
end
|
8
|
-
|
9
|
-
respond :use, Use.family, Use.family do |actor, tool, object|
|
10
|
-
actor.tell "#{you.contract you.pronoun.Subj + ' ' + you.verb.be} not carrying the #{tool}."
|
11
|
-
end
|
12
|
-
|
13
|
-
respond :use, Gamefic::Query::Children.new, Gamefic::Query::Text.new do |actor, tool, object|
|
14
|
-
actor.tell "#{you.pronoun.Subj} #{you.contract you.verb.do + ' not'} see any '#{object}' here."
|
15
|
-
end
|
16
|
-
|
17
|
-
respond :use, Query::Text.new, Use.family do |actor, tool, object|
|
18
|
-
actor.tell "#{you.pronoun.Subj} #{you.contract you.verb.do + ' not'} have anything called '#{tool}.'"
|
19
|
-
end
|
20
|
-
|
21
|
-
respond :use, Query::Children.new, Use.family do |actor, tool, object|
|
22
|
-
actor.tell "I don't know how to use #{the tool} on #{the object}. (A more specific command might work.)"
|
23
|
-
end
|
24
|
-
|
25
|
-
xlate "use :tool on :object", "use :tool :object"
|
@@ -1,51 +0,0 @@
|
|
1
|
-
script 'standard/entities/portal'
|
2
|
-
|
3
|
-
class Door < Portal
|
4
|
-
include Openable
|
5
|
-
include Lockable
|
6
|
-
|
7
|
-
def post_initialize
|
8
|
-
super
|
9
|
-
if @name.nil? and !@direction.nil?
|
10
|
-
proper_named = false
|
11
|
-
rev = @direction.reverse
|
12
|
-
self.name = "the #{@direction.adjective} door"
|
13
|
-
end
|
14
|
-
end
|
15
|
-
def open=(bool)
|
16
|
-
super
|
17
|
-
rev = find_reverse
|
18
|
-
if !rev.nil? and rev.open? != bool
|
19
|
-
rev.open = bool
|
20
|
-
end
|
21
|
-
end
|
22
|
-
def locked=(bool)
|
23
|
-
super
|
24
|
-
rev = find_reverse
|
25
|
-
if !rev.nil? and rev.locked? != bool
|
26
|
-
rev.locked = bool
|
27
|
-
end
|
28
|
-
end
|
29
|
-
def automatic=(bool)
|
30
|
-
@automatic = bool
|
31
|
-
rev = find_reverse
|
32
|
-
if !rev.nil? and rev.automatic? != bool
|
33
|
-
rev.automatic = bool
|
34
|
-
end
|
35
|
-
end
|
36
|
-
# HACK Even though Door includes Lockable, we need
|
37
|
-
# to add the lock_key definitions here for Opal.
|
38
|
-
def lock_key
|
39
|
-
@lock_key
|
40
|
-
end
|
41
|
-
def lock_key=(entity)
|
42
|
-
@lock_key = entity
|
43
|
-
rev = find_reverse
|
44
|
-
if !rev.nil? and rev.lock_key != entity
|
45
|
-
rev.lock_key = entity
|
46
|
-
end
|
47
|
-
end
|
48
|
-
def automatic?
|
49
|
-
@automatic ||= true
|
50
|
-
end
|
51
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
script 'standard/modules/openable'
|
2
|
-
|
3
|
-
module Lockable
|
4
|
-
include Openable
|
5
|
-
attr_reader :lock_key
|
6
|
-
def locked=(bool)
|
7
|
-
@locked = bool
|
8
|
-
if @locked == true
|
9
|
-
self.open = false
|
10
|
-
end
|
11
|
-
end
|
12
|
-
def open=(bool)
|
13
|
-
@open = bool
|
14
|
-
@locked = false if @open == true
|
15
|
-
end
|
16
|
-
def locked?
|
17
|
-
@locked ||= false
|
18
|
-
end
|
19
|
-
def has_lock_key?
|
20
|
-
!@lock_key.nil?
|
21
|
-
end
|
22
|
-
def lock_key=(entity)
|
23
|
-
@lock_key = entity
|
24
|
-
end
|
25
|
-
end
|
@@ -1,126 +0,0 @@
|
|
1
|
-
respond :drop, Use.many_children do |actor, things|
|
2
|
-
dropped = []
|
3
|
-
things.each { |thing|
|
4
|
-
buffer = actor.quietly :drop, thing
|
5
|
-
if thing.parent == actor
|
6
|
-
actor.tell buffer
|
7
|
-
else
|
8
|
-
dropped.push thing
|
9
|
-
end
|
10
|
-
}
|
11
|
-
if dropped.length > 0
|
12
|
-
actor.tell "#{you.pronoun.Subj} drop #{dropped.join_and}."
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
respond :drop, Use.text("all", "everything") do |actor, text|
|
17
|
-
children = actor.children.that_are_not(:attached?)
|
18
|
-
if children.length == 0
|
19
|
-
actor.tell "#{you.pronoun.Subj} #{you.contract(you.verb.do + ' not')} have anything to drop."
|
20
|
-
else
|
21
|
-
dropped = []
|
22
|
-
children.each { |child|
|
23
|
-
buffer = actor.quietly :drop, child
|
24
|
-
if child.parent != actor
|
25
|
-
dropped.push child
|
26
|
-
else
|
27
|
-
actor.tell buffer
|
28
|
-
end
|
29
|
-
}
|
30
|
-
if dropped.length > 0
|
31
|
-
actor.tell "#{you.pronoun.Subj} drop #{dropped.join_and}."
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
respond :drop, Use.text("all", "everything"), Use.text("but", "except"), Use.children do |actor, text1, text2, exception|
|
37
|
-
children = actor.children.that_are_not(:attached?)
|
38
|
-
if children.length == 0
|
39
|
-
actor.tell "#{you.pronoun.Subj} #{you.contract(you.verb.do + ' not')} have anything to drop."
|
40
|
-
else
|
41
|
-
dropped = []
|
42
|
-
children.each { |child|
|
43
|
-
next if exception == child
|
44
|
-
buffer = actor.quietly :drop, child
|
45
|
-
if child.parent != actor
|
46
|
-
dropped.push child
|
47
|
-
else
|
48
|
-
actor.tell buffer
|
49
|
-
end
|
50
|
-
}
|
51
|
-
if dropped.length > 0
|
52
|
-
actor.tell "#{you.pronoun.Subj} drop #{dropped.join_and}."
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
respond :drop, Use.text("all", "everything"), Use.text("but", "except"), Use.text do |actor, text1, text2, text3|
|
58
|
-
actor.tell "I understand you want to drop #{text1} but don't know what you're trying to exclude with \"#{text3}.\""
|
59
|
-
end
|
60
|
-
|
61
|
-
respond :drop, Use.text("all", "everything"), Use.text("but", "except"), Use.many_children do |actor, text1, text2, exceptions|
|
62
|
-
children = actor.children.that_are_not(:attached?)
|
63
|
-
if children.length == 0
|
64
|
-
actor.tell "#{you.pronoun.Subj} #{you.contract(you.verb.do + ' not')} have anything to drop."
|
65
|
-
else
|
66
|
-
dropped = []
|
67
|
-
children.each { |child|
|
68
|
-
next if exceptions.include?(child)
|
69
|
-
buffer = actor.quietly :drop, child
|
70
|
-
if child.parent != actor
|
71
|
-
dropped.push child
|
72
|
-
else
|
73
|
-
actor.tell buffer
|
74
|
-
end
|
75
|
-
}
|
76
|
-
if dropped.length > 0
|
77
|
-
actor.tell "#{you.pronoun.Subj} drop #{dropped.join_and}."
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
respond :drop, Use.text("all", "everything"), Use.text("but", "except"), Use.plural_children do |actor, text1, text2, exceptions|
|
83
|
-
children = actor.children.that_are_not(:attached?)
|
84
|
-
actor.perform :drop, children - exceptions
|
85
|
-
end
|
86
|
-
|
87
|
-
respond :drop, Use.text("all", "everything"), Use.text("but", "except"), Use.any_expression, Use.ambiguous_children do |actor, text1, text2, text3, exceptions|
|
88
|
-
children = actor.children.that_are_not(:attached?)
|
89
|
-
actor.perform :drop, children - exceptions
|
90
|
-
end
|
91
|
-
|
92
|
-
respond :drop, Use.any_expression, Use.ambiguous_children do |actor, text1, things|
|
93
|
-
filtered = things.clone
|
94
|
-
filtered.delete_if{|t| t.parent != actor}
|
95
|
-
if filtered.length == 0
|
96
|
-
actor.tell "#{you.pronoun.Subj} #{you.contract(you.verb.be + ' not')} carrying anything that matches your terms."
|
97
|
-
else
|
98
|
-
dropped = []
|
99
|
-
things.each { |thing|
|
100
|
-
if thing.parent == actor
|
101
|
-
buffer = actor.quietly :drop, thing
|
102
|
-
if thing.parent == actor
|
103
|
-
actor.tell buffer
|
104
|
-
else
|
105
|
-
dropped.push thing
|
106
|
-
end
|
107
|
-
end
|
108
|
-
}
|
109
|
-
if dropped.length > 0
|
110
|
-
actor.tell "#{you.pronoun.Subj} #{you.verb.drop} #{dropped.join_and}."
|
111
|
-
end
|
112
|
-
end
|
113
|
-
end
|
114
|
-
|
115
|
-
respond :drop, Use.any_expression, Use.ambiguous_children, Use.text("except", "but"), Use.any_expression, Use.ambiguous_children do |actor, _, things, _, _, exceptions|
|
116
|
-
actor.perform :drop, things - exceptions
|
117
|
-
end
|
118
|
-
|
119
|
-
respond :drop, Use.not_expression, Use.ambiguous_children do |actor, _, exceptions|
|
120
|
-
children = actor.children
|
121
|
-
actor.perform :drop, children - exceptions
|
122
|
-
end
|
123
|
-
|
124
|
-
respond :drop, Use.plural_children do |actor, things|
|
125
|
-
actor.perform "drop #{things.join(' and ')}"
|
126
|
-
end
|
@@ -1,60 +0,0 @@
|
|
1
|
-
respond :insert, Use.text("all", "everything"), Use.reachable(Receptacle) do |actor, text, receptacle|
|
2
|
-
children = actor.children.that_are_not(:attached?)
|
3
|
-
if children.length == 0
|
4
|
-
actor.tell "#{you.pronoun.Subj} #{you.contract you.verb.be + ' not'} carrying anything to put in #{the receptacle}."
|
5
|
-
else
|
6
|
-
inserted = []
|
7
|
-
children.each { |child|
|
8
|
-
buffer = actor.quietly :insert, child, receptacle
|
9
|
-
if child.parent != receptacle
|
10
|
-
actor.tell buffer
|
11
|
-
else
|
12
|
-
inserted.push child
|
13
|
-
end
|
14
|
-
}
|
15
|
-
if inserted.length > 0
|
16
|
-
actor.tell "#{you.pronoun.Subj} put #{inserted.join_and} in #{the receptacle}."
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
respond :insert, Use.many_children, Use.reachable(Receptacle) do |actor, children, receptacle|
|
22
|
-
inserted = []
|
23
|
-
children.each { |child|
|
24
|
-
buffer = actor.quietly :insert, child, receptacle
|
25
|
-
if child.parent != receptacle
|
26
|
-
actor.tell buffer
|
27
|
-
else
|
28
|
-
inserted.push child
|
29
|
-
end
|
30
|
-
}
|
31
|
-
if inserted.length > 0
|
32
|
-
actor.tell "#{you.pronoun.Subj} put #{inserted.join_and} in #{the receptacle}."
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
respond :insert, Use.many_children, Use.reachable(Container) do |actor, children, container|
|
37
|
-
if container.open?
|
38
|
-
actor.proceed
|
39
|
-
else
|
40
|
-
actor.tell "#{The container} is closed."
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
respond :insert, Use.any_expression, Use.ambiguous_children, Use.reachable(Receptacle) do |actor, _, children, receptacle|
|
45
|
-
actor.perform :insert, children, receptacle
|
46
|
-
end
|
47
|
-
|
48
|
-
respond :insert, Use.text("everything", "all"), Use.text("except", "but"), Use.ambiguous_children, Use.reachable(Receptacle) do |actor, _, _, exceptions, receptacle|
|
49
|
-
children = Use.children.context_from(actor).that_are_not(:attached?)
|
50
|
-
actor.perform :insert, children - exceptions, receptacle
|
51
|
-
end
|
52
|
-
|
53
|
-
respond :insert, Use.not_expression, Use.ambiguous_children, Use.reachable(Receptacle) do |actor, _, exceptions, receptacle|
|
54
|
-
children = Use.children.context_from(actor).that_are_not(:attached?)
|
55
|
-
actor.perform :insert, children - exceptions, receptacle
|
56
|
-
end
|
57
|
-
|
58
|
-
respond :insert, Use.plural_children, Use.reachable(Receptacle) do |actor, children, receptacle|
|
59
|
-
actor.perform :insert, children, receptacle
|
60
|
-
end
|
@@ -1,37 +0,0 @@
|
|
1
|
-
respond :place, Use.many_children, Use.reachable(Supporter) do |actor, children, supporter|
|
2
|
-
placed = []
|
3
|
-
children.each { |child|
|
4
|
-
buffer = actor.quietly :place, child, supporter
|
5
|
-
if child.parent != supporter
|
6
|
-
actor.tell buffer
|
7
|
-
else
|
8
|
-
placed.push child
|
9
|
-
end
|
10
|
-
}
|
11
|
-
if placed.length > 0
|
12
|
-
actor.tell "You put #{placed.join_and} on #{the supporter}."
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
respond :place, Use.any_expression, Use.ambiguous_children, Use.reachable(Supporter) do |actor, _, children, supporter|
|
17
|
-
actor.perform :place, children, supporter
|
18
|
-
end
|
19
|
-
|
20
|
-
respond :place, Use.text(/(all|everything)/), Use.reachable(Supporter) do |actor, _, supporter|
|
21
|
-
children = Use.children.context_from(actor).that_are_not(:attached?)
|
22
|
-
actor.perform :place, children, supporter
|
23
|
-
end
|
24
|
-
|
25
|
-
respond :place, Use.text(/(all|everything)/), Use.text(/(except|but)/), Use.ambiguous_children, Use.reachable(Supporter) do |actor, _, _, exceptions, supporter|
|
26
|
-
children = Use.children.context_from(actor).that_are_not(:attached?)
|
27
|
-
actor.perform :place, children - exceptions, supporter
|
28
|
-
end
|
29
|
-
|
30
|
-
respond :place, Use.not_expression, Use.ambiguous_children, Use.reachable(Supporter) do |actor, _, exceptions, supporter|
|
31
|
-
children = Use.children.context_from(actor).that_are_not(:attached?)
|
32
|
-
actor.perform :place, children - exceptions, supporter
|
33
|
-
end
|
34
|
-
|
35
|
-
respond :place, Use.plural_children, Use.reachable(Supporter) do |actor, children, supporter|
|
36
|
-
actor.perform :place, children, supporter
|
37
|
-
end
|
@@ -1,175 +0,0 @@
|
|
1
|
-
respond :take, Use.many_visible do |actor, things|
|
2
|
-
filtered = things.clone
|
3
|
-
filtered.delete_if{ |t| t.parent == actor }
|
4
|
-
if filtered.length == 0
|
5
|
-
output = "There's nothing to take that matches your terms." + (things.length > 0 ? "(You're already carrying #{things.join_and}.)" : '')
|
6
|
-
actor.tell output
|
7
|
-
else
|
8
|
-
taken = []
|
9
|
-
filtered.each { |thing|
|
10
|
-
buffer = actor.quietly :take, thing
|
11
|
-
if thing.parent != actor
|
12
|
-
actor.tell buffer
|
13
|
-
else
|
14
|
-
taken.push thing
|
15
|
-
end
|
16
|
-
}
|
17
|
-
if taken.length > 0
|
18
|
-
actor.tell "#{you.pronoun.Subj} #{you.verb.take} #{taken.join_and}."
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
respond :take, Use.text("all", "everything") do |actor, text|
|
24
|
-
children = actor.parent.children.that_are_not(:attached?).that_are(:portable?)
|
25
|
-
if actor.parent != actor.room and actor.parent.kind_of?(Supporter)
|
26
|
-
children += actor.room.children.that_are_not(:attached?).that_are(:portable?)
|
27
|
-
end
|
28
|
-
if children.length == 0
|
29
|
-
actor.tell "There's nothing obvious to take."
|
30
|
-
else
|
31
|
-
taken = []
|
32
|
-
children.each { |child|
|
33
|
-
buffer = actor.quietly :take, child
|
34
|
-
if child.parent == actor
|
35
|
-
taken.push child
|
36
|
-
else
|
37
|
-
actor.tell buffer
|
38
|
-
end
|
39
|
-
}
|
40
|
-
if taken.length > 0
|
41
|
-
actor.tell "#{you.pronoun.Subj} #{you.verb.take} #{taken.join_and}."
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
respond :take, Use.text("all", "everything"), Use.text do |actor, text1, text2|
|
47
|
-
actor.tell "I understand that you want to take #{text1} but did not understand \"#{text2}.\""
|
48
|
-
end
|
49
|
-
|
50
|
-
respond :take, Use.text("all", "everything"), Use.text("but", "except"), Use.visible do |actor, text1, text2, exception|
|
51
|
-
children = actor.parent.children.that_are_not(:attached?).that_are(:portable?)
|
52
|
-
if actor.parent != actor.room and actor.parent.kind_of?(Supporter)
|
53
|
-
children += actor.room.children.that_are_not(:attached?).that_are(:portable?)
|
54
|
-
end
|
55
|
-
if children.length == 0
|
56
|
-
actor.tell "There's nothing obvious to take."
|
57
|
-
else
|
58
|
-
taken = []
|
59
|
-
children.each { |child|
|
60
|
-
next if exception == child
|
61
|
-
buffer = actor.quietly :take, child
|
62
|
-
if child.parent == actor
|
63
|
-
taken.push child
|
64
|
-
else
|
65
|
-
actor.tell buffer
|
66
|
-
end
|
67
|
-
}
|
68
|
-
if taken.length > 0
|
69
|
-
actor.tell "#{you.pronoun.Subj} #{you.verb.take} #{taken.join_and}."
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
respond :take, Use.any_expression, Use.ambiguous_visible(:portable?) do |actor, text, things|
|
75
|
-
filtered = things.clone
|
76
|
-
filtered.delete_if{|t| t.parent == actor}
|
77
|
-
if filtered.length == 0
|
78
|
-
actor.tell "There's nothing to take that matches your terms. (#{you.contract you.pronoun.Subj + ' are'} already carrying #{things.join_and}.)"
|
79
|
-
#elsif filtered.length == 1
|
80
|
-
# actor.proceed
|
81
|
-
else
|
82
|
-
taken = []
|
83
|
-
filtered.each { |thing|
|
84
|
-
buffer = actor.quietly :take, thing
|
85
|
-
if thing.parent != actor
|
86
|
-
actor.tell buffer
|
87
|
-
else
|
88
|
-
taken.push thing
|
89
|
-
end
|
90
|
-
}
|
91
|
-
if taken.length > 0
|
92
|
-
actor.tell "#{you.pronoun.Subj} #{you.verb.take} #{taken.join_and}."
|
93
|
-
end
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
respond :take, Use.any_expression, Use.ambiguous_visible, Use.text("except", "but"), Use.any_expression, Use.ambiguous_visible do |actor, _, things, _, _, exceptions|
|
98
|
-
actor.perform :take, things - exceptions
|
99
|
-
end
|
100
|
-
|
101
|
-
respond :take, Use.text("all", "everything"), Use.text("but", "except"), Use.many_visible do |actor, text1, text2, exceptions|
|
102
|
-
visible = Use.many_visible.context_from(actor)
|
103
|
-
actor.perform :take, visible - exceptions
|
104
|
-
end
|
105
|
-
|
106
|
-
respond :take, Use.text("all", "everything"), Use.text("but", "except"), Use.any_expression, Use.ambiguous_visible do |actor, _, _, _, exceptions|
|
107
|
-
visible = Use.many_visible.context_from(actor)
|
108
|
-
actor.perform :take, visible - exceptions
|
109
|
-
end
|
110
|
-
|
111
|
-
respond :take, Use.text("all", "everything"), Use.text("but", "except"), Use.text do |actor, _, _, exceptions|
|
112
|
-
actor.tell "I don't understand what you're trying to exclude with \"#{exceptions}.\""
|
113
|
-
end
|
114
|
-
|
115
|
-
respond :take, Use.text("all", "everything"), Use.text("but", "except"), Use.plural_visible do |actor, _, _, exceptions|
|
116
|
-
visible = Use.visible.context_from(actor)
|
117
|
-
actor.perform :take, visible - exceptions
|
118
|
-
end
|
119
|
-
|
120
|
-
respond :take, Use.any_expression, Use.ambiguous_visible, Use.text("except", "but"), Use.visible do |actor, text1, things, text2, exception|
|
121
|
-
actor.perform :take, things - [exception]
|
122
|
-
end
|
123
|
-
|
124
|
-
respond :take, Use.any_expression, Use.ambiguous_visible, Use.text("except", "but"), Use.ambiguous_visible do |actor, text1, things, text2, exceptions|
|
125
|
-
actor.perform :take, things - exceptions
|
126
|
-
end
|
127
|
-
|
128
|
-
respond :take, Use.any_expression, Use.ambiguous_visible, Use.text("except", "but"), Use.plural_visible do |actor, text1, things, text2, exceptions|
|
129
|
-
actor.perform :take, things - exceptions
|
130
|
-
end
|
131
|
-
|
132
|
-
respond :take, Use.any_expression, Use.ambiguous_visible, Use.text("except", "but"), Use.any_expression, Use.ambiguous_visible do |actor, _, things, _, _, exceptions|
|
133
|
-
actor.perform :take, things - exceptions
|
134
|
-
end
|
135
|
-
|
136
|
-
respond :take, Use.ambiguous_visible, Use.text("things", "items", "stuff") do |actor, things, _|
|
137
|
-
actor.perform :take, things
|
138
|
-
end
|
139
|
-
|
140
|
-
respond :take, Use.plural_visible do |actor, things|
|
141
|
-
actor.perform :take, things
|
142
|
-
end
|
143
|
-
|
144
|
-
respond :take, Use.not_expression, Use.ambiguous_visible do |actor, _, exceptions|
|
145
|
-
visible = Use.visible.context_from(actor)
|
146
|
-
actor.perform :take, visible - exceptions
|
147
|
-
end
|
148
|
-
|
149
|
-
respond :take, Use.text("all", "everything"), Use.from_expression, Use.reachable(Receptacle) do |actor, _, _, receptacle|
|
150
|
-
children = receptacle.children.that_are_not(:attached?)
|
151
|
-
if children.length == 0
|
152
|
-
actor.tell "There's nothing inside #{the receptacle}."
|
153
|
-
else
|
154
|
-
taken = []
|
155
|
-
children.each { |child|
|
156
|
-
buffer = actor.quietly :take, child
|
157
|
-
if child.parent != actor
|
158
|
-
actor.tell buffer
|
159
|
-
else
|
160
|
-
taken.push child
|
161
|
-
end
|
162
|
-
}
|
163
|
-
if taken.length > 0
|
164
|
-
actor.tell "#{you.pronoun.Subj} #{you.verb.take} #{taken.join_and} from #{the receptacle}."
|
165
|
-
end
|
166
|
-
end
|
167
|
-
end
|
168
|
-
|
169
|
-
respond :take, Use.text("all","everything"), Use.reachable(Container) do |actor, text, container|
|
170
|
-
if container.open?
|
171
|
-
actor.proceed
|
172
|
-
else
|
173
|
-
actor.tell "#{The container} is closed."
|
174
|
-
end
|
175
|
-
end
|