inform6lib 0.1.5 → 0.1.6

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: fc0a615fe20b2f83055cddf811f048a2a49484ffadf36f6530484f17dff94ee6
4
- data.tar.gz: 68f0f81e22933676a396445659d4e5ab73caadc799612c1e67f21036ad4aefa8
3
+ metadata.gz: a40c23e7e9dcb8a291939c84699bdb885ca9101117b214875ec1ac6019ca486a
4
+ data.tar.gz: 500c0ba61643ccfd81a11ba98aac6a1152a59e644b5a871f1ffdbdc4fdfee4ec
5
5
  SHA512:
6
- metadata.gz: d8240c06d833b2ccdf0e0051a5e61c774c40178d919e9a39029d6935157e7d0b72b8553efaa11cc80f7ee9c1a65b28ec763ac4b2d92f56b536df7ed0ae230047
7
- data.tar.gz: 312174cb06f649bc4d8e192fe901bfdf97b9a72d7d679bdbc6d9bbf9d9855d305ee01388cfd92706a8a7e71c7360cdf6da19d8c95ed583f65a12a96b26dd8e14
6
+ metadata.gz: c2ab599b6af58b719f1e24bdb5ed7ac08ece5139139499bf50f8817380c0e3ed4e7a67b38d5b5a17c17bf18760411a1086d3d2412981f419f886e96b3cfc7c3c
7
+ data.tar.gz: be343e7f21440e7c127b3ff51c53c7d558bab0032767aa218a95b88e289eb2cfc1b9797508bba8df9e21a0aa0348fc3251568b4577d48c535e4ee6512ae0de25
@@ -5062,14 +5062,23 @@ class InformLibrary < Inform::Ephemeral::Object
5062
5062
  @player.unmute if @player.respond_to?(:unmute) && deadflag != 0
5063
5063
  enqueue(command: @buffer.dup)
5064
5064
 
5065
- if deadflag != 0
5066
- log.debug "#{@player} is entering the death state" # TODO: Remove
5067
- :death
5068
- end
5065
+ return session.state if deadflag == 0 && respond_to?(:session) && !session.nil?
5066
+ return __method__ if deadflag == 0
5069
5067
 
5070
- return session.state if respond_to?(:session) && !session.nil?
5068
+ AfterLife() if deadflag != 2
5069
+ return :playing if deadflag == 0
5070
+
5071
+ OBIT_HEAD()
5072
+ println ScoreSub()
5073
+ DisplayStatus()
5074
+ log.debug "#{@player} is entering the death state" # TODO: Remove
5075
+ RRQPL()
5076
+ end
5077
+
5078
+ def death
5079
+ return :playing if deadflag == 0
5071
5080
 
5072
- __method__
5081
+ AfterGameOver()
5073
5082
  end
5074
5083
 
5075
5084
  def stop
@@ -5110,37 +5119,26 @@ class InformLibrary < Inform::Ephemeral::Object
5110
5119
 
5111
5120
  @results = [nil, 0, nil, nil]; @meta = false
5112
5121
 
5113
- # i = 0
5114
- # catch(:continue) do
5115
- # rubocop: disable Lint/UnreachableLoop
5116
- while @deadflag == 0 # everything happens in this loop
5117
- return very__late__error()
5118
- end
5119
- # rubocop: enable Lint/UnreachableLoop
5120
- # end
5122
+ return late__error() if @deadflag == 0
5123
+
5121
5124
  AfterLife() if deadflag != 2
5122
- return very__late__error if deadflag == 0
5125
+ if deadflag == 0
5126
+ very__late__error()
5127
+ return late__error()
5128
+ end
5123
5129
 
5124
5130
  OBIT_HEAD()
5125
- ScoreSub()
5131
+ println ScoreSub()
5126
5132
  DisplayStatus()
5127
- AfterGameOver()
5133
+ RRQPL()
5128
5134
  end
5129
5135
 
5130
5136
  def very__late__error
5131
- if @score != @last_score
5132
- NotifyTheScore() if @notify_mode == true
5133
- @last_score = @score
5134
- end
5135
- late__error()
5136
- rescue NoVerbRoutine, NotImplemented
5137
- "Sorry, that action is not yet implemented."
5138
- rescue NoMethodError => e
5139
- parser_error e, "Sorry, there was a program error involving a missing method."
5140
- rescue TypeError => e
5141
- parser_error e, "Sorry, there was a program error involving the wrong type of object."
5142
- rescue StandardError => e
5143
- parser_error e, "Sorry, there was an unhandled program error."
5137
+ return if @deadflag != 0
5138
+ return if @score == @last_score
5139
+
5140
+ NotifyTheScore() if @notify_mode == true
5141
+ @last_score = @score
5144
5142
  end
5145
5143
 
5146
5144
  def late__error
@@ -5272,6 +5270,14 @@ class InformLibrary < Inform::Ephemeral::Object
5272
5270
  return L__M(:Miscellany, NO_OBJECT)
5273
5271
  rescue CycleError
5274
5272
  return L__M(:Miscellany, TREE_ERROR)
5273
+ rescue NoVerbRoutine, NotImplemented
5274
+ "Sorry, that action is not yet implemented."
5275
+ rescue NoMethodError => e
5276
+ parser_error e, "Sorry, there was a program error involving a missing method."
5277
+ rescue TypeError => e
5278
+ parser_error e, "Sorry, there was a program error involving the wrong type of object."
5279
+ rescue StandardError => e
5280
+ parser_error e, "Sorry, there was an unhandled program error."
5275
5281
  end
