structlist =
{
	DISPOSAL =
	{
		name = "Disposal chute",
		dir = 0,
	},
	GARDEN =
	{
		name = "Hydroponics unit",
		dir = 1,
	},
	BED =
	{
		name = "Bed",
		dir = 2,
	},
	TABLE =
	{
		name = "Food-preparing unit",
		dir = 3,
	},
	ENERGY =
	{
		name = "Battery",
		dir = 4,
	},
	ENGINE =
	{
		name = "Engine",
		dir = 5,
	},
	STAND =
	{
		name = "Diving gear stand",
		dir = 6,
	},
	GENERATOR =
	{
		name = "Power generator",
		dir = 7,
	},
	ROTOR =
	{
		name = "Rotor",
		dir = 8,
	},
	GUARD =
	{
		name = "Defense weapon",
		dir = 9,
	},
}

function create_struct(id,x,y,owner_)
	local structid = MF_create("struct")
	local owner = owner_ or 0
	
	local data = structlist[id]
	
	MF_setstring(structid,NAME,data.name)
	MF_setstring(structid,TYPE,id)
	MF_setdir(structid,data.dir)
	
	MF_setvalue(structid,ONLINE,1)
	MF_setvalue(structid,XPOS,x * map.tilesize)
	MF_setvalue(structid,YPOS,y * map.tilesize)
	MF_setvalue(structid,S_OWNER,owner)
	
	addstruct(structid)
	
	return structid
end