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.
Files changed (128) hide show
  1. checksums.yaml +4 -4
  2. data/html/core/engine.js +89 -20
  3. data/html/sinatra/engine.js +27 -13
  4. data/html/skins/hypertext/index.html +0 -2
  5. data/html/skins/standard/play.js +0 -66
  6. data/lib/gamefic-sdk.rb +2 -1
  7. data/lib/gamefic-sdk/build.rb +11 -19
  8. data/lib/gamefic-sdk/config.rb +126 -0
  9. data/lib/gamefic-sdk/platform.rb +12 -0
  10. data/lib/gamefic-sdk/platform/base.rb +35 -33
  11. data/lib/gamefic-sdk/platform/gfic.rb +5 -18
  12. data/lib/gamefic-sdk/platform/sinatra.rb +29 -31
  13. data/lib/gamefic-sdk/platform/web.rb +72 -65
  14. data/lib/gamefic-sdk/platform/web/app_config.rb +48 -48
  15. data/lib/gamefic-sdk/platform/web/engine.rb +10 -7
  16. data/lib/gamefic-sdk/platform/web/user.rb +3 -3
  17. data/lib/gamefic-sdk/server.rb +17 -19
  18. data/lib/gamefic-sdk/shell.rb +68 -16
  19. data/lib/gamefic-sdk/shell/init.rb +3 -19
  20. data/lib/gamefic-sdk/shell/test.rb +9 -14
  21. data/lib/gamefic-sdk/version.rb +1 -1
  22. data/scripts/save-restore-undo.plot.rb +25 -0
  23. data/scripts/snapshots.plot.rb +16 -14
  24. data/scripts/standard.plot.rb +3 -5
  25. data/scripts/standard/actions.plot.rb +1 -11
  26. data/scripts/standard/actions/drop.plot.rb +1 -1
  27. data/scripts/standard/actions/enter.plot.rb +4 -16
  28. data/scripts/standard/actions/go.plot.rb +2 -36
  29. data/scripts/standard/actions/insert.plot.rb +7 -21
  30. data/scripts/standard/actions/inventory.plot.rb +2 -1
  31. data/scripts/standard/actions/leave.plot.rb +7 -18
  32. data/scripts/standard/actions/look.plot.rb +45 -44
  33. data/scripts/standard/actions/nil.plot.rb +1 -1
  34. data/scripts/standard/actions/take.plot.rb +10 -28
  35. data/scripts/standard/actions/talk.plot.rb +9 -13
  36. data/scripts/standard/clothing.plot.rb +4 -0
  37. data/scripts/standard/clothing/actions.plot.rb +4 -0
  38. data/scripts/{clothing → standard/clothing}/actions/doff.plot.rb +0 -0
  39. data/scripts/{clothing → standard/clothing}/actions/drop.plot.rb +8 -8
  40. data/scripts/{clothing → standard/clothing}/actions/inventory.plot.rb +14 -14
  41. data/scripts/standard/clothing/actions/wear.plot.rb +20 -0
  42. data/scripts/standard/clothing/entities.plot.rb +7 -0
  43. data/scripts/{clothing → standard/clothing}/entities/clothing.plot.rb +0 -2
  44. data/scripts/standard/clothing/entities/coat.plot.rb +3 -0
  45. data/scripts/standard/clothing/entities/gloves.plot.rb +3 -0
  46. data/scripts/standard/clothing/entities/hat.plot.rb +3 -0
  47. data/scripts/standard/clothing/entities/pants.plot.rb +3 -0
  48. data/scripts/standard/clothing/entities/shirt.plot.rb +3 -0
  49. data/scripts/standard/clothing/entities/shoes.plot.rb +3 -0
  50. data/scripts/standard/container.plot.rb +28 -0
  51. data/scripts/{debug.plot.rb → standard/container/actions.plot.rb} +0 -0
  52. data/scripts/standard/container/entities.plot.rb +5 -0
  53. data/scripts/standard/direction.plot.rb +1 -2
  54. data/scripts/{edible.plot.rb → standard/edible.plot.rb} +5 -3
  55. data/scripts/standard/entities.plot.rb +3 -3
  56. data/scripts/standard/entities/character.plot.rb +9 -6
  57. data/scripts/standard/entities/fixture.plot.rb +1 -1
  58. data/scripts/standard/entities/item.plot.rb +2 -4
  59. data/scripts/standard/entities/portal.plot.rb +9 -5
  60. data/scripts/standard/entities/receptacle.plot.rb +1 -1
  61. data/scripts/standard/entities/room.plot.rb +5 -5
  62. data/scripts/standard/entities/scenery.plot.rb +2 -4
  63. data/scripts/standard/entities/supporter.plot.rb +4 -7
  64. data/scripts/standard/entities/thing.plot.rb +7 -0
  65. data/scripts/standard/{actions/give.plot.rb → give.plot.rb} +27 -25
  66. data/scripts/standard/lockable.plot.rb +79 -0
  67. data/scripts/standard/modules.plot.rb +2 -4
  68. data/scripts/standard/modules/attachable.plot.rb +1 -0
  69. data/scripts/standard/modules/locale_description.plot.rb +20 -0
  70. data/scripts/standard/{use.plot.rb → modules/use.plot.rb} +51 -47
  71. data/scripts/standard/openable.plot.rb +43 -0
  72. data/scripts/standard/pathfinder.plot.rb +11 -6
  73. data/scripts/standard/test.plot.rb +2 -0
  74. data/scripts/undo.plot.rb +13 -11
  75. metadata +30 -65
  76. data/lib/gamefic-sdk/plot_config.rb +0 -25
  77. data/scripts/ansi.plot.rb +0 -13
  78. data/scripts/autosuggest.plot.rb +0 -165
  79. data/scripts/clothing.plot.rb +0 -2
  80. data/scripts/clothing/actions.plot.rb +0 -4
  81. data/scripts/clothing/actions/wear.plot.rb +0 -19
  82. data/scripts/clothing/entities.plot.rb +0 -7
  83. data/scripts/clothing/entities/coat.plot.rb +0 -5
  84. data/scripts/clothing/entities/gloves.plot.rb +0 -5
  85. data/scripts/clothing/entities/hat.plot.rb +0 -5
  86. data/scripts/clothing/entities/pants.plot.rb +0 -5
  87. data/scripts/clothing/entities/shirt.plot.rb +0 -5
  88. data/scripts/clothing/entities/shoes.plot.rb +0 -5
  89. data/scripts/cover.plot.rb +0 -30
  90. data/scripts/furniture.plot.rb +0 -35
  91. data/scripts/hints.plot.rb +0 -31
  92. data/scripts/hypertext.plot.rb +0 -280
  93. data/scripts/media.plot.rb +0 -17
  94. data/scripts/multimedia.plot.rb +0 -41
  95. data/scripts/questions.plot.rb +0 -17
  96. data/scripts/room-modes.plot.rb +0 -48
  97. data/scripts/rough-sizes.plot.rb +0 -36
  98. data/scripts/save-restore.plot.rb +0 -22
  99. data/scripts/standard/actions/close.plot.rb +0 -16
  100. data/scripts/standard/actions/lock.plot.rb +0 -59
  101. data/scripts/standard/actions/look-under.plot.rb +0 -8
  102. data/scripts/standard/actions/open.plot.rb +0 -34
  103. data/scripts/standard/actions/read.plot.rb +0 -3
  104. data/scripts/standard/actions/search.plot.rb +0 -40
  105. data/scripts/standard/actions/show.plot.rb +0 -13
  106. data/scripts/standard/actions/unlock.plot.rb +0 -77
  107. data/scripts/standard/actions/use.plot.rb +0 -25
  108. data/scripts/standard/entities/container.plot.rb +0 -8
  109. data/scripts/standard/entities/door.plot.rb +0 -51
  110. data/scripts/standard/entities/entity.plot.rb +0 -12
  111. data/scripts/standard/entities/exterior.plot.rb +0 -5
  112. data/scripts/standard/modules/darkenable.plot.rb +0 -6
  113. data/scripts/standard/modules/lockable.plot.rb +0 -25
  114. data/scripts/standard/modules/openable.plot.rb +0 -15
  115. data/scripts/standard/modules/transparent.plot.rb +0 -6
  116. data/scripts/standard/plural.plot.rb +0 -2
  117. data/scripts/standard/plural/actions.plot.rb +0 -4
  118. data/scripts/standard/plural/actions/drop.plot.rb +0 -126
  119. data/scripts/standard/plural/actions/insert.plot.rb +0 -60
  120. data/scripts/standard/plural/actions/place.plot.rb +0 -37
  121. data/scripts/standard/plural/actions/take.plot.rb +0 -175
  122. data/scripts/standard/plural/queries.plot.rb +0 -5
  123. data/scripts/standard/plural/queries/ambiguous_visible.plot.rb +0 -13
  124. data/scripts/standard/plural/queries/any_expression.plot.rb +0 -17
  125. data/scripts/standard/plural/queries/many_visible.plot.rb +0 -13
  126. data/scripts/standard/plural/queries/not_expression.plot.rb +0 -16
  127. data/scripts/standard/plural/queries/plural_visible.plot.rb +0 -22
  128. 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,8 +0,0 @@
