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,10 +0,0 @@
1
- #gamefic, #image, #text-container, #controls {
2
- width: 100%;
3
- min-width: 0;
4
- max-width: none;
5
- }
6
- #gamefic {
7
- -webkit-box-shadow: none;
8
- -moz-box-shadow: none;
9
- box-shadow: none;
10
- }
@@ -1,186 +0,0 @@
1
- html {
2
- margin: 0;
3
- padding: 0;
4
- font-family: Arial, sans-serif;
5
- font-size: 12pt;
6
- }
7
- body {
8
- margin: 0;
9
- padding: 0;
10
- background-color: #E3E7EA;
11
- }
12
- body.loading {
13
- width: 100%;
14
- height: 100%;
15
- background-image: url('loading-large.gif');
16
- background-position: center center;
17
- background-repeat: no-repeat;
18
- }
19
- #gamefic_console {
20
- width: 80%;
21
- min-width: 600px;
22
- max-width: 1024px;
23
- overflow: hidden;
24
- margin: 0 auto;
25
- background-color: #FFFFFF;
26
- -webkit-box-shadow: 4px 4px 4px 0px rgba(0,0,0,0.75);
27
- -moz-box-shadow: 4px 4px 4px 0px rgba(0,0,0,0.75);
28
- box-shadow: 4px 4px 4px 0px rgba(0,0,0,0.75);
29
- }
30
- #titlebar {
31
- margin: 0 auto;
32
- padding: 1px;
33
- height: 20px;
34
- background-color: #0D1046;
35
- color: #FFFFFF;
36
- }
37
- #titlebar h1 {
38
- margin: 0 0 0 10px;
39
- height: 20px;
40
- font-size: 14px;
41
- font-weight: normal
42
- }
43
- #image-container {
44
- margin: 0 auto;
45
- padding: 0;
46
- background-color: #FFFFFF;
47
- border: 1px solid #A0A0A0;
48
- display: none;
49
- }
50
- #image {
51
- max-width: 100%;
52
- max-height: 100%;
53
- margin: 0 auto;
54
- padding: 0;
55
- background-repeat: no-repeat;
56
- background-position: top center;
57
- background-size: 100% 100%;
58
- display: none;
59
- }
60
- #image-container.loading {
61
- background-image: url('loading-circle.gif');
62
- background-position: center center;
63
- background-repeat: no-repeat;
64
- background-size: auto auto;
65
- }
66
- #image-container.loading image {
67
- visibility: hidden;
68
- }
69
- #text-container {
70
- border-top: 1px solid #A0A0A0
71
- background-color: #FFFFFF;
72
- overflow: auto;
73
- }
74
- #text {
75
- margin: 1em;
76
- }
77
- #text kbd {
78
- font-family: Courier, Monospace;
79
- font-weight: bold;
80
- color: green;
81
- }
82
- #text kbd.logged {
83
- color: gray;
84
- }
85
- #text blockquote {
86
- margin: 1em 1em 1em 0;
87
- padding: 0 0 0 1em;
88
- border-left: 2px solid #E0E0E0;
89
- color: #303030;
90
- }
91
- #controls {
92
- border-top: 1px solid #A0A0A0;
93
- background-color: #FFFFFF;
94
- }
95
- #prompt, #concluded {
96
- margin: 4px 0 4px 0;
97
- padding: 6px 0 0 10px;
98
- background-color: #FFFFFF;
99
- background-position: 10px 8px;
100
- background-repeat: no-repeat;
101
- font-size: 10pt;
102
- height: 14pt;
103
- font-weight: bold;
104
- }
105
- #commandform, #dialogform {
106
- position: relative;
107
- background-color: #FFFFFF;
108
- padding: 0 0 10px 0;
109
- }
110
- #commandline-container, #dialogline-container {
111
- margin-left: 10px;
112
- margin-right: 80px;
113
- height: 2em;
114
- }
115
- #gamefic_command, #dialogline {
116
- width: 100%;
117
- margin: 0;
118
- padding: 0;
119
- font-size: 14pt;
120
- border: 1px solid #909090;
121
- }
122
- #commandenter, #dialogenter {
123
- position: absolute;
124
- font-size: 12pt;
125
- right: 10px;
126
- top: 0;
127
- margin: 0;
128
- padding: 0;
129
- border: 1px solid black;
130
- width: 60px;
131
- }
132
- .hidden {
133
- display: none;
134
- }
135
- a.disabled {
136
- color: gray;
137
- text-decoration: none;
138
- }
139
- .error {
140
- color: red;
141
- }
142
- .hint {
143
- font-style: italic;
144
- }
145
- #prompt.hint {
146
- color: red;
147
- font-weight: bold;
148
- }
149
- kbd a {
150
- color: green;
151
- }
152
- noscript p {
153
- font-weight: bold;
154
- text-align: center;
155
- }
156
- #image_cacher {
157
- position: absolute;
158
- top: 10000;
159
- }
160
- #dialog {
161
- display: none;
162
- }
163
- #dialog nav p {
164
- text-align: center;
165
- }
166
- #dialog nav p a {
167
- margin: 0 1em 0 1em;
168
- }
169
- ol.multiple-choice {
170
- list-style: none;
171
- margin: 1em 0 1em 0.5em;
172
- padding: 0;
173
- }
174
- ol.multiple-choice li {
175
- margin: 0.5em 0 0.5em 0;
176
- padding: 0;
177
- list-style-type: decimal;
178
- }
179
- #dialog.loading * {
180
- visibility: hidden;
181
- }
182
- #dialog.loading {
183
- background-image: url('loading.gif');
184
- background-position: center center;
185
- background-repeat: no-repeat;
186
- }
@@ -1,22 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <meta charset="UTF-8" />
5
- <title><%= title %> by <%= author %></title>
6
- <%= stylesheet_tags %>
7
- </head>
8
- <body>
9
- <div id="gamefic_console">
10
- <div id="gamefic_output">
11
- </div>
12
- <div id="gamefic_controls" class="working">
13
- <form action="">
14
- <span id="gamefic_prompt"></span>
15
- <input type="text" name="command" id="gamefic_command" autocomplete="off" />
16
- <button type="submit" id="gamefic_submit">Enter</button>
17
- </form>
18
- </div>
19
- </div>
20
- <%= javascript_tags %>
21
- </body>
22
- </html>
@@ -1,4 +0,0 @@
1
- javascripts.push "core/jquery.js"
2
- javascripts.push "play.js"
3
-
4
- stylesheets.push "style.css"
@@ -1,18 +0,0 @@
1
- $(function() {
2
- console.log('starting play');
3
- $('#gamefic_controls form').submit(function(event) {
4
- $('#gamefic_controls').addClass('working');
5
- event.preventDefault();
6
- Gamefic.receive($('#gamefic_command').val());
7
- $('#gamefic_command').val('');
8
- $('#gamefic_controls').removeClass('working');
9
- });
10
- Gamefic.onUpdate((state) => {
11
- $('#gamefic_output').append(state['output']);
12
- if (state.scene == 'Conclusion') {
13
- $('#gamefic_console').addClass('concluded');
14
- }
15
- });
16
- Gamefic.start();
17
- $('#gamefic_controls').removeClass('working');
18
- });
@@ -1,73 +0,0 @@
1
- html {
2
- margin: 0;
3
- padding: 0;
4
- font-family: Arial, sans-serif;
5
- font-size: 12pt;
6
- }
7
- body {
8
- margin: 0;
9
- padding: 0;
10
- background-color: #E3E7EA;
11
- }
12
- #gamefic_console {
13
- width: 80%;
14
- min-width: 600px;
15
- max-width: 1024px;
16
- overflow: hidden;
17
- margin: 0 auto;
18
- background-color: #FFFFFF;
19
- -webkit-box-shadow: 4px 4px 4px 0px rgba(0,0,0,0.75);
20
- -moz-box-shadow: 4px 4px 4px 0px rgba(0,0,0,0.75);
21
- box-shadow: 4px 4px 4px 0px rgba(0,0,0,0.75);
22
- }
23
- #gamefic_command {
24
- width: calc(100% - 80px);
25
- margin: 0;
26
- padding: 0;
27
- font-size: 14pt;
28
- border: 1px solid #909090;
29
- }
30
- #gamefic_output {
31
- min-height: 600px;
32
- max-height: 80vh;
33
- overflow: auto;
34
- padding: 1em;
35
- }
36
- #gamefic_output figure {
37
- margin: 0;
38
- padding: 0;
39
- }
40
- #gamefic_output img {
41
- max-width: 100%;
42
- display: block;
43
- margin: 0 auto;
44
- overflow: hidden;
45
- }
46
- #gamefic_controls {
47
- border-top: 1px solid #909090;
48
- overflow: hidden;
49
- padding: 1em;
50
- }
51
- #gamefic_prompt {
52
- font-size: 10pt;
53
- }
54
- #gamefic_controls input {
55
- font-size: 14pt;
56
- height: 24px;
57
- border: 1px solid #303030;
58
- }
59
- #gamefic_controls button {
60
- display: inline-block;
61
- font-size: 14pt;
62
- line-height: normal !important;
63
- height: 26px;
64
- width: 72px;
65
- border: 1px solid #303030;
66
- margin: 0;
67
- padding: 0;
68
- color: #303030;
69
- vertical-align: top;
70
- }
71
- #gamefic_controls.working {
72
- display: none;
73
- }
@@ -1,30 +0,0 @@
1
- require 'yaml'
2
-
3
- module Gamefic::Sdk
4
-
5
- module Build
6
- def self.release directory, quiet = false
7
- config = Gamefic::Sdk::Config.load(directory)
8
- if config.auto_import?
9
- puts "Importing scripts..."
10
- Shell.start ['import', directory, '--quiet']
11
- end
12
- config.targets.each_pair { |k, v|
13
- puts "Building #{k}..." unless quiet
14
- plat = Gamefic::Sdk::Platform.load(config, k)
15
- plat.build
16
- }
17
- puts "Build#{config.targets.length > 1 ? 's' : ''} complete." unless quiet
18
- end
19
- def self.clean directory
20
- config = Gamefic::Sdk::Config.load(directory)
21
- config.targets.each_pair { |k, v|
22
- puts "Cleaning #{k}..."
23
- plat = Gamefic::Sdk::Platform.load(config, k)
24
- plat.clean
25
- }
26
- puts "Done."
27
- end
28
- end
29
-
30
- end
@@ -1,126 +0,0 @@
1
- require 'yaml'
2
- require 'pathname'
3
-
4
- module Gamefic
5
- module Sdk
6
- class Config
7
- attr_reader :source_dir
8
- attr_reader :data
9
-
10
- def initialize directory, data = {}
11
- @source_dir = directory
12
- @data = data
13
-
14
- @source_dir.freeze
15
- @data.freeze
16
- end
17
-
18
- # The game's title.
19
- #
20
- # @return [String]
21
- def title
22
- @title ||= (data['title'] || 'Untitled')
23
- end
24
-
25
- # The game's author.
26
- #
27
- # @return [String]
28
- def author
29
- @author ||= (data['author'] || 'Anonymous')
30
- end
31
-
32
- # The absolute path to the project's script directory.
33
- #
34
- # @return [String]
35
- def script_path
36
- @script_paths ||= Pathname.new(source_dir).join(data['script_path'] || './scripts').to_s
37
- end
38
-
39
- # The absolute path to the project's import directory.
40
- #
41
- # @return [String]
42
- def import_path
43
- @import_paths ||= Pathname.new(source_dir).join(data['import_path'] || './imports').to_s
44
- end
45
-
46
- # The absolute path to the project's media directory.
47
- #
48
- # @return [String]
49
- def media_path
50
- @media_path ||= Pathname.new(source_dir).join(data['media_path'] || './media').to_s
51
- end
52
-
53
- # The absolute path to the project's build directory.
54
- #
55
- # @return [String]
56
- def build_path
57
- @build_path ||= Pathname.new(source_dir).join(data['build_path'] || './build').to_s
58
- end
59
-
60
- # The absolute path to the project's release directory.
61
- #
62
- # @return [String]
63
- def release_path
64
- @release_path ||= Pathname.new(source_dir).join(data['release_path'] || './release').to_s
65
- end
66
-
67
- def auto_import?
68
- @auto_import ||= (data['auto_import'] || true)
69
- end
70
-
71
- # A hash of each target's name and its configuration options.
72
- #
73
- # @return [Hash]
74
- def targets
75
- @targets ||= (data['targets'] || {})
76
- end
77
-
78
- # A universal unique identifier for the project.
79
- #
80
- # @return [String]
81
- def uuid
82
- if @uuid.nil?
83
- if File.file?(File.join source_dir, '.uuid')
84
- @@uuid = File.read(File.join source_dir, '.uuid').strip
85
- end
86
- end
87
- @uuid
88
- end
89
-
90
- # @return [Gamefic::Sdk::Config]
91
- def self.load directory
92
- config = {}
93
- ['config.yml', 'config.yaml'].each do |cy|
94
- config_file = File.join(directory, cy)
95
- if File.exist?(config_file)
96
- config = YAML.load(File.read(config_file))
97
- break
98
- end
99
- end
100
- Config.new(directory, config)
101
- end
102
-
103
- def self.generate author = 'Anonymous', title = 'Untitled'
104
- <<-EOS
105
- title: #{title}
106
- author: #{author}
107
-
108
- script_path: ./scripts
109
- import_path: ./imports
110
- media_path: ./media
111
-
112
- build_path: ./build
113
- release_path: ./release
114
-
115
- targets:
116
- web:
117
- platform: Web
118
- html: ./html
119
- gfic:
120
- platform: Gfic
121
- filename: game.gfic
122
- EOS
123
- end
124
- end
125
- end
126
- end