mirror of
https://github.com/tobspr/shapez.io.git
synced 2025-12-16 03:31:52 +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 = [
|
||||
{ pos: new Vector(0, 0), direction: enumDirection.top },
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction:
|
||||
variant === enumBalancerVariants.mergerInverse
|
||||
? enumDirection.right
|
||||
: enumDirection.left,
|
||||
corner: true,
|
||||
},
|
||||
];
|
||||
|
||||
break;
|
||||
@ -226,6 +234,14 @@ export class MetaBalancerBuilding extends MetaBuilding {
|
||||
|
||||
entity.components.BeltUnderlays.underlays = [
|
||||
{ pos: new Vector(0, 0), direction: enumDirection.top },
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction:
|
||||
variant === enumBalancerVariants.splitterInverse
|
||||
? enumDirection.left
|
||||
: enumDirection.right,
|
||||
corner: true,
|
||||
},
|
||||
];
|
||||
|
||||
break;
|
||||
|
||||
@ -5,6 +5,7 @@ import { enumItemProcessorTypes, ItemProcessorComponent } from "../components/it
|
||||
import { Entity } from "../entity";
|
||||
import { MetaBuilding } from "../meta_building";
|
||||
import { WiredPinsComponent, enumPinSlotType } from "../components/wired_pins";
|
||||
import { BeltUnderlaysComponent } from "../components/belt_underlays";
|
||||
|
||||
export class MetaHubBuilding extends MetaBuilding {
|
||||
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",
|
||||
bottomOnly: "bottomOnly",
|
||||
topOnly: "topOnly",
|
||||
topCorner: "topCorner",
|
||||
bottomCorner: "bottomCorner",
|
||||
none: "none",
|
||||
};
|
||||
|
||||
@ -21,6 +23,7 @@ export const enumClippedBeltUnderlayType = {
|
||||
* @typedef {{
|
||||
* pos: Vector,
|
||||
* direction: enumDirection,
|
||||
* corner?: boolean,
|
||||
* cachedType?: enumClippedBeltUnderlayType
|
||||
* }} BeltUnderlayTile
|
||||
*/
|
||||
|
||||
@ -29,6 +29,8 @@ const enumUnderlayTypeToClipRect = {
|
||||
[enumClippedBeltUnderlayType.full]: FULL_CLIP_RECT,
|
||||
[enumClippedBeltUnderlayType.topOnly]: new Rectangle(0, 0, 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 {
|
||||
@ -208,9 +210,13 @@ export class BeltUnderlaysSystem extends GameSystemWithFilter {
|
||||
if (connectedTop && connectedBottom) {
|
||||
flag = enumClippedBeltUnderlayType.full;
|
||||
} else if (connectedTop) {
|
||||
flag = enumClippedBeltUnderlayType.topOnly;
|
||||
flag = underlayTile.corner
|
||||
? enumClippedBeltUnderlayType.topCorner
|
||||
: enumClippedBeltUnderlayType.topOnly;
|
||||
} else if (connectedBottom) {
|
||||
flag = enumClippedBeltUnderlayType.bottomOnly;
|
||||
flag = underlayTile.corner
|
||||
? enumClippedBeltUnderlayType.bottomCorner
|
||||
: enumClippedBeltUnderlayType.bottomOnly;
|
||||
}
|
||||
|
||||
return (underlayTile.cachedType = flag);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user