
function init()
	CraftingPoint = FindTrigger("Crafting", true)
	Diamond1Body = FindBody("Diamond1B", true)
	Diamond2Body = FindBody("Diamond2B", true)
	Diamond3Body = FindBody("Diamond3B", true)
	Diamond1 = FindShape("Diamond1", true)
	Diamond2 = FindShape("Diamond2", true)
	Diamond3 = FindShape("Diamond3", true)
	craftingtable = FindShape("CraftingTable", true)
	
	locationt = FindLocation("TableLocation", true)
	
	Dpickaxe = FindBody("DiamondPick", true)
	SetBodyTransform(Dpickaxe, Transform(Vec(13.0, 1.0, 7.0)))
	SetTag(craftingtable, "interact")
	t = GetLocationTransform(locationt)
end

function tick(dt)
	if HasTag(craftingtable, "interact") then
		if IsShapeBroken(craftingtable) then
			RemoveTag(craftingtable, "interact")
		end
	end
	if GetPlayerInteractShape() == craftingtable and InputPressed("interact") then
		if IsShapeInTrigger(CraftingPoint, Diamond1) then
			if IsShapeInTrigger(CraftingPoint, Diamond2) then
				if IsShapeInTrigger(CraftingPoint, Diamond3) then
					SetBodyTransform(Dpickaxe, Transform(t.pos))
					SetBodyTransform(Diamond1Body, Transform(Vec(0, 1000, 0)))
					SetBodyTransform(Diamond2Body, Transform(Vec(0, 1000, 0)))
					SetBodyTransform(Diamond3Body, Transform(Vec(0, 1000, 0)))
					RemoveTag(craftingtable, "interact")
				end
			end
		end
	end
end	