gamefic 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gamefic/action.rb +7 -6
- data/lib/gamefic/before.rb +12 -0
- data/lib/gamefic/character.rb +1 -1
- data/lib/gamefic/core_ext/array.rb +4 -0
- data/lib/gamefic/core_ext/string.rb +0 -31
- data/lib/gamefic/describable.rb +68 -8
- data/lib/gamefic/director.rb +108 -75
- data/lib/gamefic/engine.rb +74 -10
- data/lib/gamefic/entity.rb +3 -3
- data/lib/gamefic/import/basics/actions/close.rb +16 -0
- data/lib/gamefic/import/basics/actions/commands.rb +3 -0
- data/lib/gamefic/import/basics/actions/drop-in.rb +17 -0
- data/lib/gamefic/import/basics/actions/drop-on.rb +16 -0
- data/lib/gamefic/import/basics/actions/drop.rb +30 -0
- data/lib/gamefic/import/basics/actions/enter.rb +16 -0
- data/lib/gamefic/import/basics/actions/{traversal.rb → go.rb} +35 -35
- data/lib/gamefic/import/basics/actions/inventory.rb +8 -49
- data/lib/gamefic/import/basics/actions/leave.rb +29 -0
- data/lib/gamefic/import/basics/actions/look-in-at.rb +27 -0
- data/lib/gamefic/import/basics/actions/look-under.rb +3 -0
- data/lib/gamefic/import/basics/actions/look.rb +71 -67
- data/lib/gamefic/import/basics/actions/nil.rb +25 -0
- data/lib/gamefic/import/basics/actions/open.rb +23 -0
- data/lib/gamefic/import/basics/actions/quit.rb +3 -0
- data/lib/gamefic/import/basics/actions/take.rb +107 -0
- data/lib/gamefic/import/basics/entities/container.rb +8 -24
- data/lib/gamefic/import/basics/entities/entity.rb +11 -0
- data/lib/gamefic/import/basics/entities/fixture.rb +5 -5
- data/lib/gamefic/import/basics/entities/item.rb +5 -7
- data/lib/gamefic/import/basics/entities/portal.rb +40 -43
- data/lib/gamefic/import/basics/entities/room.rb +30 -24
- data/lib/gamefic/import/basics/entities/scenery.rb +5 -3
- data/lib/gamefic/import/basics/entities/supporter.rb +6 -0
- data/lib/gamefic/import/basics/entities/thing.rb +16 -0
- data/lib/gamefic/import/basics/queries/reachable.rb +38 -0
- data/lib/gamefic/import/basics/queries/room.rb +8 -0
- data/lib/gamefic/import/basics/queries/visible.rb +32 -0
- data/lib/gamefic/import/basics/rules/has-enough-light.rb +14 -0
- data/lib/gamefic/import/{basics → basics.old}/actions/container.rb +13 -12
- data/lib/gamefic/import/basics.old/actions/inventory.rb +50 -0
- data/lib/gamefic/import/basics.old/actions/look.rb +53 -0
- data/lib/gamefic/import/basics.old/actions/meta.rb +6 -0
- data/lib/gamefic/import/basics.old/actions/traversal.rb +35 -0
- data/lib/gamefic/import/{basics → basics.old}/actions.rb +0 -0
- data/lib/gamefic/import/basics.old/entities/container.rb +3 -0
- data/lib/gamefic/import/basics.old/entities/fixture.rb +3 -0
- data/lib/gamefic/import/basics.old/entities/item.rb +3 -0
- data/lib/gamefic/import/basics.old/entities/portal.rb +43 -0
- data/lib/gamefic/import/basics.old/entities/room.rb +27 -0
- data/lib/gamefic/import/basics.old/entities/scenery.rb +3 -0
- data/lib/gamefic/import/basics.old/entities/supporter.rb +3 -0
- data/lib/gamefic/import/{basics → basics.old}/entities.rb +0 -0
- data/lib/gamefic/import/basics.old/room_modes.rb +48 -0
- data/lib/gamefic/import/basics.rb +6 -2
- data/lib/gamefic/import/{basics/room_modes.rb → room_modes.rb} +6 -6
- data/lib/gamefic/import/standard.rb +1 -0
- data/lib/gamefic/meta.rb +12 -0
- data/lib/gamefic/optionset.rb +114 -0
- data/lib/gamefic/plot.rb +54 -21
- data/lib/gamefic/query.rb +214 -188
- data/lib/gamefic/requirement.rb +14 -0
- data/lib/gamefic/shell.rb +7 -4
- data/lib/gamefic/syntax.rb +35 -18
- data/lib/gamefic/thing.rb +7 -0
- data/lib/gamefic.rb +5 -1
- metadata +46 -12
- data/lib/gamefic/import/basics/actions/meta.rb +0 -6
- data/lib/gamefic/import/basics/entities/itemized.rb +0 -3
- data/lib/gamefic/import/basics/entities/portable.rb +0 -3
- data/lib/gamefic/user.rb +0 -66
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gamefic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.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: 2014-
|
11
|
+
date: 2014-06-02 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: An adventure game engine
|
14
14
|
email: fsnyder@gamefic.com
|
@@ -20,35 +20,69 @@ files:
|
|
20
20
|
- lib/gamefic.rb
|
21
21
|
- lib/gamefic/entity.rb
|
22
22
|
- lib/gamefic/character.rb
|
23
|
+
- lib/gamefic/requirement.rb
|
23
24
|
- lib/gamefic/story.rb
|
24
25
|
- lib/gamefic/shell.rb
|
26
|
+
- lib/gamefic/optionset.rb
|
27
|
+
- lib/gamefic/thing.rb
|
25
28
|
- lib/gamefic/base.rb
|
26
29
|
- lib/gamefic/query.rb
|
27
30
|
- lib/gamefic/action.rb
|
28
31
|
- lib/gamefic/node.rb
|
29
32
|
- lib/gamefic/director.rb
|
30
33
|
- lib/gamefic/engine.rb
|
31
|
-
- lib/gamefic/user.rb
|
32
34
|
- lib/gamefic/plot.rb
|
33
35
|
- lib/gamefic/keywords.rb
|
36
|
+
- lib/gamefic/before.rb
|
37
|
+
- lib/gamefic/meta.rb
|
34
38
|
- lib/gamefic/syntax.rb
|
35
39
|
- lib/gamefic/describable.rb
|
36
|
-
- lib/gamefic/import/
|
40
|
+
- lib/gamefic/import/room_modes.rb
|
41
|
+
- lib/gamefic/import/basics/actions/leave.rb
|
42
|
+
- lib/gamefic/import/basics/actions/take.rb
|
43
|
+
- lib/gamefic/import/basics/actions/drop-in.rb
|
44
|
+
- lib/gamefic/import/basics/actions/drop-on.rb
|
45
|
+
- lib/gamefic/import/basics/actions/commands.rb
|
46
|
+
- lib/gamefic/import/basics/actions/look-under.rb
|
47
|
+
- lib/gamefic/import/basics/actions/open.rb
|
37
48
|
- lib/gamefic/import/basics/actions/look.rb
|
49
|
+
- lib/gamefic/import/basics/actions/quit.rb
|
50
|
+
- lib/gamefic/import/basics/actions/go.rb
|
51
|
+
- lib/gamefic/import/basics/actions/nil.rb
|
52
|
+
- lib/gamefic/import/basics/actions/look-in-at.rb
|
53
|
+
- lib/gamefic/import/basics/actions/drop.rb
|
38
54
|
- lib/gamefic/import/basics/actions/inventory.rb
|
39
|
-
- lib/gamefic/import/basics/actions/
|
40
|
-
- lib/gamefic/import/basics/actions/
|
41
|
-
- lib/gamefic/import/basics/
|
42
|
-
- lib/gamefic/import/basics/
|
55
|
+
- lib/gamefic/import/basics/actions/close.rb
|
56
|
+
- lib/gamefic/import/basics/actions/enter.rb
|
57
|
+
- lib/gamefic/import/basics/rules/has-enough-light.rb
|
58
|
+
- lib/gamefic/import/basics/queries/room.rb
|
59
|
+
- lib/gamefic/import/basics/queries/reachable.rb
|
60
|
+
- lib/gamefic/import/basics/queries/visible.rb
|
61
|
+
- lib/gamefic/import/basics/entities/entity.rb
|
62
|
+
- lib/gamefic/import/basics/entities/supporter.rb
|
43
63
|
- lib/gamefic/import/basics/entities/fixture.rb
|
44
64
|
- lib/gamefic/import/basics/entities/item.rb
|
45
65
|
- lib/gamefic/import/basics/entities/scenery.rb
|
46
|
-
- lib/gamefic/import/basics/entities/
|
47
|
-
- lib/gamefic/import/basics/entities/itemized.rb
|
66
|
+
- lib/gamefic/import/basics/entities/thing.rb
|
48
67
|
- lib/gamefic/import/basics/entities/room.rb
|
49
68
|
- lib/gamefic/import/basics/entities/portal.rb
|
50
69
|
- lib/gamefic/import/basics/entities/container.rb
|
51
|
-
- lib/gamefic/import/
|
70
|
+
- lib/gamefic/import/standard.rb
|
71
|
+
- lib/gamefic/import/basics.old/room_modes.rb
|
72
|
+
- lib/gamefic/import/basics.old/actions/look.rb
|
73
|
+
- lib/gamefic/import/basics.old/actions/inventory.rb
|
74
|
+
- lib/gamefic/import/basics.old/actions/container.rb
|
75
|
+
- lib/gamefic/import/basics.old/actions/meta.rb
|
76
|
+
- lib/gamefic/import/basics.old/actions/traversal.rb
|
77
|
+
- lib/gamefic/import/basics.old/actions.rb
|
78
|
+
- lib/gamefic/import/basics.old/entities/supporter.rb
|
79
|
+
- lib/gamefic/import/basics.old/entities/fixture.rb
|
80
|
+
- lib/gamefic/import/basics.old/entities/item.rb
|
81
|
+
- lib/gamefic/import/basics.old/entities/scenery.rb
|
82
|
+
- lib/gamefic/import/basics.old/entities/room.rb
|
83
|
+
- lib/gamefic/import/basics.old/entities/portal.rb
|
84
|
+
- lib/gamefic/import/basics.old/entities/container.rb
|
85
|
+
- lib/gamefic/import/basics.old/entities.rb
|
52
86
|
- lib/gamefic/import/basics.rb
|
53
87
|
- lib/gamefic/core_ext/string.rb
|
54
88
|
- lib/gamefic/core_ext/array.rb
|
@@ -65,7 +99,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
65
99
|
requirements:
|
66
100
|
- - '>='
|
67
101
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
102
|
+
version: 1.8.7
|
69
103
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
70
104
|
requirements:
|
71
105
|
- - '>='
|
data/lib/gamefic/user.rb
DELETED
@@ -1,66 +0,0 @@
|
|
1
|
-
module Gamefic
|
2
|
-
|
3
|
-
class User
|
4
|
-
attr_reader :state, :character, :story
|
5
|
-
def initialize(story)
|
6
|
-
@story = story
|
7
|
-
@stream = UserStream.new
|
8
|
-
@state = UserState.new self
|
9
|
-
end
|
10
|
-
def stream
|
11
|
-
@stream
|
12
|
-
end
|
13
|
-
def state=(state_class)
|
14
|
-
@state = state_class.new self
|
15
|
-
end
|
16
|
-
def character=(entity)
|
17
|
-
@character = entity
|
18
|
-
@character.connect self
|
19
|
-
end
|
20
|
-
def refresh
|
21
|
-
# Nothing to do
|
22
|
-
end
|
23
|
-
def story
|
24
|
-
@story
|
25
|
-
end
|
26
|
-
def quit
|
27
|
-
exit
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
class UserStream
|
32
|
-
def initialize
|
33
|
-
@queue = Array.new
|
34
|
-
puts "\n"
|
35
|
-
end
|
36
|
-
def send(data)
|
37
|
-
print data.terminalize + "\n"
|
38
|
-
end
|
39
|
-
def select(prompt)
|
40
|
-
print prompt
|
41
|
-
line = STDIN.gets
|
42
|
-
@queue.push line.strip
|
43
|
-
end
|
44
|
-
def recv
|
45
|
-
@queue.shift
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
class UserState
|
50
|
-
attr_reader :user
|
51
|
-
def initialize(user)
|
52
|
-
@user = user
|
53
|
-
post_initialize
|
54
|
-
end
|
55
|
-
def post_initialize
|
56
|
-
@user.character = Character.new user.story, :name => 'Player'
|
57
|
-
end
|
58
|
-
def update
|
59
|
-
line = @user.stream.recv
|
60
|
-
if line != nil
|
61
|
-
@user.character.queue.push line
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
end
|