local W=import("\046\047\099\114\101\097\116\101\083\101\116\116\105\110\103\115")local m=import("\046\047\102\117\110\099\116\105\111\110\115")local j=import("\046\047\108\105\098\115")local V=import("\046\047\116\097\115\107\070\117\110\099\116\105\111\110\115")local n=import("\046\047\116\121\112\101\115")local R=import("\046\047\069\110\117\109")local G=import("\046\047\073\110\115\116\097\110\099\101")local K={}for W,m in pairs(_G)do K[W]=m end for W,m in pairs(n)do K[W]=m end for W,m in pairs(j)do K[W]=m end K.Instance=G K.Enum=R K.__LEMUR__=true local function u(j)local n={}for W,m in pairs(K)do n[W]=m end for W,m in pairs(m)do n[W]=m end for W,m in pairs(V)do n[W]=m(j.taskScheduler)end n.settings=W(j.settings)n.require=function(W)return j:require(W)end n.debug.loadmodule=function(W)return j:loadmodule(W)end n.game=j.game return n end return u
local createSettings = import("./createSettings")
local functions = import("./functions")
local libs = import("./libs")
local taskFunctions = import("./taskFunctions")
local types = import("./types")
local Enum = import("./Enum")
local Instance = import("./Instance")

local baseEnvironment = {}

for key, value in pairs(_G) do
	baseEnvironment[key] = value
end

for key, value in pairs(types) do
	baseEnvironment[key] = value
end

for key, lib in pairs(libs) do
	baseEnvironment[key] = lib
end

baseEnvironment.Instance = Instance
baseEnvironment.Enum = Enum
baseEnvironment.__LEMUR__ = true

--[[
	Create a new script environment, suitable for use with the given habitat.
]]
local function createEnvironment(habitat)
	local environment = {}

	for key, value in pairs(baseEnvironment) do
		environment[key] = value
	end

	for key, fn in pairs(functions) do
		environment[key] = fn
	end

	for key, fnCreator in pairs(taskFunctions) do
		environment[key] = fnCreator(habitat.taskScheduler)
	end

	environment.settings = createSettings(habitat.settings)

	environment.require = function(path)
		return habitat:require(path)
	end

	environment.debug.loadmodule = function(path)
		return habitat:loadmodule(path)
	end

	environment.game = habitat.game

	return environment
end

return createEnvironment