Skip to content

Instantly share code, notes, and snippets.

@Higgs1
Last active January 29, 2023 02:52
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Higgs1/8eec9d3caefc5ac96f9454d120b080cd to your computer and use it in GitHub Desktop.
Save Higgs1/8eec9d3caefc5ac96f9454d120b080cd to your computer and use it in GitHub Desktop.
Foxxie's Fantastical Factory Idle Mods

Foxxie's Fantastical Factory Idle Mods

Welcome to my collection of fantastically fabulous fox Factory Idle mods. All of these mods are completely free under the Hug-Ware license: "If we meet some day, and you think this stuff is worth it, you can give me a hug in return."

These mods do various neat things to help enhance your Factory Idle playing experience. Here's a short description of each and a link to automatically install them (assuming you already have the required software installed).

Enable Right Click Context Menu [disable right click.user.js]

Makes your normal right clicky context menu pop up when you right click, except in the map area so you can still delete things.

Full Sized Factory Idle [factoryidle.user.css]

Expands the map area to fill the rest of the screen, and gets rid of empty space too.

Factory Idle API [api.user.js]

Opens up Factory Idle's closure and exposes it's internal game variables through the variable window.MainInstance. A.K.A. it enables cheats.

Factory Idle Mod Loader [modloader.user.js]

Allows other userscripts to mod Factory Idle without conflicts or overhead by firing a custom event named "FactoryIdleLoaded" when Factory Idle completes initialization, with the event details property set to MainInstance.play. This event should be sufficient - use Factory Idle's built-in event manager to listen to actual game events. Requires my Factory Idle API script!!

Dev Mode [devmode.user.js]

Enables the built-in developer mode that lets you modify the terrian and skip ahead in time. Also serves as a quick example for using my Mod Loader script to make Factory Idle mods.

// ==UserScript==
// @name Factory Idle API
// @namespace github.com/Higgs1
// @version 0.1.0
// @description Opens up Factory Idle's closure and exposes it's internal game variables through window.MainInstance.
// @author Lexxy Fox
// @match *://factoryidle.com/
// @grant GM_getResourceText
// @run-at document-start
// @resource app https://factoryidle.com/app.js
// ==/UserScript==
window.addEventListener('beforescriptexecute', e => {
const src = e.target.src;
if (src && new URL(src).pathname === '/app.js') {
const newjs = document.createElement('script')
newjs.textContent = GM_getResourceText('app').replace('MainInstance=', 'window.MainInstance=MainInstance=')
document.head.appendChild(newjs) && e.preventDefault() || e.stopPropagation()
}
});
// ==UserScript==
// @name Factory Idle Dev Mode
// @namespace github.com/Higgs1
// @version 0.1.0
// @description Enables the built-in developer mode. Also a simple example FI mod.
// @author Lexxy Fox
// @match *://factoryidle.com/
// @grant unsafeWindow
// ==/UserScript==
document.addEventListener('FactoryIdleLoaded', e =>
e.detail.isDevMode = () => true
)
// ==UserScript==
// @name Factory Idle Disable Context Menu
// @namespace github.com/Higgs1
// @version 0.1.1
// @description Re-enables the right click context menu.
// @author Lexxy Fox
// @match *://factoryidle.com/
// @run-at document-start
// ==/UserScript==
window.addEventListener('beforescriptexecute', e =>
e.target.matches('body > script') && e.preventDefault()
)
document.getElementById('gameArea').addEventListener('contextmenu', e =>
e.target.matches('.mapContainer div div') && e.preventDefault()
)
/* ==UserStyle==
@name Full Page Factory Idle
@namespace github.com/Higgs1
@version 0.1.0
@description Makes Factory Idle take up the entire page.
@author Lexxy Fox
@preprocessor stylus
==/UserStyle== */
@-moz-document domain("factoryidle.com")
body, html, div:not(.mapContainer), span, td
-moz-user-select: unset !important
user-select: unset !important
#main > *:not(#gameArea), .controlsBox > br
display: none
#main, #gameArea, .factoryBox, .mapContainer, .mapContainer > div
width: 100% !important
height: 100% !important
min-height: unset
.mapContainer, .factoryBox
position: absolute
.controlsBox
width: unset
#gameArea
margin-top: 0
border: 0
> table.factoryBox
padding: 1em
box-sizing: border-box
display: block
> tbody
border-top: 1px solid gray
flex-direction: column
display: flex
height: 100%
> tr:nth-child(2), .mapArea, .topArea
flex: 1
> tr
display: flex
> td.overviewArea
min-width: 210px
padding: 0 9px 0 0
> td.mapArea
position: relative
// ==UserScript==
// @name Factory Idle Mod Loader
// @namespace github.com/Higgs1
// @version 0.1.0
// @description Provides JS events that trigger when Factory Idle has completed init.
// @author Lexxy Fox
// @match *://factoryidle.com/
// @grant unsafeWindow
// @run-at document-start
// ==/UserScript==
Object.defineProperty(unsafeWindow, 'MainInstance', {
configurable: 1, enumerable: 1, writeable: 1,
set: MainInstance => {
delete unsafeWindow.MainInstance
unsafeWindow.MainInstance = MainInstance
Object.defineProperty(MainInstance, 'play', {
configurable: 1, enumerable: 1, writeable: 1,
set: play => {
delete MainInstance.play
MainInstance.play = play
document.dispatchEvent(new CustomEvent('FactoryIdleLoaded', {detail: play}))
}
})
document.dispatchEvent(new CustomEvent('InstanceLoaded', {detail: MainInstance}))
}
})
@tycoonboii
Copy link

?

@therealdummy563
Copy link

huh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment