rpgtkoolmv / corescript

http://www.rpgmakerweb.com/products/programs/rpg-maker-mv
MIT License
311 stars 74 forks source link

Typescript conversion #53

Open niokasgami opened 7 years ago

niokasgami commented 7 years ago

First of all before peoples misunderstand I am not asking to convert MV to typescript I am just asking if it's possible to allow me to make a d.ts or a definition files for MV corescript (and later to make a version in typescript who follow the corescript dev alongside.)

Obviously, the reason I say this is that sometime some game dev like me wish to have access to a more strict coding environnement for their game (and obviously are not using plugin because...I know how typescript doesn't like when you edit a class)

so for being simple I would like to make a conversion of the CoreScript (or a definition file ups to you) for the peoples who enjoy programming with typescript.

I will obviously not ask you guys to do it I can Happily do it myself and pull it as a new branch.

The Pros of this are the fact it's offers a stable strict environnment and good debugging The cons are probably it's may be a little strict when it's come to plugin although it's perfect for Standalone dev I hope you will like the idea :3

inc0der commented 7 years ago

I like the idea, I don't write in typescript, I never tried it yet but I know the definition files work awesome in VSCode and it would give me better IntelliSense for corescript. I'm pretty sure other editors can use definition files in the same manner.

ghost commented 7 years ago

If you mean to write d.ts by hand, I agree with the idea. because document is missing, strict d.ts would be lifeline of development.

but I wander who writes the d.ts. The priority is relatively low. IMO people who need it are few, because plugin developers are not frontend experts.

but if you make PR which contains d.ts, we'll consider about merging it. Public interface should be stable, so maintenance cost would be acceptably low.

niokasgami commented 7 years ago

Yep i will write it they are kinda easy to do and I already have some part who are ready such the interface for some of the json :3

ghost commented 7 years ago

great!

niokasgami commented 7 years ago

yes! I just struggle with making a proper Git pushing with Visual studio code lol. It's not like visual studio where it's have a more intuitive interface for make git push.

niokasgami commented 7 years ago

A little update! for show the structure of how MV_Typescript will be :

    /**
 * The namespace for the MV datas.
 * 
 * @namespace MV
 */
declare namespace MV {

    /**
     * The JSON interface for the actor
     * 
     * @export
     * @interface MV::IDataActor
     */
    export interface IDataActor {

        [index: number]: {
            /**
             * The id of the actor
             * 
             * @type {number}
             */
            id: number;

            /**
             * the battler name of the actor.
             * 
             * @type {string}
             */
            battlerName: string;

            /**
             * The character index used for the character graphic.
             * 
             * @type {number}
             */
            characterIndex: number;

            /**
             * the filename of the character graphic.
             * 
             * @type {string}
             */
            characterName: string;

            /**
             * The class id of the character.
             * 
             * @type {number}
             */
            classId: number;

            /**
             * The actor starting equipment.
             * 
             * @type {number[]}
             */
            equips: number[];

            /**
             * The character face index used for the actor face graphic.
             * 
             * @type {number}
             */
            faceIndex: number;

            /**
             * The filename for the character graphics.
             * 
             * @type {string}
             */
            faceName: string;

            /**
             * The actors traits. 
             * 
             * @type {any[]}
             */
            traits: any[]; /// TODO : Define the good traits interfaces?

            /**
             * The actor initial level on the game startup.
             * 
             * @type {number}
             */
            initialLevel: number;

            /**
             * The actor max level.
             * 
             * @type {number}
             */
            maxLevel: number;

            /**
             * The actor name in the game.
             * 
             * @type {string}
             */
            name: string;

            /**
             * The actor nickname in the game.
             * 
             * @type {string}
             */
            nickname: string;

            /**
             * The actor notes.
             * 
             * @type {string}
             */
            note: string;

            /**
             * The actor profile.
             * 
             * @type {string}
             */
            profile: string;
        }
    }
}

It's will be also on a external repository until well it's done...because let's be honest MV Library is Massive lol and I have to find a way to concatenate all the d.ts file in one after.

but in simple it's will be organized in a way it's will be intuitive to have information and intelisenses for the files.

bsides commented 7 years ago

This is awesome but I believe you'll have a hard time with PIXI. There are some "official" d.ts files about it but not for 4 as far as I know. Or would you just ignore them?

niokasgami commented 7 years ago

@bsides they actually have d.ts files for PIXI V4 actually! it's can be found in Typed repertories!

bsides commented 7 years ago

Awesome! I'm looking forward to that PR, this is great news

bungcip commented 7 years ago

Hi all, if anyone interested on corescript in typescript. I already converted it to typescript on https://bitbucket.org/bungcip/corescript-ts (using mercurial), feel free to check it.