Skip to content

Instantly share code, notes, and snippets.

@Qubus0
Created November 26, 2024 19:28
Show Gist options
  • Save Qubus0/ead02a6ddb4932ffec44416dc575eef2 to your computer and use it in GitHub Desktop.
Save Qubus0/ead02a6ddb4932ffec44416dc575eef2 to your computer and use it in GitHub Desktop.
cursed but valid gdscript to test the godot mod loader hook preprocessor with
class_name ScriptTesting
extends Node
var six: set = actual_setter
#var six: set = set_exclude_me
var seven: set= actual_setter, get = actually_get_something
var eight: get = actually_get_something, set= actual_setter
var nine: int: set= actual_setter, get = actually_get_something
var thirteen: int: set= actual_setter ,get = actually_get_something
var ten: Array[String]: get = actually_get_something, set= actual_setter
var eleven: = 4 #set= set_exclude_me, get = get_exclude_me
var twelve: set= actual_setter#, get = get_exclude_me
var four10: get = actually_get_something, set= actual_setter
var _5teen: get = actually_get_something, set= actual_setter
var _16: get = actually_get_something, set= actual_setter
var _seven_teen: get = actually_get_something, set= actual_setter
var eighteen: get = actually_get_something, \
set= actual_setter
func method(
one,
two, three: int,
four
):
pass
@export var one : Vector2 = Vector2.ZERO :
set(value):
one = value
print("")
pass
get_groups()
get:
return one
var two: int = 0:
set(v): two = v
var three: int = 0:
get: return three + 5
var four: int = 0:
get: return three + 6
var five:
get:
set_something()
return five *2
set (value):
one = value
print("")
pass
get_groups()
func _ready() -> void:
pass
func super_something():
pass
func super_something_else():
print("oy")
func sup_func_two(): pass
func sup_func():
pass
#func other_test_func():
#pass # test if comments match
func other_test_func():
pass
static func static_super():
pass
func this_is_so_fucking_cursed
():
pass
func this_too\
():
pass
func why_would_you(put: int, \
backslashes := "\\", in_here := "?!\n"
):
pass
class SomeTestingSubclass:
# check that we are not getting inner funcs with the same name
func get_something():
return "something"
func set_something():
pass
func param_super(one: int, two: String) -> int:
return one
func other_param_super(one: int, two: String) -> int:
return one
func get_something():
return "something"
func set_something():
pass
func actually_get_something():
pass
func actual_setter(val):
six = val
func set_exclude_me():
pass
func get_exclude_me():
pass
func definitely_a_coroutine(args := []):
await tree_entered
func definitely_a_coroutine2(args := []):
var callback := func():
print("test")
return await callback.callv(args)
func definitely_a_coroutine3(args := []):
var callback := func():
print("test")
return await callback.callv([self] + args)
func definitely_a_coroutine4(args := []):
await get_tree().create_timer(1).timeout
func absolutely_not_a_coroutine(args := []):
get_something() # await is a keyword
pass
func definitely_a_coroutine5(args := []):
print("# hello", await get_something())
func definitely_a_coroutine6(args := []):
print(""" test
# hello""", await get_something())
func absolutely_not_a_coroutine2(args := []):
print(""" test
# hello""", get_something()) # don't await
func definitely_a_coroutine7(args := []):
print("# \'ello", await get_something())
extends ScriptTesting
func super_something():
super()
print("hello")
super.super_something()
super ( )
print("a")
static func static_super():
super()
pass
func param_super(one: int, two: String) -> int:
super(
one,
two)
return super (one, two)
func other_param_super(one: int, two: String) -> int:
return super(one, (two)) +5
func other_test_func():
var a := func(): print("hi")
super()
var b := func hi(): print("hi")
super()
a.call()
b.call()
class Test extends ScriptTesting:
func sup_func_two(): super()
func sup_func():
#func test():
super()
func _process(delta: float) -> void:
pass
func other_test_func():
var a := func(): print("hi")
super()
var b := func hi(): print("hi")
super()
a.call()
b.call()
func sup_func_two(): super()
func sup_func():
#func test():
super()
func _process(delta: float) -> void:
pass
func super_something_else():
super()
print("hello")
super.super_something()
super()
print("a")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment