[REQ] Queue Up Nukes & Anti-Nukes Automatically

Discussion in 'Mod Discussions' started by brianpurkiss, February 3, 2014.

  1. brianpurkiss

    brianpurkiss Post Master General

    Messages:
    7,879
    Likes Received:
    7,438
    Very simple mod in concept.

    Whenever a Nuclear Missile Launcher or Anti-Nuke Launcher is built, automatically queue up the appropriate missile and set it to infinite build.

    Would be very helpful.
    Pendaelose likes this.
  2. cptconundrum

    cptconundrum Post Master General

    Messages:
    4,186
    Likes Received:
    4,900
    I was thinking about that before. I wonder if it is possible to intercept the nuke built notification and hold the unit in an array. Then the mod could do the auto factory thing and wait until nothing is selected to select all the recently built nukes/antinukes and set a queue.

    I don't have time for this myself, but I bet it can be done.
  3. stawos

    stawos Member

    Messages:
    79
    Likes Received:
    46
    This feature is already available in the AUTO FACTORIES mod also mod is downloadable through PAMM
    Pendaelose likes this.
  4. trialq

    trialq Post Master General

    Messages:
    1,295
    Likes Received:
    917
    It sort of is, but that mod only builds something when eco is at a surplus. If you don't use the mod currently then you can use it to do what you want. Just:
    • Install the mod
    • Change the metal and energy thresholds to 1
    • Set every factory to build nothing, except for nukes and anti-nukes
    cptconundrum likes this.
  5. brianpurkiss

    brianpurkiss Post Master General

    Messages:
    7,879
    Likes Received:
    7,438
    But then it wouldn't turn on my factories. :-/
  6. LavaSnake

    LavaSnake Post Master General

    Messages:
    1,620
    Likes Received:
    691
    Two installs of the mod then? Just change the folder names, id, and any variable names and it should work.
  7. cptconundrum

    cptconundrum Post Master General

    Messages:
    4,186
    Likes Received:
    4,900
    Maybe, but the way the mod works, I can see that ending in disaster. You could do that if we had an automation API, but two mods going around selecting things, giving orders, and deselecting at the same time will cause concurrency issues unless there is some sort of lock variable in the global namespace.
  8. LavaSnake

    LavaSnake Post Master General

    Messages:
    1,620
    Likes Received:
    691
    true. I guess you could just mod the mod to make it work but that would require a decent chunk of coding.
  9. trialq

    trialq Post Master General

    Messages:
    1,295
    Likes Received:
    917
    I think javascript is single threaded, so it would work fine as code from mods, the UI etc never run simultaneously (which makes sense).

    How about each factory type having its own metal and energy thresholds? That way you could set nukes and anti-nukes to build when eco>1%, and set the others to whatever you wanted independently. I'll look into it at the weekend.
    LavaSnake and cptconundrum like this.
  10. trialq

    trialq Post Master General

    Messages:
    1,295
    Likes Received:
    917
    Auto Factory has been updated with the above, and should now do what you want it to. It should be live on PAMM later today, I'm having 'fun' with github and need someone more knowledgeable to see it and hold my hand ;)
    LavaSnake and brianpurkiss like this.
  11. brianpurkiss

    brianpurkiss Post Master General

    Messages:
    7,879
    Likes Received:
    7,438
    Woohoo! Killer update.

    Does it start the missiles as soon as the launcher is built? Or is it tied into positive economy?
  12. trialq

    trialq Post Master General

    Messages:
    1,295
    Likes Received:
    917
    As normal for the mod it's tied to positive economy, and nothing can be selected when it checks (every second) to auto-build. When it's live, just set the nuke and anti-nuke thresholds to 1%.

    BTW when there's another substantial update, I might set the minimum the thresholds can be to 0% instead of 1%. It's not really a problem but it's starting to bug me.
    brianpurkiss likes this.
  13. brianpurkiss

    brianpurkiss Post Master General

    Messages:
    7,879
    Likes Received:
    7,438
    Sahweet.

Share This Page