Skip to content

Provide ScriptID to dynamic script functions #298

Open
@makspll

Description

@makspll

Is your feature request related to a problem? Please describe.
Currently this is only retrievable via the script_id global of a script, which needs to be passed as argument. It'd be useful for loading additional data, or initializing scripts from script bindings directly.

Describe the solution you'd like
Provide a thread local similar to the world guard, and have it be accessible from the function context.

Describe alternatives you've considered
adding script ID to the function context directly, might be viable but not sure if that's injectable from all angles, it would mean function lookups would need to happen in a place where we know the script id which is not necessarily the case right now.

Additional context

I think crate devs might run into the same thing, cus ur essentially telling me which script is running the function and that seems important for automation, which is essentially what im doing. - Peepo Juice @ Bevy Discord

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions