inform-runtime 1.5.0 → 1.6.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.
@@ -23,6 +23,9 @@
23
23
  module StoryTeller
24
24
  # The StoryTeller::Library module
25
25
  module Library
26
+ class Memo < Array; end
27
+ VerbSubroutineReplacements = Memo.new
28
+
26
29
  # The StoryTeller::Library::Directives module
27
30
  module Directives
28
31
  InclusionGrammarGuessTemplate = '%<inclusion>s.h.inf.rb'.freeze
@@ -38,10 +41,12 @@ module StoryTeller
38
41
  # were ephemeral in nature.
39
42
  end
40
43
 
44
+ # rubocop: disable Metrics/AbcSize
45
+ # rubocop: disable Metrics/MethodLength
41
46
  def Include(inclusion)
42
- # warn "StoryTeller::Engine.Include(#{inclusion}) from #{caller_locations(1, 5).map { |l|
43
- # "#{l.path}:#{l.lineno}"
44
- # }.join(' | ')}"
47
+ log.debug "StoryTeller::Engine.Include(#{inclusion}) from #{caller_locations(1, 5).map do |l|
48
+ "#{l.path}:#{l.lineno}"
49
+ end.join(' | ')}"
45
50
  inclusion = StoryTeller::Engine.language_name if /^language__$/.match(inclusion)
46
51
  grammar_guess = format(InclusionGrammarGuessTemplate, inclusion: inclusion)
47
52
  guess = File.expand_path(
@@ -50,9 +55,35 @@ module StoryTeller
50
55
  StoryTeller::Engine.inform_code_prefix,
51
56
  grammar_guess))
52
57
  return StoryTeller::Library::Loader.load_grammar_by_path(guess) if File.exist?(guess)
