remove multi-dispatch code, not that useful to us

This commit is contained in:
Haze Weathers 2023-10-12 23:17:20 -04:00
parent c5a3a002b6
commit 4fa7f1ff56

View file

@ -45,36 +45,21 @@ func _ready() -> void:
func _test_http() -> void: func _test_http() -> void:
print(yield(request_execute("Gateway.getDatetime"), "completed")) print(yield(request_execute("Gateway.getDatetime"), "completed"))
print(yield(request_execute(["Gateway.getDatetime", "Gateway.getVersion"], {}, "", ["blep", "bleepo"]), "completed"))
## requests the provided component be executed, do not call async :/ ## requests the provided component be executed, do not call async :/
# may call with either single or multiple components # may call with either single or multiple components
func request_execute(component, parameters = {}, session_id: String = "", echo = null, encrypt: bool = false) -> Dictionary: func request_execute(component: String, parameters: Dictionary = {}, session_id: String = "", echo: String = "", encrypt: bool = false) -> Dictionary:
# build request headers # build request headers
var headers = [ var headers = [
"Content-Type: application/x-www-form-urlencoded", "Content-Type: application/x-www-form-urlencoded",
] ]
# build execute object # build execute object
var execute var execute = {
if component is Array: component = component,
execute = [] parameters = parameters,
for i in component.size(): echo = echo,
if component[i] is String: }
execute.append({
component = component[i],
})
if parameters is Array and parameters[i] is Dictionary:
execute[-1].parameters = parameters[i]
if echo is Array and echo[i] is String:
execute[-1].echo = echo[i]
else:
execute = {
component = component,
parameters = parameters,
}
if echo is String:
execute.echo = echo
# use encryption if a valid key is available # use encryption if a valid key is available
# TODO: implementation messed up in some way. encryption is fine, but # TODO: implementation messed up in some way. encryption is fine, but
# formatting is wrong in some way that newgrounds can not understand # formatting is wrong in some way that newgrounds can not understand