1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2025-06-13 13:04:03 +00:00

Added can process

This commit is contained in:
DJ1TJOO 2022-02-13 22:04:12 +01:00
parent eb73ca0dd9
commit f3cf68694c

View File

@ -56,6 +56,10 @@ export const MOD_ITEM_PROCESSOR_HANDLERS = {};
* @type {Object<string, (ProccessingRequirementsImplementationPayload) => boolean>} * @type {Object<string, (ProccessingRequirementsImplementationPayload) => boolean>}
*/ */
export const MODS_PROCESSING_REQUIREMENTS = {}; export const MODS_PROCESSING_REQUIREMENTS = {};
/**
* @type {Object<string, ({entity: Entity}) => boolean>}
*/
export const MODS_CAN_PROCESS = {};
export class ItemProcessorSystem extends GameSystemWithFilter { export class ItemProcessorSystem extends GameSystemWithFilter {
constructor(root) { constructor(root) {
@ -214,6 +218,12 @@ export class ItemProcessorSystem extends GameSystemWithFilter {
canProcess(entity) { canProcess(entity) {
const processorComp = entity.components.ItemProcessor; const processorComp = entity.components.ItemProcessor;
if (MODS_CAN_PROCESS[processorComp.processingRequirement]) {
return MODS_CAN_PROCESS[processorComp.processingRequirement].bind(this)({
entity,
});
}
switch (processorComp.processingRequirement) { switch (processorComp.processingRequirement) {
// DEFAULT // DEFAULT
// By default, we can start processing once all inputs are there // By default, we can start processing once all inputs are there