-- 	RoadCheat mod by DarthPresidente
-- 		For Tropico 5!
--
-- 	What it does:
--		Allows building of overlapping roads!

--	How it works:
--		Simply hold down the CTRL key to allow crossing over of roads during building.

-- Place in Tropico 5\CommonLua\

local DarthExecOnce = false
function DarthRoadCheat()
	if not DarthExecOnce then
		RoadConstruction.OriginalGetBlockingRoads = RoadConstruction.GetBlockingRoads
		DarthExecOnce = true
	end
	RoadConstruction.GetBlockingRoads = function(self, road_obj, retry_idx)
		if terminal.IsKeyPressed(const.vkControl) then
			return false, false
		end
		return RoadConstruction.OriginalGetBlockingRoads(self, road_obj, retry_idx)
	end
	DebugPrint("RoadCheat mod by DarthPresidente loaded...\n    Version:  	1.0\n    SourceFile: " .. debug.getinfo(1).source:match("@(.*)$") .. "\n")
end

OnMsg.ClassesPreprocess = function()
	DarthRoadCheat()
end