gamefic 4.2.3 → 4.2.5
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.
- checksums.yaml +4 -4
- data/.yardopts +1 -1
- data/CHANGELOG.md +7 -0
- data/lib/gamefic/active/cue.rb +23 -2
- data/lib/gamefic/active/narratives.rb +22 -19
- data/lib/gamefic/props/output.rb +0 -6
- data/lib/gamefic/scene/multiple_choice.rb +1 -0
- data/lib/gamefic/scriptable.rb +4 -1
- 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: 1e0ee9411012484287822ef70d9b657d157fac7a53950945ba749f5dbc457030
|
|
4
|
+
data.tar.gz: 867004cd0f6a9b402f53032ab4e3e0700f403bcddaa8c4ace1701afeb566e8a6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2d46f337e4e17a0961062ffb43f14b6e5702b5bc388561d430101b8afead2707c889874f4b1df64d14253d7c1d4319d23e8ab2144c88286bc7295258346f11cb
|
|
7
|
+
data.tar.gz: 0a44dfea866e1280dfe964bbc2e0b6da11ed990b7df2f93f155ccbeb1fd98a900e0e062e14ceb5ef201917cfc4fe24171d4b23cee148f0e2f5ea055c5b6155be
|
data/.yardopts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
--plugin yard-solargraph
|
|
1
|
+
--plugin yard-solargraph
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## 4.2.5 - November 29, 2026
|
|
2
|
+
- Cue resolved named scenes in other narratives
|
|
3
|
+
- Fix included_scripts order in Opal
|
|
4
|
+
|
|
5
|
+
## 4.2.4 - November 26, 2026
|
|
6
|
+
- Cue#output does not freeze data sources
|
|
7
|
+
|
|
1
8
|
## 4.2.3 - July 23, 2026
|
|
2
9
|
- Add logger dependency
|
|
3
10
|
- Cue does not freeze actor queue
|
data/lib/gamefic/active/cue.rb
CHANGED
|
@@ -43,9 +43,17 @@ module Gamefic
|
|
|
43
43
|
scene.finish
|
|
44
44
|
end
|
|
45
45
|
|
|
46
|
+
# A frozen snapshout of the current output.
|
|
47
|
+
#
|
|
46
48
|
# @return [Props::Output]
|
|
47
49
|
def output
|
|
48
|
-
|
|
50
|
+
return Props::Output::EMPTY unless props
|
|
51
|
+
data = props.output
|
|
52
|
+
.raw_data
|
|
53
|
+
.clone
|
|
54
|
+
.transform_values! { |val| val.clone.freeze }
|
|
55
|
+
.freeze
|
|
56
|
+
Props::Output.new(**data).freeze
|
|
49
57
|
end
|
|
50
58
|
|
|
51
59
|
# @return [Cue]
|
|
@@ -78,13 +86,26 @@ module Gamefic
|
|
|
78
86
|
# by symbolic keys can be instances of anonymous classes that cannot
|
|
79
87
|
# be serialized, so memoizing them breaks snapshots.
|
|
80
88
|
narrative&.prepare(key, actor, props, **context) ||
|
|
89
|
+
try_actor_narratives ||
|
|
81
90
|
try_unblocked_class ||
|
|
82
91
|
raise("Failed to cue #{key.inspect} in #{narrative.inspect}")
|
|
83
92
|
end
|
|
84
93
|
|
|
85
94
|
private
|
|
86
95
|
|
|
87
|
-
# @
|
|
96
|
+
# @todo This is a quick and dirty workaround for cues that reference a
|
|
97
|
+
# scene by a symbolic name that is defined in a different narrative.
|
|
98
|
+
#
|
|
99
|
+
# @return [Scene::Base, nil]
|
|
100
|
+
def try_actor_narratives
|
|
101
|
+
actor.narratives.to_a.reverse.each do |narr|
|
|
102
|
+
found = narr.prepare(key, actor, props, **context)
|
|
103
|
+
return found if found
|
|
104
|
+
end
|
|
105
|
+
nil
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
# @return [Scene::Base, nil]
|
|
88
109
|
def try_unblocked_class
|
|
89
110
|
return unless key.is_a?(Class) && key <= Scene::Base
|
|
90
111
|
|
|
@@ -10,93 +10,96 @@ module Gamefic
|
|
|
10
10
|
# @param narrative [Narrative]
|
|
11
11
|
# @return [self]
|
|
12
12
|
def add(narrative)
|
|
13
|
-
|
|
13
|
+
narrative_array.push(narrative) unless narrative_array.include?(narrative)
|
|
14
14
|
self
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
# @param narrative [Narrative]
|
|
18
18
|
# @return [self]
|
|
19
19
|
def delete(narrative)
|
|
20
|
-
|
|
20
|
+
narrative_array.delete(narrative)
|
|
21
21
|
self
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
def empty?
|
|
25
|
-
|
|
25
|
+
narrative_array.empty?
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
# @return [Integer]
|
|
29
29
|
def length
|
|
30
|
-
|
|
30
|
+
narrative_array.length
|
|
31
31
|
end
|
|
32
32
|
|
|
33
33
|
def one?
|
|
34
|
-
|
|
34
|
+
narrative_array.one?
|
|
35
35
|
end
|
|
36
36
|
|
|
37
37
|
# @return [Array<Response>]
|
|
38
38
|
def responses
|
|
39
|
-
|
|
39
|
+
narrative_array.flat_map(&:responses)
|
|
40
40
|
end
|
|
41
41
|
|
|
42
42
|
# @return [Array<Response>]
|
|
43
43
|
def responses_for(*verbs)
|
|
44
|
-
|
|
44
|
+
narrative_array.reverse.flat_map { |narr| narr.responses_for(*verbs) }
|
|
45
|
+
.reverse
|
|
46
|
+
.uniq(&:block)
|
|
47
|
+
.reverse
|
|
45
48
|
end
|
|
46
49
|
|
|
47
50
|
# @return [Array<Syntax>]
|
|
48
51
|
def syntaxes
|
|
49
|
-
|
|
52
|
+
narrative_array.flat_map(&:syntaxes)
|
|
50
53
|
end
|
|
51
54
|
|
|
52
55
|
# True if the specified verb is understood by any of the narratives.
|
|
53
56
|
#
|
|
54
57
|
# @param verb [String, Symbol]
|
|
55
58
|
def understand?(verb)
|
|
56
|
-
verb ?
|
|
59
|
+
verb ? narrative_array.flat_map(&:synonyms).include?(verb.to_sym) : false
|
|
57
60
|
end
|
|
58
61
|
|
|
59
62
|
# @return [Array<Binding>]
|
|
60
63
|
def before_commands
|
|
61
|
-
|
|
64
|
+
narrative_array.flat_map(&:before_commands)
|
|
62
65
|
end
|
|
63
66
|
|
|
64
67
|
# @return [Array<Binding>]
|
|
65
68
|
def after_commands
|
|
66
|
-
|
|
69
|
+
narrative_array.flat_map(&:after_commands)
|
|
67
70
|
end
|
|
68
71
|
|
|
69
72
|
# @sg-ignore Type checker has trouble reconciling return type of `Set#each`
|
|
70
73
|
# with unresolved `generic<R>` of `Enumerable#each`
|
|
71
74
|
def each(&block)
|
|
72
|
-
|
|
75
|
+
narrative_array.each(&block)
|
|
73
76
|
end
|
|
74
77
|
|
|
75
78
|
# @return [Array<Narrative>]
|
|
76
79
|
def that_are(*args)
|
|
77
|
-
|
|
80
|
+
narrative_array.to_a.that_are(*args)
|
|
78
81
|
end
|
|
79
82
|
|
|
80
83
|
# @return [Array<Narrative>]
|
|
81
84
|
def that_are_not(*args)
|
|
82
|
-
|
|
85
|
+
narrative_array.to_a.that_are_not(*args)
|
|
83
86
|
end
|
|
84
87
|
|
|
85
88
|
# @return [Array<Entity>]
|
|
86
89
|
def entities
|
|
87
|
-
|
|
90
|
+
narrative_array.flat_map(&:entities)
|
|
88
91
|
end
|
|
89
92
|
|
|
90
93
|
# @return [Array<Binding>]
|
|
91
94
|
def player_output_blocks
|
|
92
|
-
|
|
95
|
+
narrative_array.flat_map(&:player_output_blocks).uniq(&:code)
|
|
93
96
|
end
|
|
94
97
|
|
|
95
98
|
private
|
|
96
99
|
|
|
97
|
-
# @return [
|
|
98
|
-
def
|
|
99
|
-
@
|
|
100
|
+
# @return [Array<Narrative>]
|
|
101
|
+
def narrative_array
|
|
102
|
+
@narrative_array ||= []
|
|
100
103
|
end
|
|
101
104
|
end
|
|
102
105
|
end
|
data/lib/gamefic/props/output.rb
CHANGED
data/lib/gamefic/scriptable.rb
CHANGED
|
@@ -38,7 +38,10 @@ module Gamefic
|
|
|
38
38
|
include Syntaxes
|
|
39
39
|
|
|
40
40
|
def included_scripts
|
|
41
|
-
ancestors
|
|
41
|
+
# Opal does not filter for unique ancestors (presumably because it can't
|
|
42
|
+
# guarantee Set ordering), so we need to reverse -> uniq -> reverse them
|
|
43
|
+
# to maintain the same order as Ruby.
|
|
44
|
+
ancestors.that_are(Scriptable).reverse.uniq.reverse
|
|
42
45
|
end
|
|
43
46
|
end
|
|
44
47
|
end
|
data/lib/gamefic/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: gamefic
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.2.
|
|
4
|
+
version: 4.2.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Fred Snyder
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2026-
|
|
10
|
+
date: 2026-11-29 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: base64
|