inform-runtime 1.3.1 → 1.3.2

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: 1a9737a28a03ce80dd3698d1fc2824b22cb3090d4f0db6c3b52c84134e17a04c
4
- data.tar.gz: 30ea465986dd84a628280ffa63c83228e04689db657d26c1bf449a15a779165a
3
+ metadata.gz: ff0b544812291d9f9c2a5169ada547843704aa26f0a5ad0fdd82b1e914acba15
4
+ data.tar.gz: e3d011e11b4e3531054d3b4a83d199343541e44d57a770708d219a73ca40f668
5
5
  SHA512:
6
- metadata.gz: f0f82b48842ed1cb74515abf3e26d2aeadc1c29004177a556e819ff814c3ce7ee63cf8b4225f5a53a3bfa8102c6bfa2ad0a21ad4b2654518269535c9fc3eca0f
7
- data.tar.gz: e6122d69fc1a5fbbe2640709f567889a7d70d303740796883bec8ffb3001abd243b91597c02f12a7d31e9aac61de7e08b288cd648c9f784140e935279a2fb085
6
+ metadata.gz: 0c92163b72057f043cadce2abbcf7e79a20be080a51e9384289f44f62f5528738bc3c947e66758312b637c2042e480b092a342c2176bfbc0706389d49be636c2
7
+ data.tar.gz: 0e4355ed014b0e499e8e730d70ecf9b22ebaac3af317a5d6fc900ef528f819004526ee3004478e112e5c82221329fb4cb426b681e77c7b62aa1bb345269af17a
@@ -43,7 +43,6 @@ module StoryTeller
43
43
  environment: 'default',
44
44
  inform6lib_gem_code_prefix: 'inform',
45
45
  language: 'English',
46
- persist_player_location: false,
47
46
  properties: 'player actor action action_to_be ' \
48
47
  'results parameters pattern ' \
49
48
  'noun second inp1 inp2 ' \
@@ -60,16 +59,6 @@ module StoryTeller
60
59
  @libraries ||= {}
61
60
  end
62
61
 
63
- def persist_player_location?
64
- return @persist_player_location unless @persist_player_location.nil?
65
-
66
- default_config.fetch(:persist_player_location, false)
67
- end
68
-
69
- def persist_player_location=(value)
70
- @persist_player_location = value
71
- end
72
-
73
62
  def player_object
74
63
  @player_object || parser_selfobj
75
64
  end
@@ -107,26 +96,21 @@ module StoryTeller
107
96
  libraries[selfobj] = inform_library
108
97
  selfobj.inflib = inform_library if selfobj.respond_to?(:inflib=)
109
98
 
110
- ensure_player_location(inform_library) if persist_player_location?
99
+ seed_library_location(inform_library) if location_unset?(inform_library)
111
100
 
112
101
  inform_library
113
102
  end
114
103
 
115
- # rubocop: disable Metrics/CyclomaticComplexity
116
- def ensure_player_location(inflib)
117
- return unless persist_player_location?
118
- return if inflib.nil?
119
-
120
- existing_location = inflib.instance_variable_get(:@location)
121
- return unless existing_location.nil?
122
-
123
- player = inflib.selfobj
124
- location = player.location if player.respond_to?(:location)
125
- location ||= player.spawn_point if player.respond_to?(:spawn_point)
104
+ def seed_library_location(inflib)
105
+ player_obj = inflib.selfobj
106
+ location = player_obj.location if player_obj.respond_to?(:location)
126
107
 
127
108
  inflib.instance_variable_set(:@location, location) unless location.nil?
128
109
  end
129
- # rubocop: enable Metrics/CyclomaticComplexity
110
+
111
+ def location_unset?(inflib)
112
+ inflib&.instance_variable_get(:@location).nil?
113
+ end
130
114
 
131
115
  def parser_selfobj
132
116
  return nil unless defined?(Inform::Parser::SelfObj)
@@ -362,6 +362,10 @@ module Inform
362
362
  !StoryTeller::Privileges.privileged?(obj, :builder))
363
363
  end
364
364
 
365
+ def visible_to?(verb, actor)
366
+ verb.grammars.any? { |grammar| !guarded?(grammar, actor) }
367
+ end
368
+
365
369
  def role(obj)
366
370
  return :admin if StoryTeller::Privileges.privileged?(obj, :admin)
367
371
  return :builder if StoryTeller::Privileges.privileged?(obj, :builder)
@@ -38,7 +38,6 @@ module StoryTeller
38
38
  inflib = InformLibrary.new
39
39
  bind_inform_library(inflib, player)
40
40
  inflib.subscribe(inflib.selfobj)
41
- ensure_player_location(inflib) if StoryTeller::Engine.persist_player_location?
42
41
  inflib
43
42
  end
44
43
  end
@@ -26,17 +26,11 @@ module StoryTeller
26
26
  # module Location
27
27
  module Location
28
28
  def location
29
- return @location unless StoryTeller::Engine.persist_player_location?
30
-
31
29
  @player&.location || @location
32
30
  end
33
31
 
34
32
  def location=(obj)
35
- if StoryTeller::Engine.persist_player_location?
36
- @player.location = obj
37
- else
38
- @location = obj
39
- end
33
+ @player.location = @location = obj
40
34
  end
41
35
  end
42
36
 
@@ -764,6 +764,10 @@ module Rules
764
764
  page_index: 0, limit: 10, help: nil, done: :playing
765
765
  }.freeze
766
766
 
767
+ MORE_HELP_STRING = "Press Enter to show the next page.\n" +
768
+ "Type q or quit to stop paging and return to the command prompt.\n" +
769
+ "Type ? to show this help."
770
+
767
771
  # This method supports the MoreSub verb implementation.
768
772
  # rubocop: disable Metrics/AbcSize
769
773
  # rubocop: disable Metrics/CyclomaticComplexity
@@ -788,7 +792,7 @@ module Rules
788
792
 
789
793
  case input
790
794
  when /\?/
791
- println params[:help] || "<Help for More goes here>"
795
+ println params[:help] || MORE_HELP_STRING
792
796
  when /^(q|quit)$/
793
797
  @more = nil
794
798
  @prompt = nil
@@ -816,7 +820,6 @@ module Rules
816
820
  session.state = :more
817
821
  else
818
822
  new_line
819
- prompt nil
820
823
  session.state = params[:done]
821
824
  end
822
825
  end
@@ -23,7 +23,7 @@
23
23
  module StoryTeller
24
24
  # module Engine
25
25
  module Engine
26
- VERSION = '1.3.1'.freeze
26
+ VERSION = '1.3.2'.freeze
27
27
  end
28
28
  end
29
29
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inform-runtime
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.1
4
+ version: 1.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nels Nelson