mirror of
https://github.com/tobspr/shapez.io.git
synced 2024-10-27 20:34:29 +00:00
Remove instant eject flag
This commit is contained in:
parent
b3b8da04a1
commit
89294c7072
@ -77,7 +77,6 @@ export class MetaEnergyGenerator extends MetaBuilding {
|
|||||||
layer: enumLayer.wires,
|
layer: enumLayer.wires,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
instantEject: true,
|
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -65,7 +65,6 @@ export class MetaWireCrossingsBuilding extends MetaBuilding {
|
|||||||
entity.addComponent(
|
entity.addComponent(
|
||||||
new ItemEjectorComponent({
|
new ItemEjectorComponent({
|
||||||
slots: [], // set later
|
slots: [], // set later
|
||||||
instantEject: true,
|
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -26,10 +26,8 @@ export class ItemEjectorComponent extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static getSchema() {
|
static getSchema() {
|
||||||
// The cachedDestSlot, cachedTargetEntity fields
|
// The cachedDestSlot, cachedTargetEntity fields are not serialized.
|
||||||
// are not serialized.
|
|
||||||
return {
|
return {
|
||||||
instantEject: types.bool,
|
|
||||||
slots: types.array(
|
slots: types.array(
|
||||||
types.structured({
|
types.structured({
|
||||||
pos: types.vector,
|
pos: types.vector,
|
||||||
@ -57,7 +55,6 @@ export class ItemEjectorComponent extends Component {
|
|||||||
|
|
||||||
return new ItemEjectorComponent({
|
return new ItemEjectorComponent({
|
||||||
slots: slotsCopy,
|
slots: slotsCopy,
|
||||||
instantEject: this.instantEject,
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,14 +62,10 @@ export class ItemEjectorComponent extends Component {
|
|||||||
*
|
*
|
||||||
* @param {object} param0
|
* @param {object} param0
|
||||||
* @param {Array<{pos: Vector, direction: enumDirection, layer?: enumLayer}>=} param0.slots The slots to eject on
|
* @param {Array<{pos: Vector, direction: enumDirection, layer?: enumLayer}>=} param0.slots The slots to eject on
|
||||||
* @param {boolean=} param0.instantEject If the ejection is instant
|
|
||||||
*/
|
*/
|
||||||
constructor({ slots = [], instantEject = false }) {
|
constructor({ slots = [] }) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
// How long items take to eject
|
|
||||||
this.instantEject = instantEject;
|
|
||||||
|
|
||||||
this.setSlots(slots);
|
this.setSlots(slots);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -161,7 +154,7 @@ export class ItemEjectorComponent extends Component {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
this.slots[slotIndex].item = item;
|
this.slots[slotIndex].item = item;
|
||||||
this.slots[slotIndex].progress = this.instantEject ? 1 : 0;
|
this.slots[slotIndex].progress = 0;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,13 +1,10 @@
|
|||||||
import { GameSystemWithFilter } from "../game_system_with_filter";
|
|
||||||
import { globalConfig } from "../../core/config";
|
import { globalConfig } from "../../core/config";
|
||||||
import { DrawParameters } from "../../core/draw_parameters";
|
import { DrawParameters } from "../../core/draw_parameters";
|
||||||
import { Entity } from "../entity";
|
|
||||||
import { enumDirectionToVector, enumDirectionToAngle } from "../../core/vector";
|
|
||||||
import { ItemAcceptorComponent } from "../components/item_acceptor";
|
|
||||||
import { Loader } from "../../core/loader";
|
|
||||||
import { drawRotatedSprite } from "../../core/draw_utils";
|
|
||||||
import { BELT_ANIM_COUNT } from "./belt";
|
|
||||||
import { fastArrayDelete } from "../../core/utils";
|
import { fastArrayDelete } from "../../core/utils";
|
||||||
|
import { enumDirectionToVector } from "../../core/vector";
|
||||||
|
import { ItemAcceptorComponent } from "../components/item_acceptor";
|
||||||
|
import { Entity } from "../entity";
|
||||||
|
import { GameSystemWithFilter } from "../game_system_with_filter";
|
||||||
import { enumLayer } from "../root";
|
import { enumLayer } from "../root";
|
||||||
|
|
||||||
export class ItemAcceptorSystem extends GameSystemWithFilter {
|
export class ItemAcceptorSystem extends GameSystemWithFilter {
|
||||||
|
@ -29,7 +29,9 @@ export class SavegameInterface_V1002 extends SavegameInterface_V1001 {
|
|||||||
const entity = entities[i];
|
const entity = entities[i];
|
||||||
const beltComp = entity.components.Belt;
|
const beltComp = entity.components.Belt;
|
||||||
const ejectorComp = entity.components.ItemEjector;
|
const ejectorComp = entity.components.ItemEjector;
|
||||||
|
|
||||||
if (beltComp && ejectorComp) {
|
if (beltComp && ejectorComp) {
|
||||||
|
// @ts-ignore
|
||||||
ejectorComp.instantEject = true;
|
ejectorComp.instantEject = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user