require( "common" )

RegenInfo =
{
	ExitGate	= { Index = "Slime",  x =  2466, y =  1353, dir =  52, },
}

----------------------------------------------------------------------------------------------------
--
--										Main function
--
----------------------------------------------------------------------------------------------------
function Main( Field )
cExecCheck "Main"

	local Var = InstanceField[Field]
	if Var == nil then

		-- Prepare Instance
		InstanceField[Field] = {}

		Var				= InstanceField[Field]
		Var.MapIndex	= Field

		Var.StepFunc	= Default
		
		Var.ExitGate = nil
	end

	-- Continue Loop
	if Var.StepFunc ~= nil then

		Var.StepFunc	= Default
	end

	Var.StepFunc(Var)
end

function Default( Var )
cExecCheck "Default"

	if Var == nil then
		return
	end

	if Var.ExitGate = nil then
		Var.ExitGate = cMobRegen_XY( Var.MapIndex, RegenInfo.ExitGate.Index,
													RegenInfo.ExitGate.x,
													RegenInfo.ExitGate.y,
													RegenInfo.ExitGate.dir )
	end

	return Var.StepFunc(Var)
	
end