Skip to content

Commit

Permalink
Fuels?
Browse files Browse the repository at this point in the history
  • Loading branch information
SeaRyanC committed Jan 3, 2018
1 parent a16c31e commit cabd391
Show file tree
Hide file tree
Showing 34 changed files with 28,235 additions and 9,688 deletions.
4 changes: 4 additions & 0 deletions css/core.css
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ h1 {
text-shadow: 3px 3px 4px #222;
}

h2 {
text-shadow: 3px 3px 4px #222;
}

div.header {
position: fixed;
top: 10px;
Expand Down
2 changes: 1 addition & 1 deletion css/default.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ caption {
font-size: 120%;
}

h1 {
h2 {
font-size: 130%;
border-bottom: solid 1px #CCC;
}
1 change: 1 addition & 0 deletions css/images.css
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ p.military-science-pack { background:url("../images/military-science-pack.png");
p.modular-armor { background:url("../images/modular-armor.png"); }
p.night-vision-equipment { background:url("../images/night-vision-equipment.png"); }
p.nuclear-fuel-reprocessing { background:url("../images/nuclear-fuel-reprocessing.png"); }
p.nuclear-fuel { background:url("../images/nuclear-fuel.png"); }
p.nuclear-reactor { background:url("../images/nuclear-reactor.png"); }
p.offshore-pump { background:url("../images/offshore-pump.png"); }
p.oil-refinery { background:url("../images/oil-refinery.png"); }
Expand Down
Binary file added images/nuclear-fuel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 2 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

<body>
<a href="https://github.com/SeaRyanC/factorio-reference"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/e7bbb0521b397edbd5fe43e7f760759336b5e05f/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f677265656e5f3030373230302e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_green_007200.png"></a>
<!--
<h1><a href="#belt-throughput">Throughput</a></h1>
<div class="annotated">
<div class="table">
Expand Down Expand Up @@ -146,9 +147,7 @@ <h1><a href="#mining-with-modules">Mining with Modules</a></h1>
</div>
<div class="notes">
<p>How many drills does it take to fill both lanes of a blue belt with iron, copper, or coal?</p>

<p>Stone patches need 20% fewer drills due to higher mining speed.</p>

<p>To fill a red belt instead, multiply by 2/3. To fill a yellow belt instead, multiply by 1/3.</p>
</div>
</div>
Expand Down Expand Up @@ -527,7 +526,7 @@ <h1><a href="#single-car-ratios">Mixed-resource Cargo Wagons</a></h1>
<p>For recipes with fluid inputs, this table assumes you'll be using balanced pairs of empty and full barrels.</p>
</div>
</div>

-->

</body>

Expand Down
52 changes: 52 additions & 0 deletions js/displayable.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
export declare type Displayable = HTMLElement | string | number | {
name: string;
};
export declare function toElement(x: Displayable): HTMLElement;
export declare function toElement(x: Displayable | undefined): HTMLElement | undefined;
/**
* Displays the lowest integer greater than or equal to n.
* If this isn't exactly n, displays a tooltip indicating the original value.
* @param n The number to round
* @param indicate_rounding Optional; defaults to true. If false, hides the rounding indicator.
*/
export declare function ceil(n: number, indicate_rounding?: boolean): HTMLSpanElement;
/**
* Displays the greatest integer less than or equal to n.
* If this isn't exactly n, displays a tooltip indicating the original value.
* @param n The number to round
* @param indicate_rounding Optional; defaults to true. If false, hides the rounding indicator.
*/
export declare function floor(n: number, indicate_rounding?: boolean): HTMLSpanElement;
/**
* Groups items together in a row
* @param items The items to group
*/
export declare function g(...items: Displayable[]): HTMLElement;
/**
* Displays a list of items together in a row
* @param names The names of items to display
*/
export declare function itemGroup(...names: string[]): HTMLElement;
/**
* Puts an item into a paragraph element
* @param d Any displayable item
*/
export declare function p(d: Displayable): HTMLParagraphElement;
export declare function text(s: string): HTMLSpanElement;
export declare function tt(s: string): HTMLSpanElement;
export declare function nOf(n: number, item: HTMLElement): HTMLSpanElement;
export declare function item(name: string): HTMLParagraphElement;
export declare function itemCount(itemName: string, count: number): HTMLDivElement;
export declare function percent(n: number): HTMLElement;
export declare function wholePercent(n: number): HTMLElement;
export declare function large(n: number): HTMLSpanElement;
export declare function short_time(seconds: number): HTMLElement;
export declare function medium_time(seconds: number): HTMLElement;
export declare function long_time(seconds: number): HTMLElement;
export declare function time(seconds: number): HTMLElement;
export declare function fixed(n: number, units?: string): HTMLSpanElement;
export declare function spacePadded(n: number, width: number): HTMLSpanElement;
export declare function zeroPadded(n: number, width: number): HTMLSpanElement;
export declare function integer(n: number, units?: string): HTMLSpanElement;
export declare function multiplied(left: Displayable, factor: number): HTMLElement;
export declare function ratio(left: HTMLElement, right: HTMLElement): HTMLElement;
283 changes: 283 additions & 0 deletions js/displayable.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,283 @@
define(["require", "exports"], function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function toElement(x) {
if (x instanceof HTMLElement)
return x;
if (typeof x === 'string') {
return text(x);
}
if (typeof x === 'number') {
return integer(x);
}
if (x === undefined) {
return text("[undef]");
}
return item(x.name);
}
exports.toElement = toElement;
/**
* Displays the lowest integer greater than or equal to n.
* If this isn't exactly n, displays a tooltip indicating the original value.
* @param n The number to round
* @param indicate_rounding Optional; defaults to true. If false, hides the rounding indicator.
*/
function ceil(n, indicate_rounding) {
if (indicate_rounding === void 0) { indicate_rounding = true; }
var el = integer(Math.ceil(n));
if (indicate_rounding && Math.ceil(n) - n > 0.0001) {
el.title = "Rounded up from " + n.toFixed(2);
el.classList.add('rounded');
}
return el;
}
exports.ceil = ceil;
/**
* Displays the greatest integer less than or equal to n.
* If this isn't exactly n, displays a tooltip indicating the original value.
* @param n The number to round
* @param indicate_rounding Optional; defaults to true. If false, hides the rounding indicator.
*/
function floor(n, indicate_rounding) {
if (indicate_rounding === void 0) { indicate_rounding = true; }
var el = integer(Math.floor(n));
if (indicate_rounding && n - Math.floor(n) > 0.0001) {
el.title = "Rounded down from " + n.toFixed(2);
el.classList.add('rounded');
}
return el;
}
exports.floor = floor;
/**
* Groups items together in a row
* @param items The items to group
*/
function g() {
var items = [];
for (var _i = 0; _i < arguments.length; _i++) {
items[_i] = arguments[_i];
}
var node = document.createElement("span");
for (var i = 0; i < items.length; i++) {
node.appendChild(toElement(items[i]));
}
return node;
}
exports.g = g;
/**
* Displays a list of items together in a row
* @param names The names of items to display
*/
function itemGroup() {
var names = [];
for (var _i = 0; _i < arguments.length; _i++) {
names[_i] = arguments[_i];
}
return g.apply(void 0, names.slice().map(item));
}
exports.itemGroup = itemGroup;
/**
* Puts an item into a paragraph element
* @param d Any displayable item
*/
function p(d) {
var node = document.createElement("p");
node.appendChild(toElement(d));
return node;
}
exports.p = p;
function text(s) {
var node = document.createElement("span");
node.innerText = s;
return node;
}
exports.text = text;
function tt(s) {
var node = document.createElement("span");
node.innerText = s;
node.classList.add("number");
return node;
}
exports.tt = tt;
function nOf(n, item) {
var node = document.createElement("span");
node.appendChild(integer(n));
node.appendChild(document.createTextNode(" "));
node.appendChild(item);
node.title = name;
return node;
}
exports.nOf = nOf;
function item(name) {
var node = document.createElement("p");
node.classList.add(itemNameToRealItemName(name));
node.classList.add("item");
node.title = name;
return node;
}
exports.item = item;
function itemNameToRealItemName(name) {
switch (name) {
case "sulfuric-acid-barrel":
return "sulfuric-acid";
default:
return name;
}
}
function itemCount(itemName, count) {
var group = document.createElement("div");
group.classList.add("counted-item");
var item = document.createElement("p");
item.classList.add(itemNameToRealItemName(itemName));
item.classList.add("item");
item.title = itemName;
group.appendChild(item);
var cnt = document.createElement("span");
cnt.classList.add("item-count");
cnt.innerText = largeString(count);
group.appendChild(cnt);
return group;
}
exports.itemCount = itemCount;
function percent(n) {
return g((n * 100).toFixed(1), "%");
}
exports.percent = percent;
function wholePercent(n) {
return g((n * 100).toFixed(0), "%");
}
exports.wholePercent = wholePercent;
function largeString(n) {
if (n < 1000) {
return n.toFixed(0);
}
else if (n < 1000000) {
var k = n / 1000;
return k + 'k';
}
else if (n < 1000000000) {
var k = n / 1000000;
return k + 'M';
}
else {
var k = n / 1000000000;
return k + 'G';
}
}
function large(n) {
var node = document.createElement("span");
node.innerText = largeString(n);
node.classList.add("number");
return node;
}
exports.large = large;
function short_time(seconds) {
seconds = Math.round(seconds);
var minutes = Math.floor(seconds / 60);
seconds -= minutes * 60;
return g(spacePadded(minutes, 2), ':', zeroPadded(seconds, 2));
}
exports.short_time = short_time;
function medium_time(seconds) {
seconds = Math.round(seconds);
var hours = Math.floor(seconds / (60 * 60));
seconds -= hours * 60 * 60;
var minutes = Math.floor(seconds / 60);
seconds -= minutes * 60;
return g(spacePadded(hours, 2), ':', zeroPadded(minutes, 2));
}
exports.medium_time = medium_time;
function long_time(seconds) {
seconds = Math.round(seconds);
var days = Math.floor(seconds / (60 * 60 * 24));
seconds -= days * 60 * 60 * 24;
var hours = Math.floor(seconds / (60 * 60));
seconds -= hours * 60 * 60;
return g(integer(days), "d ", spacePadded(hours, 2), "h");
}
exports.long_time = long_time;
function time(seconds) {
seconds = Math.round(seconds);
var days = Math.floor(seconds / (60 * 60 * 24));
seconds -= days * 60 * 60 * 24;
var hours = Math.floor(seconds / (60 * 60));
seconds -= hours * 60 * 60;
var minutes = Math.floor(seconds / 60);
seconds -= minutes * 60;
if (days > 0) {
return g(integer(days), "d ", spacePadded(hours, 2), "h");
}
if (hours > 0) {
return g(integer(hours), "h ", spacePadded(minutes, 2), "m");
}
if (minutes > 10) {
return g(integer(minutes), "m");
}
if (minutes > 0) {
return g(integer(minutes), "m ", spacePadded(seconds, 2), "s");
}
return g(integer(seconds), "s");
}
exports.time = time;
function fixed(n, units) {
var node = document.createElement("span");
node.innerText = n.toFixed(1);
if (units)
node.innerText += " " + units;
node.classList.add("number");
return node;
}
exports.fixed = fixed;
function spacePadded(n, width) {
// &#8199; 'FIGURE SPACE'
var result = n.toString();
while (result.length < width) {
result = String.fromCharCode(8199) + result;
}
var node = document.createElement("span");
node.innerText = result;
node.classList.add("number");
return node;
}
exports.spacePadded = spacePadded;
function zeroPadded(n, width) {
var result = n.toString();
while (result.length < width) {
result = '0' + result;
}
var node = document.createElement("span");
node.innerText = result;
node.classList.add("number");
return node;
}
exports.zeroPadded = zeroPadded;
function integer(n, units) {
var node = document.createElement("span");
var text = n.toString();
if (text.length >= 4) {
text = text.substr(0, text.length - 3) + "," + text.substr(text.length - 3);
}
node.innerText = text;
if (units)
node.innerText += " " + units;
node.classList.add("number");
return node;
}
exports.integer = integer;
function multiplied(left, factor) {
return g(left, " x ", factor);
}
exports.multiplied = multiplied;
function ratio(left, right) {
// 12 <p class="item electric-drill"></p> : 11 <p class="item steel-furnace"></p>
var node = document.createElement("div");
node.classList.add('ratio');
node.appendChild(left);
var colon = text(" : ");
colon.classList.add('ratio-colon');
node.appendChild(colon);
node.appendChild(right);
return node;
}
exports.ratio = ratio;
});
Loading

0 comments on commit cabd391

Please sign in to comment.