1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2026-03-02 03:39:21 +00:00

Re-balance, fixes, etc etc

This commit is contained in:
tobspr
2020-09-27 22:22:05 +02:00
parent 62c0c45505
commit d27e9226be
29 changed files with 432 additions and 445 deletions

View File

@@ -5,6 +5,7 @@ import { enumPinSlotType, WiredPinsComponent } from "../components/wired_pins";
import { Entity } from "../entity";
import { MetaBuilding } from "../meta_building";
import { GameRoot } from "../root";
import { enumHubGoalRewards } from "../tutorial_goals";
const overlayMatrix = generateMatrixRotations([1, 1, 0, 1, 1, 1, 0, 1, 0]);
@@ -21,8 +22,7 @@ export class MetaAnalyzerBuilding extends MetaBuilding {
* @param {GameRoot} root
*/
getIsUnlocked(root) {
// @todo
return true;
return root.hubGoals.isRewardUnlocked(enumHubGoalRewards.reward_virtual_processing);
}
/** @returns {"wires"} **/

View File

@@ -4,6 +4,7 @@ import { enumPinSlotType, WiredPinsComponent } from "../components/wired_pins";
import { Entity } from "../entity";
import { MetaBuilding } from "../meta_building";
import { GameRoot } from "../root";
import { enumHubGoalRewards } from "../tutorial_goals";
export class MetaComparatorBuilding extends MetaBuilding {
constructor() {
@@ -18,8 +19,7 @@ export class MetaComparatorBuilding extends MetaBuilding {
* @param {GameRoot} root
*/
getIsUnlocked(root) {
// @todo
return true;
return root.hubGoals.isRewardUnlocked(enumHubGoalRewards.reward_virtual_processing);
}
/** @returns {"wires"} **/

View File

@@ -5,6 +5,7 @@ import { MetaBuilding, defaultBuildingVariant } from "../meta_building";
import { GameRoot } from "../root";
import { enumLogicGateType, LogicGateComponent } from "../components/logic_gate";
import { generateMatrixRotations } from "../../core/utils";
import { enumHubGoalRewards } from "../tutorial_goals";
/** @enum {string} */
export const enumLogicGateVariants = {
@@ -48,8 +49,7 @@ export class MetaLogicGateBuilding extends MetaBuilding {
* @param {GameRoot} root
*/
getIsUnlocked(root) {
// @todo
return true;
return root.hubGoals.isRewardUnlocked(enumHubGoalRewards.reward_logic_gates);
}
/** @returns {"wires"} **/

View File

@@ -5,6 +5,7 @@ import { enumPinSlotType, WiredPinsComponent } from "../components/wired_pins";
import { Entity } from "../entity";
import { defaultBuildingVariant, MetaBuilding } from "../meta_building";
import { GameRoot } from "../root";
import { enumHubGoalRewards } from "../tutorial_goals";
/** @enum {string} */
export const enumTransistorVariants = {
@@ -29,8 +30,7 @@ export class MetaTransistorBuilding extends MetaBuilding {
* @param {GameRoot} root
*/
getIsUnlocked(root) {
// @todo
return true;
return root.hubGoals.isRewardUnlocked(enumHubGoalRewards.reward_logic_gates);
}
/** @returns {"wires"} **/

View File

@@ -110,7 +110,12 @@ export class MetaVirtualProcessorBuilding extends MetaBuilding {
pinComp.setSlots([
{
pos: new Vector(0, 0),
direction: enumDirection.top,
direction: enumDirection.left,
type: enumPinSlotType.logicalEjector,
},
{
pos: new Vector(0, 0),
direction: enumDirection.right,
type: enumPinSlotType.logicalEjector,
},
{

View File

@@ -92,6 +92,11 @@ export class HubGoals extends BasicSerializableObject {
*/
this.upgradeLevels = {};
// Reset levels
for (const key in UPGRADES) {
this.upgradeLevels[key] = 0;
}
/**
* Stores the improvements for all upgrades
* @type {Object<string, number>}

View File

@@ -17,11 +17,11 @@ export class HUDWiresToolbar extends HUDBaseToolbar {
MetaWireTunnelBuilding,
MetaConstantSignalBuilding,
MetaLeverBuilding,
MetaTransistorBuilding,
MetaLogicGateBuilding,
MetaAnalyzerBuilding,
MetaVirtualProcessorBuilding,
MetaAnalyzerBuilding,
MetaComparatorBuilding,
MetaTransistorBuilding,
],
visibilityCondition: () =>
!this.root.camera.getIsMapOverlayActive() && this.root.currentLayer === "wires",

View File

@@ -70,9 +70,9 @@ export const KEYMAPPINGS = {
lever_wires: { keyCode: key("4") },
logic_gate: { keyCode: key("5") },
virtual_processor: { keyCode: key("6") },
transistor: { keyCode: key("7") },
analyzer: { keyCode: key("8") },
comparator: { keyCode: key("9") },
analyzer: { keyCode: key("7") },
comparator: { keyCode: key("8") },
transistor: { keyCode: key("9") },
},
placement: {

View File

@@ -4,7 +4,8 @@ import { enumLogicGateType, LogicGateComponent } from "../components/logic_gate"
import { enumPinSlotType } from "../components/wired_pins";
import { GameSystemWithFilter } from "../game_system_with_filter";
import { BOOL_FALSE_SINGLETON, BOOL_TRUE_SINGLETON, isTruthyItem } from "../items/boolean_item";
import { COLOR_ITEM_SINGLETONS } from "../items/color_item";
import { ColorItem, COLOR_ITEM_SINGLETONS } from "../items/color_item";
import { ShapeItem } from "../items/shape_item";
import { ShapeDefinition } from "../shape_definition";
export class LogicGateSystem extends GameSystemWithFilter {
@@ -153,18 +154,22 @@ export class LogicGateSystem extends GameSystemWithFilter {
/**
* @param {Array<BaseItem|null>} parameters
* @returns {BaseItem}
* @returns {[BaseItem, BaseItem]}
*/
compute_ROTATE(parameters) {
const item = parameters[0];
if (!item || item.getItemType() !== "shape") {
// Not a shape
return null;
return [null, null];
}
const definition = /** @type {ShapeItem} */ (item).definition;
const rotatedDefinition = this.root.shapeDefinitionMgr.shapeActionRotateCW(definition);
return this.root.shapeDefinitionMgr.getShapeItemFromDefinition(rotatedDefinition);
const rotatedDefinitionCCW = this.root.shapeDefinitionMgr.shapeActionRotateCCW(definition);
const rotatedDefinitionCW = this.root.shapeDefinitionMgr.shapeActionRotateCW(definition);
return [
this.root.shapeDefinitionMgr.getShapeItemFromDefinition(rotatedDefinitionCCW),
this.root.shapeDefinitionMgr.getShapeItemFromDefinition(rotatedDefinitionCW),
];
}
/**

View File

@@ -43,7 +43,7 @@ export const tutorialGoals = [
// Circle
{
shape: "CuCuCuCu", // belts t1
required: 40,
required: 30,
reward: enumHubGoalRewards.reward_cutter_and_trash,
},
@@ -59,14 +59,14 @@ export const tutorialGoals = [
// Rectangle
{
shape: "RuRuRuRu", // miners t1
required: 85,
required: 70,
reward: enumHubGoalRewards.reward_balancer,
},
// 4
{
shape: "RuRu----", // processors t2
required: 100,
required: 70,
reward: enumHubGoalRewards.reward_rotater,
},
@@ -74,14 +74,14 @@ export const tutorialGoals = [
// Rotater
{
shape: "Cu----Cu", // belts t2
required: 175,
required: 170,
reward: enumHubGoalRewards.reward_tunnel,
},
// 6
{
shape: "Cu------", // miners t2
required: 250,
required: 270,
reward: enumHubGoalRewards.reward_painter,
},
@@ -89,14 +89,14 @@ export const tutorialGoals = [
// Painter
{
shape: "CrCrCrCr", // unused
required: 500,
required: 300,
reward: enumHubGoalRewards.reward_rotater_ccw,
},
// 8
{
shape: "RbRb----", // painter t2
required: 700,
required: 480,
reward: enumHubGoalRewards.reward_mixer,
},
@@ -104,7 +104,7 @@ export const tutorialGoals = [
// Mixing (purple)
{
shape: "CpCpCpCp", // belts t3
required: 800,
required: 600,
reward: enumHubGoalRewards.reward_merger,
},
@@ -112,7 +112,7 @@ export const tutorialGoals = [
// STACKER: Star shape + cyan
{
shape: "ScScScSc", // miners t3
required: 900,
required: 800,
reward: enumHubGoalRewards.reward_stacker,
},
@@ -128,7 +128,7 @@ export const tutorialGoals = [
// Blueprints
{
shape: "CbCbCbRb:CwCwCwCw",
required: 1250,
required: 1000,
reward: enumHubGoalRewards.reward_blueprints,
},
@@ -136,7 +136,7 @@ export const tutorialGoals = [
// Tunnel Tier 2
{
shape: "RpRpRpRp:CwCwCwCw", // painting t3
required: 5000,
required: 3800,
reward: enumHubGoalRewards.reward_underground_belt_tier_2,
},
@@ -145,7 +145,7 @@ export const tutorialGoals = [
{
// @todo
shape: "CuCuCuCu",
required: 7000,
required: 0,
reward: enumHubGoalRewards.reward_belt_reader,
},
@@ -153,7 +153,7 @@ export const tutorialGoals = [
// Storage
{
shape: "SrSrSrSr:CyCyCyCy", // unused
required: 7500,
required: 10000,
reward: enumHubGoalRewards.reward_storage,
},
@@ -161,7 +161,7 @@ export const tutorialGoals = [
// Quad Cutter
{
shape: "SrSrSrSr:CyCyCyCy:SwSwSwSw", // belts t4 (two variants)
required: 12500,
required: 6000,
reward: enumHubGoalRewards.reward_cutter_quad,
},
@@ -169,7 +169,7 @@ export const tutorialGoals = [
// Double painter
{
shape: "CbRbRbCb:CwCwCwCw:WbWbWbWb", // miner t4 (two variants)
required: 15000,
required: 20000,
reward: enumHubGoalRewards.reward_painter_double,
},

View File

@@ -4,6 +4,7 @@ import { MetaConstantSignalBuilding } from "./buildings/constant_signal";
import { enumCutterVariants, MetaCutterBuilding } from "./buildings/cutter";
import { MetaDisplayBuilding } from "./buildings/display";
import { MetaLeverBuilding } from "./buildings/lever";
import { MetaLogicGateBuilding } from "./buildings/logic_gate";
import { enumMinerVariants, MetaMinerBuilding } from "./buildings/miner";
import { MetaMixerBuilding } from "./buildings/mixer";
import { enumPainterVariants, MetaPainterBuilding } from "./buildings/painter";
@@ -53,7 +54,7 @@ export const enumHubGoalRewardsToContentUnlocked = {
[enumHubGoalRewards.reward_constant_signal]: typed([
[MetaConstantSignalBuilding, defaultBuildingVariant],
]),
[enumHubGoalRewards.reward_logic_gates]: null, // @TODO!
[enumHubGoalRewards.reward_logic_gates]: typed([[MetaLogicGateBuilding, defaultBuildingVariant]]),
[enumHubGoalRewards.reward_virtual_processing]: null, // @TODO!
[enumHubGoalRewards.reward_wires_filters_and_levers]: typed([

View File

@@ -23,19 +23,19 @@ const fixedImprovements = [0.5, 0.5, 1, 1, 2, 2];
export const UPGRADES = {
belt: [
{
required: [{ shape: "CuCuCuCu", amount: 150 }],
required: [{ shape: "CuCuCuCu", amount: 60 }],
},
{
required: [{ shape: "--CuCu--", amount: 1000 }],
required: [{ shape: "--CuCu--", amount: 500 }],
},
{
required: [{ shape: "CpCpCpCp", amount: 5000 }],
required: [{ shape: "CpCpCpCp", amount: 1000 }],
},
{
required: [{ shape: "SrSrSrSr:CyCyCyCy", amount: 12000 }],
required: [{ shape: "SrSrSrSr:CyCyCyCy", amount: 6000 }],
},
{
required: [{ shape: "SrSrSrSr:CyCyCyCy:SwSwSwSw", amount: 20000 }],
required: [{ shape: "SrSrSrSr:CyCyCyCy:SwSwSwSw", amount: 25000 }],
},
{
required: [{ shape: finalGameShape, amount: 50000 }],
@@ -45,73 +45,73 @@ export const UPGRADES = {
miner: [
{
required: [{ shape: "RuRuRuRu", amount: 400 }],
required: [{ shape: "RuRuRuRu", amount: 300 }],
},
{
required: [{ shape: "Cu------", amount: 3000 }],
required: [{ shape: "Cu------", amount: 800 }],
},
{
required: [{ shape: "ScScScSc", amount: 7000 }],
required: [{ shape: "ScScScSc", amount: 3500 }],
},
{
required: [{ shape: "CwCwCwCw:WbWbWbWb", amount: 15000 }],
required: [{ shape: "CwCwCwCw:WbWbWbWb", amount: 23000 }],
},
{
required: [{ shape: "CbRbRbCb:CwCwCwCw:WbWbWbWb", amount: 30000 }],
required: [{ shape: "CbRbRbCb:CwCwCwCw:WbWbWbWb", amount: 50000 }],
},
{
required: [{ shape: finalGameShape, amount: 65000 }],
required: [{ shape: finalGameShape, amount: 50000 }],
excludePrevious: true,
},
],
processors: [
{
required: [{ shape: "SuSuSuSu", amount: 600 }],
required: [{ shape: "SuSuSuSu", amount: 500 }],
},
{
required: [{ shape: "RuRu----", amount: 2000 }],
required: [{ shape: "RuRu----", amount: 600 }],
},
{
required: [{ shape: "CgScScCg", amount: 15000 }],
required: [{ shape: "CgScScCg", amount: 3500 }],
},
{
required: [{ shape: "CwCrCwCr:SgSgSgSg", amount: 20000 }],
required: [{ shape: "CwCrCwCr:SgSgSgSg", amount: 25000 }],
},
{
required: [{ shape: "WrRgWrRg:CwCrCwCr:SgSgSgSg", amount: 30000 }],
required: [{ shape: "WrRgWrRg:CwCrCwCr:SgSgSgSg", amount: 50000 }],
},
{
required: [{ shape: finalGameShape, amount: 75000 }],
required: [{ shape: finalGameShape, amount: 50000 }],
excludePrevious: true,
},
],
painting: [
{
required: [{ shape: "RbRb----", amount: 1000 }],
required: [{ shape: "RbRb----", amount: 600 }],
},
{
required: [{ shape: "WrWrWrWr", amount: 3000 }],
required: [{ shape: "WrWrWrWr", amount: 3800 }],
},
{
required: [{ shape: "RpRpRpRp:CwCwCwCw", amount: 15000 }],
required: [{ shape: "RpRpRpRp:CwCwCwCw", amount: 6500 }],
},
{
required: [{ shape: "WpWpWpWp:CwCwCwCw:WpWpWpWp", amount: 20000 }],
required: [{ shape: "WpWpWpWp:CwCwCwCw:WpWpWpWp", amount: 25000 }],
},
{
required: [{ shape: "WpWpWpWp:CwCwCwCw:WpWpWpWp:CwCwCwCw", amount: 30000 }],
required: [{ shape: "WpWpWpWp:CwCwCwCw:WpWpWpWp:CwCwCwCw", amount: 50000 }],
},
{
required: [{ shape: finalGameShape, amount: 100000 }],
required: [{ shape: finalGameShape, amount: 50000 }],
excludePrevious: true,
},
],
};
// Tiers need % of the previous tier as requirement too
const tierGrowth = 1.8;
const tierGrowth = 2.5;
// Automatically generate tier levels
for (const upgradeId in UPGRADES) {