53
- StoryTeller::Library::Loader.require_first_existing(
58
+ loaded_path = StoryTeller::Library::Loader.require_first_existing(
54
59
  format(InclusionGuessesTemplate, inclusion: inclusion).split)
60
+ StoryTeller::Engine.included_library(loaded_path)
61
+ loaded_path
62
+ end
63
+ # rubocop: enable Metrics/AbcSize
64
+ # rubocop: enable Metrics/MethodLength
65
+
66
+ # rubocop: disable Metrics/MethodLength
67
+ def Array(constant, *values)
68
+ inform_name = constant.to_sym
69
+ ruby_name = if constant.to_s.match?(/\A[A-Za-z0-9_]*\z/)
70
+ inform_name
71
+ else
72
+ constant.to_s.upcase.to_sym
73
+ end
74
+
75
+ log.debug "Setting constant ::Object.#{ruby_name} to #{values}"
76
+ log.debug " inform_name: #{inform_name}"
77
+ reset_constant(ruby_name, values, ::Object)
78
+
79
+ return values if inform_name == ruby_name
80
+
81
+ install_global_reader(inform_name, ruby_name, ::Object)
82
+ rescue StandardError => e
83
+ log.error "Unexpected error resetting constant #{constant}", e
84
+ nil
55
85
  end
86
+ # rubocop: enable Metrics/MethodLength
56
87
 
57
88
  def Attribute(attribute)
58
89
  StoryTeller::Library.declarations.add_attribute(attribute)
@@ -66,19 +97,66 @@ module StoryTeller
66
97
  end
67
98
  end
68
99
 
69
- def Default(property, value)
70
- Constant(property, value)
100
+ # rubocop: disable Metrics/MethodLength
101
+ def Default(property, value, target = ::Object)
102
+ inform_name = property.to_sym
103
+ ruby_name = if property.to_s.match?(/\A[A-Z][A-Za-z0-9_]*\z/)
104
+ inform_name
105
+ else
106
+ property.to_s.upcase.to_sym
107
+ end
108
+
109
+ value = begin
110
+ target.const_get(ruby_name)
111
+ rescue RuntimeError => _e
112
+ # Ignore error
113
+ value
114
+ rescue StandardError => _e
115
+ # Ignore error
116
+ value
117
+ end
118
+
119
+ reset_constant(ruby_name, value, target) unless value.nil?
120
+
121
+ return value if inform_name == ruby_name
122
+
123
+ install_global_reader(inform_name, ruby_name, target)
124
+ rescue StandardError => e
125
+ log.error "Unexpected error resetting default #{property}", e
126
+ nil
71
127
  end
128
+ # rubocop: enable Metrics/MethodLength
72
129
 
73
- def Constant(constant, value, target = ::Object)
74
- return if constant.nil?
75
- silence_warnings do
76
- target.instance_eval { const_set(constant.to_sym, value) }
130
+ # rubocop: disable Metrics/MethodLength
131
+ def Constant(constant, value = nil, target = ::Object)
132
+ inform_name = constant.to_sym
133
+ ruby_name = if constant.to_s.match?(/\A[A-Z][A-Za-z0-9_]*\z/)
134
+ inform_name
135
+ else
136
+ constant.to_s.upcase.to_sym
77
137
  end
138
+
139
+ log.debug "Setting constant #{target}.#{ruby_name} to #{value}"
140
+ log.debug " inform_name: #{inform_name}"
141
+ reset_constant(ruby_name, value, target)
142
+
143
+ return value if inform_name == ruby_name
144
+
145
+ install_global_reader(inform_name, ruby_name, target)
78
146
  rescue StandardError => e
79
147
  log.error "Unexpected error resetting constant #{constant}", e
80
148
  nil
81
149
  end
150
+ # rubocop: enable Metrics/MethodLength
151
+
152
+ def install_global_reader(inform_name, ruby_name, target = ::Object)
153
+ reader = -> { target.instance_eval { const_get(ruby_name) } }
154
+
155
+ Kernel.define_method(inform_name, &reader)
156
+ Kernel.send(:private, inform_name)
157
+
158
+ InformLibrary.define_method(inform_name, &reader) if defined?(InformLibrary)
159
+ end
82
160
 
83
161
  def import_global(symbol)
84
162
  StoryTeller::Library.declarations.add_global(symbol)
@@ -55,9 +55,11 @@ module StoryTeller
55
55
  if File.exist?(guessed_local_file_path)
56
56
  log.debug "Loading local library file: #{guessed_local_file_path}"
57
57
  require_relative guessed_local_file_path
58
+ return guessed_local_file_path
58
59
  else
59
60
  log.debug "Loading library: #{guessed_file_path}"
60
61
  require guessed_file_path
62
+ return guessed_file_path
61
63
  end
62
64
  rescue StandardError => e
63
65
  log.error e.message
@@ -26,7 +26,7 @@ module StoryTeller
26
26
  # module Location
27
27
  module Location
28
28
  def location
29
- @player&.location || @location
29
+ @location
30
30
  end
31
31
 
32
32
  def location=(obj)
@@ -19,7 +19,6 @@
19
19
  # You should have received a copy of the GNU General Public License
20
20
  # along with the StoryTeller. If not, see <http://www.gnu.org/licenses/>.
21
21
 
22
- require_relative 'library/bootstrap'
23
22
  require_relative 'library/declarations'
24
23
  require_relative 'library/directives'
25
24
  require_relative 'library/loader'
@@ -165,26 +165,29 @@ class Logger
165
165
  end
166
166
  end
167
167
 
168
- # Add extra severity to the standard Logger class.
169
- # Also add support for including backtraces implicitly.
170
- class ExtraLogger < Logger
171
- alias original_error error
172
- def error(error_or_message = nil, error = nil, &block)
173
- return log_error(error_or_message, &block) if error.nil?
174
-
175
- original_error(TraceHelpers.generate_message(error_or_message, error))
176
- TraceHelpers.extract_backtrace(error, []).each do |trace|
177
- original_error(trace) unless trace.nil?
168
+ # module LoggerErrorBacktrace
169
+ module LoggerErrorBacktrace
170
+ def error(message = nil, error = nil, &block)
171
+ if message.respond_to?(:message)
172
+ error = message
173
+ message = error.message
178
174
  end
179
- end
180
175
 
181
- def log_error(error_or_message = nil, &block)
182
- original_error(error_or_message, &block)
183
- TraceHelpers.extract_backtrace(error_or_message, []).each do |trace|
184
- original_error(trace) unless trace.nil?
176
+ result = super(message, &block)
177
+
178
+ TraceHelpers.extract_backtrace(error)&.each do |trace|
179
+ add(Logger::ERROR, trace)
185
180
  end
181
+
182
+ result
186
183
  end
184
+ end
185
+
186
+ Logger.include(LoggerErrorBacktrace)
187
187
 
188
+ # Add extra severity to the standard Logger class.
189
+ # Also add support for including backtraces implicitly.
190
+ module TraceLogging
188
191
  SEV_LABEL_EXTRA = (Logger::SEV_LABEL + %w(TRACE)).freeze
189
192
  def format_severity(severity)
190
193
  SEV_LABEL_EXTRA[severity] || super
@@ -195,6 +198,8 @@ class ExtraLogger < Logger
195
198
  end
196
199
  end
197
200
 
201
+ Logger.include(TraceLogging)
202
+
198
203
  # The LoggingHelpers module
199
204
  module LoggingHelpers
200
205
  if defined?(Java)
@@ -221,7 +226,7 @@ module LoggingHelpers
221
226
  def init_ruby_logger(obj, level = nil, logger_name = nil, source_location = nil)
222
227
  logger_name = get_formatted_logger_name(obj, logger_name)
223
228
  logger_name = source_location.split(FORWARD_SLASH_PATTERN).last if logger_name.empty?
224
- log = ExtraLogger.new($stdout, progname: logger_name)
229
+ log = Logger.new($stdout, progname: logger_name)
225
230
  log.level = normalize_ruby_log_level(level) unless level.nil?
226
231
  log.formatter = method(:ruby_log_formatter)
227
232
  log
@@ -243,6 +243,34 @@ class FalseClass
243
243
  end
244
244
  end
245
245
 
246
+ # module Inform
247
+ module Inform
248
+ # module English
249
+ module English
250
+ TensNumerals = {
251
+ 20 => 'twenty', 30 => 'thirty', 40 => 'forty', 50 => 'fifty',
252
+ 60 => 'sixty', 70 => 'seventy', 80 => 'eighty', 90 => 'ninety'
253
+ }.freeze
254
+ EnglishNumbersLanguage = {
255
+ 1 => 'one', 2 => 'two', 3 => 'three', 4 => 'four', 5 => 'five',
256
+ 6 => 'six', 7 => 'seven', 8 => 'eight', 9 => 'nine', 10 => 'ten',
257
+ 11 => 'eleven', 12 => 'twelve', 13 => 'thirteen', 14 => 'fourteen', 15 => 'fifteen',
258
+ 16 => 'sixteen', 17 => 'seventeen', 18 => 'eighteen', 19 => 'nineteen', 20 => 'twenty'
259
+ }.freeze
260
+ OrdinalNumerals = {
261
+ 'zero' => 'zeroth', 'one' => 'first', 'two' => 'second', 'three' => 'third',
262
+ 'four' => 'fourth', 'five' => 'fifth', 'six' => 'sixth', 'seven' => 'seventh',
263
+ 'eight' => 'eighth', 'nine' => 'ninth', 'ten' => 'tenth', 'eleven' => 'eleventh',
264
+ 'twelve' => 'twelfth', 'thirteen' => 'thirteenth', 'fourteen' => 'fourteenth',
265
+ 'fifteen' => 'fifteenth', 'sixteen' => 'sixteenth', 'seventeen' => 'seventeenth',
266
+ 'eighteen' => 'eighteenth', 'nineteen' => 'nineteenth', 'twenty' => 'twentieth',
267
+ 'thirty' => 'thirtieth', 'forty' => 'fortieth', 'fifty' => 'fiftieth',
268
+ 'sixty' => 'sixtieth', 'seventy' => 'seventieth', 'eighty' => 'eightieth',
269
+ 'ninety' => 'ninetieth'
270
+ }.freeze
271
+ end
272
+ end
273
+
246
274
  # The Numeric class
247
275
  class Numeric
248
276
  def commas(delimiter = ',')
@@ -250,6 +278,69 @@ class Numeric
250
278
  parts[0].gsub!(/(\d)(?=(\d\d\d)+(?!\d))/, format(JoinedTemplate, str: '\1', other: delimiter))
251
279
  parts.join('.')
252
280
  end
281
+
282
+ def to_cardinal_numerals(language: Inform::English)
283
+ return self.to_s unless is_a?(Integer) && self >= 0
284
+ cardinal_integer(self, language)
285
+ end
286
+
287
+ def to_ordinal_numerals(language: Inform::English)
288
+ parts = decimal_numeral_parts
289
+ return self.to_s if parts.nil?
290
+
291
+ integer, fraction = parts
292
+ ordinal = ordinal_integer(integer, language)
293
+ return ordinal if fraction.nil?
294
+ "#{ordinal} point #{decimal_digits(fraction, language)}"
295
+ end
296
+
297
+ private
298
+
299
+ def decimal_numeral_parts
300
+ integer, fraction = self.to_s.split('.', 2)
301
+ return unless /\A[+-]?\d+\z/.match?(integer)
302
+ return unless fraction.nil? || /\A\d+\z/.match?(fraction)
303
+ [integer, fraction]
304
+ end
305
+
306
+ def cardinal_integer(value, language)
307
+ return 'zero' if value == 0
308
+ return language::EnglishNumbersLanguage.fetch(value) if value <= 20
309
+ return cardinal_under_hundred(value, language) if value < 100
310
+ return cardinal_under_thousand(value, language) if value < 1000
311
+ cardinal_thousands(value, language)
312
+ end
313
+
314
+ def ordinal_integer(integer, language)
315
+ ordinal = cardinal_integer(integer.delete_prefix('-').delete_prefix('+').to_i, language)
316
+ ordinal = ordinal.sub(/([a-z]+)\z/) { |word| language::OrdinalNumerals.fetch(word, "#{word}th") }
317
+ integer.start_with?('-') ? "minus #{ordinal}" : ordinal
318
+ end
319
+
320
+ def decimal_digits(fraction, language)
321
+ fraction.chars.map { |digit| cardinal_integer(digit.to_i, language) }.join(' ')
322
+ end
323
+
324
+ def cardinal_under_hundred(value, language)
325
+ tens, ones = value.divmod(10)
326
+ return language::TensNumerals.fetch(tens * 10) if ones == 0
327
+ "#{language::TensNumerals.fetch(tens * 10)}-#{cardinal_integer(ones, language)}"
328
+ end
329
+
330
+ def cardinal_under_thousand(value, language)
331
+ hundreds, remainder = value.divmod(100)
332
+ result = "#{cardinal_integer(hundreds, language)} hundred"
333
+ return result if remainder == 0
334
+ "#{result} and #{cardinal_integer(remainder, language)}"
335
+ end
336
+
337
+ def cardinal_thousands(value, language)
338
+ thousands, remainder = value.divmod(1000)
339
+ result = "#{cardinal_integer(thousands, language)} thousand"
340
+ return result if remainder == 0
341
+ separator = remainder < 100 ? ' and ' : ', '
342
+ "#{result}#{separator}#{cardinal_integer(remainder, language)}"
343
+ end
253
344
  end
254
345
 
255
346
  # The Integer class
@@ -493,6 +584,10 @@ class Array
493
584
  end
494
585
  end
495
586
 
587
+ def second
588
+ self[1]
589
+ end
590
+
496
591
  def to_sentence(conjunction = 'and')
497
592
  case length
498
593
  when 0 then ''
@@ -27,6 +27,12 @@ module Inform
27
27
  Thread.current[:event]
28
28
  end
29
29
 
30
+ def inflib
31
+ return @inflib unless @inflib.nil?
32
+
33
+ context_event&.cause
34
+ end
35
+
30
36
  def instance_variables_map
31
37
  instance_variables.each_with_object({}) do |key, memo|
32
38
  memo[key] = instance_variable_get(key)
@@ -134,8 +140,8 @@ module Inform
134
140
  frame = [object_id, method]
135
141
 
136
142
  if stack.include?(frame)
137
- raise NoMethodError, "Aborting Prototypical missing method " \
138
- "resolution #{self.class}##{method} on #{inspect}"
143
+ raise NoMethodError, "Aborting Prototypical missing method resolution " +
144
+ "#{self.class}##{method} on #{inspect}"
139
145
  end
140
146
 
141
147
  stack << frame
@@ -366,18 +372,18 @@ module Inform
366
372
  elsif values.first.nil? && self.respond_to?(:_key?) && self._key?(key)
367
373
  result = self._unset_object(key) if self.respond_to?(:_unset_object)
368
374
  elsif values.first.nil?
369
- self.will_change_column(:properties) if self.respond_to?(:will_change_column)
370
375
  self.properties.delete(property_key_for(key))
376
+ self.modified!(:properties) if self.respond_to?(:modified!)
371
377
  self.save_changes if self.respond_to?(:save_changes)
372
378
  elsif values.length > 1
373
- self.will_change_column(:properties) if self.respond_to?(:will_change_column)
374
379
  self.properties[key] = []
375
380
  self.properties[key].concat(values)
376
381
  values.clear
382
+ self.modified!(:properties) if self.respond_to?(:modified!)
377
383
  self.save_changes if self.respond_to?(:save_changes)
378
384
  else
379
- self.will_change_column(:properties) if self.respond_to?(:will_change_column)
380
385
  self.properties[key] = values.first
386
+ self.modified!(:properties) if self.respond_to?(:modified!)
381
387
  self.save_changes if self.respond_to?(:save_changes)
382
388
  end
383
389
  result || self.properties.dup[property_key_for(key)]
@@ -185,6 +185,7 @@ class Session
185
185
 
186
186
  # These states accept any input, including no input
187
187
  Promiscuous = Set.new
188
+ class BadStateError < StandardError; end
188
189
 
189
190
  # rubocop: disable Metrics/MethodLength
190
191
  def initialize(channel = nil, machine: nil, player: nil, state: :playing, settings: {})
@@ -211,7 +212,7 @@ class Session
211
212
  @outbound = sink
212
213
  end
213
214
 
214
- def write_output(value)
215
+ def write(value)
215
216
  @output.write(value)
216
217
  end
217
218
 
@@ -272,15 +273,6 @@ class Session
272
273
  @outbound.reset
273
274
  end
274
275
 
275
- def init_channel_session(channel)
276
- Session[channel] = self
277
- @channel = channel
278
- @inbound = Inbound.new(self) if defined?(Inbound)
279
- @output = OutputBuffer.new
280
- @outbound = @output
281
- @last_activity = Time.now
282
- end
283
-
284
276
  def control(player)
285
277
  self.class.release_player(@player, self)
286
278
  @player = player
@@ -341,8 +333,11 @@ class Session
341
333
  drain_output
342
334
  end
343
335
 
344
- def safely_progress(machine = self)
345
- @state = machine.public_send(@state)
336
+ # def safely_progress(machine = self, state = machine.public_send(@state))
337
+ def safely_progress(machine = self, state = nil)
338
+ state ||= machine.public_send(@state)
339
+ raise BadStateError, "Bad state: #{state}" unless state.is_a? Symbol
340
+ @state = state
346
341
  raise 'Bad state machine implementation: nil state' if @state.nil?
347
342
  rescue StandardError => e
348
343
  log.error "Error updating state: #{e.message}", e
@@ -21,6 +21,8 @@
21
21
 
22
22
  require_relative 'version'
23
23
 
24
+ VN_1610 = '1610'.freeze
25
+
24
26
  # The Inform module
25
27
  module Inform
26
28
  # Support WriteListFrom implementations that prefer to skip animate objects
@@ -114,13 +116,13 @@ module StdLib
114
116
  end
115
117
 
116
118
  def location
117
- @player.location
119
+ @location
118
120
  end
119
121
 
120
122
  def location=(o)
121
123
  log.warn "Trying to set the location directly"
122
124
  log.warn caller[1] and abort
123
- @player.location = o
125
+ @location = @player.location = o
124
126
  end
125
127
 
126
128
  def area
@@ -137,18 +139,6 @@ module StdLib
137
139
 
138
140
  def StatusLineHeight; end
139
141
 
140
- def ScoreSub
141
- false
142
- end
143
-
144
- def FullScoreSub
145
- false
146
- end
147
-
148
- def DisplayStatus
149
- false
150
- end
151
-
152
142
  def Message(*args)
153
143
  println(args[:fatalerror] || args.values.first)
154
144
  end
@@ -187,6 +177,7 @@ module StdLib
187
177
  ctx.results[2],
188
178
  ctx.results[3]
189
179
  ]
