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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ff0b544812291d9f9c2a5169ada547843704aa26f0a5ad0fdd82b1e914acba15
|
|
4
|
+
data.tar.gz: e3d011e11b4e3531054d3b4a83d199343541e44d57a770708d219a73ca40f668
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0c92163b72057f043cadce2abbcf7e79a20be080a51e9384289f44f62f5528738bc3c947e66758312b637c2042e480b092a342c2176bfbc0706389d49be636c2
|
|
7
|
+
data.tar.gz: 0e4355ed014b0e499e8e730d70ecf9b22ebaac3af317a5d6fc900ef528f819004526ee3004478e112e5c82221329fb4cb426b681e77c7b62aa1bb345269af17a
|
data/lib/story_teller/engine.rb
CHANGED
|
@@ -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
|
-
|
|
99
|
+
seed_library_location(inform_library) if location_unset?(inform_library)
|
|
111
100
|
|
|
112
101
|
inform_library
|
|
113
102
|
end
|
|
114
103
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
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
|
-
|
|
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)
|
|
@@ -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
|
-
|
|
36
|
-
@player.location = obj
|
|
37
|
-
else
|
|
38
|
-
@location = obj
|
|
39
|
-
end
|
|
33
|
+
@player.location = @location = obj
|
|
40
34
|
end
|
|
41
35
|
end
|
|
42
36
|
|
data/lib/story_teller/stdlib.rb
CHANGED
|
@@ -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] ||
|
|
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
|
data/lib/story_teller/version.rb
CHANGED