Skip to content

automatically refresh scenes if their script is extended #386

@Qubus0

Description

@Qubus0

@torcado194 found a clever solution to find the matching script to a scene - just enforce a convention.
Yes some people have different conventions or don't like them at all. In those cases they can either edit the mod loader to use that convention (like searching in a separate scripts folder), or modders will just go back to the old method of manually refreshing them.

last 3 lines are the additions to script_extension.gd.

    child_script.reload()

    var parent_script: Script = child_script.get_base_script()
    var parent_script_path: String = parent_script.resource_path
    
    var parent_scene: String = parent_script_path.get_basename() + ".tscn"
    if ResourceLoader.exists(parent_scene):
        ModLoaderMod.refresh_scene(parent_scene)

Since we are looking for a tscn here, FileAccess does not do the job in exported games, as noted by the docs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions