Bug fixes

This commit is contained in:
asraelite 2018-03-09 20:07:31 +00:00
parent 17df8c0863
commit 8a0bf0ada9
10 changed files with 187 additions and 30 deletions

121
dist/img/modules/heavy_thruster_on.svg vendored Normal file
View file

@ -0,0 +1,121 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="22.166674mm"
height="22.16667mm"
viewBox="0 0 22.166674 22.16667"
version="1.1"
id="svg8"
inkscape:version="0.92.2 5c3e80d, 2017-08-06"
sodipodi:docname="heavy_thruster_on.svg">
<defs
id="defs2" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="2.8"
inkscape:cx="12.109122"
inkscape:cy="22.634448"
inkscape:document-units="mm"
inkscape:current-layer="g828"
showgrid="true"
inkscape:window-width="1366"
inkscape:window-height="714"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
showguides="false">
<inkscape:grid
type="xygrid"
id="grid815"
originx="-85.489575"
originy="-141.05208" />
</sodipodi:namedview>
<metadata
id="metadata5">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-85.489576,-133.78125)">
<g
id="g828">
<path
sodipodi:nodetypes="cccccccccc"
inkscape:connector-curvature="0"
id="rect821"
d="m 85.989588,136.92708 h 10.58333 10.583332 V 138.25 l -1.32292,5.29167 -1.32291,1.32291 H 88.635418 L 87.312501,143.54167 85.989588,138.25 Z"
style="opacity:1;fill:#a0948f;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" />
<path
sodipodi:nodetypes="ccccc"
inkscape:connector-curvature="0"
id="rect908-35"
d="m 95.25,136.92708 2.645834,0 v 6.61459 l -2.645833,0 z"
style="opacity:1;fill:#6f5821;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" />
<path
sodipodi:nodetypes="ccccc"
inkscape:connector-curvature="0"
id="rect908"
d="m 88.635417,136.92708 h 2.645834 v 6.61458 l -1.322917,-1.32292 z"
style="opacity:1;fill:#6f5821;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" />
<path
sodipodi:nodetypes="ccccc"
inkscape:connector-curvature="0"
id="rect908-3"
d="m 104.5104,136.92708 h -2.64582 v 6.61458 l 1.32291,-1.32292 z"
style="opacity:1;vector-effect:none;fill:#6f5821;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:fill markers stroke" />
<path
sodipodi:nodetypes="ccccc"
inkscape:connector-curvature="0"
id="rect908-5-6"
d="m 85.989578,134.28125 h 21.166672 l 0,2.64583 H 85.989584 Z"
style="opacity:1;fill:#272727;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke markers fill" />
<path
sodipodi:nodetypes="ccccc"
inkscape:connector-curvature="0"
id="thrust"
d="m 88.635418,154.125 6.614583,0 1.322923,1.32292 -9.260423,0 z"
style="opacity:1;fill:#d78436;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" />
<path
sodipodi:nodetypes="ccccccccc"
inkscape:connector-curvature="0"
id="rect908-7"
d="m 88.635418,144.86458 h 6.614583 l -1.322917,2.64584 2.645834,7.9375 -2.645834,-1.32292 h -3.96875 l -2.645833,1.32292 2.645833,-7.9375 z"
style="opacity:1;fill:#5b4f4f;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" />
<path
sodipodi:nodetypes="ccccc"
inkscape:connector-curvature="0"
id="thrust-6"
d="m 97.895836,154.125 h 6.614584 l 1.32292,1.32292 h -9.260421 z"
style="opacity:1;fill:#d78436;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" />
<path
sodipodi:nodetypes="ccccccccc"
inkscape:connector-curvature="0"
id="rect908-7-3"
d="m 97.895836,144.86458 h 6.614584 l -1.32292,2.64584 2.64584,7.9375 -2.64584,-1.32292 h -3.968748 l -2.645833,1.32292 2.645833,-7.9375 z"
style="opacity:1;fill:#5b4f4f;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 5.7 KiB

48
dist/improcket.min.js vendored
View file

