inform6lib 0.1.6 → 0.1.7

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: a40c23e7e9dcb8a291939c84699bdb885ca9101117b214875ec1ac6019ca486a
4
- data.tar.gz: 500c0ba61643ccfd81a11ba98aac6a1152a59e644b5a871f1ffdbdc4fdfee4ec
3
+ metadata.gz: f15efeb140118eef829dd8ee5340aacfca63d3e757d1463d2c68bd362907093a
4
+ data.tar.gz: 776377477baa04fe8f30ea8a792aae1b080b97ea8a53f37983f5fcd1ae9f6565
5
5
  SHA512:
6
- metadata.gz: c2ab599b6af58b719f1e24bdb5ed7ac08ece5139139499bf50f8817380c0e3ed4e7a67b38d5b5a17c17bf18760411a1086d3d2412981f419f886e96b3cfc7c3c
7
- data.tar.gz: be343e7f21440e7c127b3ff51c53c7d558bab0032767aa218a95b88e289eb2cfc1b9797508bba8df9e21a0aa0348fc3251568b4577d48c535e4ee6512ae0de25
6
+ metadata.gz: c7c69108ae8844c1fcef5ecd237f5ad4333cdffbf8b6d991af40d85d18cd72f97590dbd36a24fafad938a9279e8aff8582e8cb1f314fb37904599184b92e0bf1
7
+ data.tar.gz: 1f633ae5e8802c0e1859038cc8aa98f0d83393e60cb51d985651c6832d06b8d1ef89660bbec0cbdb8c4be6f5b1732e1eb48c4e588ed095549c3aa9a954050f36
@@ -1100,7 +1100,7 @@ module English
1100
1100
  print "out of "
1101
1101
  end
1102
1102
  println the(x1) + " first."
1103
- when 5 then println "You already have " + thatorthose(x1) + "."
1103
+ when 5 then "You already have " + thatorthose(x1) + "."
1104
1104
  when 6 then if noun.has?(:pluralname); print "Those seem "; else; print "That seems "; end
1105
1105
  println "to belong to " + the(x1) + "."
1106
1106
  when 7 then if noun.has?(:pluralname); print "Those seem "; else; print "That seems "; end
@@ -5031,9 +5031,7 @@ class InformLibrary < Inform::Ephemeral::Object
5031
5031
  def play
5032
5032
  @real_location = thedark
5033
5033
  @player = selfobj; @actor = @player
5034
- log.debug "Setting capacity of #{selfobj.identity} to #{MAX_CARRIED}"
5035
5034
  selfobj.&(:capacity, MAX_CARRIED) # ### change?
5036
- log.debug " selfobj.&(:capacity): #{selfobj.&(:capacity)}"
5037
5035
 
5038
5036
  new_line
5039
5037
  LibraryExtensions.RunAll(:ext_initialise)
@@ -5119,7 +5117,7 @@ class InformLibrary < Inform::Ephemeral::Object
5119
5117
 
5120
5118
  @results = [nil, 0, nil, nil]; @meta = false
5121
5119
 
5122
- return late__error() if @deadflag == 0
5120
+ return late__error() if deadflag == 0
5123
5121
 
5124
5122
  AfterLife() if deadflag != 2
5125
5123
  if deadflag == 0
@@ -5134,7 +5132,7 @@ class InformLibrary < Inform::Ephemeral::Object
5134
5132
  end
5135
5133
 
5136
5134
  def very__late__error
5137
- return if @deadflag != 0
5135
+ return if deadflag != 0
5138
5136
  return if @score == @last_score
5139
5137
 
5140
5138
  NotifyTheScore() if @notify_mode == true
@@ -5358,10 +5356,10 @@ class InformLibrary < Inform::Ephemeral::Object
5358
5356
  PronounNotice(l)
5359
5357
  @second = @results[3]
5360
5358
  print "#{l}: "
5361
- if @inp1.nil?
5362
- @inp1 = l; result = self.begin_action(@action, l, @second, 0); @inp1 = nil
5359
+ if @inp1 == 0
5360
+ @inp1 = l; result = self.begin_action(@action, l, @second, 0); @inp1 = 0
5363
5361
  else
5364
- @inp2 = l; result = self.begin_action(@action, @noun, l, 0); @inp2 = nil
5362
+ @inp2 = l; result = self.begin_action(@action, @noun, l, 0); @inp2 = 0
5365
5363
  end
5366
5364
  print_routine_result(result)
5367
5365
  end
@@ -5530,7 +5528,7 @@ class InformLibrary < Inform::Ephemeral::Object
5530
5528
  new_line; FullScoreSub()
5531
5529
  return RRQPL()
5532
5530
  end
