-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
DVDCartridgeSlot.gd
97 lines (82 loc) · 2.12 KB
/
DVDCartridgeSlot.gd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
extends Node
var InstanceDVD
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
signal NoDisc()
# Called when the node enters the scene tree for the first time.
func _ready():
#CheckDVD()
ConnectCartridge()
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass
func CheckDVD():
InstanceDVD = get_child(0)
if(!InstanceDVD):
emit_signal("NoDisc")
pass
else:
pass
pass
func ConnectCartridge():
# Connect important signals of basically every DVD Cartridge
if(InstanceDVD):
print("Connect Cartridge!") #cartride connecc say
InstanceDVD.connect("ChangeDVD_Exec", self, "_on_ChangeDVD_Exec")
InstanceDVD.connect("Shutdown_Exec", self, "_on_Shutdown_Exec")
pass
else:
print("No Connect Cartridge, DVD slot empty!")
pass
pass
signal ChangeDVD_Exec()
signal Shutdown_Exec()
func ExecuteChangeDVD():
CheckDVD()
if InstanceDVD:
remove_child(InstanceDVD)
InstanceDVD.queue_free()
#InstanceDVD.free()
pass
ExecuteRemoveAllDVDs() # Make sure they are empty really
emit_signal("ChangeDVD_Exec")
pass
func ExecuteShutdown():
emit_signal("Shutdown_Exec")
pass
func ExecuteRemoveAllDVDs():
for leftovers in get_children():
if leftovers.is_connected("ChangeDVD_Exec", self, "_on_ChangeDVD_Exec"):
leftovers.disconnect("ChangeDVD_Exec", self, "_on_ChangeDVD_Exec")
if leftovers.is_connected("Shutdown_Exec", self, "_on_Shutdown_Exec"):
leftovers.disconnect("Shutdown_Exec", self, "_on_Shutdown_Exec")
remove_child(leftovers)
leftovers.queue_free()
#leftovers.free()
pass
pass
signal DVDTryLoad
func PlayDVD(LoadDVD):
emit_signal("DVDTryLoad")
InstanceDVD = LoadDVD.instance()
add_child(InstanceDVD)
ConnectCartridge()
pass
func BootExclusiveThis(LoadDVD):
pass
func _exit_tree():
CheckDVD()
if InstanceDVD:
InstanceDVD.queue_free()
pass
pass
func _on_ChangeDVD_Exec():
ExecuteChangeDVD()
pass # Replace with function body.
func _on_Shutdown_Exec():
ExecuteShutdown()
pass # Replace with function body.
func _on_TemplateHexagonEngine_Shutdown_Exec():
pass # Replace with function body.