180
+ ctx.player = player
190
181
  ctx.actor = player
191
182
  ctx.special_number1 = ctx.special_number2 = nil
192
183
  ctx.special_number1 = ctx.results[2] if ctx.results[2].number?
@@ -202,50 +193,80 @@ module StdLib
202
193
  # rubocop: enable Metrics/AbcSize
203
194
  # rubocop: enable Metrics/MethodLength
204
195
 
205
- # The invoke method executes without prompting afterward
196
+ # The perform_action method causes the given action to be executed
197
+ # while intending that the original action routine resumes
198
+ # execution where perform_action was called.
199
+ #
200
+ # The perform_action method executes without prompting afterward
206
201
  # but appends the output to the contextual event's buffer
207
202
  # which will be displayed upon completion of the contextual
208
203
  # event.
209
204
  #
205
+ # See: https://inform-fiction.org/manual/html/s6.html
206
+ #
210
207
  # TODO: Test: Does this mean that invoke must always be executed
211
208
  # within an event context to have its output displayed?
212
209
  # !rubocop: disable Metrics/AbcSize
213
- def invoke(action, *args)
210
+ def perform_action(action, *args)
214
211
  raise "The action parameter may not be nil" if action.nil?
215
212
 
216
213
  # log.debug 'Invocation: ' + name(@player) + ' <' + action + (args.empty? ? '' : ' ') + args.to_s + '>'
