mirror of
https://github.com/tobspr/shapez.io.git
synced 2025-12-13 02:01:51 +00:00
Undo unnecesary renaming
This commit is contained in:
parent
fb0a66f5ca
commit
5a310629c0
@ -87,7 +87,7 @@ export const globalConfig = {
|
||||
puzzleMaxBoundsSize: 20,
|
||||
puzzleValidationDurationSeconds: 30,
|
||||
|
||||
buildingAmountsToBelt: {
|
||||
buildingRatios: {
|
||||
cutter: 4,
|
||||
cutterQuad: 4,
|
||||
painter: 6,
|
||||
|
||||
@ -134,15 +134,12 @@ export class BeltPath extends BasicSerializableObject {
|
||||
*/
|
||||
tryAcceptItem(item, startProgress = 0) {
|
||||
if (this.spacingToFirstItem >= globalConfig.itemSpacingOnBelts) {
|
||||
// *Never* cap start progress, or if an item moves more than a belt in a tick, it breaks
|
||||
// instead return false if the start progress is too much
|
||||
// First, compute how much progress we can make *at max*
|
||||
const maxProgress = Math.max(0, this.spacingToFirstItem - globalConfig.itemSpacingOnBelts);
|
||||
if (startProgress > maxProgress) {
|
||||
return false;
|
||||
}
|
||||
const initialProgress = Math.min(maxProgress, startProgress);
|
||||
|
||||
this.items.unshift([this.spacingToFirstItem - startProgress, item]);
|
||||
this.spacingToFirstItem = startProgress;
|
||||
this.items.unshift([this.spacingToFirstItem - initialProgress, item]);
|
||||
this.spacingToFirstItem = initialProgress;
|
||||
|
||||
if (G_IS_DEV && globalConfig.debug.checkBeltPaths) {
|
||||
this.debug_checkIntegrity("accept-item");
|
||||
@ -273,11 +270,6 @@ export class BeltPath extends BasicSerializableObject {
|
||||
const matchingDirection = enumInvertedDirections[ejectingDirection];
|
||||
|
||||
return function (item, startProgress = 0.0) {
|
||||
// storage has to have its own duplicated logic, as it's the ONLY building which the acceptor can't filter for it
|
||||
const storageComp = targetEntity.components.Storage;
|
||||
if (storageComp && !storageComp.canAcceptItem(item)) {
|
||||
return false;
|
||||
}
|
||||
if (targetAcceptorComp.tryAcceptItem(matchingSlotIndex, matchingDirection, item, startProgress)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -104,7 +104,7 @@ export class MetaBalancerBuilding extends MetaBuilding {
|
||||
speedMultiplier = 1;
|
||||
}
|
||||
|
||||
const speed = root.hubGoals.getProcessingSpeed(enumItemProcessorTypes.balancer) * speedMultiplier;
|
||||
const speed = root.hubGoals.getProcessorBaseSpeed(enumItemProcessorTypes.balancer) * speedMultiplier;
|
||||
return [[T.ingame.buildingPlacement.infoTexts.speed, formatItemsPerSecond(speed)]];
|
||||
}
|
||||
|
||||
|
||||
@ -54,7 +54,7 @@ export class MetaCutterBuilding extends MetaBuilding {
|
||||
if (root.gameMode.throughputDoesNotMatter()) {
|
||||
return [];
|
||||
}
|
||||
const speed = root.hubGoals.getProcessingSpeed(
|
||||
const speed = root.hubGoals.getProcessorBaseSpeed(
|
||||
variant === enumCutterVariants.quad
|
||||
? enumItemProcessorTypes.cutterQuad
|
||||
: enumItemProcessorTypes.cutter
|
||||
|
||||
@ -47,7 +47,7 @@ export class MetaMixerBuilding extends MetaBuilding {
|
||||
if (root.gameMode.throughputDoesNotMatter()) {
|
||||
return [];
|
||||
}
|
||||
const speed = root.hubGoals.getProcessingSpeed(enumItemProcessorTypes.mixer);
|
||||
const speed = root.hubGoals.getProcessorBaseSpeed(enumItemProcessorTypes.mixer);
|
||||
return [[T.ingame.buildingPlacement.infoTexts.speed, formatItemsPerSecond(speed)]];
|
||||
}
|
||||
|
||||
|
||||
@ -73,15 +73,15 @@ export class MetaPainterBuilding extends MetaBuilding {
|
||||
switch (variant) {
|
||||
case defaultBuildingVariant:
|
||||
case enumPainterVariants.mirrored: {
|
||||
const speed = root.hubGoals.getProcessingSpeed(enumItemProcessorTypes.painter);
|
||||
const speed = root.hubGoals.getProcessorBaseSpeed(enumItemProcessorTypes.painter);
|
||||
return [[T.ingame.buildingPlacement.infoTexts.speed, formatItemsPerSecond(speed)]];
|
||||
}
|
||||
case enumPainterVariants.double: {
|
||||
const speed = root.hubGoals.getProcessingSpeed(enumItemProcessorTypes.painterDouble);
|
||||
const speed = root.hubGoals.getProcessorBaseSpeed(enumItemProcessorTypes.painterDouble);
|
||||
return [[T.ingame.buildingPlacement.infoTexts.speed, formatItemsPerSecond(speed, true)]];
|
||||
}
|
||||
case enumPainterVariants.quad: {
|
||||
const speed = root.hubGoals.getProcessingSpeed(enumItemProcessorTypes.painterQuad);
|
||||
const speed = root.hubGoals.getProcessorBaseSpeed(enumItemProcessorTypes.painterQuad);
|
||||
return [[T.ingame.buildingPlacement.infoTexts.speed, formatItemsPerSecond(speed)]];
|
||||
}
|
||||
}
|
||||
|
||||
@ -70,15 +70,15 @@ export class MetaRotaterBuilding extends MetaBuilding {
|
||||
}
|
||||
switch (variant) {
|
||||
case defaultBuildingVariant: {
|
||||
const speed = root.hubGoals.getProcessingSpeed(enumItemProcessorTypes.rotater);
|
||||
const speed = root.hubGoals.getProcessorBaseSpeed(enumItemProcessorTypes.rotater);
|
||||
return [[T.ingame.buildingPlacement.infoTexts.speed, formatItemsPerSecond(speed)]];
|
||||
}
|
||||
case enumRotaterVariants.ccw: {
|
||||
const speed = root.hubGoals.getProcessingSpeed(enumItemProcessorTypes.rotaterCCW);
|
||||
const speed = root.hubGoals.getProcessorBaseSpeed(enumItemProcessorTypes.rotaterCCW);
|
||||
return [[T.ingame.buildingPlacement.infoTexts.speed, formatItemsPerSecond(speed)]];
|
||||
}
|
||||
case enumRotaterVariants.rotate180: {
|
||||
const speed = root.hubGoals.getProcessingSpeed(enumItemProcessorTypes.rotater180);
|
||||
const speed = root.hubGoals.getProcessorBaseSpeed(enumItemProcessorTypes.rotater180);
|
||||
return [[T.ingame.buildingPlacement.infoTexts.speed, formatItemsPerSecond(speed)]];
|
||||
}
|
||||
}
|
||||
|
||||
@ -40,7 +40,7 @@ export class MetaStackerBuilding extends MetaBuilding {
|
||||
if (root.gameMode.throughputDoesNotMatter()) {
|
||||
return [];
|
||||
}
|
||||
const speed = root.hubGoals.getProcessingSpeed(enumItemProcessorTypes.stacker);
|
||||
const speed = root.hubGoals.getProcessorBaseSpeed(enumItemProcessorTypes.stacker);
|
||||
return [[T.ingame.buildingPlacement.infoTexts.speed, formatItemsPerSecond(speed)]];
|
||||
}
|
||||
|
||||
|
||||
@ -555,13 +555,13 @@ export class HubGoals extends BasicSerializableObject {
|
||||
*/
|
||||
getProcessorTimeWithUpgrades(upgrade, processorType) {
|
||||
assert(
|
||||
globalConfig.buildingAmountsToBelt[processorType],
|
||||
globalConfig.buildingRatios[processorType],
|
||||
"Processor type has no speed set in globalConfig.buildingSpeeds: " + processorType
|
||||
);
|
||||
|
||||
// super complicated maths here, but it works
|
||||
const processorTime =
|
||||
globalConfig.buildingAmountsToBelt[processorType] / globalConfig.beltSpeedItemsPerSecond;
|
||||
globalConfig.buildingRatios[processorType] / globalConfig.beltSpeedItemsPerSecond;
|
||||
return processorTime / upgrade;
|
||||
}
|
||||
/**
|
||||
@ -569,7 +569,7 @@ export class HubGoals extends BasicSerializableObject {
|
||||
* @param {enumItemProcessorTypes} processorType
|
||||
* @returns {number} process time in seconds
|
||||
*/
|
||||
getProcessingSpeed(processorType) {
|
||||
getProcessorBaseSpeed(processorType) {
|
||||
const time = this.getProcessingTime(processorType);
|
||||
if (!time) {
|
||||
return this.getBeltBaseSpeed();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user