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,14 +1,16 @@
1
- module Snapshots
2
- def self.history
3
- @history ||= []
4
- end
5
- end
6
-
7
- last_snapshot = nil
8
-
9
- on_player_ready do |actor|
10
- if (actor.last_action.nil? or !actor.last_action.meta?) and !last_snapshot.nil?
11
- Snapshots.history.push last_snapshot
12
- end
13
- last_snapshot = save
14
- end
1
+ # @gamefic.script snapshots
2
+
3
+ module Snapshots
4
+ def self.history
5
+ @history ||= []
6
+ end
7
+ end
8
+
9
+ last_snapshot = nil
10
+
11
+ on_player_ready do |actor|
12
+ if (actor.last_action.nil? or !actor.last_action.meta?) and !last_snapshot.nil?
13
+ Snapshots.history.push last_snapshot
14
+ end
15
+ last_snapshot = save
16
+ end
@@ -1,12 +1,10 @@
1
1
  # @gamefic.script standard
2
- # A general-purpose library that provides common actions and entities for
3
- # interactive fiction. Designed to be suitable for parser-based text
4
- # adventures, but easily extensible for other formats.
2
+ # A general-purpose library that provides common actions and entities for
3
+ # interactive fiction. Designed to be suitable for parser-based text
4
+ # adventures, but easily extensible for other formats.
5
5
 
6
6
  script 'standard/queries'
7
- script 'standard/use'
8
7
  script 'standard/modules'
9
8
  script 'standard/direction'
10
9
  script 'standard/entities'
11
10
  script 'standard/actions'
12
- script 'standard/pathfinder'
@@ -1,23 +1,13 @@
1
- script 'standard/actions/close'
1
+ script 'standard/actions/nil'
2
2
  script 'standard/actions/drop'
3
3
  script 'standard/actions/enter'
4
- script 'standard/actions/give'
5
4
  script 'standard/actions/go'
6
5
  script 'standard/actions/insert'
7
6
  script 'standard/actions/inventory'
8
7
  script 'standard/actions/leave'
9
- script 'standard/actions/lock'
10
- script 'standard/actions/look-under'
11
8
  script 'standard/actions/look'
12
- script 'standard/actions/nil'
13
- script 'standard/actions/open'
14
9
  script 'standard/actions/place'
15
10
  script 'standard/actions/quit'
16
- script 'standard/actions/read'
17
- script 'standard/actions/search'
18
- script 'standard/actions/show'
19
11
  script 'standard/actions/take'
20
12
  script 'standard/actions/talk'
21
- script 'standard/actions/unlock'
22
- script 'standard/actions/use'
23
13
  script 'standard/actions/wait'
@@ -6,7 +6,7 @@ respond :drop, Use.family() do |actor, thing|
6
6
  end
7
7
  end
8
8
 
9
- respond :drop, Query::Children.new() do |actor, thing|
9
+ respond :drop, Use.children do |actor, thing|
10
10
  if thing.sticky?
11
11
  actor.tell thing.sticky_message || "#{you.pronoun.Subj} #{you.verb.need} to keep #{the thing} for now."
12
12
  else
@@ -1,20 +1,12 @@
1
+ respond :enter, Use.siblings do |actor, thing|
2
+ actor.tell "#{The thing} #{you.contract "can not"} accommodate #{you.pronoun.obj}."
3
+ end
4
+
1
5
  respond :enter, Use.siblings(Enterable, :enterable?) do |actor, supporter|
2
6
  actor.parent = supporter
3
7
  actor.tell "#{you.pronoun.Subj} #{you.verb[supporter.enter_verb]} #{the supporter}."
4
8
  end
5
9
 
6
- respond :enter, Use.siblings(Enterable, Openable, :enterable?) do |actor, container|
7
- if container.open?
8
- actor.proceed
9
- else
10
- actor.tell "#{The container} is closed."
11
- end
12
- end
13
-
14
- respond :enter, Use.siblings do |actor, thing|
15
- actor.tell "#{The thing} #{you.contract "can not"} accommodate #{you.pronoun.obj}."
16
- end
17
-
18
10
  respond :enter, Use.parent do |actor, container|
