gamefic 0.0.3 → 0.0.4
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/lib/gamefic/action.rb +4 -1
- data/lib/gamefic/character.rb +2 -1
- data/lib/gamefic/plot.rb +7 -6
- 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: 19a80c1e4f84828c7b2bf27709fbb2c37c90100b
|
4
|
+
data.tar.gz: 63e7a3a0062cb167a9b363083bf34700783240b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e570aa3a5de2f2e321593e2eeb9fc239d12e30fecf2f9a235fe02fca947c084cf99c152c6f7ece6bf10dcc8bc1c9f0879aa0ddf82185b4cadd2d397d129278d1
|
7
|
+
data.tar.gz: 43ea2d63958bd7570b3c955dc5b364da94c8a3cb1314e32730e0252ca9508205cd450884b1d2dda0cb756df67e97d539277f0f78379baf47c4db42a5354f6602
|
data/lib/gamefic/action.rb
CHANGED
@@ -1,9 +1,12 @@
|
|
1
1
|
module Gamefic
|
2
2
|
|
3
3
|
class Action
|
4
|
-
attr_reader :command
|
4
|
+
attr_reader :command, :order_key
|
5
5
|
@@defaults = Array.new
|
6
|
+
@@order_key_seed = 0
|
6
7
|
def initialize(story, command, *queries, &proc)
|
8
|
+
@order_key = @@order_key_seed
|
9
|
+
@@order_key_seed += 1
|
7
10
|
if (command.kind_of?(Symbol) == false)
|
8
11
|
raise "Action commands must be symbols"
|
9
12
|
end
|
data/lib/gamefic/character.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Gamefic
|
2
2
|
|
3
3
|
class Character < Entity
|
4
|
-
attr_reader :state, :queue, :user
|
4
|
+
attr_reader :state, :queue, :user, :last_command
|
5
5
|
def initialize(plot, args = {})
|
6
6
|
@state = CharacterState.new(self)
|
7
7
|
@queue = Array.new
|
@@ -18,6 +18,7 @@ module Gamefic
|
|
18
18
|
#if command != nil
|
19
19
|
# @queue.push command
|
20
20
|
#end
|
21
|
+
@last_command = command
|
21
22
|
if state.busy? == false
|
22
23
|
Director.dispatch(self, command)
|
23
24
|
else
|
data/lib/gamefic/plot.rb
CHANGED
@@ -136,12 +136,13 @@ module Gamefic
|
|
136
136
|
end
|
137
137
|
@commands[action.command].unshift action
|
138
138
|
@commands[action.command].sort! { |a, b|
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
139
|
+
if a.specificity == b.specificity
|
140
|
+
# Newer action takes precedence
|
141
|
+
b.order_key <=> a.order_key
|
142
|
+
else
|
143
|
+
# Higher specificity takes precedence
|
144
|
+
b.specificity <=> a.specificity
|
145
|
+
end
|
145
146
|
}
|
146
147
|
user_friendly = action.command.to_s.sub(/_/, ' ')
|
147
148
|
args = Array.new
|
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.0.
|
4
|
+
version: 0.0.4
|
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-01-
|
11
|
+
date: 2014-01-27 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: An adventure game engine
|
14
14
|
email: fsnyder@gamefic.com
|