217
214
  ctx = invocation_context(action, *args)
215
+
216
+ Inform::Context.get.members.each do |attr|
217
+ instance_variable_set("@#{attr}", ctx.send(attr))
218
+ end
219
+
218
220
  immediately(ctx) do
219
- if BeforeRoutines(action) == false
220
- send(VerbRoutine(action))
221
- end
221
+ # elementally(ctx) do
222
+ R_Process(action, args.first, args.second)
222
223
  end
223
224
  end
224
225
  # !rubocop: enable Metrics/AbcSize
225
-
226
- # Under invoke execute a routine but tries to prevent
227
- # any output at all and does not provide other objects
228
- # the opportunity to react to the action, like invoke
229
- # does, above.
226
+ alias invoke perform_action
227
+
228
+ # Divert from the current action to the given action, and
229
+ # return true. The invoking routine method is also expected
230
+ # to also immediately return true, to maintain fidelity to
231
+ # the original Inform 6 functionality. (Unfortunately, there
232
+ # is no way to implement this in Ruby, so every place where
233
+ # divert_to_action is called will have to return on its own.)
230
234
  #
231
235
  # This should be used to cause an action outcome during
232
236
  # the execution of another Verb action subroutine. It
233
237
  # should appear as if the invoked action is part of the
234
238
  # original action.