19
11
  actor.tell "#{you.contract(you.pronoun.subj + ' ' + you.verb.be).cap_first} already in #{the container}."
20
12
  end
@@ -23,9 +15,5 @@ respond :enter, Use.parent(Supporter) do |actor, supporter|
23
15
  actor.tell "#{you.pronoun.Subj} #{you.verb[supporter.enter_verb]} #{the supporter} already."
24
16
  end
25
17
 
26
- respond :enter, Use.text do |actor, text|
27
- actor.tell "#{you.pronoun.Subj} #{you.contract(you.verb.do + ' not')} see any \"#{text}\" here."
28
- end
29
-
30
18
  interpret "get on :thing", "enter :thing"
31
19
  interpret "get in :thing", "enter :thing"
@@ -1,4 +1,4 @@
1
- respond :go, Use.family(Portal) do |actor, portal|
1
+ respond :go, Use.siblings(Portal) do |actor, portal|
2
2
  if actor.parent != actor.room
3
3
  actor.perform :leave
4
4
  end
@@ -15,44 +15,10 @@ respond :go, Use.family(Portal) do |actor, portal|
15
15
  end
16
16
  end
17
17
 
18
- respond :go, Use.family(Door, :locked?) do |actor, door|
19
- actor.tell "#{The door} is locked."
20
- end
21
-
22
- respond :go, Use.family(Door, :closed?) do |actor, door|
23
- if door.automatic?
24
- actor.perform :open, door
25
- if door.open?
26
- actor.proceed
27
- end
28
- else
29
- actor.tell "#{The door} is closed."
30
- end
31
- end
32
-
33
- respond :go, Query::Text.new() do |actor, string|
18
+ respond :go, Use.text do |actor, string|
34
19
  actor.tell "#{you.pronoun.Subj} #{you.contract(you.verb.do + ' not')} see any exit \"#{string}\" from here."
35
20
  end
36
21
 
37
- respond :go, Use.text do |actor, text|
38
- # This version of the Go action identifies portals by their destinations.
39
- portals = actor.room.children.that_are(Portal)
40
- destinations = []
41
- d_map = {}
42
- portals.each { |portal|
43
- next if portal.destination.nil?
44
- destinations.push portal.destination
45
- d_map[portal.destination] = portal
46
- }
47
- matches = destinations.select{|o| o.match? text }
48
- matches = destinations.select{|o| o.match? text, fuzzy: true } if matches.empty?
49
- if matches.length == 1
50
- actor.perform :go, d_map[matches[0]]
51
- else
52
- actor.proceed
53
- end
54
- end
55
-
56
22
  respond :go do |actor|
57
23
  actor.tell "Where do you want to go?"
58
24
  end
@@ -1,40 +1,26 @@
1
1
  script 'standard'
2
2
 
3
- respond :insert, Use.visible, Use.reachable do |actor, thing, target|
3
+ respond :insert, Use.available, Use.available do |actor, thing, target|
4
4
  actor.tell "#{you.pronoun.Subj} #{you.contract you.verb.can + ' not'} put #{the thing} inside #{the target}."
5
5
  end
6
6
 
7
- respond :insert, Use.visible, Use.reachable(Receptacle) do |actor, thing, receptacle|
7
+ respond :insert, Use.children, Use.available(Receptacle) do |actor, thing, receptacle|
8
8
  if thing.sticky?
9
9
  actor.tell thing.sticky_message || "#{you.pronoun.Subj} #{you.verb.need} to keep #{the thing} for now."
10
10
  else
11
- if actor.auto_takes?(thing)
12
- actor.tell "#{you.pronoun.Subj} put #{the thing} in #{the receptacle}."
13
- thing.parent = receptacle
14
- end
11
+ actor.tell "#{you.pronoun.Subj} put #{the thing} in #{the receptacle}."
12
+ thing.parent = receptacle
15
13
  end
