gamefic 0.0.5 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/bin/gamefic +7 -0
  3. data/lib/gamefic/character.rb +2 -0
  4. data/lib/gamefic/core_ext/string.rb +2 -2
  5. data/lib/gamefic/director.rb +36 -3
  6. data/lib/gamefic/engine.rb +9 -5
  7. data/lib/gamefic/entity.rb +1 -1
  8. data/lib/gamefic/import/basics.rb +2 -0
  9. data/lib/gamefic/import/basics/actions.rb +1 -0
  10. data/lib/gamefic/import/basics/actions/container.rb +111 -0
  11. data/lib/gamefic/import/basics/actions/inventory.rb +49 -0
  12. data/lib/gamefic/import/basics/actions/look.rb +67 -0
  13. data/lib/gamefic/import/basics/actions/meta.rb +6 -0
  14. data/lib/gamefic/import/basics/actions/traversal.rb +35 -0
  15. data/lib/gamefic/import/basics/entities.rb +1 -0
  16. data/lib/gamefic/import/basics/entities/container.rb +24 -0
  17. data/lib/gamefic/import/basics/entities/fixture.rb +5 -0
  18. data/lib/gamefic/import/basics/entities/item.rb +7 -0
  19. data/lib/gamefic/import/basics/entities/itemized.rb +3 -0
  20. data/lib/gamefic/import/basics/entities/portable.rb +3 -0
  21. data/lib/gamefic/import/basics/entities/portal.rb +43 -0
  22. data/lib/gamefic/import/basics/entities/room.rb +24 -0
  23. data/lib/gamefic/import/basics/entities/scenery.rb +3 -0
  24. data/lib/gamefic/import/basics/room_modes.rb +48 -0
  25. data/lib/gamefic/plot.rb +89 -16
  26. data/lib/gamefic/shell.rb +317 -0
  27. data/lib/gamefic/syntax.rb +1 -1
  28. data/lib/gamefic/user.rb +3 -3
  29. metadata +23 -18
  30. data/lib/gamefic/action_ext.rb +0 -7
  31. data/lib/gamefic/action_ext/container.rb +0 -114
  32. data/lib/gamefic/action_ext/inventory.rb +0 -53
  33. data/lib/gamefic/action_ext/look.rb +0 -52
  34. data/lib/gamefic/action_ext/meta.rb +0 -10
  35. data/lib/gamefic/action_ext/traversal.rb +0 -39
  36. data/lib/gamefic/entity_ext.rb +0 -7
  37. data/lib/gamefic/entity_ext/container.rb +0 -28
  38. data/lib/gamefic/entity_ext/fixture.rb +0 -9
  39. data/lib/gamefic/entity_ext/item.rb +0 -11
  40. data/lib/gamefic/entity_ext/itemized.rb +0 -7
  41. data/lib/gamefic/entity_ext/portable.rb +0 -33
  42. data/lib/gamefic/entity_ext/portal.rb +0 -47
  43. data/lib/gamefic/entity_ext/room.rb +0 -28
  44. data/lib/gamefic/entity_ext/scenery.rb +0 -7
@@ -1,11 +0,0 @@
1
- require "gamefic/entity_ext/itemized"
2
- require "gamefic/entity_ext/portable"
3
-
4
- module Gamefic
5
-
6
- class Item < Entity
7
- include Itemized
8
- include Portable
9
- end
10
-
11
- end
@@ -1,7 +0,0 @@
1
- module Gamefic
2
-
3
- module Itemized
4
-
5
- end
6
-
7
- end
@@ -1,33 +0,0 @@
1
- module Gamefic
2
-
3
- module Portable
4
-
5
- end
6
-
7
- #Action.new("take", Context::ENVIRONMENT) { |actor, object|
8
- # if object.parent == actor
9
- # actor.tell "You're already carrying #{object.longname}."
10
- # else
11
- # if object.kind_of? Portable
12
- # object.parent = actor
13
- # actor.tell "You take #{object.longname}."
14
- # else
15
- # actor.tell "You can't carry #{object.longname}."
16
- # end
17
- # end
18
- #}
19
- #Parser.translate("get [object]", "take [object]")
20
-
21
- #Action.new("drop", Context::INVENTORY) { |actor, object|
22
- # if object.parent != actor
23
- # actor.tell "You're not carrying it."
24
- # else
25
- # object.parent = actor.parent
26
- # actor.tell "You drop #{object.longname}."
27
- # end
28
- #}
29
-
30
- #Parser.translate "drop [object] floor", "drop [object]"
31
- #Parser.translate "drop [object] ground", "drop [object]"
32
-
33
- end
@@ -1,47 +0,0 @@
1
- module Gamefic
2
-
3
- class Portal < Entity
4
- attr_accessor :destination
5
- #def initialize
6
- # super
7
- # @destination = nil
8
- #end
9
- def find_reverse
10
- rev = Portal.reverse(self.name)
11
- if rev != nil
12
- destination.children.that_are(Portal).each { |c|
13
- if c.name == rev
14
- return c
15
- end
16
- }
17
- end
18
- end
19
- def self.reverse(direction)
20
- case direction.downcase
21
- when "north"
22
- "south"
23
- when "south"
24
- "north"
25
- when "west"
26
- "east"
27
- when "east"
28
- "west"
29
- when "northwest"
30
- "southeast"
31
- when "southeast"
32
- "northwest"
33
- when "northeast"
34
- "southwest"
35
- when "southwest"
36
- "northeast"
37
- when "up"
38
- "down"
39
- when "down"
40
- "up"
41
- else
42
- nil
43
- end
44
- end
45
- end
46
-
47
- end
@@ -1,28 +0,0 @@
1
- require "gamefic/entity_ext/portal"
2
-
3
- module Gamefic
4
-
5
- class Room < Entity
6
- def connect(destination, direction, type = Portal, two_way = true)
7
- portal = type.new self.plot, :name => direction, :parent => self, :destination => destination
8
- if two_way == true
9
- reverse = Portal.reverse(direction)
10
- if reverse == nil
11
- raise "\"#{direction.cap_first}\" does not have an opposite direction"
12
- end
13
- portal2 = type.new(self.plot, {
14
- :name => reverse,
15
- :parent => destination,
16
- :destination => self
17
- })
18
- end
19
- portal
20
- end
21
- def tell(message, refresh = false)
22
- children.each { |c|
23
- c.tell message, refresh
24
- }
25
- end
26
- end
27
-
28
- end
@@ -1,7 +0,0 @@
1
- module Gamefic
2
-
3
- class Scenery < Entity
4
-
5
- end
6
-
7
- end