Update artwork and minor fixes

This commit is contained in:
tobspr 2020-06-30 09:27:30 +02:00
parent ea868fd750
commit 755f4bd2ea
23 changed files with 623 additions and 598 deletions

3
artwork/wires/items.psd Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b8ace4cd365be92bfec392bf9148dbc68eeecbeeab8da943ccb9911adafb14ac
size 70920

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2d59d560782ae5c744f073f0612680e1c00f3e1b86d9d0c8cf5a6c3fb4fb79a1
size 118537
oid sha256:d42d1a6d29ed6a5930d9c90313e991cc7f2b070150ba9c3263d1ec1f108814ab
size 5149412

View File

@ -714,7 +714,7 @@
},
"sprites/blueprints/energy_generator.png":
{
"frame": {"x":126,"y":79,"w":36,"h":38},
"frame": {"x":126,"y":81,"w":36,"h":38},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":1,"y":0,"w":36,"h":38},
@ -874,7 +874,7 @@
},
"sprites/blueprints/wire_left.png":
{
"frame": {"x":596,"y":71,"w":11,"h":11},
"frame": {"x":599,"y":87,"w":11,"h":11},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":0,"y":2,"w":11,"h":11},
@ -882,7 +882,7 @@
},
"sprites/blueprints/wire_right.png":
{
"frame": {"x":603,"y":54,"w":11,"h":11},
"frame": {"x":611,"y":70,"w":11,"h":11},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":2,"y":2,"w":11,"h":11},
@ -1106,7 +1106,7 @@
},
"sprites/buildings/wire_left.png":
{
"frame": {"x":615,"y":37,"w":11,"h":11},
"frame": {"x":614,"y":85,"w":11,"h":11},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":0,"y":2,"w":11,"h":11},
@ -1114,7 +1114,7 @@
},
"sprites/buildings/wire_right.png":
{
"frame": {"x":587,"y":105,"w":11,"h":11},
"frame": {"x":614,"y":100,"w":11,"h":11},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":2,"y":2,"w":11,"h":11},
@ -1122,7 +1122,7 @@
},
"sprites/buildings/wire_top.png":
{
"frame": {"x":618,"y":52,"w":9,"h":13},
"frame": {"x":618,"y":53,"w":9,"h":13},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":2,"y":0,"w":9,"h":13},
@ -1146,7 +1146,7 @@
},
"sprites/map_overview/belt_forward.png":
{
"frame": {"x":111,"y":72,"w":3,"h":3},
"frame": {"x":131,"y":72,"w":3,"h":3},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":3,"h":3},
@ -1154,7 +1154,7 @@
},
"sprites/map_overview/belt_left.png":
{
"frame": {"x":118,"y":72,"w":3,"h":3},
"frame": {"x":138,"y":72,"w":3,"h":3},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":3,"h":3},
@ -1162,7 +1162,7 @@
},
"sprites/map_overview/belt_right.png":
{
"frame": {"x":125,"y":72,"w":3,"h":3},
"frame": {"x":145,"y":72,"w":3,"h":3},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":3,"h":3},
@ -1170,7 +1170,7 @@
},
"sprites/misc/deletion_marker.png":
{
"frame": {"x":602,"y":114,"w":10,"h":10},
"frame": {"x":602,"y":115,"w":10,"h":10},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":10,"h":10},
@ -1178,7 +1178,7 @@
},
"sprites/misc/hub_direction_indicator.png":
{
"frame": {"x":132,"y":72,"w":3,"h":3},
"frame": {"x":152,"y":72,"w":3,"h":3},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":3,"h":3},
@ -1186,7 +1186,7 @@
},
"sprites/misc/lock_direction_indicator.png":
{
"frame": {"x":102,"y":72,"w":5,"h":5},
"frame": {"x":122,"y":72,"w":5,"h":5},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":5,"h":5},
@ -1194,7 +1194,7 @@
},
"sprites/misc/slot_bad_arrow.png":
{
"frame": {"x":602,"y":114,"w":10,"h":10},
"frame": {"x":602,"y":115,"w":10,"h":10},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":10,"h":10},
@ -1202,7 +1202,7 @@
},
"sprites/misc/slot_good_arrow.png":
{
"frame": {"x":616,"y":114,"w":10,"h":10},
"frame": {"x":616,"y":115,"w":10,"h":10},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":10,"h":10},
@ -1218,7 +1218,7 @@
},
"sprites/misc/waypoint.png":
{
"frame": {"x":139,"y":72,"w":3,"h":3},
"frame": {"x":159,"y":72,"w":3,"h":3},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":3,"h":3},
@ -1232,37 +1232,53 @@
"spriteSourceSize": {"x":0,"y":0,"w":13,"h":13},
"sourceSize": {"w":13,"h":13}
},
"sprites/wires/negative_energy.png":
{
"frame": {"x":102,"y":72,"w":6,"h":6},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":6,"h":6},
"sourceSize": {"w":6,"h":6}
},
"sprites/wires/pin_negative_accept.png":
{
"frame": {"x":599,"y":86,"w":11,"h":11},
"frame": {"x":596,"y":71,"w":11,"h":12},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":1,"y":0,"w":11,"h":11},
"spriteSourceSize": {"x":1,"y":0,"w":11,"h":12},
"sourceSize": {"w":13,"h":13}
},
"sprites/wires/pin_negative_eject.png":
{
"frame": {"x":611,"y":69,"w":11,"h":11},
"frame": {"x":603,"y":54,"w":11,"h":12},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":1,"y":0,"w":11,"h":11},
"spriteSourceSize": {"x":1,"y":0,"w":11,"h":12},
"sourceSize": {"w":13,"h":13}
},
"sprites/wires/pin_positive_accept.png":
{
"frame": {"x":614,"y":84,"w":11,"h":11},
"frame": {"x":615,"y":37,"w":11,"h":12},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":1,"y":0,"w":11,"h":11},
"spriteSourceSize": {"x":1,"y":0,"w":11,"h":12},
"sourceSize": {"w":13,"h":13}
},
"sprites/wires/pin_positive_eject.png":
{
"frame": {"x":614,"y":99,"w":11,"h":11},
"frame": {"x":587,"y":105,"w":11,"h":12},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":1,"y":0,"w":11,"h":11},
"spriteSourceSize": {"x":1,"y":0,"w":11,"h":12},
"sourceSize": {"w":13,"h":13}
},
"sprites/wires/positive_energy.png":
{
"frame": {"x":112,"y":72,"w":6,"h":6},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":6,"h":6},
"sourceSize": {"w":6,"h":6}
}},
"meta": {
"app": "https://www.codeandweb.com/texturepacker",
@ -1271,6 +1287,6 @@
"format": "RGBA8888",
"size": {"w":630,"h":128},
"scale": "0.1",
"smartupdate": "$TexturePacker:SmartUpdate:f2991e3fe6c79348d0808b1f60a06ef7:740a2ce184f6485487669e0f615a8a7e:f159918d23e5952766c6d23ab52278c6$"
"smartupdate": "$TexturePacker:SmartUpdate:64992def403ecae5d6a9a8c1d669aa36:a6ea6940afa6efd3e09314c1b1be5a97:f159918d23e5952766c6d23ab52278c6$"
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 KiB

After

Width:  |  Height:  |  Size: 64 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 MiB

After

Width:  |  Height:  |  Size: 1.0 MiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 209 KiB

After

Width:  |  Height:  |  Size: 206 KiB

View File

@ -474,7 +474,7 @@
},
"sprites/belt/right_3.png":
{
"frame": {"x":1142,"y":892,"w":57,"h":57},
"frame": {"x":1207,"y":770,"w":57,"h":57},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":6,"y":6,"w":57,"h":57},
@ -482,7 +482,7 @@
},
"sprites/belt/right_4.png":
{
"frame": {"x":1203,"y":892,"w":57,"h":57},
"frame": {"x":1081,"y":832,"w":57,"h":57},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":6,"y":6,"w":57,"h":57},
@ -490,7 +490,7 @@
},
"sprites/belt/right_5.png":
{
"frame": {"x":916,"y":893,"w":57,"h":57},
"frame": {"x":1081,"y":893,"w":57,"h":57},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":6,"y":6,"w":57,"h":57},
@ -498,7 +498,7 @@
},
"sprites/belt/right_6.png":
{
"frame": {"x":977,"y":893,"w":57,"h":57},
"frame": {"x":1081,"y":954,"w":57,"h":57},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":6,"y":6,"w":57,"h":57},
@ -506,7 +506,7 @@
},
"sprites/belt/right_7.png":
{
"frame": {"x":1038,"y":893,"w":57,"h":57},
"frame": {"x":1142,"y":831,"w":57,"h":57},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":6,"y":6,"w":57,"h":57},
@ -514,7 +514,7 @@
},
"sprites/belt/right_8.png":
{
"frame": {"x":916,"y":954,"w":57,"h":57},
"frame": {"x":1142,"y":892,"w":57,"h":57},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":6,"y":6,"w":57,"h":57},
@ -522,7 +522,7 @@
},
"sprites/belt/right_9.png":
{
"frame": {"x":977,"y":954,"w":57,"h":57},
"frame": {"x":1203,"y":831,"w":57,"h":57},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":6,"y":6,"w":57,"h":57},
@ -610,7 +610,7 @@
},
"sprites/belt/right_20.png":
{
"frame": {"x":1020,"y":832,"w":57,"h":57},
"frame": {"x":959,"y":893,"w":57,"h":57},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":6,"y":6,"w":57,"h":57},
@ -618,7 +618,7 @@
},
"sprites/belt/right_21.png":
{
"frame": {"x":1024,"y":771,"w":57,"h":57},
"frame": {"x":959,"y":954,"w":57,"h":57},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":6,"y":6,"w":57,"h":57},
@ -626,7 +626,7 @@
},
"sprites/belt/right_22.png":
{
"frame": {"x":1085,"y":770,"w":57,"h":57},
"frame": {"x":1020,"y":832,"w":57,"h":57},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":6,"y":6,"w":57,"h":57},
@ -634,7 +634,7 @@
},
"sprites/belt/right_23.png":
{
"frame": {"x":1146,"y":770,"w":57,"h":57},
"frame": {"x":1020,"y":893,"w":57,"h":57},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":6,"y":6,"w":57,"h":57},
@ -642,7 +642,7 @@
},
"sprites/belt/right_24.png":
{
"frame": {"x":1207,"y":770,"w":57,"h":57},
"frame": {"x":1020,"y":954,"w":57,"h":57},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":6,"y":6,"w":57,"h":57},
@ -650,7 +650,7 @@
},
"sprites/belt/right_25.png":
{
"frame": {"x":1081,"y":832,"w":57,"h":57},
"frame": {"x":1024,"y":771,"w":57,"h":57},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":6,"y":6,"w":57,"h":57},
@ -658,7 +658,7 @@
},
"sprites/belt/right_26.png":
{
"frame": {"x":1142,"y":831,"w":57,"h":57},
"frame": {"x":1085,"y":770,"w":57,"h":57},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":6,"y":6,"w":57,"h":57},
@ -666,7 +666,7 @@
},
"sprites/belt/right_27.png":
{
"frame": {"x":1203,"y":831,"w":57,"h":57},
"frame": {"x":1146,"y":770,"w":57,"h":57},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":6,"y":6,"w":57,"h":57},
@ -898,7 +898,7 @@
},
"sprites/buildings/belt_left.png":
{
"frame": {"x":1038,"y":954,"w":57,"h":57},
"frame": {"x":1142,"y":953,"w":57,"h":57},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":0,"y":6,"w":57,"h":57},
@ -906,7 +906,7 @@
},
"sprites/buildings/belt_right.png":
{
"frame": {"x":1099,"y":953,"w":57,"h":57},
"frame": {"x":1203,"y":892,"w":57,"h":57},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":6,"y":6,"w":57,"h":57},
@ -1106,7 +1106,7 @@
},
"sprites/buildings/wire_left.png":
{
"frame": {"x":1160,"y":953,"w":47,"h":47},
"frame": {"x":1203,"y":953,"w":47,"h":47},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":0,"y":16,"w":47,"h":47},
@ -1114,7 +1114,7 @@
},
"sprites/buildings/wire_right.png":
{
"frame": {"x":1211,"y":953,"w":47,"h":47},
"frame": {"x":1254,"y":953,"w":47,"h":47},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":16,"y":16,"w":47,"h":47},
@ -1146,7 +1146,7 @@
},
"sprites/map_overview/belt_forward.png":
{
"frame": {"x":147,"y":965,"w":14,"h":16},
"frame": {"x":487,"y":926,"w":14,"h":16},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":1,"y":0,"w":14,"h":16},
@ -1154,7 +1154,7 @@
},
"sprites/map_overview/belt_left.png":
{
"frame": {"x":817,"y":797,"w":15,"h":15},
"frame": {"x":1288,"y":303,"w":15,"h":15},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":0,"y":1,"w":15,"h":15},
@ -1162,7 +1162,7 @@
},
"sprites/map_overview/belt_right.png":
{
"frame": {"x":878,"y":736,"w":15,"h":15},
"frame": {"x":1288,"y":322,"w":15,"h":15},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":1,"y":1,"w":15,"h":15},
@ -1178,7 +1178,7 @@
},
"sprites/misc/hub_direction_indicator.png":
{
"frame": {"x":1234,"y":470,"w":16,"h":16},
"frame": {"x":147,"y":965,"w":16,"h":16},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":16,"h":16},
@ -1186,7 +1186,7 @@
},
"sprites/misc/lock_direction_indicator.png":
{
"frame": {"x":240,"y":963,"w":24,"h":16},
"frame": {"x":1234,"y":470,"w":24,"h":16},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":0,"y":4,"w":24,"h":16},
@ -1218,7 +1218,7 @@
},
"sprites/misc/waypoint.png":
{
"frame": {"x":487,"y":926,"w":14,"h":16},
"frame": {"x":817,"y":797,"w":14,"h":16},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":1,"y":0,"w":14,"h":16},
@ -1232,45 +1232,61 @@
"spriteSourceSize": {"x":0,"y":0,"w":64,"h":64},
"sourceSize": {"w":64,"h":64}
},
"sprites/wires/pin_negative_accept.png":
"sprites/wires/negative_energy.png":
{
"frame": {"x":1268,"y":770,"w":41,"h":48},
"frame": {"x":878,"y":736,"w":22,"h":22},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":11,"y":0,"w":41,"h":48},
"spriteSourceSize": {"x":5,"y":5,"w":22,"h":22},
"sourceSize": {"w":32,"h":32}
},
"sprites/wires/pin_negative_accept.png":
{
"frame": {"x":916,"y":877,"w":39,"h":54},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":12,"y":0,"w":39,"h":54},
"sourceSize": {"w":64,"h":64}
},
"sprites/wires/pin_negative_eject.png":
{
"frame": {"x":1268,"y":822,"w":41,"h":48},
"frame": {"x":916,"y":935,"w":39,"h":54},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":11,"y":0,"w":41,"h":48},
"spriteSourceSize": {"x":12,"y":0,"w":39,"h":54},
"sourceSize": {"w":64,"h":64}
},
"sprites/wires/pin_positive_accept.png":
{
"frame": {"x":1264,"y":874,"w":41,"h":48},
"frame": {"x":1264,"y":831,"w":39,"h":54},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":11,"y":0,"w":41,"h":48},
"spriteSourceSize": {"x":12,"y":0,"w":39,"h":54},
"sourceSize": {"w":64,"h":64}
},
"sprites/wires/pin_positive_eject.png":
{
"frame": {"x":1264,"y":926,"w":41,"h":48},
"frame": {"x":1264,"y":889,"w":39,"h":54},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":11,"y":0,"w":41,"h":48},
"spriteSourceSize": {"x":12,"y":0,"w":39,"h":54},
"sourceSize": {"w":64,"h":64}
},
"sprites/wires/positive_energy.png":
{
"frame": {"x":240,"y":963,"w":22,"h":22},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":5,"y":5,"w":22,"h":22},
"sourceSize": {"w":32,"h":32}
}},
"meta": {
"app": "https://www.codeandweb.com/texturepacker",
"version": "1.0",
"image": "atlas0_50.png",
"format": "RGBA8888",
"size": {"w":1312,"h":1024},
"size": {"w":1306,"h":1024},
"scale": "0.5",
"smartupdate": "$TexturePacker:SmartUpdate:f2991e3fe6c79348d0808b1f60a06ef7:740a2ce184f6485487669e0f615a8a7e:f159918d23e5952766c6d23ab52278c6$"
"smartupdate": "$TexturePacker:SmartUpdate:64992def403ecae5d6a9a8c1d669aa36:a6ea6940afa6efd3e09314c1b1be5a97:f159918d23e5952766c6d23ab52278c6$"
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 482 KiB

After

Width:  |  Height:  |  Size: 485 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 984 KiB

After

Width:  |  Height:  |  Size: 972 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.0 KiB

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.0 KiB

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

@ -124,7 +124,7 @@ export class BeltPath extends BasicSerializableObject {
* Returns the layer of the this path
* @returns {enumLayer}
*/
get layer() {
getLayer() {
return this.entityPath[0].layer;
}

View File

@ -51,7 +51,7 @@ export class HUDWiresOverlay extends BaseHUDPart {
update() {
const desiredAlpha = this.root.currentLayer === enumLayer.wires ? 1.0 : 0.0;
this.currentAlpha = lerp(this.currentAlpha, desiredAlpha, 0.08);
this.currentAlpha = lerp(this.currentAlpha, desiredAlpha, 0.12);
}
/**

View File

@ -1,6 +1,5 @@
import { globalConfig } from "../../core/config";
import { smoothenDpi } from "../../core/dpi_manager";
import { DrawParameters } from "../../core/draw_parameters";
import { Loader } from "../../core/loader";
import { types } from "../../savegame/serialization";
import { BaseItem, enumItemType } from "../base_item";
@ -23,11 +22,6 @@ export class NegativeEnergyItem extends BaseItem {
return enumItemType.negativeEnergy;
}
constructor() {
super();
this.bufferGenerator = null;
}
/**
* @param {number} x
* @param {number} y
@ -35,31 +29,8 @@ export class NegativeEnergyItem extends BaseItem {
* @param {DrawParameters} parameters
*/
draw(x, y, parameters, size = 12) {
if (!this.bufferGenerator) {
this.bufferGenerator = this.internalGenerateBuffer.bind(this);
}
const dpi = smoothenDpi(globalConfig.shapesSharpness * parameters.zoomLevel);
const key = "pos:" + size + "/" + dpi;
const canvas = parameters.root.buffers.getForKey(key, "", size, size, dpi, this.bufferGenerator);
parameters.context.drawImage(canvas, x - size / 2, y - size / 2, size, size);
}
/**
* @param {HTMLCanvasElement} canvas
* @param {CanvasRenderingContext2D} context
* @param {number} w
* @param {number} h
* @param {number} dpi
*/
internalGenerateBuffer(canvas, context, w, h, dpi) {
context.translate((w * dpi) / 2, (h * dpi) / 2);
context.scale((dpi * w) / 12, (dpi * h) / 12);
context.strokeStyle = "#eee";
context.lineWidth = 2;
context.beginCircle(0, 0, 4);
context.stroke();
const sprite = Loader.getSprite("sprites/wires/negative_energy.png");
sprite.drawCachedCentered(parameters, x, y, size * 1.5);
}
}

View File

@ -1,6 +1,5 @@
import { globalConfig } from "../../core/config";
import { smoothenDpi } from "../../core/dpi_manager";
import { DrawParameters } from "../../core/draw_parameters";
import { Loader } from "../../core/loader";
import { types } from "../../savegame/serialization";
import { BaseItem, enumItemType } from "../base_item";
@ -23,11 +22,6 @@ export class PositiveEnergyItem extends BaseItem {
return enumItemType.positiveEnergy;
}
constructor() {
super();
this.bufferGenerator = null;
}
/**
* @param {number} x
* @param {number} y
@ -35,31 +29,8 @@ export class PositiveEnergyItem extends BaseItem {
* @param {DrawParameters} parameters
*/
draw(x, y, parameters, size = 12) {
if (!this.bufferGenerator) {
this.bufferGenerator = this.internalGenerateBuffer.bind(this);
}
const dpi = smoothenDpi(globalConfig.shapesSharpness * parameters.zoomLevel);
const key = "neg:" + size + "/" + dpi;
const canvas = parameters.root.buffers.getForKey(key, "", size, size, dpi, this.bufferGenerator);
parameters.context.drawImage(canvas, x - size / 2, y - size / 2, size, size);
}
/**
* @param {HTMLCanvasElement} canvas
* @param {CanvasRenderingContext2D} context
* @param {number} w
* @param {number} h
* @param {number} dpi
*/
internalGenerateBuffer(canvas, context, w, h, dpi) {
context.translate((w * dpi) / 2, (h * dpi) / 2);
context.scale((dpi * w) / 12, (dpi * h) / 12);
context.fillStyle = "#eee";
context.lineWidth = 1;
context.beginCircle(0, 0, 4);
context.fill();
const sprite = Loader.getSprite("sprites/wires/positive_energy.png");
sprite.drawCachedCentered(parameters, x, y, size * 1.5);
}
}

View File

@ -144,7 +144,7 @@ export class BeltSystem extends GameSystemWithFilter {
continue;
}
const targetEntities = this.root.map.getLayersContentsMultipleXY(x, y, entity.layer);
const targetEntities = this.root.map.getLayersContentsMultipleXY(x, y);
for (let i = 0; i < targetEntities.length; ++i) {
const targetEntity = targetEntities[i];
@ -312,7 +312,7 @@ export class BeltSystem extends GameSystemWithFilter {
drawLayer(parameters, layer) {
for (let i = 0; i < this.beltPaths.length; ++i) {
const path = this.beltPaths[i];
if (path.layer === layer) {
if (path.getLayer() === layer) {
path.draw(parameters);
}
}