mirror of
https://github.com/tobspr/shapez.io.git
synced 2025-12-16 11:41:50 +00:00
Fixed missing belt on corners of hub, splitter and merger
This commit is contained in:
parent
a7a2aad2b6
commit
1022ea989c
@ -197,6 +197,14 @@ export class MetaBalancerBuilding extends MetaBuilding {
|
|||||||
|
|
||||||
entity.components.BeltUnderlays.underlays = [
|
entity.components.BeltUnderlays.underlays = [
|
||||||
{ pos: new Vector(0, 0), direction: enumDirection.top },
|
{ pos: new Vector(0, 0), direction: enumDirection.top },
|
||||||
|
{
|
||||||
|
pos: new Vector(0, 0),
|
||||||
|
direction:
|
||||||
|
variant === enumBalancerVariants.mergerInverse
|
||||||
|
? enumDirection.right
|
||||||
|
: enumDirection.left,
|
||||||
|
corner: true,
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@ -226,6 +234,14 @@ export class MetaBalancerBuilding extends MetaBuilding {
|
|||||||
|
|
||||||
entity.components.BeltUnderlays.underlays = [
|
entity.components.BeltUnderlays.underlays = [
|
||||||
{ pos: new Vector(0, 0), direction: enumDirection.top },
|
{ pos: new Vector(0, 0), direction: enumDirection.top },
|
||||||
|
{
|
||||||
|
pos: new Vector(0, 0),
|
||||||
|
direction:
|
||||||
|
variant === enumBalancerVariants.splitterInverse
|
||||||
|
? enumDirection.left
|
||||||
|
: enumDirection.right,
|
||||||
|
corner: true,
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import { enumItemProcessorTypes, ItemProcessorComponent } from "../components/it
|
|||||||
import { Entity } from "../entity";
|
import { Entity } from "../entity";
|
||||||
import { MetaBuilding } from "../meta_building";
|
import { MetaBuilding } from "../meta_building";
|
||||||
import { WiredPinsComponent, enumPinSlotType } from "../components/wired_pins";
|
import { WiredPinsComponent, enumPinSlotType } from "../components/wired_pins";
|
||||||
|
import { BeltUnderlaysComponent } from "../components/belt_underlays";
|
||||||
|
|
||||||
export class MetaHubBuilding extends MetaBuilding {
|
export class MetaHubBuilding extends MetaBuilding {
|
||||||
constructor() {
|
constructor() {
|
||||||
@ -137,5 +138,52 @@ export class MetaHubBuilding extends MetaBuilding {
|
|||||||
],
|
],
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
entity.addComponent(
|
||||||
|
new BeltUnderlaysComponent({
|
||||||
|
underlays: [
|
||||||
|
{
|
||||||
|
pos: new Vector(0, 0),
|
||||||
|
direction: enumDirection.right,
|
||||||
|
corner: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
pos: new Vector(0, 0),
|
||||||
|
direction: enumDirection.bottom,
|
||||||
|
corner: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
pos: new Vector(0, 3),
|
||||||
|
direction: enumDirection.right,
|
||||||
|
corner: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
pos: new Vector(0, 3),
|
||||||
|
direction: enumDirection.top,
|
||||||
|
corner: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
pos: new Vector(3, 0),
|
||||||
|
direction: enumDirection.left,
|
||||||
|
corner: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
pos: new Vector(3, 0),
|
||||||
|
direction: enumDirection.bottom,
|
||||||
|
corner: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
pos: new Vector(3, 3),
|
||||||
|
direction: enumDirection.left,
|
||||||
|
corner: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
pos: new Vector(3, 3),
|
||||||
|
direction: enumDirection.top,
|
||||||
|
corner: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
})
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,6 +14,8 @@ export const enumClippedBeltUnderlayType = {
|
|||||||
full: "full",
|
full: "full",
|
||||||
bottomOnly: "bottomOnly",
|
bottomOnly: "bottomOnly",
|
||||||
topOnly: "topOnly",
|
topOnly: "topOnly",
|
||||||
|
topCorner: "topCorner",
|
||||||
|
bottomCorner: "bottomCorner",
|
||||||
none: "none",
|
none: "none",
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -21,6 +23,7 @@ export const enumClippedBeltUnderlayType = {
|
|||||||
* @typedef {{
|
* @typedef {{
|
||||||
* pos: Vector,
|
* pos: Vector,
|
||||||
* direction: enumDirection,
|
* direction: enumDirection,
|
||||||
|
* corner?: boolean,
|
||||||
* cachedType?: enumClippedBeltUnderlayType
|
* cachedType?: enumClippedBeltUnderlayType
|
||||||
* }} BeltUnderlayTile
|
* }} BeltUnderlayTile
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -29,6 +29,8 @@ const enumUnderlayTypeToClipRect = {
|
|||||||
[enumClippedBeltUnderlayType.full]: FULL_CLIP_RECT,
|
[enumClippedBeltUnderlayType.full]: FULL_CLIP_RECT,
|
||||||
[enumClippedBeltUnderlayType.topOnly]: new Rectangle(0, 0, 1, 0.5),
|
[enumClippedBeltUnderlayType.topOnly]: new Rectangle(0, 0, 1, 0.5),
|
||||||
[enumClippedBeltUnderlayType.bottomOnly]: new Rectangle(0, 0.5, 1, 0.5),
|
[enumClippedBeltUnderlayType.bottomOnly]: new Rectangle(0, 0.5, 1, 0.5),
|
||||||
|
[enumClippedBeltUnderlayType.topCorner]: new Rectangle(0, 0, 1, 0.04),
|
||||||
|
[enumClippedBeltUnderlayType.bottomCorner]: new Rectangle(0, 0.96, 1, 0.04),
|
||||||
};
|
};
|
||||||
|
|
||||||
export class BeltUnderlaysSystem extends GameSystemWithFilter {
|
export class BeltUnderlaysSystem extends GameSystemWithFilter {
|
||||||
@ -208,9 +210,13 @@ export class BeltUnderlaysSystem extends GameSystemWithFilter {
|
|||||||
if (connectedTop && connectedBottom) {
|
if (connectedTop && connectedBottom) {
|
||||||
flag = enumClippedBeltUnderlayType.full;
|
flag = enumClippedBeltUnderlayType.full;
|
||||||
} else if (connectedTop) {
|
} else if (connectedTop) {
|
||||||
flag = enumClippedBeltUnderlayType.topOnly;
|
flag = underlayTile.corner
|
||||||
|
? enumClippedBeltUnderlayType.topCorner
|
||||||
|
: enumClippedBeltUnderlayType.topOnly;
|
||||||
} else if (connectedBottom) {
|
} else if (connectedBottom) {
|
||||||
flag = enumClippedBeltUnderlayType.bottomOnly;
|
flag = underlayTile.corner
|
||||||
|
? enumClippedBeltUnderlayType.bottomCorner
|
||||||
|
: enumClippedBeltUnderlayType.bottomOnly;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (underlayTile.cachedType = flag);
|
return (underlayTile.cachedType = flag);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user