gamefic 4.0.0 → 4.1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ab6b04620f4d61106e3d7a3321dfc1833f0a7cce7eeb0e509ca77bdc5388d7c0
4
- data.tar.gz: d8d37b580f71e20870cbe4124a8af41a953448b4bd5296e8f6f73d5e8a0e5092
3
+ metadata.gz: e5aaa5c2e7e709434b596c7bd216138ccc693d3893c56ed87ee54640e545d729
4
+ data.tar.gz: a7f12b8da551d9f97b279e6050333561e5d348940681cab7cf894f97a9eca085
5
5
  SHA512:
6
- metadata.gz: ac226d280d8e1a07ad2bc154ae1cbc49a4496a847986f4d8919aef89999386432122673b568c64e2012ef3b910652aa67a31545e59eb65633105854fd0228d4b
7
- data.tar.gz: 2b271b4061e74ab43d4cd11e080261b595404f7add90ea017934e49c4d1beda47a44c3ed88b53d4ba57cc6a6602fabf5e330a18544e783b09c56129642f6f82a
6
+ metadata.gz: b15fe4c2f586a9164a3166273c15638e548fbcf78d3f3e5bef41f55a8c054c06f1d5a16c62cbb13a252e635e0416c5fcb6da1f8574a1ac3323bb117d76f78fea
7
+ data.tar.gz: d26cb35d5a6fcae8f4c3511e2b22339491b5773d2288914c1125eeb38da4db51440e5780c28b1b4aec0344bb819f4abb97323d9ef5bcf21404667edf28705fe7
data/CHANGELOG.md CHANGED
@@ -1,4 +1,10 @@
1
- ## 4.0.0
1
+ ## 4.1.0 - February 1, 2025
2
+ - Correct Scenes#pause block
3
+
4
+ ## 4.0.1 - January 26, 2025
5
+ - Cue#prepare flushes messages
6
+
7
+ ## 4.0.0 - January 25, 2025
2
8
  - Nuanced scans
3
9
  - Command hooks
4
10
  - Refactored queries
@@ -66,7 +66,7 @@ module Gamefic
66
66
  props.output.merge!({
67
67
  scene: scene.to_hash,
68
68
  prompt: props.prompt,
69
- messages: actor.messages,
69
+ messages: actor.flush,
70
70
  queue: actor.queue
71
71
  })
72
72
  actor.narratives.player_output_blocks.each { |block| block.call actor, props.output }
@@ -94,7 +94,6 @@ module Gamefic
94
94
 
95
95
  # @return [void]
96
96
  def prepare_output
97
- scene
98
97
  props.output.last_input = actor.last_cue&.props&.input
99
98
  props.output.last_prompt = actor.last_cue&.props&.prompt
100
99
  end
@@ -17,7 +17,7 @@ module Gamefic
17
17
  #
18
18
  # @param selection [Array<Entity>]
19
19
  # @param token [String]
20
- # @param use [Array<Scanner::Base>]
20
+ # @param use [Array<Class<Scanner::Base>>]
21
21
  # @return [Result]
22
22
  def self.scan(selection, token, use = processors)
23
23
  result = nil
@@ -13,7 +13,7 @@ module Gamefic
13
13
 
14
14
  # @param actor [Actor]
15
15
  # @param narrative [Narrative]
16
- # @param props [Props::Base]
16
+ # @param props [Props::Default]
17
17
  def initialize(actor, narrative = nil, props = nil, **context)
18
18
  @actor = actor
19
19
  @narrative = narrative
@@ -96,14 +96,14 @@ module Gamefic
96
96
  end
97
97
 
98
98
  # @yieldparam [Actor] The scene's actor
99
- # @yieldparam [Props::Base] The scene's props
99
+ # @yieldparam [Props::Default] The scene's props
100
100
  # @yieldparam [Hash] Additional context
101
101
  def on_start(&block)
102
102
  start_blocks.push block
103
103
  end
104
104
 
105
105
  # @yieldparam [Actor] The scene's actor
106
- # @yieldparam [Props::Base] The scene's props
106
+ # @yieldparam [Props::Default] The scene's props
107
107
  # @yieldparam [Hash] Additional context
108
108
  def on_finish(&block)
109
109
  finish_blocks.push block
@@ -113,7 +113,7 @@ module Gamefic
113
113
 
114
114
  attr_writer :context
115
115
 
116
- # @param klass [Class<Props::Base>]
116
+ # @param klass [Class<Props::Default>]
117
117
  def use_props_class(klass)
118
118
  @props_class = klass
119
119
  end
@@ -21,7 +21,7 @@ module Gamefic
21
21
  # descendants of siblings and children.
22
22
  #
23
23
  # @param args [Array<Object>] Query arguments
24
- # @return [Query::Scoped]
24
+ # @return [Query::Family]
25
25
  def available *args
26
26
  Query::Family.new(*args, name: 'available')
27
27
  end
@@ -31,7 +31,7 @@ module Gamefic
31
31
  # Define a query that returns the actor's parent.
