[REL] Preview building to be build [57164]

Discussion in 'Mod Discussions' started by cola_colin, August 25, 2013.

  1. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    http://www.nanodesu.info/stuff/pa/mods/selectionpreview.zip

    Shows a preview of the building you've selected to be build.
    Especially helpful in combination with hotbuild, so you dont select the wrong thing to be build with a hotkey.

    Either use the mod manager or add this line to your mod ui list live_game(before the lines of hotbuild!):
    '../../mods/selectionpreview/live_game/selection_preview.js'

    [​IMG]
    Last edited: August 25, 2013
  2. tatsujb

    tatsujb Post Master General

    Messages:
    12,902
    Likes Received:
    5,385
  3. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    keeps working in 54357
  4. proeleert

    proeleert Post Master General

    Messages:
    1,681
    Likes Received:
    1,656
    Also made a variation of this mod.
    It shows the build hover menu ( I find it more usefull cause the icons of factories are too alike )
    [​IMG]
    Code:
    var lastTimeActivated = new Date().getTime();
    var previewIsVisible = false;
    
    var oldExecuteStartBuild = model.executeStartBuild; //reference to original
    model.executeStartBuild = function(event, index) {
        var item = model.buildItems()[index];
        model.setBuildHover(index); //show info
        previewIsVisible = true;
        oldExecuteStartBuild(event, index); //execute original action
    };
    
    model.fabModeSelected = ko.computed(function() {
        return model.mode() === 'fab' ;
    });
    
    
    
    function checkIfVisibleExpired() {
        var dt = new Date().getTime();
        if(previewIsVisible && model.fabModeSelected() !== 'fab' && dt - lastTimeActivated > 2000) {
            lastTimeActivated = dt;
            model.clearBuildHover();
            previewIsVisible = false;
        }
    }
    
    setInterval(checkIfVisibleExpired, 1500);
    kalienero and cola_colin like this.

Share This Page