16
14
  end
17
15
 
18
- respond :insert, Use.visible, Use.reachable(Container) do |actor, thing, container|
19
- if container.open?
16
+ respond :insert, Use.available, Use.available(Receptacle) do |actor, thing, receptacle|
17
+ if thing.parent == actor
20
18
  actor.proceed
21
19
  else
22
- actor.tell "#{The container} is closed."
20
+ actor.tell "#{you.pronoun.Subj} #{you.contract you.verb.do + ' not'} have #{the thing}."
23
21
  end
24
22
  end
25
23
 
26
- respond :insert, Use.visible, Use.text do |actor, thing, container|
27
- actor.tell "#{you.pronoun.Subj} #{you.contract you.verb.do + ' not'} see anything called \"#{container}\" here."
28
- end
29
-
30
- respond :insert, Use.text, Use.visible do |actor, thing, container|
31
- actor.tell "#{you.pronoun.Subj} #{you.contract you.verb.do + ' not'} see anything called \"#{thing}\" here."
32
- end
33
-
34
- respond :insert, Use.text, Use.text do |actor, thing, container|
35
- actor.tell "I don't know what you mean by \"#{thing}\" or \"#{container}.\""
36
- end
37
-
38
24
  interpret "drop :item in :container", "insert :item :container"
39
25
  interpret "put :item in :container", "insert :item :container"
40
26
  interpret "place :item in :container", "insert :item :container"
@@ -5,4 +5,5 @@ respond :inventory do |actor|
5
5
  actor.tell "#{you.pronoun.Subj} #{you.contract you.verb.be + ' not'} carrying anything."
6
6
  end
7
7
  end
8
- xlate "i", "inventory"
8
+
9
+ interpret "i", "inventory"
@@ -1,11 +1,3 @@
1
- respond :leave, Use.parent(Container, :enterable?) do |actor, container|
2
- if container.open?
3
- actor.proceed
4
- else
5
- actor.tell "#{The container} is closed."
6
- end
7
- end
8
-
9
1
  respond :leave, Use.parent do |actor, thing|
10
2
  actor.tell "There's no way out of #{the thing}."
11
3
  end
@@ -15,7 +7,7 @@ respond :leave, Use.parent(Enterable, :enterable?) do |actor, thing|
15
7
  actor.parent = thing.parent
16
8
  end
17
9
 
18
- respond :leave, Query::Parent.new(Room) do |actor, room|
10
+ respond :leave, Use.room do |actor, room|
19
11
  portals = room.children.that_are(Portal)
20
12
  if portals.length == 0
21
13
  actor.tell "#{you.pronoun.Subj} #{you.contract you.verb.do + ' not'} see any obvious exits."
@@ -30,12 +22,9 @@ respond :leave do |actor|
30
22
  actor.perform :leave, actor.parent
31
23
  end
32
24
 
33
- xlate "exit", "leave"
34
- xlate "exit :supporter", "leave :supporter"
35
- xlate "get off :supporter", "leave :supporter"
36
- xlate "get up from :supporter", "leave :supporter"
37
- xlate "get up", "leave"
38
- xlate "get off", "leave"
39
- xlate "get out :container", "leave :container"
40
- xlate "get out of :container", "leave :container"
41
- #xlate "out", "leave"
25
+ interpret "exit", "leave"
26
+ interpret "exit :supporter", "leave :supporter"
27
+ interpret "get on :supporter", "enter :supporter"
28
+ interpret "get off :supporter", "leave :supporter"
29
+ interpret "get out :container", "leave :container"
30
+ interpret "get out of :container", "leave :container"
@@ -1,16 +1,53 @@
1
- respond :look, Use.parent(Supporter) do |actor, supporter|
2
- actor.tell supporter.description
3
- actor.tell "#{you.pronoun.Subj} are currently on #{the supporter}."
1
+ respond :look, Use.text do |actor, string|
2
+ if string == 'around'
3
+ actor.perform :look, actor.room
4
+ else
5
+ actor.tell "You don't see any \"#{string}\" here."
6
+ end
4
7
  end