5276
5282
  # def late__error
5277
5283
 
@@ -5499,23 +5505,25 @@ class InformLibrary < Inform::Ephemeral::Object
5499
5505
  end
5500
5506
 
5501
5507
  def RRQPL
5502
- L__M(:Miscellany, 5)
5503
- AfterGameOver()
5508
+ print L__M(:Miscellany, 5)
5509
+ :death
5504
5510
  end
5505
5511
 
5506
5512
  def AfterGameOver
5507
- return if defined?(MULTI_PLAYER)
5508
- prompt
5513
+ return :playing if defined?(MULTI_PLAYER)
5514
+
5509
5515
  @temp_global = 0
5510
- i = @parse[1]
5516
+ i = @buffer.to_s.split(WordOrCommaSplitPattern).first.to_s.downcase
5511
5517
  if [QUIT1__WD, QUIT2__WD].include?(i)
5512
- quit
5518
+ return __quit
5513
5519
  end
5514
5520
  if i == RESTART__WD
5515
- restart
5521
+ return __restart
5516
5522
  end
5517
5523
  if i == RESTORE__WD
5518
5524
  RestoreSub()
5525
+ return :playing if deadflag == 0
5526
+
5519
5527
  return RRQPL()
5520
5528
  end
5521
5529
  if [FULLSCORE1__WD, FULLSCORE2__WD].include?(i) && TASKS_PROVIDED == 0
@@ -5526,8 +5534,8 @@ class InformLibrary < Inform::Ephemeral::Object
5526
5534
  new_line; Amusing()
5527
5535
  return RRQPL()
5528
5536
  end
5529
- L__M(:Miscellany, 8)
5530
- return RRQL()
5537
+ print L__M(:Miscellany, 8)
5538
+ :death
5531
5539
  end
5532
5540
  alias RRQL AfterGameOver
5533
5541
 
@@ -1030,8 +1030,7 @@ module Verbs
1030
1030
  # TODO: Figure out how this could work in a non-blocking IO system. FIXME
1031
1031
  # The read method would have to create an evented future promise or
1032
1032
  # something. That seems like it would cause this code to block on the
1033
- # read command, and avoiding such blocking behavior was the entire point
1034
- # of using Netty.
1033
+ # read command.
1035
1034
  def YesOrNo
1036
1035
  loop do
1037
1036
  @input = __read
@@ -1178,7 +1177,7 @@ module Verbs
1178
1177
  end
1179
1178
 
1180
1179
  def FullScoreSub
1181
- ScoreSub()
1180
+ println ScoreSub()
1182
1181
  return false if @score == 0 || TASKS_PROVIDED == 1
1183
1182
  new_line
1184
1183
  L__M(:FullScore, 1)
@@ -2399,6 +2398,38 @@ module Verbs
2399
2398
  # Debugging verbs
2400
2399
  # ----------------------------------------------------------------------------
2401
2400
 
2401
+ # if defined?(DEBUG)
2402
+
2403
+ def TraceOnSub; @parser_trace=1; "[Trace on.]"; end
2404
+
2405
+ def TraceLevelSub
2406
+ @parser_trace = @noun
2407
+ print "[Parser tracing set to level #{@parser_trace} .]\n"
2408
+ end
2409
+
2410
+ def TraceOffSub; @parser_trace=0; "Trace off."; end
2411
+
2412
+ def RoutinesOnSub; @debug_flag = @debug_flag | 1; "[Message listing on.]"; end
2413
+
2414
+ def RoutinesOffSub; @debug_flag = @debug_flag & 14; "[Message listing off.]"; end
2415
+
2416
+ def ActionsOnSub; @debug_flag = @debug_flag | 2; "[Action listing on.]"; end
2417
+
2418
+ def ActionsOffSub; @debug_flag = @debug_flag & 13; "[Action listing off.]"; end
2419
+
2420
+ def TimersOnSub; @debug_flag = @debug_flag | 4; "[Timers listing on.]"; end
2421
+
2422
+ def TimersOffSub; @debug_flag = @debug_flag & 11; "[Timers listing off.]"; end
2423
+
2424
+ def ChangesOnSub; @debug_flag = @debug_flag | 8; "[Changes listing on.]"; end
2425
+
2426
+ def ChangesOffSub; @debug_flag = @debug_flag & 7; "[Changes listing off.]"; end
2427
+
2428
+ def PredictableSub
2429
+ setrandom(100)
2430
+ "[Random number generator now predictable.]"
2431
+ end
2432
+
2402
2433
  def XTestMove(obj, dest)
2403
2434
  if obj.is_a?(InformLibrary) || obj == LibraryMessages || obj.is_a?(Inform::Ephemeral::Object)
2404
2435
  println "[Can't move #{obj.name}: it's a system object.]"
@@ -2473,6 +2504,8 @@ module Verbs
2473
2504
  "Nothing is in scope." if @x_scope_count == 0
2474
2505
  end
2475
2506
 
2507
+ # end # defined?(DEBUG)
2508
+
2476
2509
  # ----------------------------------------------------------------------------
2477
2510
  # Finally: the mechanism for library text (the text is in the language defn)
2478
2511
  # ----------------------------------------------------------------------------
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inform6lib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nels Nelson