mirror of
https://github.com/tobspr/shapez.io.git
synced 2025-06-13 13:04:03 +00:00
Internal test mod update
This commit is contained in:
parent
7eee790ec5
commit
64b2cea19f
@ -35,8 +35,7 @@ export class ModProcessor {
|
|||||||
* @returns {Boolean}
|
* @returns {Boolean}
|
||||||
*/
|
*/
|
||||||
static canProcess(entity) {
|
static canProcess(entity) {
|
||||||
abstract;
|
return true;
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,6 +1,12 @@
|
|||||||
import * as GeoZ from "../../main";
|
import * as GeoZ from "../../main";
|
||||||
import { Vector } from "../../../core/vector";
|
import { Vector, enumDirection } from "../../../core/vector";
|
||||||
import { Entity } from "../../../game/entity";
|
import { Entity } from "../../../game/entity";
|
||||||
|
import { ModProcessor, ProcessorParameters } from "../../mod_processor";
|
||||||
|
import { ShapeItem } from "../../../game/items/shape_item";
|
||||||
|
import { ShapeDefinition } from "../../../game/shape_definition";
|
||||||
|
import { ItemProcessorComponent } from "../../../game/components/item_processor";
|
||||||
|
import { ItemEjectorComponent } from "../../../game/components/item_ejector";
|
||||||
|
import { ItemAcceptorComponent } from "../../../game/components/item_acceptor";
|
||||||
|
|
||||||
class MetaTestBuilding extends GeoZ.MetaModBuilding {
|
class MetaTestBuilding extends GeoZ.MetaModBuilding {
|
||||||
static getId() {
|
static getId() {
|
||||||
@ -55,13 +61,61 @@ class MetaTestBuilding extends GeoZ.MetaModBuilding {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
setupEntityComponents() {}
|
/**
|
||||||
|
* Creates the entity at the given location
|
||||||
|
* @param {Entity} entity
|
||||||
|
*/
|
||||||
|
setupEntityComponents(entity) {
|
||||||
|
entity.addComponent(
|
||||||
|
new ItemProcessorComponent({
|
||||||
|
inputsPerCharge: 1,
|
||||||
|
processorType: SquareConverter.getType(),
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
entity.addComponent(
|
||||||
|
new ItemEjectorComponent({
|
||||||
|
slots: [{ pos: new Vector(0, 0), direction: enumDirection.top }],
|
||||||
|
})
|
||||||
|
);
|
||||||
|
entity.addComponent(
|
||||||
|
new ItemAcceptorComponent({
|
||||||
|
slots: [
|
||||||
|
{
|
||||||
|
pos: new Vector(0, 0),
|
||||||
|
directions: [enumDirection.bottom],
|
||||||
|
filter: "shape",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class SquareConverter extends ModProcessor {
|
||||||
|
/**
|
||||||
|
* @returns {Number}
|
||||||
|
*/
|
||||||
|
static getBaseSpeed() {
|
||||||
|
return 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Process ther current item
|
||||||
|
* @param {ProcessorParameters} param0
|
||||||
|
* @returns {Boolean} Whether to track the production towards the analytics
|
||||||
|
*/
|
||||||
|
static process({ outItems }) {
|
||||||
|
outItems.push({ item: new ShapeItem(ShapeDefinition.fromShortKey("SuSuSuSu")) });
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**@type {GeoZ.Mod}*/
|
/**@type {GeoZ.Mod}*/
|
||||||
const test = {
|
const test = {
|
||||||
name: "test",
|
name: "test",
|
||||||
buildings: [MetaTestBuilding],
|
buildings: [MetaTestBuilding],
|
||||||
|
processors: [SquareConverter],
|
||||||
shapes: [
|
shapes: [
|
||||||
{
|
{
|
||||||
id: "leaf",
|
id: "leaf",
|
||||||
|
Loading…
Reference in New Issue
Block a user