Class: SimpleLineMap
- Inherits:
-
Object
- Object
- SimpleLineMap
- Defined in:
- lib/ruby-doom.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #add_barrel(p) ⇒ Object
- #add_commando(p) ⇒ Object
- #add_imp(p) ⇒ Object
- #add_sergeant(p) ⇒ Object
- #add_shotgun(p) ⇒ Object
- #create_wad(filename) ⇒ Object
-
#initialize(path) ⇒ SimpleLineMap
constructor
A new instance of SimpleLineMap.
- #nethack(size = Nethack::DEFAULT_SIZE) ⇒ Object
- #set_player(p) ⇒ Object
Constructor Details
#initialize(path) ⇒ SimpleLineMap
Returns a new instance of SimpleLineMap.
717 718 719 720 |
# File 'lib/ruby-doom.rb', line 717 def initialize(path) @path = path @things = Things.new end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
716 717 718 |
# File 'lib/ruby-doom.rb', line 716 def path @path end |
Instance Method Details
#add_barrel(p) ⇒ Object
724 725 726 |
# File 'lib/ruby-doom.rb', line 724 def (p) @things. p end |
#add_commando(p) ⇒ Object
730 731 732 |
# File 'lib/ruby-doom.rb', line 730 def add_commando(p) @things.add_commando p end |
#add_imp(p) ⇒ Object
733 734 735 |
# File 'lib/ruby-doom.rb', line 733 def add_imp(p) @things.add_imp p end |
#add_sergeant(p) ⇒ Object
727 728 729 |
# File 'lib/ruby-doom.rb', line 727 def add_sergeant(p) @things.add_sergeant p end |
#add_shotgun(p) ⇒ Object
736 737 738 |
# File 'lib/ruby-doom.rb', line 736 def add_shotgun(p) @things.add_shotgun p end |
#create_wad(filename) ⇒ Object
745 746 747 748 749 750 751 752 |
# File 'lib/ruby-doom.rb', line 745 def create_wad(filename) w = Wad.new w.lumps << UndecodedLump.new("MAP01") w.lumps << @things pc = PathCompiler.new(@path) w.lumps.concat pc.lumps w.write(filename) end |
#nethack(size = Nethack::DEFAULT_SIZE) ⇒ Object
739 740 741 742 743 744 |
# File 'lib/ruby-doom.rb', line 739 def nethack(size=Nethack::DEFAULT_SIZE) n = Nethack.new(@path.start, size) @path.visit(n) @things.items.each {|t| n.thing(t) } return n.render end |
#set_player(p) ⇒ Object
721 722 723 |
# File 'lib/ruby-doom.rb', line 721 def set_player(p) @things.add_player p end |