znmud-0.0.1/benchmark/
znmud-0.0.1/cmd/
znmud-0.0.1/cmd/emotes/
znmud-0.0.1/cmd/objects/
znmud-0.0.1/cmd/tiny/
znmud-0.0.1/doc/
znmud-0.0.1/farts/
znmud-0.0.1/lib/
znmud-0.0.1/lib/combat/
znmud-0.0.1/lib/core/bodytypes/
znmud-0.0.1/lib/engine/
znmud-0.0.1/lib/farts/
znmud-0.0.1/logs/
#
# 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