gamefic-sdk 1.4.1 → 1.5.0
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 +4 -4
- data/html/core/engine.js +5 -4
- data/lib/gamefic-sdk.rb +1 -1
- data/lib/gamefic-sdk/debug/plot.rb +1 -1
- data/lib/gamefic-sdk/platform/web/gamefic_opal.rb +2 -1
- data/lib/gamefic-sdk/version.rb +1 -1
- data/scripts/edible.plot.rb +1 -1
- data/scripts/standard.plot.rb +1 -1
- data/scripts/standard/actions/nil.plot.rb +4 -3
- data/scripts/standard/actions/quit.plot.rb +4 -4
- data/scripts/standard/direction.plot.rb +56 -0
- data/scripts/standard/entities/portal.plot.rb +5 -1
- data/scripts/standard/entities/room.plot.rb +4 -4
- data/scripts/standard/entities/supporter.plot.rb +1 -1
- metadata +5 -6
- data/scripts/standard/rules.plot.rb +0 -1
- data/scripts/standard/rules/has-enough-light.plot.rb +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f20b6887b332594e4cde84b2d7f0d9025a166c0b
|
4
|
+
data.tar.gz: 05c6b161dd96f67108d10eb8feeeae723f118f82
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c12d01760d7f7867221d9dc2edc6b6a6d03466d1135f12d57e5adc780de09ea851f0b966b1e502163c2f6125ace483dc047d3e165d41bb7d8f20728acca45a58
|
7
|
+
data.tar.gz: 46b23e73019583f9ff5abb4943c6e401fc27b82bd9432386ed93005c9842797f05847193168f3aa57e8037ff4b804591342895af2506fa8b6ab5cf6ccbe82669
|
data/html/core/engine.js
CHANGED
@@ -8,7 +8,8 @@ var Gamefic = (function() {
|
|
8
8
|
var getResponse = function(withOutput) {
|
9
9
|
var r = {
|
10
10
|
output: (withOutput ? Opal.GameficOpal.$static_user().$flush() : null),
|
11
|
-
state: Opal.GameficOpal.$static_plot().$scenes().$fetch(Opal.GameficOpal.$static_character().$scene()).$type(),
|
11
|
+
//state: Opal.GameficOpal.$static_plot().$scenes().$fetch(Opal.GameficOpal.$static_character().$scene()).$type(),
|
12
|
+
state: Opal.GameficOpal.$static_character().$scene().$type(),
|
12
13
|
prompt: lastPrompt,
|
13
14
|
input: lastInput,
|
14
15
|
testing: (Opal.GameficOpal.$static_character().$queue().$length() > 0)
|
@@ -28,7 +29,7 @@ var Gamefic = (function() {
|
|
28
29
|
start: function() {
|
29
30
|
Opal.GameficOpal.$load_scripts();
|
30
31
|
Opal.GameficOpal.$static_plot().$introduce(Opal.GameficOpal.$static_character());
|
31
|
-
lastPrompt = Opal.GameficOpal.$
|
32
|
+
lastPrompt = Opal.GameficOpal.$static_character().$prompt();
|
32
33
|
this.update('');
|
33
34
|
},
|
34
35
|
update: function(input) {
|
@@ -42,11 +43,11 @@ var Gamefic = (function() {
|
|
42
43
|
});
|
43
44
|
Opal.GameficOpal.$static_plot().$update();
|
44
45
|
Opal.GameficOpal.$static_plot().$ready();
|
45
|
-
lastPrompt = Opal.GameficOpal.$
|
46
|
+
lastPrompt = Opal.GameficOpal.$static_character().$prompt();
|
46
47
|
response = getResponse(true);
|
47
48
|
var updateResponse = response;
|
48
49
|
doReady(response);
|
49
|
-
lastPrompt = Opal.GameficOpal.$
|
50
|
+
lastPrompt = Opal.GameficOpal.$static_character().$prompt();
|
50
51
|
response = getResponse(true);
|
51
52
|
response.output = updateResponse.output + response.output;
|
52
53
|
handle(response);
|
data/lib/gamefic-sdk.rb
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
require 'gamefic/query/expression'
|
3
3
|
require 'gamefic/query/matches'
|
4
4
|
require 'gamefic/grammar/verb_set'
|
5
|
+
require 'gamefic/plot/playbook'
|
5
6
|
|
6
7
|
# HACK Opal doesn't recognize classes and modules declared from scripts
|
7
8
|
def Object.const_missing sym
|
@@ -30,7 +31,7 @@ module GameficOpal
|
|
30
31
|
|
31
32
|
class WebUser < Gamefic::User::Base
|
32
33
|
def save filename, data
|
33
|
-
data[:metadata] = GameficOpal.
|
34
|
+
data[:metadata] = GameficOpal.static_plot.metadata
|
34
35
|
`Gamefic.save(filename, data);`
|
35
36
|
end
|
36
37
|
def restore filename
|
data/lib/gamefic-sdk/version.rb
CHANGED
data/scripts/edible.plot.rb
CHANGED
data/scripts/standard.plot.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
meta nil, Query::Text.new() do |actor, string|
|
2
2
|
words = string.split_words
|
3
|
-
|
3
|
+
list = verbs(to_s: true)
|
4
|
+
if list.include?(words[0])
|
4
5
|
if words.length > 1
|
5
6
|
actor.tell "I recognize '#{words[0]}' as a verb but could not understand the rest of your sentence."
|
6
7
|
else
|
@@ -8,7 +9,7 @@ meta nil, Query::Text.new() do |actor, string|
|
|
8
9
|
end
|
9
10
|
else
|
10
11
|
found = []
|
11
|
-
|
12
|
+
list.each { |c|
|
12
13
|
next if c.include?('_')
|
13
14
|
if c.length > words[0].length and c.start_with?(words[0])
|
14
15
|
found.push c
|
@@ -27,7 +28,7 @@ end
|
|
27
28
|
|
28
29
|
meta nil, Query::Text.new("it") do |actor, string|
|
29
30
|
words = string.split_words
|
30
|
-
if
|
31
|
+
if verbs(to_s: true).include?(words[0])
|
31
32
|
actor.tell "I'm not sure what you mean by \"it.\""
|
32
33
|
else
|
33
34
|
actor.proceed
|
@@ -1,11 +1,11 @@
|
|
1
|
-
yes_or_no
|
1
|
+
confirm_quit = yes_or_no 'Are you sure you want to quit?' do |actor, data|
|
2
2
|
if data.yes?
|
3
|
-
actor.cue
|
3
|
+
actor.cue default_conclusion
|
4
4
|
else
|
5
|
-
actor.cue
|
5
|
+
actor.cue default_scene
|
6
6
|
end
|
7
7
|
end
|
8
8
|
|
9
9
|
meta :quit do |actor|
|
10
|
-
actor.cue
|
10
|
+
actor.cue confirm_quit
|
11
11
|
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
class ::Gamefic::Direction
|
2
|
+
attr_accessor :name, :adjective, :adverb, :reverse
|
3
|
+
|
4
|
+
def initialize args = {}
|
5
|
+
args.each { |key, value|
|
6
|
+
send "#{key}=", value
|
7
|
+
}
|
8
|
+
if !reverse.nil?
|
9
|
+
reverse.reverse = self
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def adjective
|
14
|
+
@adjective || @name
|
15
|
+
end
|
16
|
+
|
17
|
+
def adverb
|
18
|
+
@adverb || @name
|
19
|
+
end
|
20
|
+
|
21
|
+
def reverse=(dir)
|
22
|
+
@reverse = dir
|
23
|
+
end
|
24
|
+
|
25
|
+
def synonyms
|
26
|
+
"#{adjective} #{adverb}"
|
27
|
+
end
|
28
|
+
|
29
|
+
def to_s
|
30
|
+
@name
|
31
|
+
end
|
32
|
+
|
33
|
+
class << self
|
34
|
+
def compass
|
35
|
+
if @compass.nil?
|
36
|
+
@compass = {}
|
37
|
+
@compass[:north] = Direction.new(:name => 'north', :adjective => 'northern')
|
38
|
+
@compass[:south] = Direction.new(:name => 'south', :adjective => 'southern', :reverse => @compass[:north])
|
39
|
+
@compass[:west] = Direction.new(:name => 'west', :adjective => 'western')
|
40
|
+
@compass[:east] = Direction.new(:name => 'east', :adjective => 'eastern', :reverse => @compass[:west])
|
41
|
+
@compass[:northwest] = Direction.new(:name => 'northwest', :adjective => 'northwestern')
|
42
|
+
@compass[:southeast] = Direction.new(:name => 'southeast', :adjective => 'southeastern', :reverse => @compass[:northwest])
|
43
|
+
@compass[:northeast] = Direction.new(:name => 'northeast', :adjective => 'northeastern')
|
44
|
+
@compass[:southwest] = Direction.new(:name => 'southwest', :adjective => 'southwestern', :reverse => @compass[:northeast])
|
45
|
+
@compass[:up] = Direction.new(:name => 'up', :adjective => 'upwards')
|
46
|
+
@compass[:down] = Direction.new(:name => 'down', :adjective => 'downwards', :reverse => @compass[:up])
|
47
|
+
end
|
48
|
+
@compass
|
49
|
+
end
|
50
|
+
|
51
|
+
def find(dir)
|
52
|
+
compass[dir.to_s.downcase.to_sym]
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
class Gamefic::Portal < Gamefic::Entity
|
2
|
-
attr_accessor :destination
|
2
|
+
attr_accessor :destination
|
3
3
|
serialize :destination, :direction
|
4
4
|
|
5
5
|
# Find the portal in the destination that returns to this portal's parent
|
@@ -27,6 +27,10 @@ class Gamefic::Portal < Gamefic::Entity
|
|
27
27
|
@direction
|
28
28
|
end
|
29
29
|
|
30
|
+
def direction= d
|
31
|
+
@direction = Direction.find(d)
|
32
|
+
end
|
33
|
+
|
30
34
|
def name
|
31
35
|
@name || direction.name
|
32
36
|
end
|
@@ -31,22 +31,22 @@ class Gamefic::Room < Gamefic::Entity
|
|
31
31
|
private
|
32
32
|
def connect2 destination, direction:nil, type:Portal, two_way:true
|
33
33
|
if direction.nil?
|
34
|
-
portal = type.new
|
34
|
+
portal = type.new :parent => self, :destination => destination, :name => destination.definitely
|
35
35
|
if two_way == true
|
36
|
-
portal2 = type.new
|
36
|
+
portal2 = type.new :parent => destination, :destination => self, :name => self.definitely
|
37
37
|
end
|
38
38
|
else
|
39
39
|
if direction.kind_of?(String)
|
40
40
|
direction = Direction.find(direction)
|
41
41
|
end
|
42
|
-
portal = type.new
|
42
|
+
portal = type.new :direction => direction, :parent => self, :destination => destination
|
43
43
|
portal.proper_named = true if type == Portal
|
44
44
|
if two_way == true
|
45
45
|
reverse = direction.reverse
|
46
46
|
if reverse == nil
|
47
47
|
raise "#{direction.name.cap_first} does not have an opposite direction"
|
48
48
|
end
|
49
|
-
portal2 = type.new(
|
49
|
+
portal2 = type.new({
|
50
50
|
:direction => reverse,
|
51
51
|
:parent => destination,
|
52
52
|
:destination => self
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gamefic-sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fred Snyder
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-03-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gamefic
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1.
|
19
|
+
version: '1.5'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '1.
|
26
|
+
version: '1.5'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: opal
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -177,6 +177,7 @@ files:
|
|
177
177
|
- scripts/standard/actions/unlock.plot.rb
|
178
178
|
- scripts/standard/actions/use.plot.rb
|
179
179
|
- scripts/standard/actions/wait.plot.rb
|
180
|
+
- scripts/standard/direction.plot.rb
|
180
181
|
- scripts/standard/entities.plot.rb
|
181
182
|
- scripts/standard/entities/character.plot.rb
|
182
183
|
- scripts/standard/entities/container.plot.rb
|
@@ -221,8 +222,6 @@ files:
|
|
221
222
|
- scripts/standard/queries/reachable.plot.rb
|
222
223
|
- scripts/standard/queries/room.plot.rb
|
223
224
|
- scripts/standard/queries/visible.plot.rb
|
224
|
-
- scripts/standard/rules.plot.rb
|
225
|
-
- scripts/standard/rules/has-enough-light.plot.rb
|
226
225
|
- scripts/standard/test.plot.rb
|
227
226
|
- scripts/standard/use.plot.rb
|
228
227
|
- scripts/suggestible.plot.rb
|
@@ -1 +0,0 @@
|
|
1
|
-
script 'standard/rules/has-enough-light'
|