239
+ #
240
+ # The Inform 6 designer's manual explains using the example of
241
+ # a "steps" object which defines a before Search rule, so that
242
+ # the statement <<Enter self>> will generate the action Enter
243
+ # steps instead, and return true to stop the original Search
244
+ # action from going any further. The net effect is that one
245
+ # action has been diverted into another.
246
+ #
247
+ # See: https://inform-fiction.org/manual/html/s6.html
248
+ #
235
249
  # !rubocop: disable Metrics/AbcSize
236
- def _invoke(action, *args)
250
+ def divert_to_action(action, *args)
237
251
  raise "The action parameter may not be nil" if action.nil?
238
252
 
239
- # log.debug 'Invocation: ' + name(@player) + ' <<' + action + (args.empty? ? '' : ' ') + args.to_s + '>>'
253
+ # log.debug 'Diverting to action: ' + name(@player) + ' <<' + action + (args.empty? ? '' : ' ') + args.to_s + '>>'
254
+ perform_action(action, *args)
255
+ true
256
+ end
257
+ alias _invoke divert_to_action
258
+ # !rubocop: enable Metrics/AbcSize
259
+
260
+ # TODO: Testme (2026-09-13)
261
+ # It's unclear if this method is needed, but if it is, it is
262
+ # almost certainly only required within a multiplayer realtime
263
+ # context.
264
+ def proxy(action, *args)
240
265
  ctx = invocation_context(action, *args)
