midori-school/save.gd

52 lines
2 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):
2024-11-04 00:29:58 +01:00
var saveinit = str(slot)+","+str(int(OS.is_vsync_enabled()))+","+str(int(OS.is_window_fullscreen()))
var file = File.new()
file.open("user://userprefs", File.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:
2024-11-10 13:23:19 +01:00
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])+"\n"+str(Global.sparty[0][0])+","+str(Global.sparty[0][1])+","+str(Global.sparty[1][0])+","+str(Global.sparty[1][1])+","+str(Global.sparty[2][0])+","+str(Global.sparty[2][1])+","+str(Global.sparty[3][0])+","+str(Global.sparty[3][1])
2024-09-26 20:42:29 +02:00
if slot == 1:
2024-11-04 00:29:58 +01:00
file = File.new()
file.open("user://slot1", File.WRITE)
2024-09-26 20:42:29 +02:00
file.store_string(saveinit)
file.close()
elif slot == 2:
2024-11-04 00:29:58 +01:00
file = File.new()
file.open("user://slot2", File.WRITE)
2024-09-26 20:42:29 +02:00
file.store_string(saveinit)
file.close()
elif slot == 3:
2024-11-04 00:29:58 +01:00
file = File.new()
file.open("user://slot3", File.WRITE)
2024-09-26 20:42:29 +02:00
file.store_string(saveinit)
file.close()
elif slot == 4:
2024-11-04 00:29:58 +01:00
file = File.new()
file.open("user://slot4", File.WRITE)
2024-09-26 20:42:29 +02:00
file.store_string(saveinit)
file.close()
elif slot == 5:
2024-11-04 00:29:58 +01:00
file = File.new()
file.open("user://slot5", File.WRITE)
2024-09-26 20:42:29 +02:00
file.store_string(saveinit)
file.close()
elif slot == 6:
2024-11-04 00:29:58 +01:00
file = File.new()
file.open("user://slot6", File.WRITE)
2024-09-26 20:42:29 +02:00
file.store_string(saveinit)
file.close()
elif slot == 7:
2024-11-04 00:29:58 +01:00
file = File.new()
file.open("user://slot7", File.WRITE)
2024-09-26 20:42:29 +02:00
file.store_string(saveinit)
file.close()
elif slot == 8:
2024-11-04 00:29:58 +01:00
file = File.new()
file.open("user://slot8", File.WRITE)
2024-09-26 20:42:29 +02:00
file.store_string(saveinit)
file.close()