gamefic 3.1.0 → 3.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/gamefic/active/messaging.rb +2 -0
- data/lib/gamefic/active/take.rb +0 -2
- data/lib/gamefic/active.rb +3 -1
- data/lib/gamefic/composer.rb +2 -0
- data/lib/gamefic/props/default.rb +2 -4
- data/lib/gamefic/props/output.rb +57 -32
- data/lib/gamefic/props/pause.rb +2 -0
- data/lib/gamefic/scanner.rb +2 -0
- data/lib/gamefic/scriptable/proxy.rb +2 -0
- data/lib/gamefic/vault.rb +2 -0
- data/lib/gamefic/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ac4f50caef9bd101bf90447e3ab289b05a29470e8f722ad391f7f0c9d8c4a921
|
4
|
+
data.tar.gz: 926b7d40dc87036e3759a1a464d3db3c82187da4f829731d0d82b053ac5e52a4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6a4b426b4703a29717dbcc59bfee2e3f5d3b1b2ceeb6121741f52111e5fe2d8165e0946f8c3a085f1a3c4094edab11e2966f751dbc3cfc1541809ebc3a9ad970
|
7
|
+
data.tar.gz: ba3f3e82bd772ae392ffb23b056b62de2c1b5bebb0e810fea81bd59449d3e64c8c848f748803ac36f155ad3a2891b0e42d76ca48e4e74239a776670f19fdcc0e
|
data/CHANGELOG.md
CHANGED
data/lib/gamefic/active/take.rb
CHANGED
@@ -31,7 +31,6 @@ module Gamefic
|
|
31
31
|
|
32
32
|
# @return [Props::Default]
|
33
33
|
def start
|
34
|
-
props.output[:scene] = scene.to_hash
|
35
34
|
scene.run_start_blocks actor, props
|
36
35
|
scene.start actor, props
|
37
36
|
# @todo See if this can be handled better
|
@@ -47,7 +46,6 @@ module Gamefic
|
|
47
46
|
def finish
|
48
47
|
actor.flush
|
49
48
|
scene.finish(actor, props)
|
50
|
-
props.output.replace(last_prompt: props.prompt, last_input: props.input)
|
51
49
|
scene.run_finish_blocks actor, props
|
52
50
|
end
|
53
51
|
|
data/lib/gamefic/active.rb
CHANGED
@@ -164,6 +164,8 @@ module Gamefic
|
|
164
164
|
cue :default_scene
|
165
165
|
@props = Take.start(self, @last_cue)
|
166
166
|
@last_output = self.output
|
167
|
+
@props.output[:last_prompt] = @last_output.prompt
|
168
|
+
@props.output[:last_input] = @last_input
|
167
169
|
@output = @props.output.dup.freeze
|
168
170
|
end
|
169
171
|
|
@@ -203,7 +205,7 @@ module Gamefic
|
|
203
205
|
# True if the actor is ready to leave the game.
|
204
206
|
#
|
205
207
|
def concluding?
|
206
|
-
epic.empty? || @props&.scene&.type == 'Conclusion'
|
208
|
+
epic.empty? || @props&.scene&.fetch(:type) == 'Conclusion'
|
207
209
|
end
|
208
210
|
|
209
211
|
def accessible?
|
data/lib/gamefic/composer.rb
CHANGED
@@ -2,8 +2,6 @@
|
|
2
2
|
|
3
3
|
module Gamefic
|
4
4
|
module Props
|
5
|
-
SceneData = Struct.new(:name, :type)
|
6
|
-
|
7
5
|
# A collection of data related to a scene. Scenes define which Props class
|
8
6
|
# they use. Props can be accessed in a scene's on_start and on_finish
|
9
7
|
# callbacks.
|
@@ -27,13 +25,13 @@ module Gamefic
|
|
27
25
|
attr_reader :context
|
28
26
|
alias data context
|
29
27
|
|
30
|
-
# @return [
|
28
|
+
# @return [Hash]
|
31
29
|
attr_reader :scene
|
32
30
|
|
33
31
|
# @param scene [Scene]
|
34
32
|
# @param context [Hash]
|
35
33
|
def initialize scene, **context
|
36
|
-
@scene =
|
34
|
+
@scene = { name: scene.name, type: scene.type }
|
37
35
|
@context = context
|
38
36
|
end
|
39
37
|
|
data/lib/gamefic/props/output.rb
CHANGED
@@ -6,11 +6,10 @@ module Gamefic
|
|
6
6
|
# data.
|
7
7
|
#
|
8
8
|
class Output
|
9
|
-
|
10
|
-
|
9
|
+
READER_METHODS = %i[messages options queue scene prompt last_prompt last_input].freeze
|
10
|
+
WRITER_METHODS = %i[messages= prompt= last_prompt= last_input=].freeze
|
11
11
|
|
12
|
-
|
13
|
-
attr_reader :last_prompt
|
12
|
+
attr_reader :raw_data
|
14
13
|
|
15
14
|
def initialize **data
|
16
15
|
@raw_data = {
|
@@ -23,36 +22,49 @@ module Gamefic
|
|
23
22
|
merge! data
|
24
23
|
end
|
25
24
|
|
26
|
-
#
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
#
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
#
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
#
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
25
|
+
# @!attribute [rw] messages
|
26
|
+
# A text message to be displayed at the start of a scene.
|
27
|
+
#
|
28
|
+
# @return [String]
|
29
|
+
|
30
|
+
# @!attribute [rw] options
|
31
|
+
# An array of options to be presented to the player, e.g., in a
|
32
|
+
# MultipleChoice scene.
|
33
|
+
#
|
34
|
+
# @return [Array<String>]
|
35
|
+
|
36
|
+
# @!attribute [rw] queue
|
37
|
+
# An array of commands waiting to be executed.
|
38
|
+
#
|
39
|
+
# @return [Array<String>]
|
40
|
+
|
41
|
+
# @!attribute [rw] scene
|
42
|
+
# A hash containing the scene's :name and :type.
|
43
|
+
#
|
44
|
+
# @return [Hash]
|
45
|
+
|
46
|
+
# @!attribute [rw] [prompt]
|
47
|
+
# The input prompt to be displayed to the player.
|
48
|
+
#
|
49
|
+
# @return [String]
|
50
|
+
|
51
|
+
# @!attribute [rw] last_input
|
52
|
+
# The input received from the player in the previous scene.
|
53
|
+
#
|
54
|
+
# @return [String, nil]
|
55
|
+
|
56
|
+
# @!attribute [rw] last_prompt
|
57
|
+
# The input prompt from the previous scene.
|
58
|
+
#
|
59
|
+
# @return [String, nil]
|
60
|
+
|
61
|
+
# @param key [Symbol]
|
52
62
|
def [] key
|
53
63
|
raw_data[key]
|
54
64
|
end
|
55
65
|
|
66
|
+
# @param key [Symbol]
|
67
|
+
# @param value [Object]
|
56
68
|
def []= key, value
|
57
69
|
raw_data[key] = value
|
58
70
|
end
|
@@ -74,9 +86,22 @@ module Gamefic
|
|
74
86
|
raw_data.replace data
|
75
87
|
end
|
76
88
|
|
77
|
-
|
89
|
+
def freeze
|
90
|
+
raw_data.freeze
|
91
|
+
super
|
92
|
+
end
|
78
93
|
|
79
|
-
|
94
|
+
def method_missing method, *args
|
95
|
+
return raw_data[method] if READER_METHODS.include?(method)
|
96
|
+
|
97
|
+
return raw_data[method.to_s[0..-2].to_sym] = args.first if WRITER_METHODS.include?(method)
|
98
|
+
|
99
|
+
super
|
100
|
+
end
|
101
|
+
|
102
|
+
def respond_to_missing?(method, _with_private = false)
|
103
|
+
READER_METHODS.include?(method) || WRITER_METHODS.include?(method)
|
104
|
+
end
|
80
105
|
end
|
81
106
|
end
|
82
107
|
end
|
data/lib/gamefic/props/pause.rb
CHANGED
data/lib/gamefic/scanner.rb
CHANGED
data/lib/gamefic/vault.rb
CHANGED
data/lib/gamefic/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gamefic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fred Snyder
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-04-
|
11
|
+
date: 2024-04-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opal
|