5
8
 
6
- respond :look, Use.itself do |actor, _|
9
+ respond :look, Use.itself do |actor, thing|
7
10
  actor.tell actor.description
8
11
  actor.perform :inventory
9
12
  end
10
13
 
14
+ respond :look, Use.available do |actor, thing|
15
+ actor.tell thing.description
16
+ thing.children.that_are(:attached?).that_are(:itemized?).each { |item|
17
+ actor.tell "#{An item} is attached to #{the thing}."
18
+ }
19
+ end
20
+
21
+ respond :look, Use.available(Supporter) do |actor, thing|
22
+ actor.proceed
23
+ if thing.accessible?
24
+ itemized = thing.children.that_are_not(:attached?).that_are(:itemized?)
25
+ actor.tell "You see #{itemized.join_and} on #{the thing}." unless itemized.empty?
26
+ end
27
+ end
28
+
29
+ respond :look, Use.available(Receptacle) do |actor, thing|
30
+ actor.proceed
31
+ if thing.accessible?
32
+ itemized = thing.children.that_are_not(:attached?).that_are(:itemized?)
33
+ actor.tell "You see #{itemized.join_and} in #{the thing}." unless itemized.empty?
34
+ end
35
+ end
36
+
37
+ respond :look, Use.parent(Supporter, :enterable?) do |actor, supporter|
38
+ actor.proceed
39
+ actor.tell "#{you.pronoun.Subj} are currently on #{the supporter}."
40
+ end
41
+
11
42
  respond :look, Use.room do |actor, room|
12
43
  actor.tell "<strong>#{room.name.cap_first}</strong>"
13
44
  actor.tell room.description if room.has_description?
45
+ actor.execute :_itemize_room
46
+ end
47
+
48
+ respond :_itemize_room do |actor|
49
+ room = actor.room
50
+ next if room.nil?
14
51
  with_locales = []
15
52
  chars = room.children.that_are(Character).that_are(:itemized?) - [actor]
16
53
  charsum = []
@@ -44,11 +81,11 @@ respond :look, Use.room do |actor, room|
44
81
  if portals.length > 0
45
82
  if portals.length == 1
46
83
  p = portals[0]
47
- actor.tell "There is an exit #{p.direction || p.name || "to #{the p.destination}"}."
84
+ actor.tell "There is an exit #{p.instruction}."
48
85
  else
49
86
  dirs = []
50
87
  portals.each { |p|
51
- dirs.push (p.direction || p.name || "to #{the p.destination}")
88
+ dirs.push p.instruction
52
89
  }
53
90
  actor.tell "There are exits #{dirs.join_and(', ')}."
54
91
  end
@@ -61,45 +98,9 @@ respond :look, Use.room do |actor, room|
61
98
  }
62
99
  end
63
100
  end
64
- xlate "look", "look around"
65
- xlate "l", "look around"
66
-
67
- respond :look, Use.available() do |actor, thing|
68
- actor.tell thing.description
69
- thing.children.that_are(:attached?).that_are(:itemized?).each { |item|
70
- actor.tell "#{An item} is attached to #{the thing}."
71
- }
72
- end
73
-
74
- respond :look, Use.text do |actor, string|
75
- if string == 'around'
76
- actor.perform :look, actor.parent
77
- else
78
- actor.tell "You don't see any \"#{string}\" here."
79
- end
80
- end
81
-
82
- respond :look, Use.available(Receptacle) do |actor, receptacle|
83
- if receptacle.has_description?
84
- actor.tell receptacle.description
85
- end
86
- actor.perform :search, receptacle
87
- end
88
101
 
