gamefic 2.0.2 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +4 -1
- data/CHANGELOG.md +15 -1
- data/lib/gamefic/action.rb +37 -41
- data/lib/gamefic/active.rb +49 -76
- data/lib/gamefic/core_ext/array.rb +4 -1
- data/lib/gamefic/core_ext/string.rb +2 -8
- data/lib/gamefic/dispatcher.rb +76 -0
- data/lib/gamefic/element.rb +11 -12
- data/lib/gamefic/entity.rb +3 -3
- data/lib/gamefic/plot.rb +2 -9
- data/lib/gamefic/query/base.rb +25 -24
- data/lib/gamefic/query/descendants.rb +2 -2
- data/lib/gamefic/query/family.rb +2 -0
- data/lib/gamefic/query/text.rb +10 -11
- data/lib/gamefic/query/tree.rb +17 -0
- data/lib/gamefic/query.rb +1 -0
- data/lib/gamefic/scene/activity.rb +1 -3
- data/lib/gamefic/scene/base.rb +4 -2
- data/lib/gamefic/scene/conclusion.rb +1 -1
- data/lib/gamefic/scene/multiple_choice.rb +2 -12
- data/lib/gamefic/scene/pause.rb +1 -1
- data/lib/gamefic/scene/yes_or_no.rb +1 -1
- data/lib/gamefic/scene.rb +0 -1
- data/lib/gamefic/serialize.rb +15 -26
- data/lib/gamefic/subplot.rb +3 -12
- data/lib/gamefic/syntax.rb +25 -18
- data/lib/gamefic/version.rb +1 -1
- data/lib/gamefic/world/commands.rb +7 -26
- data/lib/gamefic/world/entities.rb +0 -10
- data/lib/gamefic/world/playbook.rb +42 -88
- data/lib/gamefic/world/players.rb +18 -2
- data/lib/gamefic/world/scenes.rb +11 -11
- data/lib/gamefic/world.rb +2 -0
- data/lib/gamefic.rb +2 -2
- metadata +18 -18
- data/lib/gamefic/plot/index.rb +0 -92
- data/lib/gamefic/scene/custom.rb +0 -7
data/lib/gamefic/world.rb
CHANGED
data/lib/gamefic.rb
CHANGED
@@ -5,7 +5,6 @@ require 'gamefic/core_ext/array'
|
|
5
5
|
require 'gamefic/core_ext/string'
|
6
6
|
|
7
7
|
require 'gamefic/describable'
|
8
|
-
# require 'gamefic/index'
|
9
8
|
require 'gamefic/serialize'
|
10
9
|
require 'gamefic/element'
|
11
10
|
require 'gamefic/entity'
|
@@ -15,8 +14,9 @@ require "gamefic/scene"
|
|
15
14
|
require "gamefic/query"
|
16
15
|
require "gamefic/action"
|
17
16
|
require "gamefic/syntax"
|
17
|
+
require "gamefic/command"
|
18
|
+
require "gamefic/dispatcher"
|
18
19
|
require 'gamefic/world'
|
19
20
|
require 'gamefic/scriptable'
|
20
21
|
require 'gamefic/plot'
|
21
|
-
require 'gamefic/plot/index'
|
22
22
|
require 'gamefic/subplot'
|
metadata
CHANGED
@@ -1,55 +1,55 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gamefic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fred Snyder
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-09-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '12.3'
|
20
|
-
- - "
|
20
|
+
- - ">="
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: '12.3'
|
23
23
|
type: :development
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
|
-
- - "
|
27
|
+
- - "~>"
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: '12.3'
|
30
|
-
- - "
|
30
|
+
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: '12.3'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: rspec
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
|
-
- - ">="
|
38
|
-
- !ruby/object:Gem::Version
|
39
|
-
version: 3.5.0
|
40
37
|
- - "~>"
|
41
38
|
- !ruby/object:Gem::Version
|
42
39
|
version: '3.5'
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: 3.5.0
|
43
43
|
type: :development
|
44
44
|
prerelease: false
|
45
45
|
version_requirements: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
|
-
- - ">="
|
48
|
-
- !ruby/object:Gem::Version
|
49
|
-
version: 3.5.0
|
50
47
|
- - "~>"
|
51
48
|
- !ruby/object:Gem::Version
|
52
49
|
version: '3.5'
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: 3.5.0
|
53
53
|
- !ruby/object:Gem::Dependency
|
54
54
|
name: simplecov
|
55
55
|
requirement: !ruby/object:Gem::Requirement
|
@@ -88,6 +88,7 @@ files:
|
|
88
88
|
- lib/gamefic/core_ext/array.rb
|
89
89
|
- lib/gamefic/core_ext/string.rb
|
90
90
|
- lib/gamefic/describable.rb
|
91
|
+
- lib/gamefic/dispatcher.rb
|
91
92
|
- lib/gamefic/element.rb
|
92
93
|
- lib/gamefic/entity.rb
|
93
94
|
- lib/gamefic/keywords.rb
|
@@ -96,7 +97,6 @@ files:
|
|
96
97
|
- lib/gamefic/plot.rb
|
97
98
|
- lib/gamefic/plot/darkroom.rb
|
98
99
|
- lib/gamefic/plot/host.rb
|
99
|
-
- lib/gamefic/plot/index.rb
|
100
100
|
- lib/gamefic/plot/snapshot.rb
|
101
101
|
- lib/gamefic/query.rb
|
102
102
|
- lib/gamefic/query/base.rb
|
@@ -109,11 +109,11 @@ files:
|
|
109
109
|
- lib/gamefic/query/parent.rb
|
110
110
|
- lib/gamefic/query/siblings.rb
|
111
111
|
- lib/gamefic/query/text.rb
|
112
|
+
- lib/gamefic/query/tree.rb
|
112
113
|
- lib/gamefic/scene.rb
|
113
114
|
- lib/gamefic/scene/activity.rb
|
114
115
|
- lib/gamefic/scene/base.rb
|
115
116
|
- lib/gamefic/scene/conclusion.rb
|
116
|
-
- lib/gamefic/scene/custom.rb
|
117
117
|
- lib/gamefic/scene/multiple_choice.rb
|
118
118
|
- lib/gamefic/scene/multiple_scene.rb
|
119
119
|
- lib/gamefic/scene/pause.rb
|
@@ -134,7 +134,7 @@ homepage: http://gamefic.com
|
|
134
134
|
licenses:
|
135
135
|
- MIT
|
136
136
|
metadata: {}
|
137
|
-
post_install_message:
|
137
|
+
post_install_message:
|
138
138
|
rdoc_options: []
|
139
139
|
require_paths:
|
140
140
|
- lib
|
@@ -149,8 +149,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
149
149
|
- !ruby/object:Gem::Version
|
150
150
|
version: '0'
|
151
151
|
requirements: []
|
152
|
-
rubygems_version: 3.
|
153
|
-
signing_key:
|
152
|
+
rubygems_version: 3.1.6
|
153
|
+
signing_key:
|
154
154
|
specification_version: 4
|
155
155
|
summary: Gamefic
|
156
156
|
test_files: []
|
data/lib/gamefic/plot/index.rb
DELETED
@@ -1,92 +0,0 @@
|
|
1
|
-
module Gamefic
|
2
|
-
class Plot
|
3
|
-
# A fixed index of plot elements. Plots and subplots use an index to track
|
4
|
-
# objects created in scripts.
|
5
|
-
#
|
6
|
-
class Index
|
7
|
-
# @param elements [Array]
|
8
|
-
def initialize elements
|
9
|
-
@elements = elements.uniq.freeze
|
10
|
-
end
|
11
|
-
|
12
|
-
# @return [Boolean]
|
13
|
-
def include? element
|
14
|
-
@elements.include?(element)
|
15
|
-
end
|
16
|
-
|
17
|
-
def all
|
18
|
-
@elements
|
19
|
-
end
|
20
|
-
|
21
|
-
def concat elements
|
22
|
-
@elements = (@elements + elements).uniq.freeze
|
23
|
-
end
|
24
|
-
|
25
|
-
def remove elements
|
26
|
-
@elements = (@elements - elements).uniq.freeze
|
27
|
-
end
|
28
|
-
|
29
|
-
# @return [Object]
|
30
|
-
def element index
|
31
|
-
@elements[index]
|
32
|
-
end
|
33
|
-
|
34
|
-
def id_for(element)
|
35
|
-
include?(element) ? "#<ELE_#{@elements.index(element)}>" : nil
|
36
|
-
end
|
37
|
-
|
38
|
-
# def self.from_serial serial, static
|
39
|
-
# if serial.is_a?(Hash) && (serial['class'] || serial['element'])
|
40
|
-
# if serial['class']
|
41
|
-
# elematch = serial['class'].match(/^#<ELE_([\d]+)>$/)
|
42
|
-
# if elematch
|
43
|
-
# klass = static.element(elematch[1].to_i)
|
44
|
-
# else
|
45
|
-
# klass = eval(serial['class'])
|
46
|
-
# end
|
47
|
-
# object = klass.allocate
|
48
|
-
# elsif serial['element']
|
49
|
-
# object = static.element(serial['element'])
|
50
|
-
# end
|
51
|
-
# serial.each_pair do |k, v|
|
52
|
-
# next unless k.to_s.start_with?('@')
|
53
|
-
# object.instance_variable_set(k, from_serial(v, static))
|
54
|
-
# end
|
55
|
-
# object
|
56
|
-
# elsif serial.is_a?(Numeric)
|
57
|
-
# serial
|
58
|
-
# elsif serial.is_a?(String)
|
59
|
-
# match = serial.match(/#<ELE_([0-9]+)>/)
|
60
|
-
# return static.element(match[1].to_i) if match
|
61
|
-
# match = serial.match(/#<SYM:([a-z0-9_\?\!]+)>/i)
|
62
|
-
# return match[1].to_sym if match
|
63
|
-
# serial
|
64
|
-
# elsif serial.is_a?(Array)
|
65
|
-
# result = serial.map { |e| from_serial(e, static) }
|
66
|
-
# result = "#<UNKNOWN>" if result.any? { |e| e == "#<UNKNOWN>" }
|
67
|
-
# result
|
68
|
-
# elsif serial.is_a?(Hash)
|
69
|
-
# result = {}
|
70
|
-
# unknown = false
|
71
|
-
# serial.each_pair do |k, v|
|
72
|
-
# k2 = from_serial(k, static)
|
73
|
-
# v2 = from_serial(v, static)
|
74
|
-
# if k2 == "#<UNKNOWN>" || v2 == "#<UNKNOWN>"
|
75
|
-
# unknown = true
|
76
|
-
# break
|
77
|
-
# end
|
78
|
-
# result[k2] = v2
|
79
|
-
# end
|
80
|
-
# result = "#<UNKNOWN>" if unknown
|
81
|
-
# result
|
82
|
-
# elsif serial && serial != true
|
83
|
-
# STDERR.puts "Unable to unserialize #{serial.class}"
|
84
|
-
# nil
|
85
|
-
# else
|
86
|
-
# # true, false, or nil
|
87
|
-
# serial
|
88
|
-
# end
|
89
|
-
# end
|
90
|
-
end
|
91
|
-
end
|
92
|
-
end
|