local function CTP_MoveSpawn_Blue_Farthest()
	Map.moveEntity(10, 11, 6);
	Map.moveEntity(11, 12, 6);
	Map.moveEntity(12, 31, 6);
	Map.moveEntity(13, 32, 6);
	CTP.getTeamByName("Blue"):respawnAll();
end

local function CTP_MoveSpawn_Blue_CloseToMid()
	Map.moveEntity(10, 34, 39);
	Map.moveEntity(11, 36, 39);
	Map.moveEntity(12, 38, 39);
	Map.moveEntity(13, 40, 39);
	CTP.getTeamByName("Blue"):respawnAll();
end

local function CTP_MoveSpawn_Red_Farthest()
	Map.moveEntity(20, 102, 6);
	Map.moveEntity(21, 103, 6);
	Map.moveEntity(22, 122, 6);
	Map.moveEntity(23, 123, 6);
	CTP.getTeamByName("Red"):respawnAll();
end

local function CTP_MoveSpawn_Red_CloseToMid()
	Map.moveEntity(20, 94, 39);
	Map.moveEntity(21, 96, 39);
	Map.moveEntity(22, 98, 39);
	Map.moveEntity(23, 100, 39);
	CTP.getTeamByName("Red"):respawnAll();
end

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- RED WINS
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

function CTP_redmidpoint_OnCapturedByRed(Team, CtrlPoint)
	CTP.getCaptureZoneByName("redhomepoint"):setLocked(true);
	CTP.getCaptureZoneByName("midpoint"):setLocked(false);
	--CTP_MoveSpawn_Blue_CloseToMid();
	--CTP_MoveSpawn_Red_CloseToMid();
end

function CTP_midpoint_OnCapturedByRed(Team, CtrlPoint)
	CTP.getCaptureZoneByName("redmidpoint"):setLocked(true);
	CTP.getCaptureZoneByName("bluemidpoint"):setLocked(false);
	--CTP_MoveSpawn_Blue_CloseToMid();
	--CTP_MoveSpawn_Red_CloseToMid();
end

function CTP_bluemidpoint_OnCapturedByRed(Team, CtrlPoint)
	CTP.getCaptureZoneByName("midpoint"):setLocked(true);
	CTP.getCaptureZoneByName("bluehomepoint"):setLocked(false);
	--CTP_MoveSpawn_Blue_Farthest();
	--CTP_MoveSpawn_Red_CloseToMid();
end

function CTP_bluehomepoint_OnCapturedByRed(Team, CtrlPoint)
	-- Red team should win
	CTP.getTeamByName("Red"):win();
end

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- BLUE WINS
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

function CTP_bluemidpoint_OnCapturedByBlue(Team, CtrlPoint)
	CTP.getCaptureZoneByName("bluemidpoint"):setLocked(true);
	CTP.getCaptureZoneByName("midpoint"):setLocked(false);
	--CTP_MoveSpawn_Red_CloseToMid();
	--CTP_MoveSpawn_Blue_CloseToMid();
end

function CTP_midpoint_OnCapturedByBlue(Team, CtrlPoint)
	CTP.getCaptureZoneByName("bluemidpoint"):setLocked(true);
	CTP.getCaptureZoneByName("redmidpoint"):setLocked(false);
	--CTP_MoveSpawn_Red_CloseToMid();
	--CTP_MoveSpawn_Blue_CloseToMid();
end

function CTP_redmidpoint_OnCapturedByBlue(Team, CtrlPoint)
	CTP.getCaptureZoneByName("midpoint"):setLocked(true);
	CTP.getCaptureZoneByName("redhomepoint"):setLocked(false);
	--CTP_MoveSpawn_Red_Farthest();
	--CTP_MoveSpawn_Blue_CloseToMid();
end

function CTP_redhomepoint_OnCapturedByBlue(Team, CtrlPoint)
	-- Blue team should win
	CTP.getTeamByName("Blue"):win();
end