gamefic-sdk 1.2.0 → 1.3.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/skins/standard/index.html.erb +0 -1
- data/lib/gamefic-sdk/platform/base.rb +1 -1
- data/lib/gamefic-sdk/shell.rb +4 -1
- data/lib/gamefic-sdk/shell/init.rb +5 -3
- data/lib/gamefic-sdk/version.rb +1 -1
- data/scripts/autosuggest.plot.rb +2 -2
- data/scripts/standard/actions/look.plot.rb +1 -1
- data/scripts/standard/entities/room.plot.rb +25 -14
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: dd968de984939b706dad22a8c19be7c4c3a78846
|
|
4
|
+
data.tar.gz: 2501c328ff2ddcf4ddfa1810f9ff715bfa181ee3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 07d9bb71a8b50df00fe994ccf3782d8c5bdeb999c3ca01ec32f6d1711165e738480b9e98e1a7b0701a4a9ec53b9a6d8a6644878b94244d7be42e55694e8fc406
|
|
7
|
+
data.tar.gz: 12c389854dfb164f677d4719c7fc632f995c4b6579028dd437ccd0cc6c354e8f840741fff7bca3d3f6ca25e82178c8767ce038821bc4e1eac9df9bb2f96f6f7b
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
<form action="">
|
|
14
14
|
<span id="gamefic_prompt"></span>
|
|
15
15
|
<input type="text" name="command" id="gamefic_command" autocomplete="off" />
|
|
16
|
-
<!--<input type="submit" id="gamefic_submit" value="Enter" />-->
|
|
17
16
|
<button type="submit" id="gamefic_submit">Enter</button>
|
|
18
17
|
</form>
|
|
19
18
|
</div>
|
data/lib/gamefic-sdk/shell.rb
CHANGED
|
@@ -21,9 +21,12 @@ module Gamefic
|
|
|
21
21
|
option :standard, type: :boolean, default: true, desc: 'Include the standard script'
|
|
22
22
|
option :scripts, type: :array, aliases: [:s, :script], desc: 'Additional scripts'
|
|
23
23
|
option :webskin, default: 'standard', aliases: [:w], desc: 'Skin to use for the Web platform'
|
|
24
|
+
option :title, type: :string, aliases: [:t], desc: "The game's title"
|
|
25
|
+
option :author, type: :string, aliases: [:a], desc: "The game's author"
|
|
24
26
|
def init(directory_name)
|
|
25
27
|
Gamefic::Sdk::Shell::Init.new(directory: directory_name,
|
|
26
|
-
quiet: options[:quiet], scripts: options[:scripts], webskin: options[:webskin]
|
|
28
|
+
quiet: options[:quiet], scripts: options[:scripts], webskin: options[:webskin],
|
|
29
|
+
title: options[:title], author: options[:author]).run
|
|
27
30
|
end
|
|
28
31
|
|
|
29
32
|
desc 'test DIRECTORY_NAME', 'Play the game in DIRECTORY_NAME'
|
|
@@ -5,7 +5,7 @@ module Gamefic
|
|
|
5
5
|
module Sdk
|
|
6
6
|
class Shell
|
|
7
7
|
class Init
|
|
8
|
-
def initialize(directory:, standard: true, quiet: false, scripts: [], webskin: 'standard')
|
|
8
|
+
def initialize(directory:, standard: true, quiet: false, scripts: [], webskin: 'standard', title: nil, author: nil)
|
|
9
9
|
@quiet = quiet
|
|
10
10
|
@directory = directory
|
|
11
11
|
@html = webskin
|
|
@@ -13,6 +13,8 @@ module Gamefic
|
|
|
13
13
|
@scripts.push('standard') if standard
|
|
14
14
|
@scripts += scripts if scripts
|
|
15
15
|
@platforms = ['Gfic', 'Web']
|
|
16
|
+
@title = title
|
|
17
|
+
@author = author
|
|
16
18
|
end
|
|
17
19
|
|
|
18
20
|
def run
|
|
@@ -67,8 +69,8 @@ module Gamefic
|
|
|
67
69
|
|
|
68
70
|
def write_config_yaml
|
|
69
71
|
File.open("#{@directory}/config.yaml", 'w') do |file|
|
|
70
|
-
file.puts "title: Untitled",
|
|
71
|
-
"author: Anonymous",
|
|
72
|
+
file.puts "title: #{@title || 'Untitled'}",
|
|
73
|
+
"author: #{@author || 'Anonymous'}",
|
|
72
74
|
"",
|
|
73
75
|
"script_paths:",
|
|
74
76
|
" - ./scripts",
|
data/lib/gamefic-sdk/version.rb
CHANGED
data/scripts/autosuggest.plot.rb
CHANGED
|
@@ -37,7 +37,7 @@ on_player_update do |actor|
|
|
|
37
37
|
actor.suggest "examine #{the entity}"
|
|
38
38
|
}
|
|
39
39
|
Use.visible.context_from(actor).that_are(:portable?).each { |entity|
|
|
40
|
-
actor.suggest "take #{the entity}"
|
|
40
|
+
actor.suggest "take #{the entity}" unless entity.parent == actor
|
|
41
41
|
}
|
|
42
42
|
Use.visible.context_from(actor).that_are(Container).that_are_not(:open?).each { |entity|
|
|
43
43
|
actor.suggest "close #{the entity}"
|
|
@@ -118,7 +118,7 @@ end
|
|
|
118
118
|
|
|
119
119
|
respond :look, Use.visible(:portable?) do |actor, thing|
|
|
120
120
|
actor.proceed
|
|
121
|
-
actor.suggest "take #{the thing}"
|
|
121
|
+
actor.suggest "take #{the thing}" unless thing.parent == actor
|
|
122
122
|
end
|
|
123
123
|
|
|
124
124
|
respond :inventory do |actor|
|
|
@@ -10,7 +10,7 @@ end
|
|
|
10
10
|
|
|
11
11
|
respond :look, Use.room do |actor, room|
|
|
12
12
|
actor.tell "<strong>#{room.name.cap_first}</strong>"
|
|
13
|
-
actor.tell room.description
|
|
13
|
+
actor.tell room.description if room.has_description?
|
|
14
14
|
with_locales = []
|
|
15
15
|
chars = room.children.that_are(Character).that_are(:itemized?) - [actor]
|
|
16
16
|
charsum = []
|
|
@@ -5,6 +5,31 @@ class Gamefic::Room < Gamefic::Entity
|
|
|
5
5
|
serialize :dark?, :explicit_exits?
|
|
6
6
|
|
|
7
7
|
def connect(destination, direction = nil, type = Portal, two_way = true)
|
|
8
|
+
if direction.kind_of?(Hash)
|
|
9
|
+
connect2(destination, direction)
|
|
10
|
+
else
|
|
11
|
+
connect2 destination, direction: direction, type: type, two_way: true
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def synonyms
|
|
16
|
+
@synonyms.to_s + " around here room"
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def tell(message)
|
|
20
|
+
children.each { |c|
|
|
21
|
+
c.tell message
|
|
22
|
+
}
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def find_portal(direction)
|
|
26
|
+
d = direction.to_s
|
|
27
|
+
portals = children.that_are(Portal).delete_if { |p| p.direction.to_s != d }
|
|
28
|
+
portals[0]
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
private
|
|
32
|
+
def connect2 destination, direction:nil, type:Portal, two_way:true
|
|
8
33
|
if direction.nil?
|
|
9
34
|
portal = type.new self.plot, :parent => self, :destination => destination, :name => destination.definitely
|
|
10
35
|
if two_way == true
|
|
@@ -31,18 +56,4 @@ class Gamefic::Room < Gamefic::Entity
|
|
|
31
56
|
end
|
|
32
57
|
portal
|
|
33
58
|
end
|
|
34
|
-
|
|
35
|
-
def synonyms
|
|
36
|
-
@synonyms.to_s + " around here room"
|
|
37
|
-
end
|
|
38
|
-
def tell(message)
|
|
39
|
-
children.each { |c|
|
|
40
|
-
c.tell message
|
|
41
|
-
}
|
|
42
|
-
end
|
|
43
|
-
def find_portal(direction)
|
|
44
|
-
d = direction.to_s
|
|
45
|
-
portals = children.that_are(Portal).delete_if { |p| p.direction.to_s != d }
|
|
46
|
-
portals[0]
|
|
47
|
-
end
|
|
48
59
|
end
|
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.3.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: 2016-12-
|
|
11
|
+
date: 2016-12-26 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: gamefic
|