#EDITOR
#gradient

HashTable.InsertKey("gradC1", Gradient.Col1)
HashTable.InsertKey("gradC2", Gradient.Col2)


for i in csuszka:
	if i.Value('id') == 0:
		HashTable.InsertKey("gradSat", (SOL.csuszka2.X - (i.X - i.Width /2 )) / ((i.Width - 10) /100))
		
HashTable.InsertKey("gradDir", System.globalvar('gradDir'))

HashTable.InsertKey("bg", System.globalvar('bg'))
HashTable.InsertKey("bg_opacity", tb.Opacity)
HashTable.InsertKey("music", System.globalvar('music'))

###################################################
#Rules
###################################################
if CGUI.ComboBoxGetItemNameAt("gamemode", CGUI.ComboBoxGetIndexSelected("gamemode")) != "Reactor":
	HashTable.InsertKey("GameMode", "")
else:
	HashTable.InsertKey("GameMode", "reactor")

HashTable.InsertKey("LineCountLimit", int(CGUI.TextBoxGetCaption("linelimit")))
HashTable.InsertKey("LineWidthLimit", int(CGUI.TextBoxGetCaption("linewidthlimit")))
HashTable.InsertKey("GravityChangeTime", int(CGUI.TextBoxGetCaption("gravity")))

#returns 0\1
#0-up
#1-down
HashTable.InsertKey("GravityStartDirection", btn_GravDown)

###################################################
#background
###################################################
HashTable.InsertKey("SpriteList", str(loadSpriteList))

HashTable.InsertKey("SpriteCount", bgtest.Count)

###################################################
#System.globalvar("var")
###################################################

#Gravity
for i in SpriteButton:
	if i.CompareButtonIdentifier("gravity") ==1:

		if i.ButtonToggledByID("gravity") == 0:
			HashTable.InsertKey("gravity", 9.8)

		if i.ButtonToggledByID("gravity") == 1:
			HashTable.InsertKey("gravity", -9.8)

#######################
if System.globalvar("csap") > 0:
	HashTable.InsertKey("csapCount", csap.Count)
	
	for i in range(csap.Count):
		HashTable.InsertKey("csapPos" + str(i), "[" + str(csap[i].X) + "," + str(csap[i].Y) + "," + str(csap[i].Angle) + "," + str(csap[i].Filter) + "," + str(csap[i].Value('locked')) + "]")
		HashTable.InsertKey("uvegPos" + str(i), "[" + str(uveg[i].X) + "," + str(uveg[i].Y) + "," + str(uveg[i].Angle) + "]")

if System.globalvar("elevator") > 0:
	HashTable.InsertKey("liftCount", lift.Count)
	
	for i in range(lift.Count):
		HashTable.InsertKey("liftPos" + str(i), "[" + str(lift[i].X) + "," + str(lift[i].Y) + "," + str(lift[i].Angle) + "]")
		HashTable.InsertKey("lift_ePos" + str(i), "[" + str(lift_e[i].X) + "," + str(lift_e[i].Y) + "," + str(lift_e[i].Angle) + "]")

if System.globalvar("hinge") > 0:	
	HashTable.InsertKey("hingeCount", hinge.Count)
	
	for i in range(hinge.Count):
		HashTable.InsertKey("hingePos" + str(i), "[" + str(hinge[i].X) + "," + str(hinge[i].Y) + "," + str(hinge[i].Angle) + "]")
		HashTable.InsertKey("hinge_start" + str(i), "[" + str(hinge_start[i].X) + "," + str(hinge_start[i].Y) + "," + str(hinge_start[i].Angle) + "]")

if System.globalvar("rotating") > 0:	
	HashTable.InsertKey("rotatingCount", rotating.Count)
	
	for i in range(rotating.Count):
		HashTable.InsertKey("rotating" + str(i), "[" + str(rotating[i].X) + "," + str(rotating[i].Y) + "," + str(rotating[i].Angle) + "]")
		
#
if System.globalvar("plat") > 0:	
	HashTable.InsertKey("platCount", plat.Count)
	
	for i in range(plat.Count):
		HashTable.InsertKey("p_obstacle" + str(i), "[" + str(plat[i].X) + "," + str(plat[i].Y) + "," + str(plat[i].Angle) + "," + str(plat[i].Width) + "]")
		
if System.globalvar("txt") > 0:	
	HashTable.InsertKey("obj_textCount", obj_text.Count)
	
	for i in range(obj_text.Count):
		HashTable.InsertKey("obj_text" + str(i), "[" + str(obj_text[i].X) + "," + str(obj_text[i].Y) + "," + '"' + str(obj_text[i].Text) + '"' +"," + str(obj_text[i].Filter) +"," + str(obj_text[i].Width) +"," + str(obj_text[i].Height) + "]")
		
