Jump to content

API of classes and methods accessible via lua scripts ?


CareBearCorpse

Recommended Posts

Hello,

As title says, is there some sort of API to detail what Java classes and methods are accessible via mod scripts ? I suppose all java public classes and methods are not accessible so i'm left thinking a specific javadoc or sth may prevent from relying too much on other people's scripts, to know what it's possible to do.

Concretely, i was thinking about instantiating a character ( yeah i know NPCs are not back yet ), and assuming it's technically possible, i'd have no clue on how to do it : Zombie.Character.spawn() ? And then how can I know which methods of my character can be

called in my scripts ?

I searched this forum as well as pz-mod.net without results, and all i found was the Events reference, which is useful but has a limited scope.

So if anybody has any insight, please enlighten me.

PS : as a thanks for reading my concerns, i'll disclose a top-secret information to you all :

several zombie outbreaks (and fast ones at that) were reported in France :

http://okbut.co/posts/ok-pas-de-petites-economies-mais-dalerte-nucleaire/?ui_lang=en_EN

Link to comment
Share on other sites

Easiest way is to just decompile the zomboid\lua\ directory. LuaManager specifically details any global functions available through Lua, as well as exposed Java classes and methods.

But, even if there were an API, it'd be much like the current JavaDoc: there'd be very little (or no) description of how to use something.

Link to comment
Share on other sites

Hey, there is the list of all java clas exposed to lua :

 

        IsoTree.class
        IsoLot.class
        Stats.class
        MetaObject.class
        MainScreenState.class
        LuaTimedAction.class
        LuaTimedActionNew.class
        GameTime.class
        InventoryItemFactory.class
        LuaUIWindow.class
        UIElement.class
        IsoObjectPicker.class
        KahluaUtil.class
        InventoryContainer.class
        IsoMetaChunk.class
        IsoMetaCell.class
        IsoMetaGrid.class
        Trigger.class
        BuildingDef.class
        RoomDef.class
        QuestCreator.class
        IRCClient.class
        IsoLuaCharacter.class
        IsoDummyCameraCharacter.class
        LoginState.class
        EnumMap.class
        Texture.class
        Core.class
        zombie.ui.UIFont.class
        TextManager.class
        PropertyContainer.class
        IsoFlagType.class
        IsoObjectType.class
        IsoWorld.class
        IsoCell.class
        IsoGridSquare.class
        SliceY.class
        InventoryItem.class
        Food.class
        HandWeapon.class
        DrainableComboItem.class
        Literature.class
        ComboItem.class
        Clothing.class
        SystemDisabler.class
        SurvivorType.class
        LuaEventManager.class
        IsoCamera.class
        Iterator.class
        Keys.class
        LuaState.class
        BurntToDeath.class
        DieState.class
        ExploreState.class
        IdleState.class
        LuaState.class
        LungeState.class
        PathFindState.class
        ReanimateState.class
        StaggerBackDieState.class
        StaggerBackState.class
        SwipeState.class
        SwipeStatePlayer.class
        ThumpState.class
        WalkTowardState.class
        WanderState.class
        ZombiePathfindState.class
        SoundManager.class
        IsoUtils.class
        LosUtil.class
        VirtualItemSlot.class
        IsoSprite.class
        IsoObject.class
        IsoMovingObject.class
        IsoGameCharacter.class
        IsoSurvivor.class
        IsoZombie.class
        IsoPlayer.class
        Keyboard.class
        Math.class
        UIManager.class
        ProfessionFactory.class
        Profession.class
        TraitFactory.class
        Trait.class
        ObservationFactory.class
        Observation.class
        PerkFactory.class
        Perk.class
        DataOutputStream.class
        DataInputStream.class
        SurvivorFactory.class
        Mouse.class
        IsoBarricade.class
        IsoCrate.class
        IsoCurtain.class
        IsoDeadBody.class
        IsoDoor.class
        IsoFire.class
        IsoWorldInventoryObject.class
        IsoPushableObject.class
        IsoJukebox.class
        IsoLightSwitch.class
        IsoMolotovCocktail.class
        IsoRadio.class
        IsoStove.class
        IsoWheelieBin.class
        IsoWindow.class
        IsoZombieGiblets.class
        Keyboard.class
        PerkFactory.Perks.class
        Coroutine.class
        PerkFactory.class
        UIFont.class
        SpriteRenderer.class
        ClothingBodyLocation.class
        UnbarricadeAction.class
        BarricadeAction.class        
        ScriptManager.class        
        GameLoadingState.class        
        VirtualZombieManager.class        
        RecipeManager.class
        Recipe.class
        RainManager.class
        IsoFireManager.class
        ChooseGameInfo.Story.class
        IsoThumpable.class
        BodyPartType.class
        BodyPart.class
        BodyDamage.class
        ObjectTooltip.class
        NewHealthPanel.class
        Color.class
        ColorInfo.class
        SandboxOptions.class
        Calendar.class
        SimpleDateFormat.class
        Translator.class
        Language.class

 

For the funcion, check the java doc :)

Link to comment
Share on other sites

Thanks for the replies, you almost ninja'ed the OP :D.

 

But, even if there were an API, it'd be much like the current JavaDoc: there'd be very little (or no) description of how to use something.

Now all hope is gone ! Well, you've gotta a point, if it's not documented it makes things significantly harder...

But then i'm still wondering how do all the modders manage to get something done ? Only through trials & failures, and getting advice/examples from other modders/devs ?

 