89
- respond :look, Use.available(Supporter) do |actor, supporter|
90
- actor.proceed
91
- supported = supporter.children.that_are_not(:attached?)
92
- if supported.length > 0
93
- actor.tell "You see #{supported.join_and} sitting there."
94
- end
95
- end
96
-
97
- respond :look, Use.available(Door) do |actor, door|
98
- if door.has_description?
99
- actor.proceed
100
- end
101
- actor.tell "#{The door} is " + (door.open? ? 'open' : 'closed') + '.'
102
- end
102
+ interpret "look", "look around"
103
+ interpret "l", "look around"
103
104
 
104
105
  interpret "look at :thing", "look :thing"
105
106
  interpret "l :thing", "look :thing"
@@ -1,6 +1,6 @@
1
1
  meta nil, Query::Text.new() do |actor, string|
2
2
  words = string.split_words
3
- list = verbs(to_s: true)
3
+ list = verbs
4
4
  if list.include?(words[0])
5
5
  if words.length > 1
6
6
  actor.tell "I recognize '#{words[0]}' as a verb but could not understand the rest of your sentence."
@@ -1,46 +1,28 @@
1
- respond :take, Use.reachable do |actor, thing|
2
- actor.tell "#{you.pronoun.Subj} #{you.contract you.verb.can + ' not'} take #{the thing}."
3
- end
4
-
5
- respond :take, Use.visible do |actor, thing|
6
- if thing.parent == actor.parent
7
- actor.proceed
8
- elsif thing.parent.kind_of?(Container) and !thing.parent.open?
9
- actor.tell "#{The thing} is inside #{the thing.parent}, which is closed."
10
- end
11
- end
12
-
13
- respond :take, Use.visible do |actor, thing|
14
- if actor.parent.kind_of?(Supporter) and actor.parent != thing.parent and actor.parent != thing.parent.parent
15
- actor.tell "#{you.pronoun.Subj} can't reach it from #{the actor.parent}."
16
- else
17
- actor.proceed
18
- end
19
- end
20
-
21
- respond :take, Use.reachable(:attached?) do |actor, thing|
22
- actor.tell "#{The thing} is attached to #{the thing.parent}."
1
+ respond :take, Use.text do |actor, text|
2
+ actor.tell "#{you.pronoun.Subj} #{you.contract(you.verb.do + ' not')} see any \"#{text}\" here."
23
3
  end
24
4
 
25
- respond :take, Use.reachable(Entity, :portable?) do |actor, thing|
5
+ respond :take, Use.available do |actor, thing|
26
6
  if thing.parent == actor
27
7
  actor.tell "#{you.contract(you.pronoun.subj + ' are').cap_first} already carrying #{the thing}."
28
- else
8
+ elsif thing.portable?
29
9
  if actor.parent != thing.parent
30
10
  actor.tell "#{you.pronoun.Subj} #{you.verb.take} #{the thing} from #{the thing.parent}."
31
11
  else
32
12
  actor.tell "#{you.pronoun.Subj} #{you.verb.take} #{the thing}."
33
13
  end
34
14
  thing.parent = actor
15
+ else
16
+ actor.tell "#{you.pronoun.Subj} #{you.contract you.verb.can + ' not'} take #{the thing}."
35
17
  end
36
18
  end
37
19
 
38
- respond :take, Use.reachable(Rubble) do |actor, rubble|
39
- actor.tell "#{you.pronoun.Subj} #{you.contract(you.verb.do + ' not')} have any use for #{the rubble}."
20
+ respond :take, Use.available(:attached?) do |actor, thing|
21
+ actor.tell "#{The thing} is attached to #{the thing.parent}."
40
22
  end
41
23
 
42
- respond :take, Use.text do |actor, text|
43
- actor.tell "#{you.pronoun.Subj} #{you.contract(you.verb.do + ' not')} see any \"#{text}\" here."
24
+ respond :take, Use.available(Rubble) do |actor, rubble|
25
+ actor.tell "#{you.pronoun.Subj} #{you.contract(you.verb.do + ' not')} have any use for #{the rubble}."
44
26
  end
45
27
 
46
28
  interpret "get :thing", "take :thing"