gamefic-sdk 1.7.0 → 2.0.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.
Files changed (115) hide show
  1. checksums.yaml +5 -5
  2. data/bin/gamefic +16 -0
  3. data/lib/gamefic-sdk.rb +4 -24
  4. data/lib/gamefic-sdk/diagram.rb +205 -0
  5. data/lib/gamefic-sdk/scaffold.rb +54 -0
  6. data/lib/gamefic-sdk/server.rb +81 -65
  7. data/lib/gamefic-sdk/shell.rb +22 -129
  8. data/lib/gamefic-sdk/tasks.rb +40 -0
  9. data/lib/gamefic-sdk/tasks/common.rb +21 -0
  10. data/lib/gamefic-sdk/tasks/ruby.rb +99 -0
  11. data/lib/gamefic-sdk/tasks/web.rb +82 -0
  12. data/lib/gamefic-sdk/version.rb +5 -5
  13. metadata +123 -139
  14. data/bin/gfk +0 -6
  15. data/html/core/engine.js +0 -114
  16. data/html/core/jquery.js +0 -5
  17. data/html/core/jquery.modal.css +0 -44
  18. data/html/core/jquery.modal.js +0 -225
  19. data/html/core/js.cookie.js +0 -137
  20. data/html/sinatra/engine.js +0 -65
  21. data/html/skins/hypertext/compass.png +0 -0
  22. data/html/skins/hypertext/index.html +0 -149
  23. data/html/skins/hypertext/style.css +0 -74
  24. data/html/skins/minimal/index.html.erb +0 -22
  25. data/html/skins/minimal/index.rb +0 -4
  26. data/html/skins/minimal/play.js +0 -36
  27. data/html/skins/minimal/style.css +0 -8
  28. data/html/skins/multimedia/close.png +0 -0
  29. data/html/skins/multimedia/index.html +0 -179
  30. data/html/skins/multimedia/mobile.css +0 -10
  31. data/html/skins/multimedia/spinner.gif +0 -0
  32. data/html/skins/multimedia/style.css +0 -186
  33. data/html/skins/standard/index.html.erb +0 -22
  34. data/html/skins/standard/index.rb +0 -4
  35. data/html/skins/standard/play.js +0 -18
  36. data/html/skins/standard/style.css +0 -73
  37. data/lib/gamefic-sdk/build.rb +0 -30
  38. data/lib/gamefic-sdk/config.rb +0 -126
  39. data/lib/gamefic-sdk/debug.rb +0 -4
  40. data/lib/gamefic-sdk/debug/action.rb +0 -30
  41. data/lib/gamefic-sdk/debug/plot.rb +0 -23
  42. data/lib/gamefic-sdk/platform.rb +0 -22
  43. data/lib/gamefic-sdk/platform/base.rb +0 -68
  44. data/lib/gamefic-sdk/platform/gfic.rb +0 -27
  45. data/lib/gamefic-sdk/platform/sinatra.rb +0 -98
  46. data/lib/gamefic-sdk/platform/web.rb +0 -176
  47. data/lib/gamefic-sdk/platform/web/app_config.rb +0 -81
  48. data/lib/gamefic-sdk/platform/web/engine.rb +0 -44
  49. data/lib/gamefic-sdk/platform/web/user.rb +0 -19
  50. data/lib/gamefic-sdk/shell/init.rb +0 -83
  51. data/lib/gamefic-sdk/shell/test.rb +0 -32
  52. data/scripts/save-restore-undo.plot.rb +0 -25
  53. data/scripts/snapshots.plot.rb +0 -16
  54. data/scripts/standard.plot.rb +0 -10
  55. data/scripts/standard/actions.plot.rb +0 -13
  56. data/scripts/standard/actions/drop.plot.rb +0 -19
  57. data/scripts/standard/actions/enter.plot.rb +0 -19
  58. data/scripts/standard/actions/go.plot.rb +0 -48
  59. data/scripts/standard/actions/insert.plot.rb +0 -37
  60. data/scripts/standard/actions/inventory.plot.rb +0 -9
  61. data/scripts/standard/actions/leave.plot.rb +0 -30
  62. data/scripts/standard/actions/look.plot.rb +0 -108
  63. data/scripts/standard/actions/nil.plot.rb +0 -36
  64. data/scripts/standard/actions/place.plot.rb +0 -41
  65. data/scripts/standard/actions/quit.plot.rb +0 -11
  66. data/scripts/standard/actions/take.plot.rb +0 -31
  67. data/scripts/standard/actions/talk.plot.rb +0 -27
  68. data/scripts/standard/actions/wait.plot.rb +0 -3
  69. data/scripts/standard/clothing.plot.rb +0 -4
  70. data/scripts/standard/clothing/actions.plot.rb +0 -4
  71. data/scripts/standard/clothing/actions/doff.plot.rb +0 -12
  72. data/scripts/standard/clothing/actions/drop.plot.rb +0 -8
  73. data/scripts/standard/clothing/actions/inventory.plot.rb +0 -14
  74. data/scripts/standard/clothing/actions/wear.plot.rb +0 -20
  75. data/scripts/standard/clothing/entities.plot.rb +0 -7
  76. data/scripts/standard/clothing/entities/clothing.plot.rb +0 -5
  77. data/scripts/standard/clothing/entities/coat.plot.rb +0 -3
  78. data/scripts/standard/clothing/entities/gloves.plot.rb +0 -3
  79. data/scripts/standard/clothing/entities/hat.plot.rb +0 -3
  80. data/scripts/standard/clothing/entities/pants.plot.rb +0 -3
  81. data/scripts/standard/clothing/entities/shirt.plot.rb +0 -3
  82. data/scripts/standard/clothing/entities/shoes.plot.rb +0 -3
  83. data/scripts/standard/container.plot.rb +0 -28
  84. data/scripts/standard/container/actions.plot.rb +0 -0
  85. data/scripts/standard/container/entities.plot.rb +0 -5
  86. data/scripts/standard/direction.plot.rb +0 -55
  87. data/scripts/standard/edible.plot.rb +0 -21
  88. data/scripts/standard/entities.plot.rb +0 -12
  89. data/scripts/standard/entities/character.plot.rb +0 -10
  90. data/scripts/standard/entities/fixture.plot.rb +0 -3
  91. data/scripts/standard/entities/item.plot.rb +0 -3
  92. data/scripts/standard/entities/portal.plot.rb +0 -44
  93. data/scripts/standard/entities/receptacle.plot.rb +0 -3
  94. data/scripts/standard/entities/room.plot.rb +0 -57
  95. data/scripts/standard/entities/rubble.plot.rb +0 -11
  96. data/scripts/standard/entities/scenery.plot.rb +0 -3
  97. data/scripts/standard/entities/supporter.plot.rb +0 -7
  98. data/scripts/standard/entities/thing.plot.rb +0 -7
  99. data/scripts/standard/give.plot.rb +0 -27
  100. data/scripts/standard/lockable.plot.rb +0 -79
  101. data/scripts/standard/modules.plot.rb +0 -9
  102. data/scripts/standard/modules/attachable.plot.rb +0 -12
  103. data/scripts/standard/modules/auto_takes.plot.rb +0 -50
  104. data/scripts/standard/modules/enterable.plot.rb +0 -15
  105. data/scripts/standard/modules/explicit_exits.plot.rb +0 -15
  106. data/scripts/standard/modules/itemizable.plot.rb +0 -18
  107. data/scripts/standard/modules/locale_description.plot.rb +0 -20
  108. data/scripts/standard/modules/parent-room.plot.rb +0 -9
  109. data/scripts/standard/modules/portable.plot.rb +0 -11
  110. data/scripts/standard/modules/use.plot.rb +0 -51
  111. data/scripts/standard/openable.plot.rb +0 -43
  112. data/scripts/standard/pathfinder.plot.rb +0 -65
  113. data/scripts/standard/queries.plot.rb +0 -21
  114. data/scripts/standard/test.plot.rb +0 -10
  115. data/scripts/undo.plot.rb +0 -13
