initial take on wire auto-rotation

pull/558/head
tobspr 4 years ago
parent a32c0530bb
commit f16ab2389a

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 59 KiB

After

Width:  |  Height:  |  Size: 60 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1001 KiB

After

Width:  |  Height:  |  Size: 1001 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 204 KiB

After

Width:  |  Height:  |  Size: 202 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 466 KiB

After

Width:  |  Height:  |  Size: 486 KiB

@ -2,7 +2,7 @@
"sprites/belt/forward_0.png":
{
"frame": {"x":1251,"y":720,"w":77,"h":95},
"frame": {"x":1806,"y":298,"w":77,"h":95},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":9,"y":0,"w":77,"h":95},
@ -10,7 +10,7 @@
},
"sprites/belt/forward_1.png":
{
"frame": {"x":1319,"y":540,"w":77,"h":95},
"frame": {"x":1832,"y":397,"w":77,"h":95},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":9,"y":0,"w":77,"h":95},
@ -18,7 +18,7 @@
},
"sprites/belt/forward_2.png":
{
"frame": {"x":1221,"y":1174,"w":77,"h":95},
"frame": {"x":1524,"y":1143,"w":77,"h":95},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":9,"y":0,"w":77,"h":95},
@ -26,7 +26,7 @@
},
"sprites/belt/forward_3.png":
{
"frame": {"x":1662,"y":1134,"w":77,"h":95},
"frame": {"x":1508,"y":1341,"w":77,"h":95},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":9,"y":0,"w":77,"h":95},
@ -34,7 +34,7 @@
},
"sprites/belt/forward_4.png":
{
"frame": {"x":1743,"y":1133,"w":77,"h":95},
"frame": {"x":1589,"y":1341,"w":77,"h":95},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":9,"y":0,"w":77,"h":95},
@ -42,7 +42,7 @@
},
"sprites/belt/forward_5.png":
{
"frame": {"x":1824,"y":1133,"w":77,"h":95},
"frame": {"x":1670,"y":1341,"w":77,"h":95},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":9,"y":0,"w":77,"h":95},
@ -50,7 +50,7 @@
},
"sprites/belt/forward_6.png":
{
"frame": {"x":1743,"y":1232,"w":77,"h":95},
"frame": {"x":1751,"y":1341,"w":77,"h":95},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":9,"y":0,"w":77,"h":95},
@ -58,7 +58,7 @@
},
"sprites/belt/forward_7.png":
{
"frame": {"x":1824,"y":1232,"w":77,"h":95},
"frame": {"x":1832,"y":1341,"w":77,"h":95},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":9,"y":0,"w":77,"h":95},
@ -66,7 +66,7 @@
},
"sprites/belt/forward_8.png":
{
"frame": {"x":1723,"y":1331,"w":77,"h":95},
"frame": {"x":1848,"y":1053,"w":77,"h":95},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":9,"y":0,"w":77,"h":95},
@ -74,7 +74,7 @@
},
"sprites/belt/forward_9.png":
{
"frame": {"x":1804,"y":1331,"w":77,"h":95},
"frame": {"x":1848,"y":1152,"w":77,"h":95},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":9,"y":0,"w":77,"h":95},
@ -82,7 +82,7 @@
},
"sprites/belt/forward_10.png":
{
"frame": {"x":1332,"y":715,"w":77,"h":95},
"frame": {"x":1334,"y":660,"w":77,"h":95},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":9,"y":0,"w":77,"h":95},
@ -90,7 +90,7 @@
},
"sprites/belt/forward_11.png":
{
"frame": {"x":1341,"y":814,"w":77,"h":95},
"frame": {"x":1342,"y":816,"w":77,"h":95},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":9,"y":0,"w":77,"h":95},
@ -98,7 +98,7 @@
},
"sprites/belt/forward_12.png":
{
"frame": {"x":978,"y":1181,"w":77,"h":95},
"frame": {"x":1107,"y":886,"w":77,"h":95},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":9,"y":0,"w":77,"h":95},
@ -106,7 +106,7 @@
},
"sprites/belt/forward_13.png":
{
"frame": {"x":1059,"y":1180,"w":77,"h":95},
"frame": {"x":1134,"y":1033,"w":77,"h":95},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":9,"y":0,"w":77,"h":95},
@ -114,7 +114,7 @@
},
"sprites/belt/forward_14.png":
{
"frame": {"x":1066,"y":1279,"w":77,"h":95},
"frame": {"x":1215,"y":998,"w":77,"h":95},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":9,"y":0,"w":77,"h":95},
@ -122,7 +122,7 @@
},
"sprites/belt/forward_15.png":
{
"frame": {"x":1107,"y":886,"w":77,"h":95},
"frame": {"x":1603,"y":774,"w":77,"h":95},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":9,"y":0,"w":77,"h":95},
@ -130,7 +130,7 @@
},
"sprites/belt/forward_16.png":
{
"frame": {"x":1134,"y":985,"w":77,"h":95},
"frame": {"x":1684,"y":774,"w":77,"h":95},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":9,"y":0,"w":77,"h":95},
@ -138,7 +138,7 @@
},
"sprites/belt/forward_17.png":
{
"frame": {"x":1140,"y":1174,"w":77,"h":95},
"frame": {"x":1765,"y":774,"w":77,"h":95},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":9,"y":0,"w":77,"h":95},
@ -146,7 +146,7 @@
},
"sprites/belt/forward_18.png":
{
"frame": {"x":1147,"y":1273,"w":77,"h":95},
"frame": {"x":1846,"y":773,"w":77,"h":95},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":9,"y":0,"w":77,"h":95},
@ -154,7 +154,7 @@
},
"sprites/belt/forward_19.png":
{
"frame": {"x":1156,"y":1372,"w":77,"h":95},
"frame": {"x":1353,"y":1185,"w":77,"h":95},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":9,"y":0,"w":77,"h":95},
@ -162,7 +162,7 @@
},
"sprites/belt/forward_20.png":
{
"frame": {"x":1228,"y":1273,"w":77,"h":95},
"frame": {"x":1605,"y":1143,"w":77,"h":95},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":9,"y":0,"w":77,"h":95},
@ -170,7 +170,7 @@
},
"sprites/belt/forward_21.png":
{
"frame": {"x":1237,"y":1372,"w":77,"h":95},
"frame": {"x":1686,"y":1143,"w":77,"h":95},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":9,"y":0,"w":77,"h":95},
@ -178,7 +178,7 @@
},
"sprites/belt/forward_22.png":
{
"frame": {"x":1309,"y":1273,"w":77,"h":95},
"frame": {"x":1767,"y":1143,"w":77,"h":95},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":9,"y":0,"w":77,"h":95},
@ -186,7 +186,7 @@
},
"sprites/belt/forward_23.png":
{
"frame": {"x":1318,"y":1372,"w":77,"h":95},
"frame": {"x":1524,"y":1242,"w":77,"h":95},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":9,"y":0,"w":77,"h":95},
@ -194,7 +194,7 @@
},
"sprites/belt/forward_24.png":
{
"frame": {"x":1399,"y":1314,"w":77,"h":95},
"frame": {"x":1605,"y":1242,"w":77,"h":95},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":9,"y":0,"w":77,"h":95},
@ -202,7 +202,7 @@
},
"sprites/belt/forward_25.png":
{
"frame": {"x":1480,"y":1314,"w":77,"h":95},
"frame": {"x":1686,"y":1242,"w":77,"h":95},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":9,"y":0,"w":77,"h":95},
@ -210,7 +210,7 @@
},
"sprites/belt/forward_26.png":
{
"frame": {"x":1561,"y":1314,"w":77,"h":95},
"frame": {"x":1767,"y":1242,"w":77,"h":95},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":9,"y":0,"w":77,"h":95},
@ -218,7 +218,7 @@
},
"sprites/belt/forward_27.png":
{
"frame": {"x":1642,"y":1314,"w":77,"h":95},
"frame": {"x":1427,"y":1314,"w":77,"h":95},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":9,"y":0,"w":77,"h":95},
@ -226,7 +226,7 @@
},
"sprites/belt/left_0.png":
{
"frame": {"x":1377,"y":414,"w":86,"h":86},
"frame": {"x":1382,"y":414,"w":86,"h":86},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":0,"y":9,"w":86,"h":86},
@ -234,7 +234,7 @@
},
"sprites/belt/left_1.png":
{
"frame": {"x":1467,"y":414,"w":86,"h":86},
"frame": {"x":1472,"y":414,"w":86,"h":86},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":0,"y":9,"w":86,"h":86},
@ -242,7 +242,7 @@
},
"sprites/belt/left_2.png":
{
"frame": {"x":1760,"y":503,"w":86,"h":86},
"frame": {"x":1263,"y":1187,"w":86,"h":86},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":0,"y":9,"w":86,"h":86},
@ -250,7 +250,7 @@
},
"sprites/belt/left_3.png":
{
"frame": {"x":1683,"y":683,"w":86,"h":86},
"frame": {"x":977,"y":1360,"w":86,"h":86},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":0,"y":9,"w":86,"h":86},
@ -258,7 +258,7 @@
},
"sprites/belt/left_4.png":
{
"frame": {"x":1773,"y":683,"w":86,"h":86},
"frame": {"x":1067,"y":1360,"w":86,"h":86},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":0,"y":9,"w":86,"h":86},
@ -266,7 +266,7 @@
},
"sprites/belt/left_5.png":
{
"frame": {"x":1422,"y":774,"w":86,"h":86},
"frame": {"x":1157,"y":1367,"w":86,"h":86},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":0,"y":9,"w":86,"h":86},
@ -274,7 +274,7 @@
},
"sprites/belt/left_6.png":
{
"frame": {"x":1512,"y":774,"w":86,"h":86},
"frame": {"x":1247,"y":1367,"w":86,"h":86},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":0,"y":9,"w":86,"h":86},
@ -282,7 +282,7 @@
},
"sprites/belt/left_7.png":
{
"frame": {"x":1602,"y":773,"w":86,"h":86},
"frame": {"x":1337,"y":1367,"w":86,"h":86},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":0,"y":9,"w":86,"h":86},
@ -290,7 +290,7 @@
},
"sprites/belt/left_8.png":
{
"frame": {"x":1692,"y":773,"w":86,"h":86},
"frame": {"x":1452,"y":594,"w":86,"h":86},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":0,"y":9,"w":86,"h":86},
@ -298,7 +298,7 @@
},
"sprites/belt/left_9.png":
{
"frame": {"x":1782,"y":773,"w":86,"h":86},
"frame": {"x":1542,"y":594,"w":86,"h":86},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":0,"y":9,"w":86,"h":86},
@ -306,7 +306,7 @@
},
"sprites/belt/left_10.png":
{
"frame": {"x":1557,"y":413,"w":86,"h":86},
"frame": {"x":1562,"y":413,"w":86,"h":86},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":0,"y":9,"w":86,"h":86},
@ -314,7 +314,7 @@
},
"sprites/belt/left_11.png":
{
"frame": {"x":1647,"y":413,"w":86,"h":86},
"frame": {"x":1652,"y":413,"w":86,"h":86},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":0,"y":9,"w":86,"h":86},
@ -322,7 +322,7 @@
},
"sprites/belt/left_12.png":
{
"frame": {"x":1737,"y":413,"w":86,"h":86},
"frame": {"x":1742,"y":413,"w":86,"h":86},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":0,"y":9,"w":86,"h":86},
@ -330,7 +330,7 @@
},
"sprites/belt/left_13.png":
{
"frame": {"x":1229,"y":540,"w":86,"h":86},
"frame": {"x":993,"y":1180,"w":86,"h":86},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":0,"y":9,"w":86,"h":86},
@ -338,7 +338,7 @@
},
"sprites/belt/left_14.png":
{
"frame": {"x":1229,"y":630,"w":86,"h":86},
"frame": {"x":1083,"y":1180,"w":86,"h":86},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":0,"y":9,"w":86,"h":86},
@ -346,7 +346,7 @@
},
"sprites/belt/left_15.png":
{
"frame": {"x":1251,"y":819,"w":86,"h":86},
"frame": {"x":1320,"y":570,"w":86,"h":86},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":0,"y":9,"w":86,"h":86},
@ -354,7 +354,7 @@
},
"sprites/belt/left_16.png":
{
"frame": {"x":1400,"y":504,"w":86,"h":86},
"frame": {"x":1461,"y":504,"w":86,"h":86},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":0,"y":9,"w":86,"h":86},
@ -362,7 +362,7 @@
},
"sprites/belt/left_17.png":
{
"frame": {"x":1490,"y":504,"w":86,"h":86},
"frame": {"x":1188,"y":908,"w":86,"h":86},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":0,"y":9,"w":86,"h":86},
@ -370,7 +370,7 @@
},
"sprites/belt/left_18.png":
{
"frame": {"x":1580,"y":503,"w":86,"h":86},
"frame": {"x":1215,"y":1097,"w":86,"h":86},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":0,"y":9,"w":86,"h":86},
@ -378,7 +378,7 @@
},
"sprites/belt/left_19.png":
{
"frame": {"x":1670,"y":503,"w":86,"h":86},
"frame": {"x":1173,"y":1187,"w":86,"h":86},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":0,"y":9,"w":86,"h":86},
@ -386,7 +386,7 @@
},
"sprites/belt/left_20.png":
{
"frame": {"x":1400,"y":594,"w":86,"h":86},
"frame": {"x":1551,"y":504,"w":86,"h":86},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":0,"y":9,"w":86,"h":86},
@ -394,7 +394,7 @@
},
"sprites/belt/left_21.png":
{
"frame": {"x":1490,"y":594,"w":86,"h":86},
"frame": {"x":1641,"y":503,"w":86,"h":86},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":0,"y":9,"w":86,"h":86},
@ -402,7 +402,7 @@
},
"sprites/belt/left_22.png":
{
"frame": {"x":1580,"y":593,"w":86,"h":86},
"frame": {"x":1731,"y":503,"w":86,"h":86},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":0,"y":9,"w":86,"h":86},
@ -410,7 +410,7 @@
},
"sprites/belt/left_23.png":
{
"frame": {"x":1670,"y":593,"w":86,"h":86},
"frame": {"x":1821,"y":503,"w":86,"h":86},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":0,"y":9,"w":86,"h":86},
@ -418,7 +418,7 @@
},
"sprites/belt/left_24.png":
{
"frame": {"x":1760,"y":593,"w":86,"h":86},
"frame": {"x":993,"y":1270,"w":86,"h":86},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":0,"y":9,"w":86,"h":86},
@ -426,7 +426,7 @@
},
"sprites/belt/left_25.png":
{
"frame": {"x":1413,"y":684,"w":86,"h":86},
"frame": {"x":1083,"y":1270,"w":86,"h":86},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":0,"y":9,"w":86,"h":86},
@ -434,7 +434,7 @@
},
"sprites/belt/left_26.png":
{
"frame": {"x":1503,"y":684,"w":86,"h":86},
"frame": {"x":1173,"y":1277,"w":86,"h":86},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":0,"y":9,"w":86,"h":86},
@ -442,7 +442,7 @@
},
"sprites/belt/left_27.png":
{
"frame": {"x":1593,"y":683,"w":86,"h":86},
"frame": {"x":1263,"y":1277,"w":86,"h":86},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":0,"y":9,"w":86,"h":86},
@ -450,7 +450,7 @@
},
"sprites/belt/right_0.png":
{
"frame": {"x":1422,"y":864,"w":86,"h":86},
"frame": {"x":1415,"y":684,"w":86,"h":86},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":9,"y":9,"w":86,"h":86},
@ -458,7 +458,7 @@
},
"sprites/belt/right_1.png":
{
"frame": {"x":1512,"y":864,"w":86,"h":86},
"frame": {"x":1505,"y":684,"w":86,"h":86},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":9,"y":9,"w":86,"h":86},
@ -466,7 +466,7 @@
},
"sprites/belt/right_2.png":
{
"frame": {"x":1590,"y":954,"w":86,"h":86},
"frame": {"x":1775,"y":683,"w":86,"h":86},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":9,"y":9,"w":86,"h":86},
@ -474,7 +474,7 @@
},
"sprites/belt/right_3.png":
{
"frame": {"x":1584,"y":1044,"w":86,"h":86},
"frame": {"x":1680,"y":963,"w":86,"h":86},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":9,"y":9,"w":86,"h":86},
@ -482,7 +482,7 @@
},
"sprites/belt/right_4.png":
{
"frame": {"x":1302,"y":1093,"w":86,"h":86},
"frame": {"x":1770,"y":963,"w":86,"h":86},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":9,"y":9,"w":86,"h":86},
@ -490,7 +490,7 @@
},
"sprites/belt/right_5.png":
{
"frame": {"x":1302,"y":1183,"w":86,"h":86},
"frame": {"x":1395,"y":1044,"w":86,"h":86},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":9,"y":9,"w":86,"h":86},
@ -498,7 +498,7 @@
},
"sprites/belt/right_6.png":
{
"frame": {"x":1392,"y":1134,"w":86,"h":86},
"frame": {"x":1485,"y":1044,"w":86,"h":86},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":9,"y":9,"w":86,"h":86},
@ -506,7 +506,7 @@
},
"sprites/belt/right_7.png":
{
"frame": {"x":1482,"y":1134,"w":86,"h":86},
"frame": {"x":1575,"y":1053,"w":86,"h":86},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":9,"y":9,"w":86,"h":86},
@ -514,7 +514,7 @@
},
"sprites/belt/right_8.png":
{
"frame": {"x":1572,"y":1134,"w":86,"h":86},
"frame": {"x":1665,"y":1053,"w":86,"h":86},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":9,"y":9,"w":86,"h":86},
@ -522,7 +522,7 @@
},
"sprites/belt/right_9.png":
{
"frame": {"x":1392,"y":1224,"w":86,"h":86},
"frame": {"x":1755,"y":1053,"w":86,"h":86},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":9,"y":9,"w":86,"h":86},
@ -530,7 +530,7 @@
},
"sprites/belt/right_10.png":
{
"frame": {"x":1602,"y":863,"w":86,"h":86},
"frame": {"x":1423,"y":774,"w":86,"h":86},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":9,"y":9,"w":86,"h":86},
@ -538,7 +538,7 @@
},
"sprites/belt/right_11.png":
{
"frame": {"x":1692,"y":863,"w":86,"h":86},
"frame": {"x":1513,"y":774,"w":86,"h":86},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":9,"y":9,"w":86,"h":86},
@ -546,7 +546,7 @@
},
"sprites/belt/right_12.png":
{
"frame": {"x":1782,"y":863,"w":86,"h":86},
"frame": {"x":1423,"y":864,"w":86,"h":86},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":9,"y":9,"w":86,"h":86},
@ -554,7 +554,7 @@
},
"sprites/belt/right_13.png":
{
"frame": {"x":1827,"y":413,"w":86,"h":86},
"frame": {"x":1513,"y":864,"w":86,"h":86},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":9,"y":9,"w":86,"h":86},
@ -562,7 +562,7 @@
},
"sprites/belt/right_14.png":
{
"frame": {"x":1066,"y":1378,"w":86,"h":86},
"frame": {"x":1595,"y":684,"w":86,"h":86},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":9,"y":9,"w":86,"h":86},
@ -570,7 +570,7 @@
},
"sprites/belt/right_15.png":
{
"frame": {"x":1134,"y":1084,"w":86,"h":86},
"frame": {"x":1603,"y":873,"w":86,"h":86},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":9,"y":9,"w":86,"h":86},
@ -578,7 +578,7 @@
},
"sprites/belt/right_16.png":
{
"frame": {"x":1230,"y":909,"w":86,"h":86},
"frame": {"x":1632,"y":594,"w":86,"h":86},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":9,"y":9,"w":86,"h":86},
@ -586,7 +586,7 @@
},
"sprites/belt/right_17.png":
{
"frame": {"x":1320,"y":913,"w":86,"h":86},
"frame": {"x":1722,"y":593,"w":86,"h":86},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":9,"y":9,"w":86,"h":86},
@ -594,7 +594,7 @@
},
"sprites/belt/right_18.png":
{
"frame": {"x":1410,"y":954,"w":86,"h":86},
"frame": {"x":1812,"y":593,"w":86,"h":86},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":9,"y":9,"w":86,"h":86},
@ -602,7 +602,7 @@
},
"sprites/belt/right_19.png":
{
"frame": {"x":1500,"y":954,"w":86,"h":86},
"frame": {"x":1685,"y":684,"w":86,"h":86},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":9,"y":9,"w":86,"h":86},
@ -610,7 +610,7 @@
},
"sprites/belt/right_20.png":
{
"frame": {"x":1680,"y":953,"w":86,"h":86},
"frame": {"x":1693,"y":873,"w":86,"h":86},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":9,"y":9,"w":86,"h":86},
@ -618,7 +618,7 @@
},
"sprites/belt/right_21.png":
{
"frame": {"x":1770,"y":953,"w":86,"h":86},
"frame": {"x":1783,"y":873,"w":86,"h":86},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":9,"y":9,"w":86,"h":86},
@ -626,7 +626,7 @@
},
"sprites/belt/right_22.png":
{
"frame": {"x":1680,"y":1043,"w":86,"h":86},
"frame": {"x":1320,"y":915,"w":86,"h":86},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":9,"y":9,"w":86,"h":86},
@ -634,7 +634,7 @@
},
"sprites/belt/right_23.png":
{
"frame": {"x":1770,"y":1043,"w":86,"h":86},
"frame": {"x":1296,"y":1005,"w":86,"h":86},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":9,"y":9,"w":86,"h":86},
@ -642,7 +642,7 @@
},
"sprites/belt/right_24.png":
{
"frame": {"x":1224,"y":999,"w":86,"h":86},
"frame": {"x":1305,"y":1095,"w":86,"h":86},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":9,"y":9,"w":86,"h":86},
@ -650,7 +650,7 @@
},
"sprites/belt/right_25.png":
{
"frame": {"x":1314,"y":1003,"w":86,"h":86},
"frame": {"x":1410,"y":954,"w":86,"h":86},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":9,"y":9,"w":86,"h":86},
@ -658,7 +658,7 @@
},
"sprites/belt/right_26.png":
{
"frame": {"x":1404,"y":1044,"w":86,"h":86},
"frame": {"x":1500,"y":954,"w":86,"h":86},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":9,"y":9,"w":86,"h":86},
@ -666,7 +666,7 @@
},
"sprites/belt/right_27.png":
{
"frame": {"x":1494,"y":1044,"w":86,"h":86},
"frame": {"x":1590,"y":963,"w":86,"h":86},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":9,"y":9,"w":86,"h":86},
@ -674,7 +674,7 @@
},
"sprites/blueprints/belt_left.png":
{
"frame": {"x":263,"y":1277,"w":87,"h":87},
"frame": {"x":1229,"y":570,"w":87,"h":87},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":0,"y":8,"w":87,"h":87},
@ -682,7 +682,7 @@
},
"sprites/blueprints/belt_right.png":
{
"frame": {"x":263,"y":1368,"w":87,"h":87},
"frame": {"x":1251,"y":817,"w":87,"h":87},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":8,"y":8,"w":87,"h":87},
@ -690,7 +690,7 @@
},
"sprites/blueprints/belt_top.png":
{
"frame": {"x":1828,"y":298,"w":79,"h":95},
"frame": {"x":1251,"y":718,"w":79,"h":95},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":8,"y":0,"w":79,"h":95},
@ -802,7 +802,7 @@
},
"sprites/blueprints/splitter-compact.png":
{
"frame": {"x":499,"y":1322,"w":139,"h":138},
"frame": {"x":1239,"y":298,"w":139,"h":138},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":5,"y":2,"w":139,"h":138},
@ -850,7 +850,7 @@
},
"sprites/blueprints/underground_belt_entry.png":
{
"frame": {"x":1262,"y":298,"w":138,"h":112},
"frame": {"x":835,"y":1328,"w":138,"h":112},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":4,"y":32,"w":138,"h":112},
@ -858,7 +858,7 @@
},
"sprites/blueprints/underground_belt_exit-tier2.png":
{
"frame": {"x":1119,"y":298,"w":139,"h":112},
"frame": {"x":692,"y":1327,"w":139,"h":112},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":4,"y":0,"w":139,"h":112},
@ -866,7 +866,7 @@
},
"sprites/blueprints/underground_belt_exit.png":
{
"frame": {"x":1404,"y":298,"w":138,"h":112},
"frame": {"x":1382,"y":298,"w":138,"h":112},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":4,"y":0,"w":138,"h":112},
@ -874,7 +874,7 @@
},
"sprites/blueprints/wire-split.png":
{
"frame": {"x":1099,"y":529,"w":95,"h":53},
"frame": {"x":1229,"y":661,"w":95,"h":53},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":0,"y":42,"w":95,"h":53},
@ -882,7 +882,7 @@
},
"sprites/blueprints/wire-turn.png":
{
"frame": {"x":1850,"y":569,"w":53,"h":53},
"frame": {"x":1334,"y":759,"w":53,"h":53},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":42,"y":42,"w":53,"h":53},
@ -890,7 +890,7 @@
},
"sprites/blueprints/wire.png":
{
"frame": {"x":560,"y":738,"w":11,"h":95},
"frame": {"x":978,"y":1181,"w":11,"h":95},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":42,"y":0,"w":11,"h":95},
@ -898,7 +898,7 @@
},
"sprites/buildings/belt_left.png":
{
"frame": {"x":1482,"y":1224,"w":86,"h":86},
"frame": {"x":1434,"y":1134,"w":86,"h":86},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":0,"y":9,"w":86,"h":86},
@ -906,7 +906,7 @@
},
"sprites/buildings/belt_right.png":
{
"frame": {"x":1572,"y":1224,"w":86,"h":86},
"frame": {"x":1434,"y":1224,"w":86,"h":86},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":9,"y":9,"w":86,"h":86},
@ -914,7 +914,7 @@
},
"sprites/buildings/belt_top.png":
{
"frame": {"x":1251,"y":720,"w":77,"h":95},
"frame": {"x":1806,"y":298,"w":77,"h":95},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":9,"y":0,"w":77,"h":95},
@ -954,7 +954,7 @@
},
"sprites/buildings/miner.png":
{
"frame": {"x":785,"y":1328,"w":136,"h":142},
"frame": {"x":1099,"y":299,"w":136,"h":142},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":5,"y":0,"w":136,"h":142},
@ -1026,7 +1026,7 @@
},
"sprites/buildings/splitter-compact-inverse.png":
{
"frame": {"x":354,"y":1296,"w":141,"h":136},
"frame": {"x":263,"y":1322,"w":141,"h":136},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":0,"y":3,"w":141,"h":136},
@ -1034,7 +1034,7 @@
},
"sprites/buildings/splitter-compact.png":
{
"frame": {"x":642,"y":1327,"w":139,"h":136},
"frame": {"x":408,"y":1322,"w":139,"h":136},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":5,"y":3,"w":139,"h":136},
@ -1074,7 +1074,7 @@
},
"sprites/buildings/underground_belt_entry-tier2.png":
{
"frame": {"x":925,"y":1328,"w":137,"h":124},
"frame": {"x":551,"y":1322,"w":137,"h":124},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":5,"y":20,"w":137,"h":124},
@ -1082,7 +1082,7 @@
},
"sprites/buildings/underground_belt_entry.png":
{
"frame": {"x":1546,"y":298,"w":137,"h":111},
"frame": {"x":1524,"y":298,"w":137,"h":111},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":5,"y":33,"w":137,"h":111},
@ -1090,7 +1090,7 @@
},
"sprites/buildings/underground_belt_exit-tier2.png":
{
"frame": {"x":1687,"y":298,"w":137,"h":111},
"frame": {"x":1665,"y":298,"w":137,"h":111},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":5,"y":0,"w":137,"h":111},
@ -1098,7 +1098,7 @@
},
"sprites/buildings/underground_belt_exit.png":
{
"frame": {"x":1099,"y":414,"w":137,"h":111},
"frame": {"x":1099,"y":445,"w":137,"h":111},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":5,"y":0,"w":137,"h":111},
@ -1106,31 +1106,31 @@
},
"sprites/buildings/wire-split.png":
{
"frame": {"x":1240,"y":484,"w":95,"h":52},
"frame": {"x":1240,"y":510,"w":95,"h":56},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":0,"y":43,"w":95,"h":52},
"spriteSourceSize": {"x":0,"y":39,"w":95,"h":56},
"sourceSize": {"w":95,"h":95}
},
"sprites/buildings/wire-turn.png":
{
"frame": {"x":1850,"y":626,"w":52,"h":52},
"frame": {"x":1339,"y":510,"w":52,"h":56},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":43,"y":43,"w":52,"h":52},
"spriteSourceSize": {"x":43,"y":39,"w":52,"h":56},
"sourceSize": {"w":95,"h":95}
},
"sprites/buildings/wire.png":
{
"frame": {"x":1099,"y":299,"w":9,"h":95},
"frame": {"x":560,"y":738,"w":17,"h":95},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":43,"y":0,"w":9,"h":95},
"spriteSourceSize": {"x":39,"y":0,"w":17,"h":95},
"sourceSize": {"w":95,"h":95}
},
"sprites/debug/acceptor_slot.png":
{
"frame": {"x":1863,"y":682,"w":38,"h":48},
"frame": {"x":1410,"y":570,"w":38,"h":48},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":5,"y":0,"w":38,"h":48},
@ -1138,39 +1138,15 @@
},
"sprites/debug/ejector_slot.png":
{
"frame": {"x":1188,"y":884,"w":38,"h":48},
"frame": {"x":1278,"y":908,"w":38,"h":48},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":5,"y":0,"w":38,"h":48},
"sourceSize": {"w":48,"h":48}
},
"sprites/map_overview/belt_forward.png":
{
"frame": {"x":1906,"y":626,"w":20,"h":24},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":2,"y":0,"w":20,"h":24},
"sourceSize": {"w":24,"h":24}
},
"sprites/map_overview/belt_left.png":
{
"frame": {"x":499,"y":1296,"w":22,"h":22},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":0,"y":2,"w":22,"h":22},
"sourceSize": {"w":24,"h":24}
},
"sprites/map_overview/belt_right.png":
{
"frame": {"x":549,"y":1000,"w":22,"h":22},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":2,"y":2,"w":22,"h":22},
"sourceSize": {"w":24,"h":24}
},
"sprites/misc/deletion_marker.png":
{
"frame": {"x":1850,"y":503,"w":62,"h":62},
"frame": {"x":1395,"y":504,"w":62,"h":62},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":5,"y":5,"w":62,"h":62},
@ -1178,7 +1154,7 @@
},
"sprites/misc/hub_direction_indicator.png":
{
"frame": {"x":1385,"y":684,"w":24,"h":24},
"frame": {"x":3,"y":1434,"w":24,"h":24},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":24,"h":24},
@ -1186,7 +1162,7 @@
},
"sprites/misc/slot_bad_arrow.png":
{
"frame": {"x":1850,"y":503,"w":62,"h":62},
"frame": {"x":1395,"y":504,"w":62,"h":62},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":5,"y":5,"w":62,"h":62},
@ -1194,7 +1170,7 @@
},
"sprites/misc/slot_good_arrow.png":
{
"frame": {"x":1319,"y":639,"w":62,"h":72},
"frame": {"x":1851,"y":103,"w":62,"h":72},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":5,"y":0,"w":62,"h":72},
@ -1202,7 +1178,7 @@
},
"sprites/misc/storage_overlay.png":
{
"frame": {"x":1240,"y":414,"w":133,"h":66},
"frame": {"x":1240,"y":440,"w":133,"h":66},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":2,"y":2,"w":133,"h":66},
@ -1210,7 +1186,7 @@
},
"sprites/misc/waypoint.png":
{
"frame": {"x":1906,"y":654,"w":20,"h":24},
"frame": {"x":1386,"y":1005,"w":20,"h":24},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":2,"y":0,"w":20,"h":24},
@ -1226,7 +1202,7 @@
},
"sprites/wires/logical_acceptor.png":
{
"frame": {"x":978,"y":1280,"w":38,"h":44},
"frame": {"x":1107,"y":985,"w":38,"h":44},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":29,"y":0,"w":38,"h":44},
@ -1234,7 +1210,7 @@
},
"sprites/wires/logical_ejector.png":
{
"frame": {"x":1020,"y":1280,"w":38,"h":44},
"frame": {"x":1134,"y":1132,"w":38,"h":44},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":29,"y":0,"w":38,"h":44},
@ -1245,8 +1221,8 @@
"version": "1.0",
"image": "atlas0_75.png",
"format": "RGBA8888",
"size": {"w":1929,"h":1473},
"size": {"w":1928,"h":1461},
"scale": "0.75",
"smartupdate": "$TexturePacker:SmartUpdate:bbf80c2f55955cd3dbb580e43ccfea82:9e740478b79b3e996673e595e1d88942:f159918d23e5952766c6d23ab52278c6$"
"smartupdate": "$TexturePacker:SmartUpdate:c4d9ce4754efb3b4d6e3cef914c53f61:8ed7e310e21445dc84756e12578a7755:f159918d23e5952766c6d23ab52278c6$"
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 933 KiB

After

Width:  |  Height:  |  Size: 945 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

@ -683,3 +683,33 @@ export function generateMatrixRotations(originalMatrix) {
return result;
}
/**
*
* @typedef {{
* top: any,
* right: any,
* bottom: any,
* left: any
* }} DirectionalObject
*/
/**
* Rotates a directional object
* @param {DirectionalObject} obj
* @returns {DirectionalObject}
*/
export function rotateDirectionalObject(obj, rotation) {
const queue = [obj.top, obj.right, obj.bottom, obj.left];
while (rotation !== 0) {
rotation -= 90;
queue.push(queue.shift());
}
return {
top: queue[0],
right: queue[1],
bottom: queue[2],
left: queue[3],
};
}

@ -1,10 +1,11 @@
import { Loader } from "../../core/loader";
import { rotateDirectionalObject } from "../../core/utils";
import { Vector } from "../../core/vector";
import { SOUNDS } from "../../platform/sound";
import { enumWireType, WireComponent } from "../components/wire";
import { Entity } from "../entity";
import { MetaBuilding } from "../meta_building";
import { enumLayer, GameRoot } from "../root";
import { beltOverlayMatrices } from "./belt_base";
export const arrayWireRotationVariantToType = [enumWireType.regular, enumWireType.turn, enumWireType.split];
@ -108,4 +109,157 @@ export class MetaWireBuilding extends MetaBuilding {
getSpecialOverlayRenderMatrix(rotation, rotationVariant, variant, entity) {
return wireOverlayMatrices[entity.components.Wire.type][rotation];
}
getPreviewSprite(rotationVariant) {
switch (arrayWireRotationVariantToType[rotationVariant]) {
case enumWireType.regular: {
return Loader.getSprite("sprites/buildings/wire.png");
}
case enumWireType.turn: {
return Loader.getSprite("sprites/buildings/wire-turn.png");
}
case enumWireType.split: {
return Loader.getSprite("sprites/buildings/wire-split.png");
}
default: {
assertAlways(false, "Invalid belt rotation variant");
}
}
}
getBlueprintSprite(rotationVariant) {
switch (arrayWireRotationVariantToType[rotationVariant]) {
case enumWireType.regular: {
return Loader.getSprite("sprites/blueprints/wire.png");
}
case enumWireType.turn: {
return Loader.getSprite("sprites/blueprints/wire-turn.png");
}
case enumWireType.split: {
return Loader.getSprite("sprites/blueprints/wire-split.png");
}
default: {
assertAlways(false, "Invalid belt rotation variant");
}
}
}
/**
* Should compute the optimal rotation variant on the given tile
* @param {object} param0
* @param {GameRoot} param0.root
* @param {Vector} param0.tile
* @param {number} param0.rotation
* @param {string} param0.variant
* @param {string} param0.layer
* @return {{ rotation: number, rotationVariant: number, connectedEntities?: Array<Entity> }}
*/
computeOptimalDirectionAndRotationVariantAtTile({ root, tile, rotation, variant, layer }) {
const connections = root.logic.getLocalWireConnectionsAtTile(tile);
const d = rotateDirectionalObject(connections, rotation);
// "Sticky" bottom
connections.bottom = true;
let flag = 0;
flag |= d.top ? 0x1000 : 0;
flag |= d.right ? 0x100 : 0;
flag |= d.bottom ? 0x10 : 0;
flag |= d.left ? 0x1 : 0;
let targetType = enumWireType.regular;
switch (flag) {
case 0x0000:
// Nothing
break;
case 0x0001:
// Left
targetType = enumWireType.turn;
rotation += 90;
break;
case 0x0010:
// Bottom
break;
case 0x0011:
// Bottom | Left
targetType = enumWireType.turn;
rotation += 90;
break;
case 0x0100:
// Right
targetType = enumWireType.turn;
break;
case 0x0101:
// Right | Left
// @todo: Might want to do rotation += 90 here
rotation += 90;
break;
case 0x0110:
// Right | Bottom
targetType = enumWireType.turn;
break;
case 0x0111:
// Right | Bottom | Left
targetType = enumWireType.split;
break;
case 0x1000:
// Top
break;
case 0x1001:
// Top | Left
targetType = enumWireType.turn;
rotation += 180;
break;
case 0x1010:
// Top | Bottom
break;
case 0x1011:
// Top | Bottom | Left
targetType = enumWireType.split;
rotation += 90;
break;
case 0x1100:
// Top | Right
targetType = enumWireType.turn;
rotation -= 90;
break;
case 0x1101:
// Top | Right | Left
targetType = enumWireType.split;
rotation += 180;
break;
case 0x1110:
// Top | Right | Bottom
targetType = enumWireType.split;
rotation -= 90;
break;
case 0x1111:
// Top | Right | Bottom | Left
// @todo: Crossing
break;
}
return {
// Clamp rotation
rotation: (rotation + 360 * 10) % 360,
rotationVariant: arrayWireRotationVariantToType.indexOf(targetType),
};
}
}

@ -18,10 +18,43 @@ export class WireComponent extends Component {
/**
* @param {object} param0
* @param {enumWireType?} param0.type
* @param {enumWireType=} param0.type
*/
constructor({ type = enumWireType.regular }) {
super();
this.type = type;
}
/**
* Returns the local connections
* @returns {import("../../core/utils").DirectionalObject}
*/
getLocalConnections() {
switch (this.type) {
case enumWireType.regular:
return {
top: true,
right: false,
bottom: true,
left: false,
};
case enumWireType.turn:
return {
top: false,
right: true,
bottom: true,
left: false,
};
case enumWireType.split:
return {
top: false,
right: true,
bottom: true,
left: true,
};
default:
assertAlways(false, "Invalid wire type: " + this.type);
}
}
}

@ -1,5 +1,5 @@
import { createLogger } from "../core/logging";
import { round2Digits } from "../core/utils";
import { round2Digits, rotateDirectionalObject } from "../core/utils";
import { enumDirection, enumDirectionToVector, Vector } from "../core/vector";
import { Entity } from "./entity";
import { MetaBuilding } from "./meta_building";
@ -179,6 +179,46 @@ export class GameLogic {
return true;
}
/**
* Returns the wire connections at the given tile
* @param {Vector} tile
* @returns {import("../core/utils").DirectionalObject}
*/
getLocalWireConnectionsAtTile(tile) {
return {
top: this.getTileWireConnections(tile.addScalars(0, -1)).bottom,
right: this.getTileWireConnections(tile.addScalars(1, 0)).left,
bottom: this.getTileWireConnections(tile.addScalars(0, 1)).top,
left: this.getTileWireConnections(tile.addScalars(-1, 0)).right,
};
}
/**
* Returns the wire connection at the given tile
* @param {Vector} tile
* @returns {import("../core/utils").DirectionalObject}
*/
getTileWireConnections(tile) {
const result = {
top: null,
right: null,
bottom: null,
left: null,
};
const contents = this.root.map.getLayerContentXY(tile.x, tile.y, enumLayer.wires);
if (!contents) {
return result;
}
const staticComp = contents.components.StaticMapEntity;
const wiresComp = contents.components.Wire;
if (wiresComp) {
const connections = wiresComp.getLocalConnections();
return rotateDirectionalObject(connections, staticComp.rotation);
}
return result;
}
/**
* Returns the acceptors and ejectors which affect the current tile
* @param {Vector} tile

@ -3,6 +3,11 @@ import { WireComponent, enumWireType } from "../components/wire";
import { MapChunkView } from "../map_chunk_view";
import { globalConfig } from "../../core/config";
import { Loader } from "../../core/loader";
import { Entity } from "../entity";
import { gMetaBuildingRegistry } from "../../core/global_registries";
import { MetaWireBuilding, arrayWireRotationVariantToType } from "../buildings/wire";
import { Vector } from "../../core/vector";
import { defaultBuildingVariant } from "../meta_building";
export class WireSystem extends GameSystemWithFilter {
constructor(root) {
@ -13,6 +18,9 @@ export class WireSystem extends GameSystemWithFilter {
[enumWireType.turn]: Loader.getSprite("sprites/buildings/wire-turn.png"),
[enumWireType.split]: Loader.getSprite("sprites/buildings/wire-split.png"),
};
this.root.signals.entityDestroyed.add(this.updateSurroundingWirePlacement, this);
this.root.signals.entityAdded.add(this.updateSurroundingWirePlacement, this);
}
/**
@ -33,4 +41,70 @@ export class WireSystem extends GameSystemWithFilter {
}
}
}
/**
* Updates the wire placement after an entity has been added / deleted
* @param {Entity} entity
*/
updateSurroundingWirePlacement(entity) {
if (!this.root.gameInitialized) {
return;
}
const staticComp = entity.components.StaticMapEntity;
if (!staticComp) {
return;
}
const metaWire = gMetaBuildingRegistry.findByClass(MetaWireBuilding);
// Compute affected area
const originalRect = staticComp.getTileSpaceBounds();
const affectedArea = originalRect.expandedInAllDirections(1);
for (let x = affectedArea.x; x < affectedArea.right(); ++x) {
for (let y = affectedArea.y; y < affectedArea.bottom(); ++y) {
if (originalRect.containsPoint(x, y)) {
// Make sure we don't update the original entity
continue;
}
const targetEntities = this.root.map.getLayersContentsMultipleXY(x, y);
for (let i = 0; i < targetEntities.length; ++i) {
const targetEntity = targetEntities[i];
const targetWireComp = targetEntity.components.Wire;
const targetStaticComp = targetEntity.components.StaticMapEntity;
if (!targetWireComp) {
// Not a wire
continue;
}
const {
rotation,
rotationVariant,
} = metaWire.computeOptimalDirectionAndRotationVariantAtTile({
root: this.root,
tile: new Vector(x, y),
rotation: targetStaticComp.originalRotation,
variant: defaultBuildingVariant,
layer: targetEntity.layer,
});
// Compute delta to see if anything changed
const newType = arrayWireRotationVariantToType[rotationVariant];
if (targetStaticComp.rotation !== rotation || newType !== targetWireComp.type) {
// Change stuff
targetStaticComp.rotation = rotation;
metaWire.updateVariants(targetEntity, rotationVariant, defaultBuildingVariant);
// Make sure the chunks know about the update
this.root.signals.entityChanged.dispatch(targetEntity);
}
}
}
}
}
}

Loading…
Cancel
Save