Hey, there is the list of all java clas exposed to lua :

 

        IsoTree.class

        IsoLot.class

        Stats.class

        MetaObject.class

        MainScreenState.class

        LuaTimedAction.class

        LuaTimedActionNew.class

        GameTime.class

        InventoryItemFactory.class

        LuaUIWindow.class

        UIElement.class

        IsoObjectPicker.class

        KahluaUtil.class

        InventoryContainer.class

        IsoMetaChunk.class

        IsoMetaCell.class

        IsoMetaGrid.class

        Trigger.class

        BuildingDef.class

        RoomDef.class

        QuestCreator.class

        IRCClient.class

        IsoLuaCharacter.class

        IsoDummyCameraCharacter.class

        LoginState.class

        EnumMap.class

        Texture.class

        Core.class

        zombie.ui.UIFont.class

        TextManager.class

        PropertyContainer.class

        IsoFlagType.class

        IsoObjectType.class

        IsoWorld.class

        IsoCell.class

        IsoGridSquare.class

        SliceY.class

        InventoryItem.class

        Food.class

        HandWeapon.class

        DrainableComboItem.class

        Literature.class

        ComboItem.class

        Clothing.class

        SystemDisabler.class

        SurvivorType.class

        LuaEventManager.class

        IsoCamera.class

        Iterator.class

        Keys.class

        LuaState.class

        BurntToDeath.class

        DieState.class

        ExploreState.class

        IdleState.class

        LuaState.class

        LungeState.class

        PathFindState.class

        ReanimateState.class

        StaggerBackDieState.class

        StaggerBackState.class

        SwipeState.class

        SwipeStatePlayer.class

        ThumpState.class

        WalkTowardState.class

        WanderState.class

        ZombiePathfindState.class

        SoundManager.class

        IsoUtils.class

        LosUtil.class

        VirtualItemSlot.class

        IsoSprite.class

        IsoObject.class

        IsoMovingObject.class

        IsoGameCharacter.class

        IsoSurvivor.class

        IsoZombie.class

        IsoPlayer.class

        Keyboard.class

        Math.class

        UIManager.class

        ProfessionFactory.class

        Profession.class

        TraitFactory.class

        Trait.class

        ObservationFactory.class

        Observation.class

        PerkFactory.class

        Perk.class

        DataOutputStream.class

        DataInputStream.class

        SurvivorFactory.class

        Mouse.class

        IsoBarricade.class

        IsoCrate.class

        IsoCurtain.class

        IsoDeadBody.class

        IsoDoor.class

        IsoFire.class

        IsoWorldInventoryObject.class

        IsoPushableObject.class

        IsoJukebox.class

        IsoLightSwitch.class

        IsoMolotovCocktail.class

        IsoRadio.class

        IsoStove.class

        IsoWheelieBin.class

        IsoWindow.class

        IsoZombieGiblets.class

        Keyboard.class

        PerkFactory.Perks.class

        Coroutine.class

        PerkFactory.class

        UIFont.class

        SpriteRenderer.class

        ClothingBodyLocation.class

        UnbarricadeAction.class

        BarricadeAction.class        

        ScriptManager.class        

        GameLoadingState.class        

        VirtualZombieManager.class        

        RecipeManager.class

        Recipe.class

        RainManager.class

        IsoFireManager.class

        ChooseGameInfo.Story.class

        IsoThumpable.class

        BodyPartType.class

        BodyPart.class

        BodyDamage.class

        ObjectTooltip.class

        NewHealthPanel.class

        Color.class

        ColorInfo.class

        SandboxOptions.class

        Calendar.class

        SimpleDateFormat.class

        Translator.class

        Language.class

 

For the funcion, check the java doc :)

Should I take this as a "yes, it's technically possible to instantiate and use all these classes in the mods" ?
Link to comment
Share on other sites

Now all hope is gone ! Well, you've gotta a point, if it's not documented it makes things significantly harder...

But then i'm still wondering how do all the modders manage to get something done ? Only through trials & failures, and getting advice/examples from other modders/devs ?

 

I can only speak for me, but Trail & Error + JD-GUI (for spelunking in the Java source) are my best friends :P

 

 

 

Should I take this as a "yes, it's technically possible to instantiate and use all these classes in the mods" ?

 

Should be. If you need a Getter / Setter or something like that we have a "lua requests" thread which RJ checks from time to time.

 

 

I'll move this thread to the Modding Help section :)

Link to comment
Share on other sites

Reading the OP, just want to check you have access to the JavaDoc as it is: http://www.projectzomboid.com/modding/

Not sure how up to date this is though

Yeah i do have access to it, thanks (was it a question ?  :oops: ).

Though if i'm ever to start coding i think i may stick to Enigma and RoboMat's suggestion : opening and decompiling the binary files directly from the game folder ; this way the doc could only be outdated relatively to private dev/test builds.

Which, for the record, can also be achieved like this using the Eclipse GUI (courtesy of Eggplanticus) : http://theindiestone.com/forums/index.php/topic/1156-pz-source-code-spelunking-debugging-and-decompiling/

Do you guys think it would be worth adding the list of exposed classes provided by RJ (http://theindiestone.com/forums/index.php/topic/2355-api-of-classes-and-methods-accessible-via-lua-scripts/#entry33935) to the javadoc thread here : http://theindiestone.com/forums/index.php/topic/703-updated-javadocs/ ? (to much info better than too little ?)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...