Module: GameMachine::Commands::MessageHelper
- Included in:
- ChatCommands, PlayerCommands
- Defined in:
- server/lib/game_machine/commands/message_helper.rb
Instance Method Summary collapse
- #entity(id) ⇒ Object
- #entity_with_player(id, player_id) ⇒ Object
- #is_component?(obj) ⇒ Boolean
- #is_entity?(obj) ⇒ Boolean
- #set_player(entity, player_id) ⇒ Object
Instance Method Details
#entity(id) ⇒ Object
4 5 6 |
# File 'server/lib/game_machine/commands/message_helper.rb', line 4 def entity(id) MessageLib::Entity.new.set_id(id) end |
#entity_with_player(id, player_id) ⇒ Object
8 9 10 |
# File 'server/lib/game_machine/commands/message_helper.rb', line 8 def entity_with_player(id,player_id) entity(id).set_player(MessageLib::Player.new.set_id(player_id)) end |
#is_component?(obj) ⇒ Boolean
16 17 18 |
# File 'server/lib/game_machine/commands/message_helper.rb', line 16 def is_component?(obj) obj.respond_to?(:message_name) end |
#is_entity?(obj) ⇒ Boolean
20 21 22 |
# File 'server/lib/game_machine/commands/message_helper.rb', line 20 def is_entity?(obj) obj.is_a?(MessageLib::Entity) end |
#set_player(entity, player_id) ⇒ Object
12 13 14 |
# File 'server/lib/game_machine/commands/message_helper.rb', line 12 def set_player(entity,player_id) entity.set_player(MessageLib::Player.new.set_id(player_id)) end |