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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ac6d80d81bfdeb6188299d401d4e728585cbf02143eb78685c9d1b4c24fc7d66
4
- data.tar.gz: 89187ba8fb00f0bb105bbb2418836efe24b003c77c4b30e1b3d511609da11870
3
+ metadata.gz: 5bdd4083848db339cdeafce5c791e3ac5481b0a429b36a26a67209c87cc93084
4
+ data.tar.gz: c3e6ea2b838f838562fef6a6d8459744c130acf122f628801ec5baecef1ccbe7
5
5
  SHA512:
6
- metadata.gz: 2b03ed10e8d213f68d3de7eab1425e234b2bbdfdc95bf3c9da4e3095645c5944424979fa964c75fbf0089d225f5896149c1dbab63acec7c79cf5d5c680910658
7
- data.tar.gz: 8710c4cbc2d574acc8ef82d4884fc5b19a3c0554293b0cbe634737b384292a8dbcee1df9a67d830901fbc7c1586a7b9f20f65f3f7ec795b8d12bf0ec38c6cfb8
6
+ metadata.gz: 2824bc22bbfec5bc22fa8ffe65844251996e0d82f62055db20561fc2f931a7f71916cc7f51ce983c39f1fd4eefecb306b3f8f34a4c75a6d23cf79e362f5200e5
7
+ data.tar.gz: 10e80aa12837436a43bbfe1e87f5c4ed6c8306ded60aa149fb3feaf6fc6160e6ec64b934d2b1ed2895d9adf4c64778ac5c0bf44d4afb5bbfbe3e4f9f5aa02697
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 4.0.0 - January 25, 2025
2
+ - Update to Gamefic 4.0
3
+
1
4
  ## 3.0.1 - September 10, 2024
2
5
  - Skip empty options in output
3
6
 
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', '~> 3.0'
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'
@@ -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.ready
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 @plot.concluding?
28
- @user.update @character.output
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
- @plot.update
47
- @plot.ready
50
+ narrator.finish
51
+ narrator.start
48
52
  end
49
53
 
50
54
  private
51
55
 
52
56
  def send_and_receive
53
- @user.update @character.output
54
- return unless @character.queue.empty?
57
+ user.update character.output
58
+ return unless character.queue.empty?
55
59
 
56
- @character.queue.push @user.query("#{@character.output[:prompt]} ")
60
+ character.queue.push user.query("#{character.output[:prompt]} ")
57
61
  end
58
62
  end
59
63
  end
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Gamefic
2
4
  module Tty
3
- VERSION = '3.0.1'.freeze
5
+ VERSION = '4.0.0'
4
6
  end
5
7
  end
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: 3.0.1
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: 2024-09-10 00:00:00.000000000 Z
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: '3.0'
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: '3.0'
26
+ version: '4.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: html_to_ansi
29
29
  requirement: !ruby/object:Gem::Requirement