32
32
  #
33
33
  # @param args [Array<Object>] Query arguments
34
- # @return [Query::Scoped]
34
+ # @return [Query::Parent]
35
35
  def parent *args
36
36
  Query::Parent.new(*args, name: 'parent')
37
37
  end
@@ -39,7 +39,7 @@ module Gamefic
39
39
  # Define a query that searches an actor's children.
40
40
  #
41
41
  # @param args [Array<Object>] Query arguments
42
- # @return [Query::Scoped]
42
+ # @return [Query::Children]
43
43
  def children *args
44
44
  Query::Children.new(*args, name: 'children')
45
45
  end
@@ -47,7 +47,7 @@ module Gamefic
47
47
  # Define a query that searches an actor's descendants.
48
48
  #
49
49
  # @param args [Array<Object>] Query arguments
50
- # @return [Query::Scoped]
50
+ # @return [Query::Descendants]
51
51
  def descendants *args
52
52
  Query::Descendants.new(*args)
53
53
  end
@@ -55,7 +55,7 @@ module Gamefic
55
55
  # Define a query that searches an actor's siblings.
56
56
  #
57
57
  # @param args [Array<Object>] Query arguments
58
- # @return [Query::Scoped]
58
+ # @return [Query::Siblings]
59
59
  def siblings *args
60
60
  Query::Siblings.new(*args, name: 'siblings')
61
61
  end
@@ -63,7 +63,7 @@ module Gamefic
63
63
  # Define a query that searches an actor's siblings and their descendants.
64
64
  #
65
65
  # @param args [Array<Object>] Query arguments
66
- # @return [Query::Scoped]
66
+ # @return [Query::Extended]
67
67
  def extended *args
68
68
  Query::Extended.new(*args, name: 'extended')
69
69
  end
@@ -71,7 +71,7 @@ module Gamefic
71
71
  # Define a query that returns the actor itself.
72
72
  #
73
73
  # @param args [Array<Object>] Query arguments
74
- # @return [Query::Scoped]
74
+ # @return [Query::Myself]
75
75
  def myself *args
76
76
  Query::Myself.new(*args, name: 'myself')
77
77
  end
@@ -93,6 +93,7 @@ module Gamefic
93
93
  # a string representation of an integer. A successful query returns the
94
94
  # integer instead of an entity.
95
95
  #
96
+ # @return [Query::Integer]
96
97
  def integer
97
98
  Query::Integer.new name: 'integer'
98
99
  end
@@ -114,16 +114,26 @@ module Gamefic
114
114
  block Class.new(Scene::YesOrNo, &block), name
115
115
  end
116
116
 
117
+ # Create an active choice scene.
118
+ #
117
119
  # @param name [Symbol, nil]
118
120
  # @return [Class<Scene::ActiveChoice>]
119
121
  def active_choice(name = nil, &block)
120
122
  block Class.new(Scene::ActiveChoice, &block), name
121
123
  end
122
124
 
125
+ # Create a pause.
126
+ # The block will be executed at the start of the scene and the player
127
+ # will be prompted to press enter to continue.
128
+ #
123
129
  # @param name [Symbol, nil]
130
+ # @yieldparam [Actor]
131
+ # @yieldparam [Props::Default]
124
132
  # @return [Class<Scene::Pause>]
125
133
  def pause(name = nil, &block)
126
- block Class.new(Scene::Pause, &block), name
134
+ block(Class.new(Scene::Pause) do
135
+ on_start(&block)
136
+ end, name)
127
137
  end
128
138
 
129
139
  # Create a conclusion.
@@ -136,6 +146,8 @@ module Gamefic
136
146
  # end
137
147
  #
138
148
  # @param name [Symbol, nil]
149
+ # @yieldparam [Actor]
150
+ # @yieldparam [Props::Default]
139
151
  # @return [Class<Scene::Conclusion>]
140
152
  def conclusion(name = nil, &block)
141
153
  block(Class.new(Scene::Conclusion) do
@@ -3,10 +3,22 @@
3
3
  module Gamefic
4
4
  module Scriptable
5
5
  module Seeds
6
+ # @return [Array<Proc>]
6
7
  def seeds
7
8
  @seeds ||= []
8
9
  end
9
10
 
11
+ # Set methods and procs that get executed when a narrative gets initialized.
12
+ #
13
+ # @example
14
+ # class Example < Gamefic::Plot
15
+ # attr_reader :thing
16
+ #
17
+ # seed do
18
+ # @thing = make Entity, name: 'thing'
19
+ # end
20
+ # end
21
+ #
10
22
  def seed *methods, &block
11
23
  seeds.push(proc { methods.flatten.each { |method| send(method) } }) unless methods.empty?
12
24
  seeds.push block if block
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Gamefic
4
- VERSION = '4.0.0'
4
+ VERSION = '4.1.0'
5
5
  end
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: 4.0.0
4
+ version: 4.1.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: 2025-01-25 00:00:00.000000000 Z
11
+ date: 2025-02-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opal