Skip to content

Commit

Permalink
Cherrypick ScriptMainGenerator changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Anuken authored and buthed010203 committed Oct 7, 2024
1 parent ebb3714 commit 27650ca
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions core/assets/scripts/global.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ function targetedBuilding(){

importPackage(Packages.arc)
importPackage(Packages.arc.audio)
importPackage(Packages.arc.files)
importPackage(Packages.arc.flabel)
importPackage(Packages.arc.flabel.effects)
importPackage(Packages.arc.func)
importPackage(Packages.arc.graphics)
importPackage(Packages.arc.graphics.g2d)
Expand Down Expand Up @@ -117,11 +120,13 @@ importPackage(Packages.mindustry.graphics)
importPackage(Packages.mindustry.graphics.g3d)
importPackage(Packages.mindustry.input)
importPackage(Packages.mindustry.io)
importPackage(Packages.mindustry.io.versions)
importPackage(Packages.mindustry.logic)
importPackage(Packages.mindustry.maps)
importPackage(Packages.mindustry.maps.filters)
importPackage(Packages.mindustry.maps.generators)
importPackage(Packages.mindustry.maps.planet)
importPackage(Packages.mindustry.mod)
importPackage(Packages.mindustry.net)
importPackage(Packages.mindustry.service)
importPackage(Packages.mindustry.type)
Expand Down
2 changes: 1 addition & 1 deletion core/src/mindustry/client/ScriptEngineHolder.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ package mindustry.client
import javax.script.*

object ScriptEngineHolder {
val kts: ScriptEngine? by lazy { ScriptEngineManager().getEngineByExtension("kts")?.apply { eval("import arc.*;import arc.audio.*;import arc.files.*;import arc.func.*;import arc.flabel.*;import arc.graphics.*;import arc.graphics.g2d.*;import arc.graphics.gl.*;import arc.input.*;import arc.math.*;import arc.math.geom.*;import arc.scene.*;import arc.scene.actions.*;import arc.scene.event.*;import arc.scene.style.*;import arc.scene.ui.*;import arc.scene.ui.layout.*;import arc.scene.utils.*;import arc.struct.*;import arc.util.*;import arc.util.io.*;import arc.util.noise.*;import arc.util.pooling.*;import arc.util.serialization.*;import arc.util.viewport.*;import mindustry.*;import mindustry.ai.*;import mindustry.ai.types.*;import mindustry.async.*;import mindustry.audio.*;import mindustry.content.*;import mindustry.core.*;import mindustry.ctype.*;import mindustry.editor.*;import mindustry.entities.*;import mindustry.entities.abilities.*;import mindustry.entities.bullet.*;import mindustry.entities.effect.*;import mindustry.entities.part.*;import mindustry.entities.pattern.*;import mindustry.entities.units.*;import mindustry.game.*;import mindustry.gen.*;import mindustry.graphics.*;import mindustry.graphics.g3d.*;import mindustry.input.*;import mindustry.io.*;import mindustry.logic.*;import mindustry.maps.*;import mindustry.maps.filters.*;import mindustry.maps.generators.*;import mindustry.maps.planet.*;import mindustry.net.*;import mindustry.service.*;import mindustry.type.*;import mindustry.type.ammo.*;import mindustry.type.unit.*;import mindustry.type.weapons.*;import mindustry.type.weather.*;import mindustry.ui.*;import mindustry.ui.dialogs.*;import mindustry.ui.fragments.*;import mindustry.ui.layout.*;import mindustry.world.*;import mindustry.world.blocks.*;import mindustry.world.blocks.campaign.*;import mindustry.world.blocks.defense.*;import mindustry.world.blocks.defense.turrets.*;import mindustry.world.blocks.distribution.*;import mindustry.world.blocks.environment.*;import mindustry.world.blocks.heat.*;import mindustry.world.blocks.legacy.*;import mindustry.world.blocks.liquid.*;import mindustry.world.blocks.logic.*;import mindustry.world.blocks.payloads.*;import mindustry.world.blocks.power.*;import mindustry.world.blocks.production.*;import mindustry.world.blocks.sandbox.*;import mindustry.world.blocks.storage.*;import mindustry.world.blocks.units.*;import mindustry.world.consumers.*;import mindustry.world.draw.*;import mindustry.world.meta.*;import mindustry.world.modules.*;import mindustry.client.*;import mindustry.client.antigrief.*;import mindustry.client.communication.*;import mindustry.client.crypto.*;import mindustry.client.navigation.*;import mindustry.client.navigation.waypoints.*;import mindustry.client.ui.*;import mindustry.client.utils.*;") } }
val kts: ScriptEngine? by lazy { ScriptEngineManager().getEngineByExtension("kts")?.apply { eval("import arc.*;import arc.audio.*;import arc.files.*;import arc.flabel.*;import arc.flabel.effects.*;import arc.func.*;import arc.graphics.*;import arc.graphics.g2d.*;import arc.graphics.gl.*;import arc.input.*;import arc.math.*;import arc.math.geom.*;import arc.scene.*;import arc.scene.actions.*;import arc.scene.event.*;import arc.scene.style.*;import arc.scene.ui.*;import arc.scene.ui.layout.*;import arc.scene.utils.*;import arc.struct.*;import arc.util.*;import arc.util.io.*;import arc.util.noise.*;import arc.util.pooling.*;import arc.util.serialization.*;import arc.util.viewport.*;import mindustry.*;import mindustry.ai.*;import mindustry.ai.types.*;import mindustry.async.*;import mindustry.audio.*;import mindustry.client.*;import mindustry.client.antigrief.*;import mindustry.client.claj.*;import mindustry.client.communication.*;import mindustry.client.communication.syncing.*;import mindustry.client.crypto.*;import mindustry.client.navigation.*;import mindustry.client.navigation.waypoints.*;import mindustry.client.ui.*;import mindustry.client.utils.*;import mindustry.content.*;import mindustry.core.*;import mindustry.ctype.*;import mindustry.editor.*;import mindustry.entities.*;import mindustry.entities.abilities.*;import mindustry.entities.bullet.*;import mindustry.entities.effect.*;import mindustry.entities.part.*;import mindustry.entities.pattern.*;import mindustry.entities.units.*;import mindustry.game.*;import mindustry.gen.*;import mindustry.graphics.*;import mindustry.graphics.g3d.*;import mindustry.input.*;import mindustry.io.*;import mindustry.io.versions.*;import mindustry.logic.*;import mindustry.maps.*;import mindustry.maps.filters.*;import mindustry.maps.generators.*;import mindustry.maps.planet.*;import mindustry.mod.*;import mindustry.net.*;import mindustry.service.*;import mindustry.type.*;import mindustry.type.ammo.*;import mindustry.type.unit.*;import mindustry.type.weapons.*;import mindustry.type.weather.*;import mindustry.ui.*;import mindustry.ui.dialogs.*;import mindustry.ui.fragments.*;import mindustry.ui.layout.*;import mindustry.world.*;import mindustry.world.blocks.*;import mindustry.world.blocks.campaign.*;import mindustry.world.blocks.defense.*;import mindustry.world.blocks.defense.turrets.*;import mindustry.world.blocks.distribution.*;import mindustry.world.blocks.environment.*;import mindustry.world.blocks.heat.*;import mindustry.world.blocks.legacy.*;import mindustry.world.blocks.liquid.*;import mindustry.world.blocks.logic.*;import mindustry.world.blocks.payloads.*;import mindustry.world.blocks.power.*;import mindustry.world.blocks.production.*;import mindustry.world.blocks.sandbox.*;import mindustry.world.blocks.storage.*;import mindustry.world.blocks.units.*;import mindustry.world.consumers.*;import mindustry.world.draw.*;import mindustry.world.meta.*;import mindustry.world.modules.*") } }
}
4 changes: 3 additions & 1 deletion tools/src/mindustry/tools/ScriptMainGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class ScriptMainGenerator{

public static void main(String[] args) throws Exception{
String base = "mindustry";
Seq<String> blacklist = Seq.with("plugin", "mod", "net", "io", "tools");
Seq<String> blacklist = Seq.with("tools");
Seq<String> nameBlacklist = Seq.with();
Seq<Class<?>> whitelist = Seq.with(Draw.class, Fill.class, Lines.class, Core.class, TextureAtlas.class, TextureRegion.class, Time.class, System.class, PrintStream.class,
AtlasRegion.class, String.class, Mathf.class, Angles.class, Color.class, Runnable.class, Object.class, Icon.class, Tex.class, Shader.class,
Expand All @@ -41,6 +41,8 @@ public static void main(String[] args) throws Exception{
getClasses("arc.audio"),
getClasses("arc.input"),
getClasses("arc.util"),
getClasses("arc.files"),
getClasses("arc.flabel"),
getClasses("arc.struct")
);
classes.addAll(whitelist);
Expand Down

0 comments on commit 27650ca

Please sign in to comment.