gamefic-sdk 1.7.0 → 2.0.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 +5 -5
- data/bin/gamefic +16 -0
- data/lib/gamefic-sdk.rb +4 -24
- data/lib/gamefic-sdk/diagram.rb +205 -0
- data/lib/gamefic-sdk/scaffold.rb +54 -0
- data/lib/gamefic-sdk/server.rb +81 -65
- data/lib/gamefic-sdk/shell.rb +22 -129
- data/lib/gamefic-sdk/tasks.rb +40 -0
- data/lib/gamefic-sdk/tasks/common.rb +21 -0
- data/lib/gamefic-sdk/tasks/ruby.rb +99 -0
- data/lib/gamefic-sdk/tasks/web.rb +82 -0
- data/lib/gamefic-sdk/version.rb +5 -5
- metadata +123 -139
- data/bin/gfk +0 -6
- data/html/core/engine.js +0 -114
- data/html/core/jquery.js +0 -5
- data/html/core/jquery.modal.css +0 -44
- data/html/core/jquery.modal.js +0 -225
- data/html/core/js.cookie.js +0 -137
- data/html/sinatra/engine.js +0 -65
- data/html/skins/hypertext/compass.png +0 -0
- data/html/skins/hypertext/index.html +0 -149
- data/html/skins/hypertext/style.css +0 -74
- data/html/skins/minimal/index.html.erb +0 -22
- data/html/skins/minimal/index.rb +0 -4
- data/html/skins/minimal/play.js +0 -36
- data/html/skins/minimal/style.css +0 -8
- data/html/skins/multimedia/close.png +0 -0
- data/html/skins/multimedia/index.html +0 -179
- data/html/skins/multimedia/mobile.css +0 -10
- data/html/skins/multimedia/spinner.gif +0 -0
- data/html/skins/multimedia/style.css +0 -186
- data/html/skins/standard/index.html.erb +0 -22
- data/html/skins/standard/index.rb +0 -4
- data/html/skins/standard/play.js +0 -18
- data/html/skins/standard/style.css +0 -73
- data/lib/gamefic-sdk/build.rb +0 -30
- data/lib/gamefic-sdk/config.rb +0 -126
- data/lib/gamefic-sdk/debug.rb +0 -4
- data/lib/gamefic-sdk/debug/action.rb +0 -30
- data/lib/gamefic-sdk/debug/plot.rb +0 -23
- data/lib/gamefic-sdk/platform.rb +0 -22
- data/lib/gamefic-sdk/platform/base.rb +0 -68
- data/lib/gamefic-sdk/platform/gfic.rb +0 -27
- data/lib/gamefic-sdk/platform/sinatra.rb +0 -98
- data/lib/gamefic-sdk/platform/web.rb +0 -176
- data/lib/gamefic-sdk/platform/web/app_config.rb +0 -81
- data/lib/gamefic-sdk/platform/web/engine.rb +0 -44
- data/lib/gamefic-sdk/platform/web/user.rb +0 -19
- data/lib/gamefic-sdk/shell/init.rb +0 -83
- data/lib/gamefic-sdk/shell/test.rb +0 -32
- data/scripts/save-restore-undo.plot.rb +0 -25
- data/scripts/snapshots.plot.rb +0 -16
- data/scripts/standard.plot.rb +0 -10
- data/scripts/standard/actions.plot.rb +0 -13
- data/scripts/standard/actions/drop.plot.rb +0 -19
- data/scripts/standard/actions/enter.plot.rb +0 -19
- data/scripts/standard/actions/go.plot.rb +0 -48
- data/scripts/standard/actions/insert.plot.rb +0 -37
- data/scripts/standard/actions/inventory.plot.rb +0 -9
- data/scripts/standard/actions/leave.plot.rb +0 -30
- data/scripts/standard/actions/look.plot.rb +0 -108
- data/scripts/standard/actions/nil.plot.rb +0 -36
- data/scripts/standard/actions/place.plot.rb +0 -41
- data/scripts/standard/actions/quit.plot.rb +0 -11
- data/scripts/standard/actions/take.plot.rb +0 -31
- data/scripts/standard/actions/talk.plot.rb +0 -27
- data/scripts/standard/actions/wait.plot.rb +0 -3
- data/scripts/standard/clothing.plot.rb +0 -4
- data/scripts/standard/clothing/actions.plot.rb +0 -4
- data/scripts/standard/clothing/actions/doff.plot.rb +0 -12
- data/scripts/standard/clothing/actions/drop.plot.rb +0 -8
- data/scripts/standard/clothing/actions/inventory.plot.rb +0 -14
- data/scripts/standard/clothing/actions/wear.plot.rb +0 -20
- data/scripts/standard/clothing/entities.plot.rb +0 -7
- data/scripts/standard/clothing/entities/clothing.plot.rb +0 -5
- data/scripts/standard/clothing/entities/coat.plot.rb +0 -3
- data/scripts/standard/clothing/entities/gloves.plot.rb +0 -3
- data/scripts/standard/clothing/entities/hat.plot.rb +0 -3
- data/scripts/standard/clothing/entities/pants.plot.rb +0 -3
- data/scripts/standard/clothing/entities/shirt.plot.rb +0 -3
- data/scripts/standard/clothing/entities/shoes.plot.rb +0 -3
- data/scripts/standard/container.plot.rb +0 -28
- data/scripts/standard/container/actions.plot.rb +0 -0
- data/scripts/standard/container/entities.plot.rb +0 -5
- data/scripts/standard/direction.plot.rb +0 -55
- data/scripts/standard/edible.plot.rb +0 -21
- data/scripts/standard/entities.plot.rb +0 -12
- data/scripts/standard/entities/character.plot.rb +0 -10
- data/scripts/standard/entities/fixture.plot.rb +0 -3
- data/scripts/standard/entities/item.plot.rb +0 -3
- data/scripts/standard/entities/portal.plot.rb +0 -44
- data/scripts/standard/entities/receptacle.plot.rb +0 -3
- data/scripts/standard/entities/room.plot.rb +0 -57
- data/scripts/standard/entities/rubble.plot.rb +0 -11
- data/scripts/standard/entities/scenery.plot.rb +0 -3
- data/scripts/standard/entities/supporter.plot.rb +0 -7
- data/scripts/standard/entities/thing.plot.rb +0 -7
- data/scripts/standard/give.plot.rb +0 -27
- data/scripts/standard/lockable.plot.rb +0 -79
- data/scripts/standard/modules.plot.rb +0 -9
- data/scripts/standard/modules/attachable.plot.rb +0 -12
- data/scripts/standard/modules/auto_takes.plot.rb +0 -50
- data/scripts/standard/modules/enterable.plot.rb +0 -15
- data/scripts/standard/modules/explicit_exits.plot.rb +0 -15
- data/scripts/standard/modules/itemizable.plot.rb +0 -18
- data/scripts/standard/modules/locale_description.plot.rb +0 -20
- data/scripts/standard/modules/parent-room.plot.rb +0 -9
- data/scripts/standard/modules/portable.plot.rb +0 -11
- data/scripts/standard/modules/use.plot.rb +0 -51
- data/scripts/standard/openable.plot.rb +0 -43
- data/scripts/standard/pathfinder.plot.rb +0 -65
- data/scripts/standard/queries.plot.rb +0 -21
- data/scripts/standard/test.plot.rb +0 -10
- data/scripts/undo.plot.rb +0 -13
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
module Enterable
|
|
2
|
-
attr_writer :enterable, :leave_verb, :enter_verb, :inside_verb
|
|
3
|
-
def enterable?
|
|
4
|
-
@enterable ||= false
|
|
5
|
-
end
|
|
6
|
-
def inside_verb
|
|
7
|
-
@inside_verb ||= "be in"
|
|
8
|
-
end
|
|
9
|
-
def enter_verb
|
|
10
|
-
@enter_verb ||= "enter"
|
|
11
|
-
end
|
|
12
|
-
def leave_verb
|
|
13
|
-
@leave_verb ||= "leave"
|
|
14
|
-
end
|
|
15
|
-
end
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
module ExplicitExits
|
|
2
|
-
attr_writer :explicit_exits
|
|
3
|
-
def explicit_exits?
|
|
4
|
-
@explicit_exits ||= ExplicitExits.default
|
|
5
|
-
end
|
|
6
|
-
def self.default
|
|
7
|
-
if @default.nil?
|
|
8
|
-
@default = true
|
|
9
|
-
end
|
|
10
|
-
@default
|
|
11
|
-
end
|
|
12
|
-
def self.default=(bool)
|
|
13
|
-
@default = bool
|
|
14
|
-
end
|
|
15
|
-
end
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
module Itemizable
|
|
2
|
-
attr_writer :itemized
|
|
3
|
-
def itemized?
|
|
4
|
-
if @itemized.nil?
|
|
5
|
-
@itemized = Itemizable.default
|
|
6
|
-
end
|
|
7
|
-
@itemized
|
|
8
|
-
end
|
|
9
|
-
def self.default
|
|
10
|
-
if @default.nil?
|
|
11
|
-
@default = true
|
|
12
|
-
end
|
|
13
|
-
@default
|
|
14
|
-
end
|
|
15
|
-
def self.default=(bool)
|
|
16
|
-
@default = bool
|
|
17
|
-
end
|
|
18
|
-
end
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
# Add a locale description to entities.
|
|
2
|
-
# In the standard library, itemizing the contents of a room will display an
|
|
3
|
-
# entity's locale description instead of adding its name to a list.
|
|
4
|
-
#
|
|
5
|
-
# Example without locale descriptions:
|
|
6
|
-
# You are in a room.
|
|
7
|
-
# You see a book, a key, and a cup.
|
|
8
|
-
#
|
|
9
|
-
# Example with a locale description for the cup:
|
|
10
|
-
# You are in a room.
|
|
11
|
-
# You see a book and a key.
|
|
12
|
-
# A gold cup gleams in the candlelight.
|
|
13
|
-
#
|
|
14
|
-
module LocaleDescription
|
|
15
|
-
attr_writer :locale_description
|
|
16
|
-
|
|
17
|
-
def locale_description
|
|
18
|
-
@locale_description ||= ''
|
|
19
|
-
end
|
|
20
|
-
end
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
module Use
|
|
2
|
-
def self.children *args
|
|
3
|
-
Gamefic::Query::Children.new *args
|
|
4
|
-
end
|
|
5
|
-
|
|
6
|
-
def self.family *args
|
|
7
|
-
Gamefic::Query::Family.new *args
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
def self.parent *args
|
|
11
|
-
Gamefic::Query::Parent.new *args
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
def self.siblings *args
|
|
15
|
-
Gamefic::Query::Siblings.new *args
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
def self.text *args
|
|
19
|
-
Gamefic::Query::Text.new *args
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
# @todo This query is a candidate for deprecation. It's probably not worth
|
|
23
|
-
# the trouble to maintain a separate query just for transparent containers.
|
|
24
|
-
#
|
|
25
|
-
def self.visible *args
|
|
26
|
-
Gamefic::Query::Family.new *args
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
# @todo This query is a candidate for deprecation. For now it's an alias for
|
|
30
|
-
# Use.available.
|
|
31
|
-
#
|
|
32
|
-
def self.reachable *args
|
|
33
|
-
Gamefic::Query::Available.new *args
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
def self.available *args
|
|
37
|
-
Gamefic::Query::Available.new *args
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
def self.room *args
|
|
41
|
-
Gamefic::Query::Room.new *args
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
def self.itself *args
|
|
45
|
-
Gamefic::Query::Room.new *args
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
def self.from objects, *args
|
|
49
|
-
Gamefic::Query::External.new objects, *args
|
|
50
|
-
end
|
|
51
|
-
end
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
# @gamefic.script standard/openable
|
|
2
|
-
|
|
3
|
-
module Openable
|
|
4
|
-
attr_writer :openable
|
|
5
|
-
def open= bool
|
|
6
|
-
@open = bool
|
|
7
|
-
end
|
|
8
|
-
def open?
|
|
9
|
-
@open ||= false
|
|
10
|
-
end
|
|
11
|
-
def closed?
|
|
12
|
-
!open?
|
|
13
|
-
end
|
|
14
|
-
def accessible?
|
|
15
|
-
open?
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
respond :open, Use.available do |actor, thing|
|
|
20
|
-
actor.tell "You can't open #{the thing}."
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
respond :open, Use.available(Openable) do |actor, thing|
|
|
24
|
-
if thing.open?
|
|
25
|
-
actor.tell "#{The thing} is already open."
|
|
26
|
-
else
|
|
27
|
-
actor.tell "You open #{the thing}."
|
|
28
|
-
thing.open = true
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
respond :close, Use.available do |actor, thing|
|
|
33
|
-
actor.tell "You can't close #{the thing}."
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
respond :close, Use.available(Openable) do |actor, thing|
|
|
37
|
-
if thing.open?
|
|
38
|
-
actor.tell "You close #{the thing}."
|
|
39
|
-
thing.open = false
|
|
40
|
-
else
|
|
41
|
-
actor.tell "#{The thing} is already open."
|
|
42
|
-
end
|
|
43
|
-
end
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
# @gamefic.script standard/pathfinder
|
|
2
|
-
# Pathfinders provide the shortest route between two locations. The
|
|
3
|
-
# destination needs to be accessible from the origin through portals. Note
|
|
4
|
-
# that Pathfinders do not take into account portals that characters should
|
|
5
|
-
# not be able to traverse, such as locked doors.
|
|
6
|
-
|
|
7
|
-
class Pathfinder
|
|
8
|
-
# @return [Room]
|
|
9
|
-
attr_reader :origin
|
|
10
|
-
# @return [Room]
|
|
11
|
-
attr_reader :destination
|
|
12
|
-
|
|
13
|
-
def initialize origin, destination
|
|
14
|
-
@origin = origin
|
|
15
|
-
@destination = destination
|
|
16
|
-
@path = nil
|
|
17
|
-
@paths = [[@origin]]
|
|
18
|
-
@visited = []
|
|
19
|
-
if @origin == @destination
|
|
20
|
-
@path = []
|
|
21
|
-
else
|
|
22
|
-
while @path.nil? and @paths.length > 0
|
|
23
|
-
embark
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
# @return [Array<Room>]
|
|
29
|
-
def path
|
|
30
|
-
# @path is nil if the path is invalid, but #path should return an empty
|
|
31
|
-
# array instead.
|
|
32
|
-
@path || []
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
# @return [Boolean]
|
|
36
|
-
def valid?
|
|
37
|
-
path.length > 0 or origin == destination
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
private
|
|
41
|
-
|
|
42
|
-
def embark
|
|
43
|
-
new_paths = []
|
|
44
|
-
@paths.each { |path|
|
|
45
|
-
last = path.last
|
|
46
|
-
portals = last.children.that_are(Portal)
|
|
47
|
-
portals.each { |portal|
|
|
48
|
-
new_path = path.clone
|
|
49
|
-
if !@visited.include?(portal.destination)
|
|
50
|
-
new_path.push portal.destination
|
|
51
|
-
@visited.push portal.destination
|
|
52
|
-
if portal.destination == @destination
|
|
53
|
-
@path = new_path
|
|
54
|
-
@path.shift
|
|
55
|
-
break
|
|
56
|
-
end
|
|
57
|
-
new_paths.push new_path
|
|
58
|
-
end
|
|
59
|
-
}
|
|
60
|
-
path.push nil
|
|
61
|
-
}
|
|
62
|
-
@paths += new_paths
|
|
63
|
-
@paths.delete_if{|path| path.last.nil?}
|
|
64
|
-
end
|
|
65
|
-
end
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
class Gamefic::Query::Available < Gamefic::Query::Base
|
|
2
|
-
def context_from(subject)
|
|
3
|
-
result = []
|
|
4
|
-
top = subject.room || subject.parent
|
|
5
|
-
unless top.nil?
|
|
6
|
-
result.concat subquery_accessible(top)
|
|
7
|
-
end
|
|
8
|
-
result.delete subject
|
|
9
|
-
subject.children.each { |c|
|
|
10
|
-
result.push c
|
|
11
|
-
result.concat subquery_accessible(c)
|
|
12
|
-
}
|
|
13
|
-
result
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
class Gamefic::Query::Room < Gamefic::Query::Base
|
|
18
|
-
def context_from(subject)
|
|
19
|
-
subject.room ? [subject.room] : []
|
|
20
|
-
end
|
|
21
|
-
end
|
data/scripts/undo.plot.rb
DELETED