mirror of
https://github.com/tobspr/shapez.io.git
synced 2026-03-02 03:39:21 +00:00
Improve map overlay rendering and raise zoom limit
This commit is contained in:
@@ -9,6 +9,29 @@ import { GameRoot } from "../root";
|
||||
|
||||
export const arrayBeltVariantToRotation = [enumDirection.top, enumDirection.left, enumDirection.right];
|
||||
|
||||
const overlayMatrices = {
|
||||
[enumDirection.top]: {
|
||||
0: [0, 1, 0, 0, 1, 0, 0, 1, 0],
|
||||
90: [0, 0, 0, 1, 1, 1, 0, 0, 0],
|
||||
180: [0, 1, 0, 0, 1, 0, 0, 1, 0],
|
||||
270: [0, 0, 0, 1, 1, 1, 0, 0, 0],
|
||||
},
|
||||
|
||||
[enumDirection.left]: {
|
||||
0: [0, 0, 0, 1, 1, 0, 0, 1, 0],
|
||||
90: [0, 1, 0, 1, 1, 0, 0, 0, 0],
|
||||
180: [0, 1, 0, 0, 1, 1, 0, 0, 0],
|
||||
270: [0, 0, 0, 0, 1, 1, 0, 1, 0],
|
||||
},
|
||||
|
||||
[enumDirection.right]: {
|
||||
0: [0, 0, 0, 0, 1, 1, 0, 1, 0],
|
||||
90: [0, 0, 0, 1, 1, 0, 0, 1, 0],
|
||||
180: [0, 1, 0, 1, 1, 0, 0, 0, 0],
|
||||
270: [0, 1, 0, 0, 1, 1, 0, 0, 0],
|
||||
},
|
||||
};
|
||||
|
||||
export class MetaBeltBaseBuilding extends MetaBuilding {
|
||||
getHasDirectionLockAvailable() {
|
||||
return true;
|
||||
@@ -44,6 +67,17 @@ export class MetaBeltBaseBuilding extends MetaBuilding {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {number} rotation
|
||||
* @param {number} rotationVariant
|
||||
* @param {string} variant
|
||||
* @param {Entity} entity
|
||||
*/
|
||||
getSpecialOverlayRenderMatrix(rotation, rotationVariant, variant, entity) {
|
||||
return overlayMatrices[entity.components.Belt.direction][rotation];
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the entity at the given location
|
||||
* @param {Entity} entity
|
||||
|
||||
@@ -11,6 +11,8 @@ import { formatItemsPerSecond } from "../../core/utils";
|
||||
/** @enum {string} */
|
||||
export const enumMinerVariants = { chainable: "chainable" };
|
||||
|
||||
const overlayMatrix = [1, 1, 1, 1, 0, 1, 1, 1, 1];
|
||||
|
||||
export class MetaMinerBuilding extends MetaBuilding {
|
||||
constructor() {
|
||||
super("miner");
|
||||
@@ -41,6 +43,16 @@ export class MetaMinerBuilding extends MetaBuilding {
|
||||
return super.getAvailableVariants(root);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {number} rotation
|
||||
* @param {number} rotationVariant
|
||||
* @param {string} variant
|
||||
* @param {Entity} entity
|
||||
*/
|
||||
getSpecialOverlayRenderMatrix(rotation, rotationVariant, variant, entity) {
|
||||
return overlayMatrix;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the entity at the given location
|
||||
* @param {Entity} entity
|
||||
|
||||
@@ -25,13 +25,31 @@ export const enumUndergroundBeltVariantToTier = {
|
||||
[enumUndergroundBeltVariants.tier2]: 1,
|
||||
};
|
||||
|
||||
const overlayMatrices = [
|
||||
// Sender
|
||||
{
|
||||
0: [1, 1, 1, 0, 1, 0, 0, 1, 0],
|
||||
90: [0, 0, 0, 1, 1, 1, 0, 0, 0],
|
||||
180: [0, 1, 0, 0, 1, 0, 0, 1, 0],
|
||||
270: [0, 0, 0, 1, 1, 1, 0, 0, 0],
|
||||
},
|
||||
|
||||
// Receiver
|
||||
{
|
||||
0: [0, 1, 0, 0, 1, 0, 1, 1, 1],
|
||||
90: [0, 1, 0, 1, 1, 0, 0, 0, 0],
|
||||
180: [0, 1, 0, 0, 1, 1, 0, 0, 0],
|
||||
270: [0, 0, 0, 0, 1, 1, 0, 1, 0],
|
||||
},
|
||||
];
|
||||
|
||||
export class MetaUndergroundBeltBuilding extends MetaBuilding {
|
||||
constructor() {
|
||||
super("underground_belt");
|
||||
}
|
||||
|
||||
getSilhouetteColor() {
|
||||
return "#555";
|
||||
return "#222";
|
||||
}
|
||||
|
||||
getFlipOrientationAfterPlacement() {
|
||||
@@ -42,6 +60,16 @@ export class MetaUndergroundBeltBuilding extends MetaBuilding {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {number} rotation
|
||||
* @param {number} rotationVariant
|
||||
* @param {string} variant
|
||||
* @param {Entity} entity
|
||||
*/
|
||||
getSpecialOverlayRenderMatrix(rotation, rotationVariant, variant, entity) {
|
||||
return overlayMatrices[rotationVariant][rotation];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {GameRoot} root
|
||||
* @param {string} variant
|
||||
|
||||
Reference in New Issue
Block a user