extends Node

enum EDITOR_MODES {EDIT, VIEW, LEVEL_CAM, NONE}

const MODE_EDIT = "edit"
const MODE_VIEW = "view"
const MODE_LEVEL_CAM = "level_cam"
const MODE_MENU = "menu"
const MODE_NONE = "none"

var editor

var current = MODE_EDIT
var last = MODE_NONE


func set_current(mode):
	if current == mode:
		return false
	print ("----- trying to change editor mode from " + str(current) + " to " + str(mode) + " -----")
	var failure = false
	if current != MODE_EDIT:
		if mode == MODE_MENU or mode == MODE_LEVEL_CAM:
			failure = true
		elif current == MODE_LEVEL_CAM and mode == MODE_MENU:
			failure = true
		elif current == MODE_MENU and mode == MODE_LEVEL_CAM:
			failure = true
	
	if failure:
		print ("WARNING: failed changing editor mode from " + str(current) + " to " + str(mode))
		return false
		
	print ("changing editor mode from " + str(current) + " to " + str(mode) + " was a success")
	

	last = current
	print ("last: " + str(last))
	print ("new: " + str(mode))
	current = mode
	
	return true

func return_to_previous():
	if last != MODE_NONE:
		return set_current(last)
	else:
		print ("WARNING: can't return to MODE_NONE")
		return false

