gamefic 4.1.0 → 4.1.1
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 -0
- data/CHANGELOG.md +4 -0
- data/gamefic.gemspec +2 -0
- data/lib/gamefic/plot.rb +2 -0
- data/lib/gamefic/scene/base.rb +8 -6
- data/lib/gamefic/scriptable/hooks.rb +9 -9
- data/lib/gamefic/scriptable/responses.rb +2 -2
- data/lib/gamefic/scriptable/scenes.rb +2 -0
- data/lib/gamefic/version.rb +1 -1
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0e888ff6feb58de6f23f2727cc23fed710935f1876ea393ee84c19c2252166c8
|
4
|
+
data.tar.gz: 314a944a945ffb5c51cdc37b842452653408c5a902722b91585cb036b82ee8b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa90ce26213fbeec901719fcb1d099c14f627bb5c1ac94eefaa8c883c06f1d48bf6a269c4f259d67d6b63d35d6855a67cf5e3b0a22f3be23b3dde955afd47a3d
|
7
|
+
data.tar.gz: e237330cd06ca31b3b53ae00b2d774aa9f5b1ab6a307efcc179a07c77928d0e409f3c5237ec94739583c1b835cb8600d81c7c0b2b33ceaa4ced2f3b331f8a081
|
data/.yardopts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--plugin yard-solargraph
|
data/CHANGELOG.md
CHANGED
data/gamefic.gemspec
CHANGED
@@ -21,6 +21,8 @@ Gem::Specification.new do |s|
|
|
21
21
|
|
22
22
|
s.required_ruby_version = '>= 2.7.0'
|
23
23
|
|
24
|
+
s.add_runtime_dependency 'yard-solargraph', '~> 0.1'
|
25
|
+
|
24
26
|
s.add_development_dependency 'opal', '~> 1.7'
|
25
27
|
s.add_development_dependency 'opal-rspec', '~> 1.0'
|
26
28
|
s.add_development_dependency 'opal-sprockets', '~> 1.0'
|
data/lib/gamefic/plot.rb
CHANGED
data/lib/gamefic/scene/base.rb
CHANGED
@@ -95,16 +95,18 @@ module Gamefic
|
|
95
95
|
@finish_blocks ||= []
|
96
96
|
end
|
97
97
|
|
98
|
-
# @yieldparam [Actor] The scene's actor
|
99
|
-
# @yieldparam [Props::Default] The scene's props
|
100
|
-
# @yieldparam [Hash] Additional context
|
98
|
+
# @yieldparam actor [Actor] The scene's actor
|
99
|
+
# @yieldparam props [Props::Default] The scene's props
|
100
|
+
# @yieldparam context [Hash] Additional context
|
101
|
+
# @yieldreceiver [Narrative]
|
101
102
|
def on_start(&block)
|
102
103
|
start_blocks.push block
|
103
104
|
end
|
104
105
|
|
105
|
-
# @yieldparam [Actor] The scene's actor
|
106
|
-
# @yieldparam [Props::Default] The scene's props
|
107
|
-
# @yieldparam [Hash] Additional context
|
106
|
+
# @yieldparam actor [Actor] The scene's actor
|
107
|
+
# @yieldparam props [Props::Default] The scene's props
|
108
|
+
# @yieldparam context [Hash] Additional context
|
109
|
+
# @yieldreceiver [Narrative]
|
108
110
|
def on_finish(&block)
|
109
111
|
finish_blocks.push block
|
110
112
|
end
|
@@ -26,7 +26,7 @@ module Gamefic
|
|
26
26
|
# @param verbs [Array<Symbol>]
|
27
27
|
# @yieldparam [Actor]
|
28
28
|
# @yieldparam [Command]
|
29
|
-
# @
|
29
|
+
# @yieldreceiver [Object<self>]
|
30
30
|
def before_command(*verbs, &block)
|
31
31
|
before_commands.push(proc do |actor, command|
|
32
32
|
instance_exec(actor, command, &block) if verbs.empty? || verbs.include?(command.verb)
|
@@ -43,7 +43,7 @@ module Gamefic
|
|
43
43
|
# @param verbs [Array<Symbol>]
|
44
44
|
# @yieldparam [Actor]
|
45
45
|
# @yieldparam [Command]
|
46
|
-
# @
|
46
|
+
# @yieldreceiver [Object<self>]
|
47
47
|
def after_command(*verbs, &block)
|
48
48
|
after_commands.push(proc do |actor, command|
|
49
49
|
instance_exec(actor, command, &block) if verbs.empty? || verbs.include?(command.verb)
|
@@ -52,7 +52,7 @@ module Gamefic
|
|
52
52
|
|
53
53
|
# Define a callback to be executed after a scene starts.
|
54
54
|
#
|
55
|
-
# @
|
55
|
+
# @yieldreceiver [Object<self>]
|
56
56
|
def on_ready(&block)
|
57
57
|
ready_blocks.push block
|
58
58
|
end
|
@@ -61,14 +61,14 @@ module Gamefic
|
|
61
61
|
# a scene starts.
|
62
62
|
#
|
63
63
|
# @yieldparam [Actor]
|
64
|
-
# @
|
64
|
+
# @yieldreceiver [Object<self>]
|
65
65
|
def on_player_ready(&block)
|
66
66
|
ready_blocks.push(proc { players.each { |player| instance_exec(player, &block) } })
|
67
67
|
end
|
68
68
|
|
69
69
|
# Define a callback to be executed after a scene finishes.
|
70
70
|
#
|
71
|
-
# @
|
71
|
+
# @yieldreceiver [Object<self>]
|
72
72
|
def on_update(&block)
|
73
73
|
update_blocks.push block
|
74
74
|
end
|
@@ -77,7 +77,7 @@ module Gamefic
|
|
77
77
|
# a scene finishes.
|
78
78
|
#
|
79
79
|
# @yieldparam [Actor]
|
80
|
-
# @
|
80
|
+
# @yieldreceiver [Object<self>]
|
81
81
|
def on_player_update(&block)
|
82
82
|
update_blocks.push(proc { players.each { |player| instance_exec(player, &block) } })
|
83
83
|
end
|
@@ -97,7 +97,7 @@ module Gamefic
|
|
97
97
|
#
|
98
98
|
# @yieldparam [Actor]
|
99
99
|
# @yieldparam [Props::Output]
|
100
|
-
# @
|
100
|
+
# @yieldreceiver [Object<self>]
|
101
101
|
def on_player_output(&block)
|
102
102
|
player_output_blocks.push(block)
|
103
103
|
end
|
@@ -105,7 +105,7 @@ module Gamefic
|
|
105
105
|
# Define a callback that gets executed when a narrative reaches a
|
106
106
|
# conclusion.
|
107
107
|
#
|
108
|
-
# @
|
108
|
+
# @yieldreceiver [Object<self>]
|
109
109
|
def on_conclude(&block)
|
110
110
|
conclude_blocks.push(block)
|
111
111
|
end
|
@@ -117,7 +117,7 @@ module Gamefic
|
|
117
117
|
# narrative itself concluding.
|
118
118
|
#
|
119
119
|
# @yieldparam [Actor]
|
120
|
-
# @
|
120
|
+
# @yieldreceiver [Object<self>]
|
121
121
|
def on_player_conclude(&block)
|
122
122
|
player_conclude_blocks.push(block)
|
123
123
|
end
|
@@ -27,7 +27,7 @@ module Gamefic
|
|
27
27
|
# @param verb [Symbol, String, nil] An imperative verb for the command
|
28
28
|
# @param args [Array<Object>] Filters for the command's tokens
|
29
29
|
# @yieldparam [Gamefic::Actor]
|
30
|
-
# @
|
30
|
+
# @yieldreceiver [Object<self>]
|
31
31
|
# @return [Response]
|
32
32
|
def respond verb, *args, &proc
|
33
33
|
response = Response.new(verb&.to_sym, *args, &proc)
|
@@ -41,7 +41,7 @@ module Gamefic
|
|
41
41
|
# @param verb [Symbol, String, nil] An imperative verb for the command
|
42
42
|
# @param args [Array<Object>] Filters for the command's tokens
|
43
43
|
# @yieldparam [Gamefic::Actor]
|
44
|
-
# @
|
44
|
+
# @yieldreceiver [Object<self>]
|
45
45
|
# @return [Response]
|
46
46
|
def meta verb, *args, &proc
|
47
47
|
response = Response.new(verb&.to_sym, *args, meta: true, &proc)
|
@@ -44,6 +44,7 @@ module Gamefic
|
|
44
44
|
end
|
45
45
|
alias scene block
|
46
46
|
|
47
|
+
# @return [Array<Proc>]
|
47
48
|
def introductions
|
48
49
|
@introductions ||= []
|
49
50
|
end
|
@@ -84,6 +85,7 @@ module Gamefic
|
|
84
85
|
# end
|
85
86
|
#
|
86
87
|
# @param name [Symbol, nil]
|
88
|
+
# @yieldreceiver [Class<Scene::MultipleChoice>]
|
87
89
|
# @return [Class<Scene::MultipleChoice>]
|
88
90
|
def multiple_choice(name = nil, &block)
|
89
91
|
block Class.new(Scene::MultipleChoice, &block), name
|
data/lib/gamefic/version.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gamefic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.1.
|
4
|
+
version: 4.1.1
|
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-02
|
11
|
+
date: 2025-03-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: yard-solargraph
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.1'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.1'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: opal
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -112,6 +126,7 @@ files:
|
|
112
126
|
- ".rspec-opal"
|
113
127
|
- ".rubocop.yml"
|
114
128
|
- ".solargraph.yml"
|
129
|
+
- ".yardopts"
|
115
130
|
- CHANGELOG.md
|
116
131
|
- Gemfile
|
117
132
|
- LICENSE
|