gamefic-sdk 1.6.0 → 1.7.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 +89 -20
- data/html/sinatra/engine.js +27 -13
- data/html/skins/hypertext/index.html +0 -2
- data/html/skins/standard/play.js +0 -66
- data/lib/gamefic-sdk.rb +2 -1
- data/lib/gamefic-sdk/build.rb +11 -19
- data/lib/gamefic-sdk/config.rb +126 -0
- data/lib/gamefic-sdk/platform.rb +12 -0
- data/lib/gamefic-sdk/platform/base.rb +35 -33
- data/lib/gamefic-sdk/platform/gfic.rb +5 -18
- data/lib/gamefic-sdk/platform/sinatra.rb +29 -31
- data/lib/gamefic-sdk/platform/web.rb +72 -65
- data/lib/gamefic-sdk/platform/web/app_config.rb +48 -48
- data/lib/gamefic-sdk/platform/web/engine.rb +10 -7
- data/lib/gamefic-sdk/platform/web/user.rb +3 -3
- data/lib/gamefic-sdk/server.rb +17 -19
- data/lib/gamefic-sdk/shell.rb +68 -16
- data/lib/gamefic-sdk/shell/init.rb +3 -19
- data/lib/gamefic-sdk/shell/test.rb +9 -14
- data/lib/gamefic-sdk/version.rb +1 -1
- data/scripts/save-restore-undo.plot.rb +25 -0
- data/scripts/snapshots.plot.rb +16 -14
- data/scripts/standard.plot.rb +3 -5
- data/scripts/standard/actions.plot.rb +1 -11
- data/scripts/standard/actions/drop.plot.rb +1 -1
- data/scripts/standard/actions/enter.plot.rb +4 -16
- data/scripts/standard/actions/go.plot.rb +2 -36
- data/scripts/standard/actions/insert.plot.rb +7 -21
- data/scripts/standard/actions/inventory.plot.rb +2 -1
- data/scripts/standard/actions/leave.plot.rb +7 -18
- data/scripts/standard/actions/look.plot.rb +45 -44
- data/scripts/standard/actions/nil.plot.rb +1 -1
- data/scripts/standard/actions/take.plot.rb +10 -28
- data/scripts/standard/actions/talk.plot.rb +9 -13
- data/scripts/standard/clothing.plot.rb +4 -0
- data/scripts/standard/clothing/actions.plot.rb +4 -0
- data/scripts/{clothing → standard/clothing}/actions/doff.plot.rb +0 -0
- data/scripts/{clothing → standard/clothing}/actions/drop.plot.rb +8 -8
- data/scripts/{clothing → standard/clothing}/actions/inventory.plot.rb +14 -14
- data/scripts/standard/clothing/actions/wear.plot.rb +20 -0
- data/scripts/standard/clothing/entities.plot.rb +7 -0
- data/scripts/{clothing → standard/clothing}/entities/clothing.plot.rb +0 -2
- data/scripts/standard/clothing/entities/coat.plot.rb +3 -0
- data/scripts/standard/clothing/entities/gloves.plot.rb +3 -0
- data/scripts/standard/clothing/entities/hat.plot.rb +3 -0
- data/scripts/standard/clothing/entities/pants.plot.rb +3 -0
- data/scripts/standard/clothing/entities/shirt.plot.rb +3 -0
- data/scripts/standard/clothing/entities/shoes.plot.rb +3 -0
- data/scripts/standard/container.plot.rb +28 -0
- data/scripts/{debug.plot.rb → standard/container/actions.plot.rb} +0 -0
- data/scripts/standard/container/entities.plot.rb +5 -0
- data/scripts/standard/direction.plot.rb +1 -2
- data/scripts/{edible.plot.rb → standard/edible.plot.rb} +5 -3
- data/scripts/standard/entities.plot.rb +3 -3
- data/scripts/standard/entities/character.plot.rb +9 -6
- data/scripts/standard/entities/fixture.plot.rb +1 -1
- data/scripts/standard/entities/item.plot.rb +2 -4
- data/scripts/standard/entities/portal.plot.rb +9 -5
- data/scripts/standard/entities/receptacle.plot.rb +1 -1
- data/scripts/standard/entities/room.plot.rb +5 -5
- data/scripts/standard/entities/scenery.plot.rb +2 -4
- data/scripts/standard/entities/supporter.plot.rb +4 -7
- data/scripts/standard/entities/thing.plot.rb +7 -0
- data/scripts/standard/{actions/give.plot.rb → give.plot.rb} +27 -25
- data/scripts/standard/lockable.plot.rb +79 -0
- data/scripts/standard/modules.plot.rb +2 -4
- data/scripts/standard/modules/attachable.plot.rb +1 -0
- data/scripts/standard/modules/locale_description.plot.rb +20 -0
- data/scripts/standard/{use.plot.rb → modules/use.plot.rb} +51 -47
- data/scripts/standard/openable.plot.rb +43 -0
- data/scripts/standard/pathfinder.plot.rb +11 -6
- data/scripts/standard/test.plot.rb +2 -0
- data/scripts/undo.plot.rb +13 -11
- metadata +30 -65
- data/lib/gamefic-sdk/plot_config.rb +0 -25
- data/scripts/ansi.plot.rb +0 -13
- data/scripts/autosuggest.plot.rb +0 -165
- data/scripts/clothing.plot.rb +0 -2
- data/scripts/clothing/actions.plot.rb +0 -4
- data/scripts/clothing/actions/wear.plot.rb +0 -19
- data/scripts/clothing/entities.plot.rb +0 -7
- data/scripts/clothing/entities/coat.plot.rb +0 -5
- data/scripts/clothing/entities/gloves.plot.rb +0 -5
- data/scripts/clothing/entities/hat.plot.rb +0 -5
- data/scripts/clothing/entities/pants.plot.rb +0 -5
- data/scripts/clothing/entities/shirt.plot.rb +0 -5
- data/scripts/clothing/entities/shoes.plot.rb +0 -5
- data/scripts/cover.plot.rb +0 -30
- data/scripts/furniture.plot.rb +0 -35
- data/scripts/hints.plot.rb +0 -31
- data/scripts/hypertext.plot.rb +0 -280
- data/scripts/media.plot.rb +0 -17
- data/scripts/multimedia.plot.rb +0 -41
- data/scripts/questions.plot.rb +0 -17
- data/scripts/room-modes.plot.rb +0 -48
- data/scripts/rough-sizes.plot.rb +0 -36
- data/scripts/save-restore.plot.rb +0 -22
- data/scripts/standard/actions/close.plot.rb +0 -16
- data/scripts/standard/actions/lock.plot.rb +0 -59
- data/scripts/standard/actions/look-under.plot.rb +0 -8
- data/scripts/standard/actions/open.plot.rb +0 -34
- data/scripts/standard/actions/read.plot.rb +0 -3
- data/scripts/standard/actions/search.plot.rb +0 -40
- data/scripts/standard/actions/show.plot.rb +0 -13
- data/scripts/standard/actions/unlock.plot.rb +0 -77
- data/scripts/standard/actions/use.plot.rb +0 -25
- data/scripts/standard/entities/container.plot.rb +0 -8
- data/scripts/standard/entities/door.plot.rb +0 -51
- data/scripts/standard/entities/entity.plot.rb +0 -12
- data/scripts/standard/entities/exterior.plot.rb +0 -5
- data/scripts/standard/modules/darkenable.plot.rb +0 -6
- data/scripts/standard/modules/lockable.plot.rb +0 -25
- data/scripts/standard/modules/openable.plot.rb +0 -15
- data/scripts/standard/modules/transparent.plot.rb +0 -6
- data/scripts/standard/plural.plot.rb +0 -2
- data/scripts/standard/plural/actions.plot.rb +0 -4
- data/scripts/standard/plural/actions/drop.plot.rb +0 -126
- data/scripts/standard/plural/actions/insert.plot.rb +0 -60
- data/scripts/standard/plural/actions/place.plot.rb +0 -37
- data/scripts/standard/plural/actions/take.plot.rb +0 -175
- data/scripts/standard/plural/queries.plot.rb +0 -5
- data/scripts/standard/plural/queries/ambiguous_visible.plot.rb +0 -13
- data/scripts/standard/plural/queries/any_expression.plot.rb +0 -17
- data/scripts/standard/plural/queries/many_visible.plot.rb +0 -13
- data/scripts/standard/plural/queries/not_expression.plot.rb +0 -16
- data/scripts/standard/plural/queries/plural_visible.plot.rb +0 -22
- data/scripts/suggestible.plot.rb +0 -54
@@ -6,11 +6,11 @@ respond :talk, Use.itself do |actor, yourself|
|
|
6
6
|
actor.perform :talk
|
7
7
|
end
|
8
8
|
|
9
|
-
respond :talk, Use.
|
9
|
+
respond :talk, Use.available do |actor, thing|
|
10
10
|
actor.tell "Nothing happens."
|
11
11
|
end
|
12
12
|
|
13
|
-
respond :talk, Use.
|
13
|
+
respond :talk, Use.available(Character) do |actor, character|
|
14
14
|
if actor == character
|
15
15
|
actor.perform :talk
|
16
16
|
else
|
@@ -18,14 +18,10 @@ respond :talk, Use.family(Character) do |actor, character|
|
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
xlate "ask :character about :subject", "talk :character :subject"
|
29
|
-
xlate "tell :character :subject", "talk :character :subject"
|
30
|
-
xlate "tell :character about :subject", "talk :character :subject"
|
31
|
-
xlate "ask :character for :subject", "talk :character :subject"
|
21
|
+
interpret "talk to :character", "talk :character"
|
22
|
+
interpret "talk to :character about :subject", "talk :character :subject"
|
23
|
+
interpret "ask :character :subject", "talk :character :subject"
|
24
|
+
interpret "ask :character about :subject", "talk :character :subject"
|
25
|
+
interpret "tell :character :subject", "talk :character :subject"
|
26
|
+
interpret "tell :character about :subject", "talk :character :subject"
|
27
|
+
interpret "ask :character for :subject", "talk :character :subject"
|
File without changes
|
@@ -1,8 +1,8 @@
|
|
1
|
-
respond :drop, Query::Children.new(Clothing) do |actor, clothing|
|
2
|
-
if clothing.attached?
|
3
|
-
actor.perform :doff, clothing
|
4
|
-
end
|
5
|
-
if !clothing.attached?
|
6
|
-
actor.proceed
|
7
|
-
end
|
8
|
-
end
|
1
|
+
respond :drop, Query::Children.new(Clothing) do |actor, clothing|
|
2
|
+
if clothing.attached?
|
3
|
+
actor.perform :doff, clothing
|
4
|
+
end
|
5
|
+
if !clothing.attached?
|
6
|
+
actor.proceed
|
7
|
+
end
|
8
|
+
end
|
@@ -1,14 +1,14 @@
|
|
1
|
-
respond :inventory do |actor|
|
2
|
-
if actor.children.length > 0
|
3
|
-
carried = actor.children.that_are_not(:attached?)
|
4
|
-
worn = actor.children.that_are(:attached?)
|
5
|
-
if carried.length > 0
|
6
|
-
actor.tell "You are carrying #{carried.join_and}."
|
7
|
-
end
|
8
|
-
if worn.length > 0
|
9
|
-
actor.tell "You are wearing #{worn.join_and}."
|
10
|
-
end
|
11
|
-
else
|
12
|
-
actor.tell "You aren't carrying anything."
|
13
|
-
end
|
14
|
-
end
|
1
|
+
respond :inventory do |actor|
|
2
|
+
if actor.children.length > 0
|
3
|
+
carried = actor.children.that_are_not(:attached?)
|
4
|
+
worn = actor.children.that_are(:attached?)
|
5
|
+
if carried.length > 0
|
6
|
+
actor.tell "You are carrying #{carried.join_and}."
|
7
|
+
end
|
8
|
+
if worn.length > 0
|
9
|
+
actor.tell "You are wearing #{worn.join_and}."
|
10
|
+
end
|
11
|
+
else
|
12
|
+
actor.tell "You aren't carrying anything."
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
respond :wear, Use.available(Clothing) do |actor, clothing|
|
2
|
+
if clothing.parent != actor
|
3
|
+
actor.tell "You don't have #{the clothing}."
|
4
|
+
end
|
5
|
+
if clothing.attached?
|
6
|
+
actor.tell "You're already wearing #{the clothing}."
|
7
|
+
else
|
8
|
+
already = actor.children.that_are(clothing.class).that_are(:attached?)
|
9
|
+
if already.length == 0
|
10
|
+
clothing.attached = true
|
11
|
+
actor.tell "You put on #{the clothing}."
|
12
|
+
else
|
13
|
+
actor.tell "You're already wearing #{an already[0]}."
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
xlate "put on :clothing", "wear :clothing"
|
19
|
+
xlate "put :clothing on", "wear :clothing"
|
20
|
+
xlate "don :clothing", "wear :clothing"
|
@@ -0,0 +1,7 @@
|
|
1
|
+
script 'standard/clothing/entities/clothing'
|
2
|
+
script 'standard/clothing/entities/coat'
|
3
|
+
script 'standard/clothing/entities/gloves'
|
4
|
+
script 'standard/clothing/entities/hat'
|
5
|
+
script 'standard/clothing/entities/pants'
|
6
|
+
script 'standard/clothing/entities/shirt'
|
7
|
+
script 'standard/clothing/entities/shoes'
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# @gamefic.script standard/container
|
2
|
+
|
3
|
+
script 'standard/openable'
|
4
|
+
script 'standard/lockable'
|
5
|
+
#script 'standard/container/entities'
|
6
|
+
#script 'standard/container/actions'
|
7
|
+
|
8
|
+
class Container < Receptacle
|
9
|
+
include Openable
|
10
|
+
include Lockable
|
11
|
+
#include Transparent
|
12
|
+
end
|
13
|
+
|
14
|
+
respond :insert, Use.available, Use.available(Container) do |actor, thing, container|
|
15
|
+
if container.open?
|
16
|
+
actor.proceed
|
17
|
+
else
|
18
|
+
actor.tell "#{The container} is closed."
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
respond :leave, Use.parent(Container, :enterable?, :closed?) do |actor, container|
|
23
|
+
actor.tell "#{The container} is closed."
|
24
|
+
end
|
25
|
+
|
26
|
+
respond :enter, Use.siblings(Container, :enterable?, :closed?) do |actor, container|
|
27
|
+
actor.tell "#{The container} is closed."
|
28
|
+
end
|
File without changes
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# @gamefic.script standard/edible
|
2
|
+
|
1
3
|
module Edibility
|
2
4
|
attr_writer :edible
|
3
5
|
def edible?
|
@@ -5,15 +7,15 @@ module Edibility
|
|
5
7
|
end
|
6
8
|
end
|
7
9
|
|
8
|
-
class
|
10
|
+
class Thing
|
9
11
|
include Edibility
|
10
12
|
end
|
11
13
|
|
12
|
-
respond :eat, Use.
|
14
|
+
respond :eat, Use.available do |actor, item|
|
13
15
|
actor.tell "You can't eat #{the item}."
|
14
16
|
end
|
15
17
|
|
16
|
-
respond :eat, Use.
|
18
|
+
respond :eat, Use.available(:edible?) do |actor, item|
|
17
19
|
actor.tell "You eat #{the item}."
|
18
20
|
destroy item
|
19
21
|
end
|
@@ -1,7 +1,7 @@
|
|
1
|
-
script 'standard/entities/
|
1
|
+
script 'standard/entities/thing'
|
2
2
|
script 'standard/entities/character'
|
3
|
-
script 'standard/entities/container'
|
4
|
-
script 'standard/entities/door'
|
3
|
+
#script 'standard/entities/container'
|
4
|
+
#script 'standard/entities/door'
|
5
5
|
script 'standard/entities/fixture'
|
6
6
|
script 'standard/entities/item'
|
7
7
|
script 'standard/entities/portal'
|
@@ -1,7 +1,10 @@
|
|
1
|
-
class
|
2
|
-
include ParentRoom
|
3
|
-
include Attachable
|
4
|
-
include Itemizable
|
5
|
-
include AutoTakes
|
6
|
-
|
1
|
+
class Character < Thing
|
2
|
+
#include ParentRoom
|
3
|
+
#include Attachable
|
4
|
+
#include Itemizable
|
5
|
+
#include AutoTakes
|
6
|
+
#include LocaleDescription
|
7
|
+
include Gamefic::Active
|
7
8
|
end
|
9
|
+
|
10
|
+
player_class Character
|
@@ -1,4 +1,4 @@
|
|
1
|
-
class Portal <
|
1
|
+
class Portal < Thing
|
2
2
|
attr_accessor :destination
|
3
3
|
|
4
4
|
# Find the portal in the destination that returns to this portal's parent
|
@@ -16,7 +16,7 @@ class Portal < Gamefic::Entity
|
|
16
16
|
end
|
17
17
|
nil
|
18
18
|
end
|
19
|
-
|
19
|
+
|
20
20
|
# Get the ordinal direction of this Portal
|
21
21
|
# Portals have distinct direction and name properties so games can display a
|
22
22
|
# bare compass direction for exits, e.g., "south" vs. "the southern door."
|
@@ -25,7 +25,7 @@ class Portal < Gamefic::Entity
|
|
25
25
|
def direction
|
26
26
|
@direction
|
27
27
|
end
|
28
|
-
|
28
|
+
|
29
29
|
def direction= d
|
30
30
|
@direction = Direction.find(d)
|
31
31
|
end
|
@@ -33,8 +33,12 @@ class Portal < Gamefic::Entity
|
|
33
33
|
def name
|
34
34
|
@name || (direction.nil? ? destination.name : direction.name)
|
35
35
|
end
|
36
|
-
|
36
|
+
|
37
|
+
def instruction
|
38
|
+
direction || (destination ? "to #{destination.definitely}" : name)
|
39
|
+
end
|
40
|
+
|
37
41
|
def synonyms
|
38
|
-
"#{super} #{@direction} #{!direction.nil? ? direction.synonyms : ''}"
|
42
|
+
"#{super} #{@destination} #{@direction} #{!direction.nil? ? direction.synonyms : ''}"
|
39
43
|
end
|
40
44
|
end
|
@@ -1,5 +1,4 @@
|
|
1
|
-
class Room <
|
2
|
-
include Darkenable
|
1
|
+
class Room < Thing
|
3
2
|
include ExplicitExits
|
4
3
|
|
5
4
|
def connect(destination, direction = nil, type = Portal, two_way = true)
|
@@ -13,20 +12,21 @@ class Room < Gamefic::Entity
|
|
13
12
|
def synonyms
|
14
13
|
@synonyms.to_s + " around here room"
|
15
14
|
end
|
16
|
-
|
15
|
+
|
17
16
|
def tell(message)
|
18
17
|
children.each { |c|
|
19
18
|
c.tell message
|
20
19
|
}
|
21
20
|
end
|
22
|
-
|
21
|
+
|
23
22
|
def find_portal(direction)
|
24
23
|
d = direction.to_s
|
25
24
|
portals = children.that_are(Portal).delete_if { |p| p.direction.to_s != d }
|
26
25
|
portals[0]
|
27
26
|
end
|
28
|
-
|
27
|
+
|
29
28
|
private
|
29
|
+
|
30
30
|
def connect2 destination, direction:nil, type:Portal, two_way:true
|
31
31
|
if direction.nil?
|
32
32
|
portal = type.new :parent => self, :destination => destination
|
@@ -1,10 +1,7 @@
|
|
1
|
-
class Supporter <
|
1
|
+
class Supporter < Thing
|
2
2
|
include Enterable
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
self.inside_verb = "be on"
|
8
|
-
super
|
9
|
-
end
|
4
|
+
set_default enter_verb: 'get on'
|
5
|
+
set_default leave_verb: 'get off'
|
6
|
+
set_default inside_verb: 'be on'
|
10
7
|
end
|
@@ -1,25 +1,27 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
actor.tell "#{
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
actor.
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
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"
|