Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: script class usable as "real" class #4181

Open
3 tasks done
cyn0x8 opened this issue Feb 19, 2025 · 1 comment
Open
3 tasks done

Enhancement: script class usable as "real" class #4181

cyn0x8 opened this issue Feb 19, 2025 · 1 comment
Labels
status: planned Planned to be implemented some time in the future. topic: mods Related to the creation or use of mods. type: enhancement Involves an enhancement or new feature.

Comments

@cyn0x8
Copy link
Contributor

cyn0x8 commented Feb 19, 2025

Issue Checklist

  • I have read the Contributing Guide
  • I have checked the Issues/Discussions pages to see if my enhancement has already been suggested
  • I have properly titled my enhancement

What is your suggestion, and why should it be implemented?

implementation of https://x.com/EliteMasterEric/status/1844421657957630386 ?

where you could something like

package exampleMod1;

import exampleMod2.ChildClass as ChildClass2;

import funkin.modding.base.ScriptedFunkinSprite;
import funkin.modding.module.ScriptedModule;

class BaseClass extends ScriptedFunkinSprite {
    public function testFunction():Void {
        trace("exampleMod1.BaseClass"); // outputs "exampleMod1.BaseClass"
    }
}

class ChildClass extends BaseClass {
    override public function testFunction():Void {
        super.testFunction(); // "outputs "exampleMod1.BaseClass"
        trace("exampleMod1.ChildClass"); // outputs "exampleMod1.ChildClass"
    }
}

class ExampleModule extends ScriptedModule {
    override public function new() {
        super("ExampleModule");
    }
    
    var exampleVar:ChildClass2 = null;
    override public function onCreate(event:ScriptEvent):Void {
        exampleVar = new ChildClass2();
        exampleVar.testFunction(); // outputs "exampleMod1.BaseClass" and "exampleMod2.ChildClass"
    }
}
package exampleMod2;

import exampleMod1.BaseClass;

import funkin.modding.base.ScriptedFunkinSprite;

class ChildClass extends BaseClass {
    override public function testFunction():Void {
        super.testFunction(); // "outputs "exampleMod1.BaseClass"
        trace("exampleMod2.ChildClass2"); // outputs "exampleMod2.ChildClass"
    }
}

itd make scripting a lot nicer!!

@cyn0x8 cyn0x8 added status: pending triage Awaiting review. type: enhancement Involves an enhancement or new feature. labels Feb 19, 2025
@AbnormalPoof AbnormalPoof added topic: mods Related to the creation or use of mods. status: planned Planned to be implemented some time in the future. and removed status: pending triage Awaiting review. labels Feb 24, 2025
@AbnormalPoof
Copy link
Collaborator

AbnormalPoof commented Feb 24, 2025

This is currently a work in progress in Polymod on the experiment/static-fields branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: planned Planned to be implemented some time in the future. topic: mods Related to the creation or use of mods. type: enhancement Involves an enhancement or new feature.
Projects
None yet
Development

No branches or pull requests

2 participants