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.
Files changed (115) hide show
  1. checksums.yaml +5 -5
  2. data/bin/gamefic +16 -0
  3. data/lib/gamefic-sdk.rb +4 -24
  4. data/lib/gamefic-sdk/diagram.rb +205 -0
  5. data/lib/gamefic-sdk/scaffold.rb +54 -0
  6. data/lib/gamefic-sdk/server.rb +81 -65
  7. data/lib/gamefic-sdk/shell.rb +22 -129
  8. data/lib/gamefic-sdk/tasks.rb +40 -0
  9. data/lib/gamefic-sdk/tasks/common.rb +21 -0
  10. data/lib/gamefic-sdk/tasks/ruby.rb +99 -0
  11. data/lib/gamefic-sdk/tasks/web.rb +82 -0
  12. data/lib/gamefic-sdk/version.rb +5 -5
  13. metadata +123 -139
  14. data/bin/gfk +0 -6
  15. data/html/core/engine.js +0 -114
  16. data/html/core/jquery.js +0 -5
  17. data/html/core/jquery.modal.css +0 -44
  18. data/html/core/jquery.modal.js +0 -225
  19. data/html/core/js.cookie.js +0 -137
  20. data/html/sinatra/engine.js +0 -65
  21. data/html/skins/hypertext/compass.png +0 -0
  22. data/html/skins/hypertext/index.html +0 -149
  23. data/html/skins/hypertext/style.css +0 -74
  24. data/html/skins/minimal/index.html.erb +0 -22
  25. data/html/skins/minimal/index.rb +0 -4
  26. data/html/skins/minimal/play.js +0 -36
  27. data/html/skins/minimal/style.css +0 -8
  28. data/html/skins/multimedia/close.png +0 -0
  29. data/html/skins/multimedia/index.html +0 -179
  30. data/html/skins/multimedia/mobile.css +0 -10
  31. data/html/skins/multimedia/spinner.gif +0 -0
  32. data/html/skins/multimedia/style.css +0 -186
  33. data/html/skins/standard/index.html.erb +0 -22
  34. data/html/skins/standard/index.rb +0 -4
  35. data/html/skins/standard/play.js +0 -18
  36. data/html/skins/standard/style.css +0 -73
  37. data/lib/gamefic-sdk/build.rb +0 -30
  38. data/lib/gamefic-sdk/config.rb +0 -126
  39. data/lib/gamefic-sdk/debug.rb +0 -4
  40. data/lib/gamefic-sdk/debug/action.rb +0 -30
  41. data/lib/gamefic-sdk/debug/plot.rb +0 -23
  42. data/lib/gamefic-sdk/platform.rb +0 -22
  43. data/lib/gamefic-sdk/platform/base.rb +0 -68
  44. data/lib/gamefic-sdk/platform/gfic.rb +0 -27
  45. data/lib/gamefic-sdk/platform/sinatra.rb +0 -98
  46. data/lib/gamefic-sdk/platform/web.rb +0 -176
  47. data/lib/gamefic-sdk/platform/web/app_config.rb +0 -81
  48. data/lib/gamefic-sdk/platform/web/engine.rb +0 -44
  49. data/lib/gamefic-sdk/platform/web/user.rb +0 -19
  50. data/lib/gamefic-sdk/shell/init.rb +0 -83
  51. data/lib/gamefic-sdk/shell/test.rb +0 -32
  52. data/scripts/save-restore-undo.plot.rb +0 -25
  53. data/scripts/snapshots.plot.rb +0 -16
  54. data/scripts/standard.plot.rb +0 -10
  55. data/scripts/standard/actions.plot.rb +0 -13
  56. data/scripts/standard/actions/drop.plot.rb +0 -19
  57. data/scripts/standard/actions/enter.plot.rb +0 -19
  58. data/scripts/standard/actions/go.plot.rb +0 -48
  59. data/scripts/standard/actions/insert.plot.rb +0 -37
  60. data/scripts/standard/actions/inventory.plot.rb +0 -9
  61. data/scripts/standard/actions/leave.plot.rb +0 -30
  62. data/scripts/standard/actions/look.plot.rb +0 -108
  63. data/scripts/standard/actions/nil.plot.rb +0 -36
  64. data/scripts/standard/actions/place.plot.rb +0 -41
  65. data/scripts/standard/actions/quit.plot.rb +0 -11
  66. data/scripts/standard/actions/take.plot.rb +0 -31
  67. data/scripts/standard/actions/talk.plot.rb +0 -27
  68. data/scripts/standard/actions/wait.plot.rb +0 -3
  69. data/scripts/standard/clothing.plot.rb +0 -4
  70. data/scripts/standard/clothing/actions.plot.rb +0 -4
  71. data/scripts/standard/clothing/actions/doff.plot.rb +0 -12
  72. data/scripts/standard/clothing/actions/drop.plot.rb +0 -8
  73. data/scripts/standard/clothing/actions/inventory.plot.rb +0 -14
  74. data/scripts/standard/clothing/actions/wear.plot.rb +0 -20
  75. data/scripts/standard/clothing/entities.plot.rb +0 -7
  76. data/scripts/standard/clothing/entities/clothing.plot.rb +0 -5
  77. data/scripts/standard/clothing/entities/coat.plot.rb +0 -3
  78. data/scripts/standard/clothing/entities/gloves.plot.rb +0 -3
  79. data/scripts/standard/clothing/entities/hat.plot.rb +0 -3
  80. data/scripts/standard/clothing/entities/pants.plot.rb +0 -3
  81. data/scripts/standard/clothing/entities/shirt.plot.rb +0 -3
  82. data/scripts/standard/clothing/entities/shoes.plot.rb +0 -3
  83. data/scripts/standard/container.plot.rb +0 -28
  84. data/scripts/standard/container/actions.plot.rb +0 -0
  85. data/scripts/standard/container/entities.plot.rb +0 -5
  86. data/scripts/standard/direction.plot.rb +0 -55
  87. data/scripts/standard/edible.plot.rb +0 -21
  88. data/scripts/standard/entities.plot.rb +0 -12
  89. data/scripts/standard/entities/character.plot.rb +0 -10
  90. data/scripts/standard/entities/fixture.plot.rb +0 -3
  91. data/scripts/standard/entities/item.plot.rb +0 -3
  92. data/scripts/standard/entities/portal.plot.rb +0 -44
  93. data/scripts/standard/entities/receptacle.plot.rb +0 -3
  94. data/scripts/standard/entities/room.plot.rb +0 -57
  95. data/scripts/standard/entities/rubble.plot.rb +0 -11
  96. data/scripts/standard/entities/scenery.plot.rb +0 -3
  97. data/scripts/standard/entities/supporter.plot.rb +0 -7
  98. data/scripts/standard/entities/thing.plot.rb +0 -7
  99. data/scripts/standard/give.plot.rb +0 -27
  100. data/scripts/standard/lockable.plot.rb +0 -79
  101. data/scripts/standard/modules.plot.rb +0 -9
  102. data/scripts/standard/modules/attachable.plot.rb +0 -12
  103. data/scripts/standard/modules/auto_takes.plot.rb +0 -50
  104. data/scripts/standard/modules/enterable.plot.rb +0 -15
  105. data/scripts/standard/modules/explicit_exits.plot.rb +0 -15
  106. data/scripts/standard/modules/itemizable.plot.rb +0 -18
  107. data/scripts/standard/modules/locale_description.plot.rb +0 -20
  108. data/scripts/standard/modules/parent-room.plot.rb +0 -9
  109. data/scripts/standard/modules/portable.plot.rb +0 -11
  110. data/scripts/standard/modules/use.plot.rb +0 -51
  111. data/scripts/standard/openable.plot.rb +0 -43
  112. data/scripts/standard/pathfinder.plot.rb +0 -65
  113. data/scripts/standard/queries.plot.rb +0 -21
  114. data/scripts/standard/test.plot.rb +0 -10
  115. 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,9 +0,0 @@
1
- module ParentRoom
2
- def room
3
- p = parent
4
- while !p.kind_of?(Room) and !p.nil?
5
- p = p.parent
6
- end
7
- p
8
- end
9
- end
@@ -1,11 +0,0 @@
1
- module Portable
2
- attr_writer :portable
3
- attr_writer :sticky
4
- attr_accessor :sticky_message
5
- def portable?
6
- @portable ||= false
7
- end
8
- def sticky?
9
- @sticky ||= false
10
- end
11
- 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
@@ -1,10 +0,0 @@
1
- # @gamefic.script standard/test
2
-
3
- meta :test, Query::Text.new do |actor, name|
4
- sym = name.to_sym
5
- if test_procs[sym].nil?
6
- actor.tell "There's no test named '#{name}' in this game."
7
- else
8
- run_test sym, actor
9
- end
10
- end
@@ -1,13 +0,0 @@
1
- # @gamefic.script undo
2
-
3
- script 'snapshots'
4
-
5
- meta :undo do |actor|
6
- last = Snapshots.history.pop
7
- if last.nil?
8
- actor.tell "No previous turns are available."
9
- else
10
- restore last
11
- actor.tell "Previous turn undone."
12
- end
13
- end