@@ -1,9 +0,0 @@
1
- respond :inventory do |actor|
2
- if actor.children.length > 0
3
- actor.tell "#{you.pronoun.Subj} #{you.verb.be} carrying #{actor.children.join_and}."
4
- else
5
- actor.tell "#{you.pronoun.Subj} #{you.contract you.verb.be + ' not'} carrying anything."
6
- end
7
- end
8
-
9
- interpret "i", "inventory"
@@ -1,30 +0,0 @@
1
- respond :leave, Use.parent do |actor, thing|
2
- actor.tell "There's no way out of #{the thing}."
3
- end
4
-
5
- respond :leave, Use.parent(Enterable, :enterable?) do |actor, thing|
6
- actor.tell "#{you.pronoun.Subj} #{you.verb[thing.leave_verb]} #{the thing}."
7
- actor.parent = thing.parent
8
- end
9
-
10
- respond :leave, Use.room do |actor, room|
11
- portals = room.children.that_are(Portal)
12
- if portals.length == 0
13
- actor.tell "#{you.pronoun.Subj} #{you.contract you.verb.do + ' not'} see any obvious exits."
14
- elsif portals.length == 1
15
- actor.perform :go, portals[0]
16
- else
17
- actor.tell "I don't know which way you want to go: #{portals.join_or}."
18
- end
19
- end
20
-
21
- respond :leave do |actor|
22
- actor.perform :leave, actor.parent
23
- end
24
-
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,108 +0,0 @@
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
7
- end
8
-
9
- respond :look, Use.itself do |actor, thing|
10
- actor.tell actor.description
11
- actor.perform :inventory
12
- end
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
-
42
- respond :look, Use.room do |actor, room|
43
- actor.tell "<strong>#{room.name.cap_first}</strong>"
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?
51
- with_locales = []
52
- chars = room.children.that_are(Character).that_are(:itemized?) - [actor]
53
- charsum = []
54
- chars.each { |char|
55
- if char.locale_description != ""
56
- with_locales.push char
57
- else
58
- charsum.push char
59
- end
60
- }
61
- if charsum.length > 0
62
- actor.tell "#{charsum.join_and.cap_first} #{charsum.length == 1 ? 'is' : 'are'} here."
63
- end
64
- items = room.children.that_are(:itemized?) - [actor] - room.children.that_are(Character) - room.children.that_are(Portal)
65
- itemsum = []
66
- items.each { |item|
67
- if item.locale_description != ""
68
- with_locales.push item
69
- else
70
- itemsum.push item
71
- end
72
- }
73
- if itemsum.length > 0
74
- actor.tell "#{you.pronoun.Subj} #{you.verb.see} #{itemsum.join_and}."
75
- end
76
- with_locales.each { |entity|
77
- actor.tell entity.locale_description
78
- }
79
- if room.explicit_exits?
80
- portals = room.children.that_are(Portal).that_are(:itemized?)
81
- if portals.length > 0
82
- if portals.length == 1
83
- p = portals[0]
84
- actor.tell "There is an exit #{p.instruction}."
85
- else
86
- dirs = []
87
- portals.each { |p|
88
- dirs.push p.instruction
89
- }
90
- actor.tell "There are exits #{dirs.join_and(', ')}."
91
- end
92
- end
93
- end
94
- if actor.parent.kind_of?(Supporter)
95
- actor.tell "#{you.pronoun.Subj} #{you.verb.be} on #{the actor.parent}."
96
- actor.parent.children.that_are_not(actor).each { |s|
97
- actor.tell "#{A s} is on #{the actor.parent}."
98
- }
99
- end
100
- end
101
-
102
- interpret "look", "look around"
103
- interpret "l", "look around"
104
-
105
- interpret "look at :thing", "look :thing"
106
- interpret "l :thing", "look :thing"
107
- interpret "examine :thing", "look :thing"
108
- interpret "x :thing", "look :thing"
@@ -1,36 +0,0 @@
1
- meta nil, Query::Text.new() do |actor, string|
2
- words = string.split_words
3
- list = verbs
4
- if list.include?(words[0])
5
- if words.length > 1
6
- actor.tell "I recognize '#{words[0]}' as a verb but could not understand the rest of your sentence."
7
- else
8
- actor.tell "I recognize '#{words[0]}' as a verb but could not understand it in this context."
9
- end
10
- else
11
- found = []
12
- list.each { |c|
13
- next if c.include?('_')
14
- if c.length > words[0].length and c.start_with?(words[0])
15
- found.push c
16
- end
17
- }
18
- if found.length == 1
19
- words[0] = found[0]
20
- actor.perform words.join(' ')
21
- elsif found.length > 1 and words[0].length > 2
22
- actor.tell "I'm not sure if #{words[0]} means #{found.join_and(', ', ' or ')}."
23
- else
24
- actor.tell "I don't recognize '#{words[0]}' as a verb."
25
- end
26
- end
27
- end
28
-
29
- meta nil, Query::Text.new(/^it$/) do |actor, string|
30
- words = string.split_words
31
- if verbs(to_s: true).include?(words[0])
32
- actor.tell "I'm not sure what you mean by \"it.\""
33
- else
34
- actor.proceed
35
- end
36
- end
@@ -1,41 +0,0 @@
1
- respond :place, Use.children, Use.reachable do |actor, thing, supporter|
2
- actor.tell "#{you.pronoun.Subj} #{you.contract(you.verb.can + ' not')} put #{the thing} on #{the supporter}."
3
- end
4
-
5
- respond :place, Use.visible, Use.reachable(Supporter) do |actor, thing, supporter|
6
- if thing.parent != actor
7
- actor.perform :take, thing
8
- end
9
- if thing.parent == actor
10
- thing.parent = supporter
11
- actor.tell "You put #{the thing} on #{the supporter}."
12
- end
13
- end
14
-
15
- respond :place, Use.children, Use.reachable(Supporter) do |actor, thing, supporter|
16
- if thing.sticky?
17
- actor.tell thing.sticky_message || "#{you.pronoun.Subj} #{you.verb.need} to keep #{the thing} for now."
18
- else
19
- thing.parent = supporter
20
- actor.tell "#{you.pronoun.Subj} #{you.verb.put} #{the thing} on #{the supporter}."
21
- end
22
- end
23
-
24
- respond :place, Use.visible, Use.text do |actor, thing, supporter|
25
- actor.tell "#{you.pronoun.Subj} #{you.contract(you.verb.do + ' not')} see anything called \"#{supporter}\" here."
26
- end
27
-
28
- respond :place, Use.text, Use.visible do |actor, thing, supporter|
29
- actor.tell "#{you.pronoun.Subj} #{you.contract(you.verb.do + ' not')} see anything called \"#{thing}\" here."
30
- end
31
-
32
- respond :place, Use.text, Use.text do |actor, thing, supporter|
33
- actor.tell "I don't know what you mean by \"#{thing}\" or \"#{supporter}.\""
34
- end
35
-
36
- xlate "put :thing on :supporter", "place :thing :supporter"
37
- xlate "put :thing down on :supporter", "place :thing :supporter"
38
- xlate "set :thing on :supporter", "place :thing :supporter"
39
- xlate "set :thing down on :supporter", "place :thing :supporter"
40
- xlate "drop :thing on :supporter", "place :thing :supporter"
41
- xlate "place :thing on :supporter", "place :thing :supporter"
@@ -1,11 +0,0 @@
1
- confirm_quit = yes_or_no 'Are you sure you want to quit?' do |actor, data|
2
- if data.yes?
3
- actor.cue default_conclusion
4
- else
5
- actor.cue default_scene
6
- end
7
- end
8
-
9
- meta :quit do |actor|
10
- actor.cue confirm_quit
11
- end
@@ -1,31 +0,0 @@
1
- respond :take, Use.text do |actor, text|
2
- actor.tell "#{you.pronoun.Subj} #{you.contract(you.verb.do + ' not')} see any \"#{text}\" here."
3
- end
4
-
5
- respond :take, Use.available do |actor, thing|
6
- if thing.parent == actor
7
- actor.tell "#{you.contract(you.pronoun.subj + ' are').cap_first} already carrying #{the thing}."
8
- elsif thing.portable?
9
- if actor.parent != thing.parent
10
- actor.tell "#{you.pronoun.Subj} #{you.verb.take} #{the thing} from #{the thing.parent}."
11
- else
12
- actor.tell "#{you.pronoun.Subj} #{you.verb.take} #{the thing}."
13
- end
14
- thing.parent = actor
15
- else
16
- actor.tell "#{you.pronoun.Subj} #{you.contract you.verb.can + ' not'} take #{the thing}."
17
- end
18
- end
19
-
20
- respond :take, Use.available(:attached?) do |actor, thing|
21
- actor.tell "#{The thing} is attached to #{the thing.parent}."
22
- end
23
-
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}."
26
- end
27
-
28
- interpret "get :thing", "take :thing"
29
- interpret "pick up :thing", "take :thing"
30
- interpret "pick :thing up", "take :thing"
31
- interpret "carry :thing", "take :thing"
@@ -1,27 +0,0 @@
1
- respond :talk do |actor|
2
- actor.tell "#{you.pronoun.Subj} #{you.verb.talk} to #{you.pronoun.reflex}."
3
- end
4
-
5
- respond :talk, Use.itself do |actor, yourself|
6
- actor.perform :talk
7
- end
8
-
9
- respond :talk, Use.available do |actor, thing|
10
- actor.tell "Nothing happens."
11
- end
12
-
13
- respond :talk, Use.available(Character) do |actor, character|
14
- if actor == character
15
- actor.perform :talk
16
- else
17
- actor.tell "#{The character} has nothing to say."
18
- end
19
- end
20
-
21
- interpret "talk to :character", "talk :character"
22
- interpret "talk to :character about :subject", "talk :character :subject"
23
- interpret "ask :character :subject", "talk :character :subject"
24
- interpret "ask :character about :subject", "talk :character :subject"
25
- interpret "tell :character :subject", "talk :character :subject"
26
- interpret "tell :character about :subject", "talk :character :subject"
27
- interpret "ask :character for :subject", "talk :character :subject"
@@ -1,3 +0,0 @@
1
- respond :wait do |actor|
2
- actor.tell "Time passes."
3
- end
@@ -1,4 +0,0 @@
1
- # @gamefic.script standard/clothing
2
-
3
- script 'standard/clothing/entities'
4
- script 'standard/clothing/actions'
@@ -1,4 +0,0 @@
1
- script 'standard/clothing/actions/doff'
2
- script 'standard/clothing/actions/drop'
3
- script 'standard/clothing/actions/inventory'
4
- script 'standard/clothing/actions/wear'
@@ -1,12 +0,0 @@
1
- respond :doff, Query::Children.new(Clothing) do |actor, clothing|
2
- if !clothing.attached?
3
- actor.tell "You're not wearing #{the clothing}."
4
- else
5
- clothing.attached = false
6
- actor.tell "You take off #{the clothing}."
7
- end
8
- end
9
-
10
- xlate "remove :clothing", "doff :clothing"
11
- xlate "take off :clothing", "doff :clothing"
12
- xlate "take :clothing off", "doff :clothing"
@@ -1,8 +0,0 @@
1
- respond :drop, Query::Children.new(Clothing) do |actor, clothing|
2
- if clothing.attached?
3
- actor.perform :doff, clothing
4
- end
5
- if !clothing.attached?
6
- actor.proceed
7
- end
8
- end
@@ -1,14 +0,0 @@
1
- respond :inventory do |actor|
2
- if actor.children.length > 0
3
- carried = actor.children.that_are_not(:attached?)
4
- worn = actor.children.that_are(:attached?)
5
- if carried.length > 0
6
- actor.tell "You are carrying #{carried.join_and}."
7
- end
8
- if worn.length > 0
9
- actor.tell "You are wearing #{worn.join_and}."
10
- end
11
- else
12
- actor.tell "You aren't carrying anything."
13
- end
14
- end
@@ -1,20 +0,0 @@
1
- respond :wear, Use.available(Clothing) do |actor, clothing|
2
- if clothing.parent != actor
3
- actor.tell "You don't have #{the clothing}."
4
- end
5
- if clothing.attached?
6
- actor.tell "You're already wearing #{the clothing}."
7
- else
8
- already = actor.children.that_are(clothing.class).that_are(:attached?)
9
- if already.length == 0
10
- clothing.attached = true
11
- actor.tell "You put on #{the clothing}."
12
- else
13
- actor.tell "You're already wearing #{an already[0]}."
14
- end
15
- end
16
- end
17
-
18
- xlate "put on :clothing", "wear :clothing"
19
- xlate "put :clothing on", "wear :clothing"
20
- xlate "don :clothing", "wear :clothing"
@@ -1,7 +0,0 @@
1
- script 'standard/clothing/entities/clothing'
2
- script 'standard/clothing/entities/coat'
3
- script 'standard/clothing/entities/gloves'
4
- script 'standard/clothing/entities/hat'
5
- script 'standard/clothing/entities/pants'
6
- script 'standard/clothing/entities/shirt'
7
- script 'standard/clothing/entities/shoes'
@@ -1,5 +0,0 @@
1
- class Clothing < Item
2
- def worn?
3
- self.parent.kind_of?(Character) and self.attached?
4
- end
5
- end
@@ -1,3 +0,0 @@
1
- class Coat < Clothing
2
-
3
- end
@@ -1,3 +0,0 @@
1
- class Gloves < Clothing
2
-
3
- end
@@ -1,3 +0,0 @@
1
- class Hat < Clothing
2
-
3
- end
@@ -1,3 +0,0 @@
1
- class Pants < Clothing
2
-
3
- end
@@ -1,3 +0,0 @@
1
- class Shirt < Clothing
2
-
3
- end
@@ -1,3 +0,0 @@
1
- class Shoes < Clothing
2
-
3
- end
@@ -1,28 +0,0 @@
1
- # @gamefic.script standard/container
2
-
3
- script 'standard/openable'
4
- script 'standard/lockable'
5
- #script 'standard/container/entities'
6
- #script 'standard/container/actions'
7
-
8
- class Container < Receptacle
9
- include Openable
10
- include Lockable
11
- #include Transparent
12
- end
13
-
14
- respond :insert, Use.available, Use.available(Container) do |actor, thing, container|
15
- if container.open?
16
- actor.proceed
17
- else
18
- actor.tell "#{The container} is closed."
19
- end
20
- end
21
-
22
- respond :leave, Use.parent(Container, :enterable?, :closed?) do |actor, container|
23
- actor.tell "#{The container} is closed."
24
- end
25
-
26
- respond :enter, Use.siblings(Container, :enterable?, :closed?) do |actor, container|
27
- actor.tell "#{The container} is closed."
28
- end