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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6fcda4b3bdd0419b60b41a81cd0b1e9591a30af6c96ca633133b9cd2b97e4b6c
4
- data.tar.gz: 8c25f4a3f31b9fb329e38ae43964a4c34c03bbe730f37dc27741ab51b63da5f4
3
+ metadata.gz: 7d1c6f5160edae8ea6546a7858d9c68f39f54bae7cfab52ba5d483e0faf43b1b
4
+ data.tar.gz: eb9bfd5c67a756f49731365b2f69e012dad7594bbd535965123c6ef077ebef47
5
5
  SHA512:
6
- metadata.gz: 94836874e1d5f7f36b3b4ffb9cf349f9c47e35c17f16ad414adc3abe02d31e46604e1ce38d1df68eff54c95bef202ea9f617204201e7a24be7b85c2675c30dc5
7
- data.tar.gz: e64d2c1028fccc76862da36578240ab502483db29c6a7eb887e1df141d679e5de4705682e282d53b3abaa476487d2f8624e72d0d515e1633a5c3de7fc289b0e0
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
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-02-27 00:00:00.000000000 Z
11
+ date: 2018-03-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rtype-native