#!/usr/bin/env
# $Revision: 1.36 $
# $Date: 2003/12/06 18:12:08 $
# $Author: jefus, mikeman2 $


class Player < Mobile
	attr_accessor :password
	attr_accessor :access

	def save
		begin
			super
			@config['@location'] = @location.rid
			#MarshalSQL.dump(skills, @name) #marshal them skills
		rescue
			Logger.log("Couldn't save player #{name}: #{$!}")
			return false
		end
		return true
	end

	def initialize(pid)
		@config = CFile.new("system:players:#{pid}")
		@location = $system.rooms.fetch(@config['@location']) if @config['@location'] != nil
		@location = $system.rooms['0'] if @config['@location'] == nil
		#@skills = MarshalSQL.load(@name)
		super(@config)
		return self
	end

	def to_s
		return "Player #{@name}"
	end
	
	def move(room)
		super(room)
		puts self.location.render
		$system.progs.run("roomenter", self) #the roomenter trigger 
	end

end

Logger.log("Player code initialized.")