Any wishes for additional mod support?

I don’t know if that exists, but what about some method to “spawn” an blank, default window?

@Haxor You can do it this way: window.open();

@PatrickKlug Can you make the function that generates a review message public? It would be useful for my multiplayer mod.

A GDT.eventKeys.mod.allLoaded event, fired after the last mod is loaded, could help with interop or compatibility between mods. Similarly, it would be nice if the mod.loaded event passed the name of the mod that was loaded to the callback. That would allow us to do things like:

GDT.on(GDT.eventKeys.mod.loaded, function(m) { 
    // Only handle this if it's my mod that was loaded.
    if(m == "My Mod") { MyMod.init(); }
});

Ideally, each individual mod’s mod.loaded events would fire before the final mod.allLoaded event does.

@kane_t I’m pretty sure the ready callback when you load your mod already takes care of that.

(function()
{
    var ready = function()
    {
        mymod.init();
    };

    var error = function()
    {
        alert("Failed to initialize mymod");
    };
    
    var filestoload = ["mods/mymod/inside/mymod.js"];
    GDT.loadJs(filestoload, ready, error);
})();

Ah, that’s right, that could take care of my example. I didn’t think of that because I don’t use loadJs(), I just let GDT load my mod automatically from the definition in package.json. It still might be useful to somebody to be able to see when another, specific mod is loaded, but I can’t think of a use case for that, myself.

A mod.allLoaded event would still be useful, though, and I’m pretty sure there’s no workaround for that yet.

@Darkly I’ll expose the following methods:

Reviews.rateGame which is the whole review algorithm (rather complicated).
Reviews.getReviews which calculates the separate review scores and calls getGenericReviewMessage (see below)
Reviews.getGenericReviewMessage(game, score) which generates the generic review text for each reviewer.

4 Likes

Soo maybe anyway to make custom windows easier?
Because now we can make only <div>'s and I don’t get it.

I believe the UltimateLib has some helper methods to make custom windows easier but any UI changes require HTML knowledge and I don’t think there’s much point in abstracting this any further. Advanced modding simply does require some HTML/JS skills.

It doesn’t work…
When I click anywhere the time freezes…

I’ll add a mod.allLoaded event.

Oh, you mean that kind of window. facepalm

Yeah, you’ll have to use divs :frowning: To create an empty window:

$("#resources").append('<div id="myDialog" class="tallWindow windowBorder"></div>');

And to show it:

UI.showModalContent("#myDialog", {
    disableCheckForNotifications: true,
    close: true, //whether there is an X button that closes it
    onOpen: function() {
        //do something
    },
    onClose: function() {
        GameManager.resume(true);
    }
});
2 Likes

Ugh.
I dunno if this doesn’t work or I am just (…), but it’s just like it was earlier, I’m clicking anywhere and the game just freezes.
(sorry for going a bit offtopic)

It works for me… if you want to, you can send the code in a PM and I’ll help you.

Great, thanks!

Do you have an ETA for the workshop release, or is it too early to tell yet?

Noticed this and just wondering if support could be added or not, Is there a way to provide the folder name to mods, so say for whatever reason you download a mod and name the folder hippo2. Can you provide the mod which is actually hippo the folder url so it knows to find the files in hippo2? example:

var folderPath = "......"
GDT.loadJS(['mods/'+folderPath+'/source.js']);

But folderpath would be provided on your end with the correct folder name?

Just one more thing… (</Columbo>)

The function that generates the candidates when you hire staff is currently anonymous. It probably deserves to be exposed in some way. You could do that by just giving it a name, so we could override the entire thing, but it might also be useful to add events for it.

An event that’s fired before returning the generated candidates, maybe “beforeStaffChoice” or “beforeHiring,” which passes to the event handlers the array of generated candidates, the budget ratio, and maybe that mersenne twister you create (why do you do that, BTW? Why not just keep using the company RNG?) would allow modders to append traits to staff without replacing the whole function. I was thinking it might be interesting, for example, to have staff members sometimes have a specialty in certain genres (so you might get, for instance, a designer who’s particularly good with Action games). It would be pretty easy to implement with an event like that.

An event that fires after a new staff member is chosen could also be useful. I don’t need it myself, though.

EDIT: Actually, on reflection, an “afterStaffChoice” event would be necessary for what I was thinking, since the properties of the generated staff members are manually copied to the Character object that’s later created. Simply adding a property to that array wouldn’t be enough, we’d need to store the information in the mod’s data store. So, an “afterStaffChoice” event that passes, to the handler, the object from the generated candidate array which the player chose to be hired (which would include any of the properties we appended in the “beforeStaffChoice” event), or nothing (if the window was closed without hiring a staff member).

1 Like

Will do :smile:

Exposing:

UI._hireStaff(applicant): method that is called to add an applicant to the company and initialize the visuals.
UI._generateJobApplicants():returns the array of generated applicants.

And adding new events (GDT.eventKeys):

staffApplicantsGenerated:'gameplay.staffApplicantsGenerated',//data={applicants, settings, rng}
staffHired: 'gameplay.staffHired',//data={character, applicant}
staffFired: 'gameplay.staffFired'//data={character}

Event data will contain the generated applicants, the settings used to generate them and the rng in use.

The reason we use a separate RNG: We want that job searches are deterministic so you can’t cheat by simply reloading the game. We don’t want to save the applicants in data, so we generate them when the UI shows. The company’s RNG state from the time we initiated the search to the time the UI shows is not deterministic because it depends on the players actions in the meantime. We thus store a seed when we first initiate the search and initialize a new RNG from that seed when we generate applicants.

I’m also adding a new Sales.applyGridSales method which is called every week to apply the sales. This should make it much easier to overhaul the sales logic for the grid system (you can then simply hijack that method). /cc @Stian

1 Like

Fantastic! Thanks again!

Many thanks! I was literally playing with the code to make that, when I checked the forum :stuck_out_tongue:

1 Like