function ccDoorEditor( ply, cmd, args )
	
	if( not file.Exists( "TacoScript/mapdata/" .. game.GetMap() .. ".txt" ) ) then
		
		file.Write( "TacoScript/mapdata/" .. game.GetMap() .. ".txt", "" );
		
	end
	
	local function Append( text )
		
		file.Write( "TacoScript/mapdata/" .. game.GetMap() .. ".txt", file.Read( "TacoScript/mapdata/" .. game.GetMap() .. ".txt" ) .. "\n" .. text );
		
	end
	
	local edit = vgui.Create( "DFrame" );
		edit:SetSize( 350, 400 );
		edit:Center();
		edit:SetTitle( "Door Editor" );
		edit:MakePopup();
		
	edit.buildingName = vgui.Create( "DTextEntry", edit );
		edit.buildingName:SetPos( 5, 30 );
		edit.buildingName:SetSize( 250, 20 );
		
	edit.buildingStart = vgui.Create( "DButton", edit );
		edit.buildingStart:SetPos( 260, 30 );
		edit.buildingStart:SetSize( 85, 20 );
		edit.buildingStart:SetText( "Start Building" );
		edit.buildingStart.DoClick = function()
			
			Append( "BEGINBUILDING \"" .. edit.buildingName:GetValue() .. "\"" );
			
		end
		
	edit.doorName = vgui.Create( "DTextEntry", edit );
		edit.doorName:SetPos( 5, 120 );
		edit.doorName:SetSize( 340, 20 );
		
	edit.doorParent = vgui.Create( "DTextEntry", edit );
		edit.doorParent:SetPos( 5, 150 );
		edit.doorParent:SetSize( 340, 20 );
		
	--doorstate 5 (unbuyable)
		
	--doorprice 0
		
	edit.AddDoor = vgui.Create( "DButton", edit );
		edit.AddDoor:SetPos( 5, 210 );
		edit.AddDoor:SetSize( 340, 20 );
		edit.AddDoor:SetText( "Add Door" );
		edit.AddDoor.DoClick = function()
			
			local ent = LocalPlayer():GetEyeTrace().Entity;
			
			local pos = ent:GetPos();
			
			Append( pos.x .. " " .. pos.y .. " " .. pos.z .. " \"" .. edit.doorName:GetValue() .. "\" \"" .. edit.doorParent:GetValue() .. "\" 5 0" );
			
		end
		
	edit.endBuilding = vgui.Create( "DButton", edit );
		edit.endBuilding:SetPos( 5, 270 );
		edit.endBuilding:SetSize( 340, 20 );
		edit.endBuilding:SetText( "End Building" );
		edit.endBuilding.DoClick = function()
			
			Append( "ENDBUILDING" );
			
		end
	
end
concommand.Add( "rp_dooredit", ccDoorEditor );
