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,5 +0,0 @@
1
- class Container < Receptacle
2
- include Openable
3
- include Lockable
4
- #include Transparent
5
- end
@@ -1,55 +0,0 @@
1
- class 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
- end
@@ -1,21 +0,0 @@
1
- # @gamefic.script standard/edible
2
-
3
- module Edibility
4
- attr_writer :edible
5
- def edible?
6
- @edible ||= false
7
- end
8
- end
9
-
10
- class Thing
11
- include Edibility
12
- end
13
-
14
- respond :eat, Use.available do |actor, item|
15
- actor.tell "You can't eat #{the item}."
16
- end
17
-
18
- respond :eat, Use.available(:edible?) do |actor, item|
19
- actor.tell "You eat #{the item}."
20
- destroy item
21
- end
@@ -1,12 +0,0 @@
1
- script 'standard/entities/thing'
2
- script 'standard/entities/character'
3
- #script 'standard/entities/container'
4
- #script 'standard/entities/door'
5
- script 'standard/entities/fixture'
6
- script 'standard/entities/item'
7
- script 'standard/entities/portal'
8
- script 'standard/entities/receptacle'
9
- script 'standard/entities/room'
10
- script 'standard/entities/scenery'
11
- script 'standard/entities/rubble'
12
- script 'standard/entities/supporter'
@@ -1,10 +0,0 @@
1
- class Character < Thing
2
- #include ParentRoom
3
- #include Attachable
4
- #include Itemizable
5
- #include AutoTakes
6
- #include LocaleDescription
7
- include Gamefic::Active
8
- end
9
-
10
- player_class Character
@@ -1,3 +0,0 @@
1
- class Fixture < Thing
2
-
3
- end
@@ -1,3 +0,0 @@
1
- class Item < Thing
2
- set_default portable: true
3
- end
@@ -1,44 +0,0 @@
1
- class Portal < Thing
2
- attr_accessor :destination
3
-
4
- # Find the portal in the destination that returns to this portal's parent
5
- #
6
- # @return [Room]
7
- def find_reverse
8
- return nil if destination.nil?
9
- rev = direction.reverse
10
- if rev != nil
11
- destination.children.that_are(Portal).each { |c|
12
- if c.direction == rev
13
- return c
14
- end
15
- }
16
- end
17
- nil
18
- end
19
-
20
- # Get the ordinal direction of this Portal
21
- # Portals have distinct direction and name properties so games can display a
22
- # bare compass direction for exits, e.g., "south" vs. "the southern door."
23
- #
24
- # @return [Direction]
25
- def direction
26
- @direction
27
- end
28
-
29
- def direction= d
30
- @direction = Direction.find(d)
31
- end
32
-
33
- def name
34
- @name || (direction.nil? ? destination.name : direction.name)
35
- end
36
-
37
- def instruction
38
- direction || (destination ? "to #{destination.definitely}" : name)
39
- end
40
-
41
- def synonyms
42
- "#{super} #{@destination} #{@direction} #{!direction.nil? ? direction.synonyms : ''}"
43
- end
44
- end
@@ -1,3 +0,0 @@
1
- class Receptacle < Thing
2
- include Enterable
3
- end
@@ -1,57 +0,0 @@
1
- class Room < Thing
2
- include ExplicitExits
3
-
4
- def connect(destination, direction = nil, type = Portal, two_way = true)
5
- if direction.kind_of?(Hash)
6
- connect2(destination, direction)
7
- else
8
- connect2 destination, direction: direction, type: type, two_way: true
9
- end
10
- end
11
-
12
- def synonyms
13
- @synonyms.to_s + " around here room"
14
- end
15
-
16
- def tell(message)
17
- children.each { |c|
18
- c.tell message
19
- }
20
- end
21
-
22
- def find_portal(direction)
23
- d = direction.to_s
24
- portals = children.that_are(Portal).delete_if { |p| p.direction.to_s != d }
25
- portals[0]
26
- end
27
-
28
- private
29
-
30
- def connect2 destination, direction:nil, type:Portal, two_way:true
31
- if direction.nil?
32
- portal = type.new :parent => self, :destination => destination
33
- if two_way == true
34
- portal2 = type.new :parent => destination, :destination => self
35
- end
36
- else
37
- if direction.kind_of?(String)
38
- direction = Direction.find(direction)
39
- end
40
- portal = type.new :direction => direction, :parent => self, :destination => destination
41
- portal.proper_named = true if type == Portal
42
- if two_way == true
43
- reverse = direction.reverse
44
- if reverse == nil
45
- raise "#{direction.name.cap_first} does not have an opposite direction"
46
- end
47
- portal2 = type.new({
48
- :direction => reverse,
49
- :parent => destination,
50
- :destination => self
51
- })
52
- portal2.proper_named = true if type == Portal
53
- end
54
- end
55
- portal
56
- end
57
- end
@@ -1,11 +0,0 @@
1
- script 'standard/entities/scenery'
2
-
3
- # Rubble is Scenery with slightly modified action responses.
4
- # Intended for things that might be portable but are useless.
5
- # Rule of thumb: Scenery is something that can't be carried,
6
- # like a table or the sky; and Rubble is something that might
7
- # be portable but is otherwise useless, like trash or debris.
8
-
9
- class Rubble < Scenery
10
-
11
- end
@@ -1,3 +0,0 @@
1
- class Scenery < Thing
2
- set_default itemized: false
3
- end
@@ -1,7 +0,0 @@
1
- class Supporter < Thing
2
- include Enterable
3
-
4
- set_default enter_verb: 'get on'
5
- set_default leave_verb: 'get off'
6
- set_default inside_verb: 'be on'
7
- end
@@ -1,7 +0,0 @@
1
- class Thing < Gamefic::Entity
2
- include Portable
3
- include Itemizable
4
- include ParentRoom
5
- include Attachable
6
- include LocaleDescription
7
- end
@@ -1,27 +0,0 @@
1
- # @gamefic.script standard/give
2
-
3
- respond :give, Use.available, Query::Children.new do |actor, character, gift|
4
- actor.tell "Nothing happens."
5
- end
6
-
7
- respond :give, Use.available(Character), Use.available do |actor, character, gift|
8
- if gift.sticky?
9
- actor.tell gift.sticky_message || "#{you.pronoun.Subj} #{you.verb.need} to keep #{the gift} for now."
10
- else
11
- actor.tell "#{The character} doesn't want #{the gift}."
12
- end
13
- end
14
-
15
- respond :give, Use.available(Character), Use.available do |actor, character, gift|
16
- if gift.parent == actor
17
- actor.proceed
18
- else
19
- actor.tell "#{you.pronoun.Subj} #{you.contract(you.verb.do + ' not')} have #{the gift}."
20
- end
21
- end
22
-
23
- respond :give, Use.text, Use.available do |actor, character, gift|
24
- actor.tell "#{you.pronoun.Subj} #{you.contract(you.verb.do + ' not')} see any \"#{character}\" here."
25
- end
26
-
27
- interpret "give :gift to :character", "give :character :gift"
@@ -1,79 +0,0 @@
1
- # @gamefic.script standard/lockable
2
-
3
- script 'standard/openable'
4
-
5
- module Lockable
6
- include Openable
7
-
8
- attr_accessor :lock_key
9
-
10
- def locked=(bool)
11
- @locked = bool
12
- if @locked == true
13
- self.open = false
14
- end
15
- end
16
-
17
- def open=(bool)
18
- @open = bool
19
- @locked = false if @open == true
20
- end
21
-
22
- def locked?
23
- @locked ||= false
24
- end
25
-
26
- def has_lock_key?
27
- !@lock_key.nil?
28
- end
29
- end
30
-
31
- respond :lock, Use.available do |actor, thing|
32
- actor.tell "#{you.pronoun.Subj} #{you.contract you.verb.can + ' not'} lock #{the thing}."
33
- end
34
-
35
- respond :_toggle_lock, Use.available(Lockable, :has_lock_key?) do |actor, thing|
36
- verb = thing.locked? ? 'unlock' : 'lock'
37
- key = nil
38
- if thing.lock_key.parent == actor
39
- key = thing.lock_key
40
- end
41
- if key.nil?
42
- actor.tell "#{you.pronoun.Subj} #{you.contract you.verb.do + ' not'} have any way to #{verb} #{the thing}."
43
- else
44
- actor.tell "#{you.pronoun.Subj} #{you.verb['verb']} #{the thing} with #{the key}."
45
- thing.locked = !thing.locked?
46
- end
47
- end
48
-
49
- respond :lock, Use.available(Lockable, :has_lock_key?), Use.children do |actor, thing, key|
50
- if thing.lock_key == key
51
- actor.perform :_toggle_lock, thing
52
- else
53
- actor.tell "#{you.pronoun.Subj} #{you.contract you.verb.can + ' not'} unlock #{the thing} with #{the key}."
54
- end
55
- end
56
-
57
- respond :lock, Use.available(Lockable, :has_lock_key?), Use.available do |actor, thing, key|
58
- actor.perform :take, key if key.parent != actor
59
- actor.proceed if key.parent == actor
60
- end
61
-
62
- respond :unlock, Use.available do |actor, thing|
63
- actor.tell "#{you.pronoun.Subj} #{you.contract you.verb.can + ' not'} unlock #{the thing}."
64
- end
65
-
66
- respond :unlock, Use.available(Lockable, :has_lock_key?), Use.children do |actor, thing, key|
67
- if thing.lock_key == key
68
- actor.perform :_toggle_lock, thing
69
- else
70
- actor.tell "#{you.pronoun.Subj} #{you.contract you.verb.can + ' not'} unlock #{the thing} with #{the key}."
71
- end
72
- end
73
-
74
- respond :unlock, Use.available(Lockable, :has_lock_key?), Use.available do |actor, thing, key|
75
- actor.perform :take, key if key.parent != actor
76
- actor.proceed if key.parent == actor
77
- end
78
-
79
- interpret "lock :container with :key", "lock :container :key"
@@ -1,9 +0,0 @@
1
- script 'standard/modules/use'
2
- script 'standard/modules/attachable'
3
- script 'standard/modules/auto_takes'
4
- script 'standard/modules/enterable'
5
- script 'standard/modules/explicit_exits'
6
- script 'standard/modules/itemizable'
7
- script 'standard/modules/parent-room'
8
- script 'standard/modules/portable'
9
- script 'standard/modules/locale_description'
@@ -1,12 +0,0 @@
1
- module Attachable
2
- def attached?
3
- if @attached.nil?
4
- @attached = false
5
- end
6
- @attached
7
- end
8
-
9
- def attached=(bool)
10
- @attached = bool
11
- end
12
- end
@@ -1,50 +0,0 @@
1
- module AutoTakes
2
- def auto_takes?(entity)
3
- return true if entity.parent == self
4
- if AutoTakes.enabled?
5
- if AutoTakes.taking_message.to_s != ""
6
- self.tell (AutoTakes.taking_message % {:name => entity.definitely, :Name => entity.definitely.cap_first})
7
- end
8
- buff = self.quietly :take, entity
9
- if entity.parent != self
10
- self.tell buff
11
- false
12
- else
13
- if AutoTakes.taken_message.to_s != ""
14
- self.tell (AutoTakes.taken_message % {:name => entity.definitely, :Name => entity.definitely.cap_first})
15
- end
16
- true
17
- end
18
- else
19
- self.tell (AutoTakes.untaken_message % {:name => entity.definitely, :Name => entity.definitely.cap_first})
20
- false
21
- end
22
- end
23
- def self.enabled?
24
- if @enabled.nil?
25
- @enabled = true
26
- end
27
- @enabled
28
- end
29
- def self.enabled=(bool)
30
- @enabled = bool
31
- end
32
- def self.taking_message
33
- @taking_message ||= ""
34
- end
35
- def self.taking_message=(text)
36
- @taking_message = text
37
- end
38
- def self.taken_message
39
- @taken_message ||= ""
40
- end
41
- def self.taken_message=(text)
42
- @taken_message = text
43
- end
44
- def self.untaken_message
45
- @untaken_message ||= "You don't have %{name}."
46
- end
47
- def self.untaken_message=(text)
48
- @untaken_message = text
49
- end
50
- end