if System.globalvar("arrow") > 0:	
	HashTable.InsertKey("arrowCount", Arrow.Count)
	
	for i in range(Arrow.Count):
		HashTable.InsertKey("arrow" + str(i), "[" + str(arrowstart[i].X) + "," + str(arrowstart[i].Y) + "," + str(arrowdest[i].X) + "," + str(arrowdest[i].Y) + "]")

#
#	
if System.globalvar("lock") > 0:	
	HashTable.InsertKey("pushbtnCount", pushbtn.Count)
	
	for i in range(pushbtn.Count):
		HashTable.InsertKey("pushbtn" + str(i), "[" + str(SOL.pushbtn[i].X) + "," + str(SOL.pushbtn[i].Y) +"," + str(SOL.pushbtn[i].Filter) + "]")
		
if System.globalvar("unlocker") > 0:	
	HashTable.InsertKey("unlockerCount", unlocker.Count)
	
	for i in range(unlocker.Count):
		HashTable.InsertKey("unlocker" + str(i), "[" + str(SOL.unlocker[i].X) + "," + str(SOL.unlocker[i].Y) +"," + str(SOL.unlocker[i].Filter) + "]")
		
		
#portals
#Pos X
#Pos Y
#Angle
#Filter
if System.globalvar("portal1") > 0:
	HashTable.InsertKey("portalRedCount", PortalRed.Count)

	for i in range(PortalRed.Count):
			HashTable.InsertKey("portalRed" + str(i), "[" + str(SOL.PortalRed[i].X) + "," + str(SOL.PortalRed[i].Y) + "," + str(SOL.PortalRed[i].Angle) + "," + str(SOL.PortalRed[i].Filter) + "]")

if System.globalvar("portal2") > 0:
	HashTable.InsertKey("portalBlueCount", PortalBlue.Count)

	for i in range(PortalBlue.Count):
			HashTable.InsertKey("portalBlue" + str(i), "[" + str(SOL.PortalBlue[i].X) + "," + str(SOL.PortalBlue[i].Y) + "," + str(SOL.PortalBlue[i].Angle) + "," + str(SOL.PortalBlue[i].Filter) + "]")


#electric in

if System.globalvar("electric_1") > 0:
	HashTable.InsertKey("electric1Count", p_elect.Count)

	for i in range(p_elect.Count):
		HashTable.InsertKey("p_elect" + str(i), "[" + str(SOL.p_elect[i].X) + "," + str(SOL.p_elect[i].Y) + "," + str(SOL.p_elect[i].Angle) + "]")

#electric out
if System.globalvar("electric_2") > 0:
	HashTable.InsertKey("electric2Count", p_elect2.Count)

	for i in range(p_elect2.Count):
		HashTable.InsertKey("p_elect2" + str(i), "[" + str(SOL.p_elect2[i].X) + "," + str(SOL.p_elect2[i].Y) + "," + str(SOL.p_elect2[i].Angle) + "]")

#saw
if System.globalvar("saw") > 0:
	HashTable.InsertKey("sawCount", p_saw.Count)

	for i in range(p_saw.Count):
		HashTable.InsertKey("p_saw" + str(i), "[" + str(SOL.p_saw[i].X) + "," + str(SOL.p_saw[i].Y) +"," + str(saw_path[i].X) + "," + str(saw_path[i].Y) + "," + str(saw_path2[i].X) + "," + str(saw_path2[i].Y) + "," + str(saw_lock[i].Value('state')) +"]")

#trapdoor
if System.globalvar("trapdoor") > 0:
	HashTable.InsertKey("trapdoorCount", p_trapdoor.Count)

	for i in range(p_trapdoor.Count):
		HashTable.InsertKey("trapdoor" + str(i), "[" + str(SOL.p_trapdoor[i].X) + "," + str(SOL.p_trapdoor[i].Y) + "," + str(SOL.p_trapdoor[i].Angle) + "," + str(SOL.BoxTrapdoor[i].X) + "," + str(SOL.BoxTrapdoor[i].Y) + "]")

###############################################################################################################################################
#													REACTOR
#reactor zone
###############################################################################################################################################

if System.globalvar("reactor") > 0:
	HashTable.InsertKey("reactorCount", reactor_zone.Count)

	for i in range(reactor_zone.Count):
		HashTable.InsertKey("reactor" + str(i), "[" + str(SOL.reactor_zone[i].X) + "," + str(SOL.reactor_zone[i].Y) + "," + str(SOL.reactor_zone[i].Angle) + "," + str(SOL.reactor_zone[i].Width) + "," + str(SOL.reactor_zone[i].Height) + "]")