Skip to content

Commit 2237863

Browse files
authored
refactor: use truthy values in dictionaries used as hashsets (#422)
1 parent 2f7e138 commit 2237863

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

addons/mod_loader/internal/hooks.gd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ static func add_hook(mod_callable: Callable, script_path: String, method_name: S
1818
% [script_path, "before" if is_before else "after", method_name ], LOG_NAME
1919
)
2020
if not ModLoaderStore.hooked_script_paths.has(script_path):
21-
ModLoaderStore.hooked_script_paths[script_path] = null
21+
ModLoaderStore.hooked_script_paths[script_path] = true
2222

2323

2424
static func call_hooks(self_object: Object, args: Array, hook_hash:int) -> void:

addons/mod_loader/internal/mod_hook_preprocessor.gd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,10 +368,10 @@ static func collect_getters_and_setters(text: String, regex_getter_setter: RegEx
368368
for mat in regex_getter_setter.search_all(text):
369369
if mat.get_string(1).is_empty() or mat.get_string(1).contains("#"):
370370
continue
371-
result[mat.get_string(2)] = null
371+
result[mat.get_string(2)] = true
372372

373373
if mat.get_string(3).is_empty() or mat.get_string(3).contains("#"):
374374
continue
375-
result[mat.get_string(4)] = null
375+
result[mat.get_string(4)] = true
376376

377377
return result

addons/mod_loader/mod_loader_store.gd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ var modding_hooks := {}
4545

4646
# Example:
4747
# var hooked_script_paths := {
48-
# "res://game/game.gd": null,
48+
# "res://game/game.gd": true,
4949
# }
5050
var hooked_script_paths := {}
5151

0 commit comments

Comments
 (0)