Class: Gamefic::Mud::State::Guest
- Defined in:
- lib/gamefic-mud/state/guest.rb
Overview
A simple introductory state that creates a character with a name provided by the user. MUDs in production should implement a more robust version of authentication, but this is sufficient for testing and development.
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from Gamefic::Mud::State::Base
Instance Method Details
#process(message) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/gamefic-mud/state/guest.rb', line 14 def process if .strip.empty? adapter.send_raw "Blank names are not allowed.\r\n" start else character = adapter.plot.make_player_character character.name = .strip adapter.character = character adapter.start Mud::State::Play end end |
#start ⇒ Object
10 11 12 |
# File 'lib/gamefic-mud/state/guest.rb', line 10 def start adapter.send_raw 'Enter your name: ' end |