Skip to content

Commit dead201

Browse files
committed
crossing fingers 👀
1 parent 0616a81 commit dead201

File tree

1 file changed

+41
-10
lines changed

1 file changed

+41
-10
lines changed

addons/dialogic/Other/DialogicClass.gd

Lines changed: 41 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,10 @@ static func get_variable(name: String) -> String:
132132
if Engine.is_editor_hint():
133133
return Engine.get_singleton('DialogicSingleton').get_variable(name)
134134
else:
135-
if DialogicSingleton:
136-
return DialogicSingleton.get_variable(name)
135+
var cursed_singleton
136+
if Engine.has_singleton('DialogicSingleton'):
137+
cursed_singleton = Engine.get_singleton('DialogicSingleton')
138+
return cursed_singleton.get_variable(name)
137139
else:
138140
return ''
139141

@@ -146,9 +148,12 @@ static func get_variable(name: String) -> String:
146148
## @param value The value to set the variable to.
147149
static func set_variable(name: String, value) -> void:
148150
if Engine.is_editor_hint():
149-
Engine.get_singleton('DialogicSingleton').set_variable(name, value)
151+
Engine.get_singleton('DialogicSingleton').set_variable(name)
150152
else:
151-
DialogicSingleton.set_variable(name, value)
153+
var cursed_singleton
154+
if Engine.has_singleton('DialogicSingleton'):
155+
cursed_singleton = Engine.get_singleton('DialogicSingleton')
156+
cursed_singleton.set_variable(name, value)
152157

153158

154159
## Gets the glossary data for the definition with the given name.
@@ -162,7 +167,12 @@ static func get_glossary(name: String) -> Dictionary:
162167
if Engine.is_editor_hint():
163168
return Engine.get_singleton('DialogicSingleton').get_glossary(name)
164169
else:
165-
return DialogicSingleton.get_glossary(name)
170+
var cursed_singleton
171+
if Engine.has_singleton('DialogicSingleton'):
172+
cursed_singleton = Engine.get_singleton('DialogicSingleton')
173+
return cursed_singleton.get_glossary(name)
174+
else:
175+
return {}
166176

167177

168178
## Sets the data for the glossary of the given name.
@@ -175,7 +185,10 @@ static func set_glossary(name: String, title: String, text: String, extra: Strin
175185
if Engine.is_editor_hint():
176186
Engine.get_singleton('DialogicSingleton').set_glossary(name, title, text, extra)
177187
else:
178-
DialogicSingleton.set_glossary(name, title, text, extra)
188+
var cursed_singleton
189+
if Engine.has_singleton('DialogicSingleton'):
190+
cursed_singleton = Engine.get_singleton('DialogicSingleton')
191+
cursed_singleton.set_glossary(name, title, text, extra)
179192

180193

181194
## Gets the currently saved timeline.
@@ -187,7 +200,12 @@ static func get_current_timeline() -> String:
187200
if Engine.is_editor_hint():
188201
return Engine.get_singleton('DialogicSingleton').get_current_timeline()
189202
else:
190-
return DialogicSingleton.get_current_timeline()
203+
var cursed_singleton
204+
if Engine.has_singleton('DialogicSingleton'):
205+
cursed_singleton = Engine.get_singleton('DialogicSingleton')
206+
return cursed_singleton.get_current_timeline()
207+
else:
208+
return ''
191209

192210

193211
## Sets the currently saved timeline.
@@ -198,7 +216,12 @@ static func set_current_timeline(new_timeline: String) -> String:
198216
if Engine.is_editor_hint():
199217
return Engine.get_singleton('DialogicSingleton').set_current_timeline(new_timeline)
200218
else:
201-
return DialogicSingleton.set_current_timeline(new_timeline)
219+
var cursed_singleton
220+
if Engine.has_singleton('DialogicSingleton'):
221+
cursed_singleton = Engine.get_singleton('DialogicSingleton')
222+
return cursed_singleton.set_current_timeline(new_timeline)
223+
else:
224+
return ''
202225

203226

204227
## Export the current Dialogic state.
@@ -210,7 +233,12 @@ static func export() -> Dictionary:
210233
if Engine.is_editor_hint():
211234
return Engine.get_singleton('DialogicSingleton').export()
212235
else:
213-
return DialogicSingleton.export()
236+
var cursed_singleton
237+
if Engine.has_singleton('DialogicSingleton'):
238+
cursed_singleton = Engine.get_singleton('DialogicSingleton')
239+
return cursed_singleton.export()
240+
else:
241+
return {}
214242

215243

216244
## Import a Dialogic state.
@@ -222,4 +250,7 @@ static func import(data: Dictionary) -> void:
222250
if Engine.is_editor_hint():
223251
Engine.get_singleton('DialogicSingleton').import(data)
224252
else:
225-
DialogicSingleton.import(data)
253+
var cursed_singleton
254+
if Engine.has_singleton('DialogicSingleton'):
255+
cursed_singleton = Engine.get_singleton('DialogicSingleton')
256+
cursed_singleton.import(data)

0 commit comments

Comments
 (0)