241
- elementally(ctx) do
242
- silently do
243
- send(VerbRoutine(action))
244
- end
266
+ immediately(ctx) do
267
+ perform_action(action, *args)
245
268
  end
246
269
  end
247
- # !rubocop: enable Metrics/AbcSize
248
- alias silently_invoke _invoke
249
270
 
250
271
  # rubocop: disable Metrics/AbcSize
251
272
  # rubocop: disable Metrics/CyclomaticComplexity
@@ -321,7 +342,7 @@ module StdLib
321
342
  return false unless ReactionHandlers.include?(prop)
322
343
  # TODO: Only apply Behavior modules if object is not being controlled
323
344
  # by a player.
324
- obj.apply_modules if obj.respond_to?(:apply_modules)
345
+ obj.apply_modules! if obj.respond_to?(:apply_modules!)
325
346
  si = obj.inflib
326
347
  obj.inflib = self
327
348
 
@@ -452,6 +473,16 @@ module StdLib
452
473
  # rubocop: enable Metrics/CyclomaticComplexity
453
474
  # rubocop: enable Metrics/PerceivedComplexity
454
475
  # rubocop: enable Style/ReturnNilInPredicateMethodDefinition
476
+
477
+ def parser_error(e, message)
478
+ log.error "Error parsing user command: #{e.class}: #{e}"
479
+ e.backtrace.each { |t| log.error t }
480
+ log.error " parser: #{self.identity}"
481
+ log.error " input: #{@input}"
482
+ log.error " actor: #{@actor}"
483
+ log.error " action: #{@action}"
484
+ message
485
+ end
455
486
  end
