local S=import("\046\047\099\114\101\097\116\101\083\101\116\116\105\110\103\115")local W=import("\046\047\102\117\110\099\116\105\111\110\115")local n=import("\046\047\108\105\098\115")local j=import("\046\047\116\097\115\107\070\117\110\099\116\105\111\110\115")local Z=import("\046\047\116\121\112\101\115")local v=import("\046\047\069\110\117\109")local s=import("\046\047\073\110\115\116\097\110\099\101")local T={}for S,W in pairs(_G)do T[S]=W end for S,W in pairs(Z)do T[S]=W end for S,W in pairs(n)do T[S]=W end T.Instance=s T.Enum=v T.__LEMUR__=true local function k(n)local Z={}for S,W in pairs(T)do Z[S]=W end for S,W in pairs(W)do Z[S]=W end for S,W in pairs(j)do Z[S]=W(n.taskScheduler)end Z.settings=S(n.settings)Z.require=function(S)return n:require(S)end Z.game=n.game return Z end return k
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.game = habitat.game

	return environment
end

return createEnvironment