twisty 0.0.4 → 0.1.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/lib/twisty/engine.rb +2 -0
- data/lib/twisty/entity.rb +11 -0
- data/lib/twisty/item.rb +8 -0
- data/lib/twisty/room.rb +9 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7d1c6f5160edae8ea6546a7858d9c68f39f54bae7cfab52ba5d483e0faf43b1b
|
4
|
+
data.tar.gz: eb9bfd5c67a756f49731365b2f69e012dad7594bbd535965123c6ef077ebef47
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3f4e57b0c880495d354cca48bf6a0738dde66045782677d3ec855799046818a81924674c2a0281a53e671753629aeccf838264cbba970b7e7b8b6eb36e093f82
|
7
|
+
data.tar.gz: ac822566e63604ec5539a567c2c5e0b0e3eab0d6509339b3a7ba7d6efa4acbe6e4dc7ffb51acbdff7d16f2d4daaafd15fc8eebd67aaa6a582d5487f157cf0175
|
data/lib/twisty/engine.rb
CHANGED
@@ -29,6 +29,8 @@ class Engine
|
|
29
29
|
attr_reader :rooms
|
30
30
|
#(+Array+[+Symbol+]) Keys of the Items the player is carrying
|
31
31
|
attr_reader :inventory
|
32
|
+
#(+Hash+[+Command+]) Hash of user typeable commands indexed by regular expression
|
33
|
+
attr_reader :commands
|
32
34
|
|
33
35
|
#Initialiser. As this class is a singleton use Engine.instance instead
|
34
36
|
def initialize
|
data/lib/twisty/entity.rb
CHANGED
@@ -9,6 +9,8 @@
|
|
9
9
|
|
10
10
|
require 'rtype'
|
11
11
|
|
12
|
+
require_relative 'error.rb'
|
13
|
+
|
12
14
|
#Author:: Ryan McCoskrie (mailto:work@ryanmccoskrie.me)
|
13
15
|
#Copyright:: Copyright (c) 2017 - 2018 RyanMcCoskrie
|
14
16
|
#License:: MIT public license
|
@@ -39,6 +41,15 @@ class Entity
|
|
39
41
|
end
|
40
42
|
end
|
41
43
|
|
44
|
+
rtype [Symbol] => nil
|
45
|
+
#Creates an identical instance of the Entity
|
46
|
+
#
|
47
|
+
#other:: (+Symbol+) Index entry of the new instance
|
48
|
+
def clone(other)
|
49
|
+
raise GameError.new "Can not use Entity directly. Please use subclass instead"
|
50
|
+
return nil
|
51
|
+
end
|
52
|
+
|
42
53
|
#(+Engine+)
|
43
54
|
#
|
44
55
|
#Convinience class to access the Engine
|
data/lib/twisty/item.rb
CHANGED
@@ -49,6 +49,14 @@ class Item < Entity
|
|
49
49
|
@contents = []
|
50
50
|
end
|
51
51
|
|
52
|
+
rtype [Symbol] => nil
|
53
|
+
#Creates another Item identical to this instance
|
54
|
+
#
|
55
|
+
#other:: (+Symbol+) Index of the new instance of Item
|
56
|
+
def clone(other)
|
57
|
+
engine.define_item(other, @name, @desc, :fixed => @fixed, :storage => @storage)
|
58
|
+
return nil
|
59
|
+
end
|
52
60
|
rtype [] => Boolean
|
53
61
|
#(+Boolean+)
|
54
62
|
#
|
data/lib/twisty/room.rb
CHANGED
@@ -44,6 +44,15 @@ class Room < Entity
|
|
44
44
|
@items = []
|
45
45
|
end
|
46
46
|
|
47
|
+
rtype [Symbol] => nil
|
48
|
+
#Creates another Item identical to this instance
|
49
|
+
#
|
50
|
+
#other:: (+Symbol+) Index of the new instance of Item
|
51
|
+
def clone(other)
|
52
|
+
engine.define_room(other, @name, @desc)
|
53
|
+
return nil
|
54
|
+
end
|
55
|
+
|
47
56
|
rtype [] => Boolean
|
48
57
|
#(+Boolean+)
|
49
58
|
#
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: twisty
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan McCoskrie
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-03-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rtype-native
|