Skip to content

Instantly share code, notes, and snippets.

Avatar

Matt McFarland MattMcFarland

  • Software Engineer
  • Dayton, OH
View GitHub Profile
@MattMcFarland
MattMcFarland / readme.md
Last active Dec 1, 2020
Run X4 Foundations in debug mode with timestamped file names so you don't lose them.
View readme.md

Run X4 Foundations in debug mode.

The handy script below (x4-debug.bat) can be used as a shortcut to start x4 in debug mode. You get:

  • All debug messages turned on
  • All debug logs sent to a timestamped file, so you dont lose anything

Setup

Copy paste the code in the file below, then update the value for X4_EXE_PATH - change it to wherever X4.exe is located.

@MattMcFarland
MattMcFarland / styles.less
Created Jul 15, 2016
Ligature fonts for atom
View styles.less
atom-text-editor {
font-family: 'Fira Code';
font-style: normal;
text-rendering: optimizeLegibility;
}
atom-text-editor::shadow {
.string.quoted,
.string.regexp {
-webkit-font-feature-settings: "liga" off, "calt" off;
}
View add-ware-to-x4.md

Adding a new ware

Please consider every mentioning of {WARE_ID} to be replaced of what ware we want to add, and it must be lowercase to ensure compatibility across systems. Generally, we will be prefixing every ware we add with something unqiue to avoid any collision issues with other mods. This is mentioned as {PREFIX}

UPDATE: you can simplify this process by automating majority of the work using this tool.

Create new assets

To add a ware and the production of the ware to the game, the following files need to be created from scratch:

@MattMcFarland
MattMcFarland / jsverify jasmine.js
Last active Oct 29, 2018
js verify with jasmine
View jsverify jasmine.js
describe('Maths', () => {
it('addition is commutative', () => {
expect(jsc.checkForall(jsc.integer, jsc.integer, (a, b) => a + b === b + a)).toBeTrue()
})
})
@MattMcFarland
MattMcFarland / with mocha.js
Last active Mar 10, 2018
jsverify with mocha
View with mocha.js
describe('Maths', () => {
it('addition is commutative', () => {
jsc.assertForall(jsc.integer, jsc.integer, (a, b) => a + b === b + a)
// same as:
assert(jsc.checkForall(jsc.integer, jsc.integer, (a, b) => a + b === b + a) === true)
})
})
@MattMcFarland
MattMcFarland / Create a tree with path string.js
Created Jun 30, 2017
Create a tree with path string created by MattMcFarland - https://repl.it/JC8r/22
View Create a tree with path string.js
const pathString = 'one/two/three';
function buildTree(pathString) {
const pathArray = pathString.split('/')
let pathList = {}
for (var i = pathArray.length - 1; i >= 0; i--) {
let newObj = Object.assign({}, pathList);
pathList = {
[pathArray[i]]: newObj
View random-dungeon.lua
-- Copyright(c) Matt McFarland - 2017
-- MIT LICENSE
-- This will create rooms using the BSP method
rooms = {}
function _init()
local main_container = container(0, 6, 127, 121)
local max_depth = 6
local container_tree = split_container(main_container, max_depth)
@MattMcFarland
MattMcFarland / Grid.js
Created Apr 14, 2017
A 2d grid library (with unit tests)
View Grid.js
const assert = require('assert')
const transpose = (array) => array.reduce((p, n) => n.map((item, i) => [...(p[i] || []), n[i]]), [])
/**
* @class Grid
*/
class Grid {
/**
* @static transpose
* @param grid - grid to transpose
View test.lua
function _init()
my_grid = make_grid(10,10)
.map(set_wall)
my_grid.each(log)
room = my_grid
.select(4, 4, 7, 7)
.map(set_blank)