midori-school/save.gd

43 lines
1.8 KiB
GDScript3
Raw Normal View History

2023-12-26 17:09:27 +01:00
extends Node
2024-09-26 20:42:29 +02:00
func _init(slot, erase):
var saveinit = str(slot)+","+str(DisplayServer.window_get_vsync_mode())+","+str(DisplayServer.window_get_mode())
var file = FileAccess.open("user://userprefs", FileAccess.WRITE)
2023-12-26 17:09:27 +01:00
file.store_string(saveinit)
file.close()
2024-09-26 20:42:29 +02:00
if erase:
saveinit = "0,0,<null>,<null>,<null>,<null>,<null>,<null>\n0\n0\n1,11,19\n0,0,0,0,0,0"
else:
saveinit = str(Global.party[0][0])+","+str(Global.party[0][1])+","+str(Global.party[1][0])+","+str(Global.party[1][1])+","+str(Global.party[2][0])+","+str(Global.party[2][1])+","+str(Global.party[3][0])+","+str(Global.party[3][1])+"\n"+str(Global.cpchar)+"\n"+str(Global.dificulty)+"\n"+str(Global.cplace[0])+","+str(Global.cplace[1])+","+str(Global.cplace[2])+"\n"+str(Global.quest[0])+","+str(Global.quest[1])+","+str(Global.quest[2])+","+str(Global.quest[3])+","+str(Global.quest[4])+","+str(Global.quest[5])
if slot == 1:
file = FileAccess.open("user://slot1", FileAccess.WRITE)
file.store_string(saveinit)
file.close()
elif slot == 2:
file = FileAccess.open("user://slot2", FileAccess.WRITE)
file.store_string(saveinit)
file.close()
elif slot == 3:
file = FileAccess.open("user://slot3", FileAccess.WRITE)
file.store_string(saveinit)
file.close()
elif slot == 4:
file = FileAccess.open("user://slot4", FileAccess.WRITE)
file.store_string(saveinit)
file.close()
elif slot == 5:
file = FileAccess.open("user://slot5", FileAccess.WRITE)
file.store_string(saveinit)
file.close()
elif slot == 6:
file = FileAccess.open("user://slot6", FileAccess.WRITE)
file.store_string(saveinit)
file.close()
elif slot == 7:
file = FileAccess.open("user://slot7", FileAccess.WRITE)
file.store_string(saveinit)
file.close()
elif slot == 8:
file = FileAccess.open("user://slot8", FileAccess.WRITE)
file.store_string(saveinit)
file.close()