gamefic-tty 3.0.1 → 4.0.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 +3 -0
- data/gamefic-tty.gemspec +1 -1
- data/lib/gamefic-tty/engine.rb +12 -8
- data/lib/gamefic-tty/version.rb +3 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5bdd4083848db339cdeafce5c791e3ac5481b0a429b36a26a67209c87cc93084
|
4
|
+
data.tar.gz: c3e6ea2b838f838562fef6a6d8459744c130acf122f628801ec5baecef1ccbe7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2824bc22bbfec5bc22fa8ffe65844251996e0d82f62055db20561fc2f931a7f71916cc7f51ce983c39f1fd4eefecb306b3f8f34a4c75a6d23cf79e362f5200e5
|
7
|
+
data.tar.gz: 10e80aa12837436a43bbfe1e87f5c4ed6c8306ded60aa149fb3feaf6fc6160e6ec64b934d2b1ed2895d9adf4c64778ac5c0bf44d4afb5bbfbe3e4f9f5aa02697
|
data/CHANGELOG.md
CHANGED
data/gamefic-tty.gemspec
CHANGED
@@ -36,7 +36,7 @@ Gem::Specification.new do |spec|
|
|
36
36
|
# spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
37
37
|
spec.require_paths = ['lib']
|
38
38
|
|
39
|
-
spec.add_runtime_dependency 'gamefic', '~>
|
39
|
+
spec.add_runtime_dependency 'gamefic', '~> 4.0'
|
40
40
|
spec.add_runtime_dependency 'html_to_ansi', '~> 0.2.0'
|
41
41
|
|
42
42
|
spec.add_development_dependency 'bundler', '~> 2.0'
|
data/lib/gamefic-tty/engine.rb
CHANGED
@@ -12,20 +12,24 @@ module Gamefic
|
|
12
12
|
# @return [Character]
|
13
13
|
attr_reader :character
|
14
14
|
|
15
|
+
# @return [Narrator]
|
16
|
+
attr_reader :narrator
|
17
|
+
|
15
18
|
# @param plot [Plot]
|
16
19
|
# @param user [User]
|
17
20
|
def initialize(plot: Gamefic::Plot.new, user: Gamefic::Tty::User.new)
|
18
21
|
@plot = plot
|
19
22
|
@user = user
|
20
23
|
@character = @plot.introduce
|
21
|
-
@plot
|
24
|
+
@narrator = Gamefic::Narrator.new(plot)
|
25
|
+
narrator.start
|
22
26
|
end
|
23
27
|
|
24
28
|
# Run the plot to its conclusion.
|
25
29
|
#
|
26
30
|
def run
|
27
|
-
turn until
|
28
|
-
|
31
|
+
turn until narrator.concluding?
|
32
|
+
user.update character.output
|
29
33
|
end
|
30
34
|
|
31
35
|
# Create an engine and run the plot.
|
@@ -43,17 +47,17 @@ module Gamefic
|
|
43
47
|
#
|
44
48
|
def turn
|
45
49
|
send_and_receive
|
46
|
-
|
47
|
-
|
50
|
+
narrator.finish
|
51
|
+
narrator.start
|
48
52
|
end
|
49
53
|
|
50
54
|
private
|
51
55
|
|
52
56
|
def send_and_receive
|
53
|
-
|
54
|
-
return unless
|
57
|
+
user.update character.output
|
58
|
+
return unless character.queue.empty?
|
55
59
|
|
56
|
-
|
60
|
+
character.queue.push user.query("#{character.output[:prompt]} ")
|
57
61
|
end
|
58
62
|
end
|
59
63
|
end
|
data/lib/gamefic-tty/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gamefic-tty
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.0.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:
|
11
|
+
date: 2025-01-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gamefic
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '4.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '4.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: html_to_ansi
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|