@ -89,7 +89,7 @@ const modules = {
type: 'thruster',
id: 'heavy',
mass: 5,
value: 6,
value: 4,
connectivity: [true, false, false, false],
thrust: 40
},
@ -99,7 +99,7 @@ const modules = {
type: 'thruster',
id: 'advanced',
mass: 2,
value: 20,
value: 15,
connectivity: [true, false, false, false],
thrust: 30
}
@ -188,12 +188,12 @@ const images = {
on: 'modules/light_thruster_on.svg'
},
heavy: {
off: 'modules/light_thruster.svg',
on: 'modules/light_thruster_on.svg'
off: 'modules/heavy_thruster.svg',
on: 'modules/heavy_thruster_on.svg'
},
advanced: {
off: 'modules/light_thruster.svg',
on: 'modules/light_thruster_on.svg'
off: 'modules/advanced_thruster.svg',
on: 'modules/advanced_thruster_on.svg'
}
},
connector: {
@ -608,6 +608,7 @@ let onupdate = () => {};
function init$1() {
items.clear();
update();
}
function canToss() {
@ -1354,15 +1355,15 @@ function randomPlanet(x, y, {
type: type
});
for (let i = 0.1; i < 4; i += 1) {
if (Math.random() > ENTITY_SPAWN_RATE) {
for (let i = 0.1; i < 10; i += 0.5) {
if (Math.random() > 0.95) {
let e = randomEntity();
e.orbit(planet, i * radius, Math.random() * Math.PI * 2);
}
}
for (let i = 0; i < 5; i++) {
if (Math.random() > ENTITY_SPAWN_RATE || true) {
for (let i = 0; i < 10; i++) {
if (Math.random() > 0.7) {
let e = randomEntity();
e.orbit(planet, 1.5, Math.random() * Math.PI * 2);
e.gravity = false;
@ -1376,7 +1377,7 @@ function randomPlanet(x, y, {
function randomEntity(x, y) {
let entity;
if (Math.random() > 0.3) {
if (Math.random() > 0.5) {
entity = new Entity(x, y, 'fuelcan');
} else {
let type, id;
@ -1756,6 +1757,7 @@ function init$5() {
window.addEventListener('wheel', event => {
mouse.scroll = event.deltaY;
event.preventDefault();
});
window.addEventListener('contextmenu', event => {
@ -2702,8 +2704,8 @@ const TAU$1 = TAU;
let canvas, context, tempCanvas, tempContext;
let perspective;
let trace = false;
let markers = false;
let trace = true;
let markers = true;
function init$8() {
canvas = document.querySelector('#main');
@ -2797,6 +2799,8 @@ class Perspective {
this.targetZoom = DEFAULT_ZOOM;
this.oldTarget = 0;
this.oldShift = [0, 0];
this.shiftX = 0;
this.shiftY = 0;
this.oldZoom = 0;
this.transition = 0;
this.zoomTransition = 0;
@ -2939,7 +2943,9 @@ const mapping$1 = {
toggleTrace: 'KeyT',
toggleMarkers: 'KeyR',
toggleMusic: 'KeyM',
togglePause: 'KeyP'
togglePause: 'KeyP',
zoomIn: 'KeyZ',
zoomOut: 'KeyX'
};
let held, pressed;
@ -2956,7 +2962,17 @@ function tick$5() {
if (!state.editing) {
if (mouse.scroll !== 0) {
changeZoom(-mouse.scroll);
// Fix for Firefox.
let delta = mouse.scroll > 0 ? -50 : 50;
changeZoom(delta);
}
if (held[mapping$1.zoomIn]) {
changeZoom(-10);
}
if (held[mapping$1.zoomOut]) {
changeZoom(10);
}
if (pressed[mapping$1.togglePause] && !state.gameOver) {
@ -3055,6 +3071,8 @@ function changeView$1(view) {
state.editing = false;
state.paused = false;
init$3();
init$4();
perspective.reset();
init$1();
} else if (view === 'instructions') {
state.playing = false;

View file

@ -25,12 +25,12 @@ export const images = {
on: 'modules/light_thruster_on.svg'
},
heavy: {
off: 'modules/light_thruster.svg',
on: 'modules/light_thruster_on.svg'
off: 'modules/heavy_thruster.svg',
on: 'modules/heavy_thruster_on.svg'
},
advanced: {
off: 'modules/light_thruster.svg',
on: 'modules/light_thruster_on.svg'
off: 'modules/advanced_thruster.svg',
on: 'modules/advanced_thruster_on.svg'
}
},
connector: {

View file

@ -89,7 +89,7 @@ export const modules = {
type: 'thruster',
id: 'heavy',
mass: 5,
value: 6,
value: 4,
connectivity: [true, false, false, false],
thrust: 40
},
@ -99,7 +99,7 @@ export const modules = {
type: 'thruster',
id: 'advanced',
mass: 2,
value: 20,
value: 15,
connectivity: [true, false, false, false],
thrust: 30
}

View file

@ -17,7 +17,9 @@ export const mapping = {
toggleTrace: 'KeyT',
toggleMarkers: 'KeyR',
toggleMusic: 'KeyM',
togglePause: 'KeyP'
togglePause: 'KeyP',
zoomIn: 'KeyZ',
zoomOut: 'KeyX'
};
let held, pressed;
@ -34,7 +36,17 @@ export function tick() {
if (!state.editing) {
if (input.mouse.scroll !== 0) {
graphics.changeZoom(-input.mouse.scroll);
// Fix for Firefox.
let delta = input.mouse.scroll > 0 ? -50 : 50;
graphics.changeZoom(delta);
}
if (held[mapping.zoomIn]) {
graphics.changeZoom(-10);
}
if (held[mapping.zoomOut]) {
graphics.changeZoom(10);
}
if (pressed[mapping.togglePause] && !state.gameOver) {

View file

@ -40,6 +40,8 @@ export function changeView(view) {
state.editing = false;
state.paused = false;
world.init();
edit.init();
graphics.perspective.reset();
inventory.init();
} else if (view === 'instructions') {
state.playing = false;

View file

@ -14,6 +14,7 @@ let onupdate = () => {};
export function init() {
items.clear();
update();
}
export function canToss() {

View file

@ -10,8 +10,8 @@ const TAU = consts.TAU;
export let canvas, context, tempCanvas, tempContext;
export let perspective;
export let trace = false;
export let markers = false;
export let trace = true;
export let markers = true;
export function init() {
canvas = document.querySelector('#main');
@ -109,6 +109,8 @@ class Perspective {
this.targetZoom = consts.DEFAULT_ZOOM;
this.oldTarget = 0;
this.oldShift = [0, 0];
this.shiftX = 0;
this.shiftY = 0;
this.oldZoom = 0;
this.transition = 0;
this.zoomTransition = 0;

View file

@ -45,6 +45,7 @@ export function init() {
window.addEventListener('wheel', event => {
mouse.scroll = event.deltaY;
event.preventDefault();
});
window.addEventListener('contextmenu', event => {

View file

@ -80,15 +80,15 @@ function randomPlanet(x, y, {
type: type
});
for (let i = 0.1; i < 4; i += 1) {
if (Math.random() > consts.ENTITY_SPAWN_RATE) {
for (let i = 0.1; i < 10; i += 0.5) {
if (Math.random() > 0.95) {
let e = randomEntity();
e.orbit(planet, i * radius, Math.random() * Math.PI * 2);
}
}
for (let i = 0; i < 5; i++) {
if (Math.random() > consts.ENTITY_SPAWN_RATE || true) {
for (let i = 0; i < 10; i++) {
if (Math.random() > 0.7) {
let e = randomEntity();
e.orbit(planet, 1.5, Math.random() * Math.PI * 2);
e.gravity = false;
@ -102,7 +102,7 @@ function randomPlanet(x, y, {
function randomEntity(x, y) {
let entity, type, id;
if (Math.random() > 0.3) {
if (Math.random() > 0.5) {
entity = new Entity(x, y, 'fuelcan');
} else {
let type, id;