Last active
January 5, 2021 06:38
-
-
Save jacobrosenthal/c8145648c98d4d14ccdc9928a61666ea to your computer and use it in GitHub Desktop.
Artifact Auto Miner
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Remember, you have access these globals: | |
* 1. df - Just like the df object in your console. | |
* 2. ui - For interacting with the game's user interface. | |
* 3. plugin - To register the plugin, plus other helpful things. | |
* | |
* Let's log these to the console when you run your plugin! | |
*/ | |
console.log(df, ui, plugin); | |
class Plugin { | |
clock; | |
constructor() { | |
let clock = setInterval(() => { | |
const planets = Array.from(df.getMyPlanets()) | |
.filter(p => (p.energy/p.energyCap) >=.96) | |
.filter(p => df.isPlanetMineable(p)) | |
.filter(p => !p.hasTriedFindingArtifact); | |
for (const planet of planets) { | |
df.findArtifact(planet.locationId); | |
} | |
}, 1000 * 60 * 10 ); | |
this.clock = clock; | |
} | |
async render(container) { | |
container.style.width = '50'; | |
} | |
destroy() { | |
clearInterval(this.clock); | |
} | |
} | |
/** | |
* And don't forget to register it! | |
*/ | |
plugin.register(new Plugin()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment