mirror of
https://github.com/tobspr/shapez.io.git
synced 2024-10-27 20:34:29 +00:00
Fix items overlapping sometimes, fix constant signal being editable
This commit is contained in:
parent
22735591e9
commit
aa2b64eae5
@ -1,4 +1,4 @@
|
||||
@echo off
|
||||
cmd /c gulp standalone.prepareVDF
|
||||
cmd /c yarn gulp standalone.prepareVDF
|
||||
steamcmd +login %STEAM_UPLOAD_SHAPEZ_ID% %STEAM_UPLOAD_SHAPEZ_USER% +run_app_build %cd%/scripts/app.vdf +quit
|
||||
start https://partner.steamgames.com/apps/builds/1318690
|
||||
|
@ -1,4 +1,12 @@
|
||||
export const CHANGELOG = [
|
||||
{
|
||||
version: "1.2.3",
|
||||
date: "unreleased",
|
||||
entries: [
|
||||
"Fixed constant signals being editable from the regular layer",
|
||||
"Fixed items still overlapping sometimes between buildings and belts",
|
||||
],
|
||||
},
|
||||
{
|
||||
version: "1.2.2",
|
||||
date: "07.12.2020",
|
||||
|
@ -13,6 +13,10 @@ export class HUDConstantSignalEdit extends BaseHUDPart {
|
||||
* @param {enumMouseButton} button
|
||||
*/
|
||||
downPreHandler(pos, button) {
|
||||
if (this.root.currentLayer !== "wires") {
|
||||
return;
|
||||
}
|
||||
|
||||
const tile = this.root.camera.screenToWorld(pos).toTileSpace();
|
||||
const contents = this.root.map.getLayerContentXY(tile.x, tile.y, "wires");
|
||||
if (contents) {
|
||||
|
@ -332,10 +332,53 @@ export class ItemEjectorSystem extends GameSystemWithFilter {
|
||||
let progress = slot.progress;
|
||||
const nextBeltPath = slot.cachedBeltPath;
|
||||
if (nextBeltPath) {
|
||||
progress = Math.min(
|
||||
progress,
|
||||
nextBeltPath.spacingToFirstItem / globalConfig.itemSpacingOnBelts
|
||||
);
|
||||
/*
|
||||
If you imagine the track between the center of the building and the center of the first belt as
|
||||
a range from 0 to 1:
|
||||
|
||||
Building Belt
|
||||
| X | X |
|
||||
| 0...................1 |
|
||||
|
||||
And for example the first item on belt has a distance of 0.4 to the beginning of the belt:
|
||||
|
||||
Building Belt
|
||||
| X | X |
|
||||
| 0...................1 |
|
||||
^ item
|
||||
|
||||
Then the space towards this first item is always 0.5 (the distance from the center of the building to the beginning of the belt)
|
||||
PLUS the spacing to the item, so in this case 0.5 + 0.4 = 0.9:
|
||||
|
||||
Building Belt
|
||||
| X | X |
|
||||
| 0...................1 |
|
||||
^ item @ 0.9
|
||||
|
||||
Since items must not get clashed, we need to substract some spacing (lets assume it is 0.6, exact value see globalConfig.itemSpacingOnBelts),
|
||||
So we do 0.9 - globalConfig.itemSpacingOnBelts = 0.3
|
||||
|
||||
Building Belt
|
||||
| X | X |
|
||||
| 0...................1 |
|
||||
^ ^ item @ 0.9
|
||||
^ max progress = 0.3
|
||||
|
||||
Because now our range actually only goes to the end of the building, and not towards the center of the building, we need to multiply
|
||||
all values by 2:
|
||||
|
||||
Building Belt
|
||||
| X | X |
|
||||
| 0.........1.........2 |
|
||||
^ ^ item @ 1.8
|
||||
^ max progress = 0.6
|
||||
|
||||
And that's it! If you summarize the calculations from above into a formula, you get the one below.
|
||||
*/
|
||||
|
||||
const maxProgress =
|
||||
(0.5 + nextBeltPath.spacingToFirstItem - globalConfig.itemSpacingOnBelts) * 2;
|
||||
progress = Math.min(maxProgress, progress);
|
||||
}
|
||||
|
||||
// Skip if the item would barely be visible
|
||||
|
Loading…
Reference in New Issue
Block a user