456
487
  # module StdLib
457
488
 
@@ -651,7 +682,7 @@ module Rules
651
682
 
652
683
  # rubocop: disable Metrics/MethodLength
653
684
  def yesorno?
654
- reset_io # TODO: Remove this. Why is the buffer getting a newline character added to it?
685
+ # reset_io # TODO: Remove this. Why is the buffer getting a newline character added to it?
655
686
  case @buffer.split.first
656
687
  when /^(y|yes)$/i
657
688
  println(resume)
@@ -23,12 +23,11 @@
23
23
  module StoryTeller
24
24
  # module Engine
25
25
  module Engine
26
- VERSION = '1.5.0'.freeze
26
+ VERSION = '1.6.2'.freeze
27
27
  end
28
28
  end
29
29
 
30
30
  # module Inform
31
31
  module Inform
32
32
  VERSION = StoryTeller::Engine::VERSION
33
- VN_1610 = '1610'.freeze
34
33
  end
@@ -21,7 +21,6 @@
21
21
 
22
22
  require_relative 'inform/models'
23
23
  require_relative 'tree'
24
- require_relative 'daemon'
25
24
 
26
25
  # module Inform
27
26
  module Inform
@@ -34,7 +33,6 @@ module Inform
34
33
  include StoryTeller::Builtins
35
34
  include StoryTeller::IO if defined?(StoryTeller::IO)
36
35
  include StoryTeller::Publisher if defined?(StoryTeller::Publisher)
37
- include StoryTeller::Daemons if defined?(StoryTeller::Daemons)
38
36
  include Inform::Context if defined?(Inform::Context)
39
37
  include Inform::Events if defined?(Inform::Events)
40
38
  include Inform::Prototypical if defined?(Inform::Prototypical)