function sparktech.can_drain_energy(target_pos, ammount) ---
	--- check whether you can drain
	return minetest.get_meta(target_pos):get_int("energy") >= ammount
end

function sparktech.drain_energy(target_pos, ammount)
	local target = minetest.get_meta(target_pos)
	local current = target:get_int("energy")
	if sparktech.can_drain_energy(target_pos, ammount) then
		target:set_int("energy", current - ammount)
		return true
	end
	return false
end