1
- script 'standard/entities/receptacle'
2
-
3
- class Container < Receptacle
4
- include Enterable
5
- include Openable
6
- include Lockable
7
- include Transparent
8
- end
@@ -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,12 +0,0 @@
1
- class Gamefic::Entity
2
- include Portable
3
- include Itemizable
4
- include ParentRoom
5
- include Attachable
6
-
7
- attr_writer :locale_description
8
-
9
- def locale_description
10
- @locale_description ||= ""
11
- end
12
- end
@@ -1,5 +0,0 @@
1
- script 'standard/entities/room'
2
-
3
- class Exterior < Room
4
-
5
- end
@@ -1,6 +0,0 @@
1
- module Darkenable
2
- attr_writer :dark
3
- def dark?
4
- @dark ||= false
5
- end
6
- 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,15 +0,0 @@
1
- module Openable
2
- attr_writer :openable
3
- def open= bool
4
- @open = bool
5
- end
6
- def open?
7
- @open ||= false
8
- end
9
- def closed?
10
- !open?
11
- end
12
- def accessible?
13
- open?
14
- end
15
- end
@@ -1,6 +0,0 @@
1
- module Transparent
2
- attr_writer :transparent
3
- def transparent?
4
- @transparent ||= false
5
- end
6
- end
@@ -1,2 +0,0 @@
1
- script 'standard/plural/queries'
2
- script 'standard/plural/actions'
@@ -1,4 +0,0 @@
1
- script 'standard/plural/actions/drop'
2
- script 'standard/plural/actions/insert'
3
- script 'standard/plural/actions/place'
4
- script 'standard/plural/actions/take'
@@ -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