# # file:: cmd_follow.rb # This source code copyright (C) 2009 Craig Smith # All rights reserved. # # Released under the terms of the TeensyMUD Public License # See LICENSE file for additional information. # module Cmd bindtextdomain("cmd") # The follow another player def cmd_follow(args) me = _("me") myself = _("self") case args when /(\S+)/ pname = $1 if pname == me or pname == myself p = get_object(@following) p.del_follower(id) if p @following = nil sendto _("You are no longer following anybody.") add_event(id, p.id, :show, _("%{name} stops following you." % {:name => name})) return end ppl = peopleinroom(pname) case ppl.size when 0 sendto _("They are not in the room.") when 1 p = ppl[0] @following = p.id p.add_follower(id) sendto _("You begin to follow %{name}." % {:name => p.name}) add_event(id, p.id, :show, _("%{name} starts following you." % {:name => name})) else sendto _("Which one?") end else sendto _("Follow who?") end end end