5533
- if @deadflag == 2 && i == AMUSING__WD && AMUSING_PROVIDED == 0
5531
+ if deadflag == 2 && i == AMUSING__WD && AMUSING_PROVIDED == 0
5534
5532
  new_line; Amusing()
5535
5533
  return RRQPL()
5536
5534
  end
@@ -5628,26 +5626,40 @@ class InformLibrary < Inform::Ephemeral::Object
5628
5626
  end
5629
5627
 
5630
5628
  def PrintOrRun(obj, prop, flag = false)
5631
- si = obj.inflib; obj.inflib = inflib
5632
- # return RunRoutines(obj, prop) if obj.properties.include?(prop)
5633
- return RunRoutines(obj, prop) if obj.properties[prop].is_a?(Array)
5634
- if obj.respond_to?(prop) && !obj.method(prop).nil?
5635
- result = obj.send(prop)
5636
- if result.is_a?(Class) || result.nil? || obj.linked?(prop)
5637
- return RunTimeError(2, obj, prop)
5638
- elsif result.is_a?(String)
5639
- print result.to_s
5640
- raise "Why is flag true?" if flag == true
5641
- new_line if flag == false
5642
- return true
5643
- else
5644
- return result
5645
- end
5646
- elsif obj.linked?(prop)
5629
+ # I6: obj.#prop > WORDSIZE detects routines (multi-valued properties)
5630
+ # Ruby equivalent: property is a method on the object
5631
+ return RunRoutines(obj, prop) if obj.respond_to?(prop)
5632
+
5633
+ # Get raw property value from properties hash
5634
+ value = obj.properties[prop]
5635
+
5636
+ # I6: if (obj.prop == NULL) rfalse
5637
+ return false if value.nil?
5638
+
5639
+ # I6: switch (metaclass(obj.prop))
5640
+ case value
5641
+ when Inform::Object, Class, NilClass
5642
+ # I6: Class, Object, nothing should produce RunTimeError(2)
5647
5643
  return RunTimeError(2, obj, prop)
5644
+
5645
+ when String
5646
+ # I6: String case - print and optionally newline
5647
+ print value
5648
+ new_line unless flag
5649
+ return true
5650
+
5651
+ when Proc
5652
+ # Single-valued routine reference
5653
+ return RunRoutines(obj, prop)
5654
+
5655
+ when Array
5656
+ # Multi-valued property (I6 routine equivalent)
5657
+ return RunRoutines(obj, prop)
5658
+
5659
+ else
5660
+ # Fallback - treat as routine
5661
+ return RunRoutines(obj, prop)
5648
5662
  end
5649
- ensure
5650
- obj.inflib = si
5651
5663
  end
5652
5664
 
5653
5665
  def PrintOrRunVar(var, flag = false)
@@ -100,6 +100,8 @@ module Verbs
100
100
  end
101
101
 
102
102
  def RunTimeError(n, p1 = nil, p2 = nil)
103
+ log.error "RunTimeError..."
104
+ caller.each { |t| log.error t }
103
105
  if defined? DEBUG
104
106
  print "** Library error #{n} (#{p1},#{p2}) **\n** "
105
107
  case n
@@ -1358,7 +1360,10 @@ module Verbs
1358
1360
  return L__M(:Take, 4, item) if ancestor == item
1359
1361
 
1360
1362
  # Does the player already directly contain the item?
1361
- return L__M(:Take, 5, item) if item.in? @player
1363
+ if item.in? @player
1364
+ println L__M(:Take, 5, item)
1365
+ return true
1366
+ end
1362
1367
 
1363
1368
  # Can the player touch the item, or is there (e.g.) a closed container
1364
1369
  # in the way?
@@ -1387,8 +1392,7 @@ module Verbs
1387
1392
 
1388
1393
  k = 0; @player.objectloop { |j2| k += 1 if j2.hasnt?(:worn) }
1389
1394
 
1390
- capacity_value = ValueOrRun(@player, :capacity)
1391
- if capacity_value < k
1395
+ if k >= ValueOrRun(@player, :capacity)
1392
1396
  return L__M(:Take, 12) if SACK_OBJECT.nil?
1393
1397
 
1394
1398
  return L__M(:Take, 12) if SACK_OBJECT.parent != @player
@@ -1400,11 +1404,9 @@ module Verbs
1400
1404
 
1401
1405
  unless j.nil?
1402
1406
  L__M(:Take, 13, j)
1403
- @keep_silent = true; Insert j, SACK_OBJECT; keep_silent = false
1404
- return true if !j < SACK_OBJECT
1407
+ @keep_silent = true; invoke :Insert, j, SACK_OBJECT; @keep_silent = false
1408
+ return true if j.notin?(SACK_OBJECT)
1405
1409
  end
1406
-
1407
- return L__M(:Take, 12)
1408
1410
  end
1409
1411
 
1410
1412
  # Transfer the item.
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.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nels Nelson