mirror of
https://github.com/tobspr/shapez.io.git
synced 2024-10-27 20:34:29 +00:00
Added mod processing requirements (#1371)
* Added mod processing requirements * Added missing bind * Renamed to mods
This commit is contained in:
parent
86b104080f
commit
41c6b1c595
@ -38,11 +38,25 @@ const MAX_QUEUED_CHARGES = 2;
|
|||||||
* }} ProcessorImplementationPayload
|
* }} ProcessorImplementationPayload
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Type of a processor implementation
|
||||||
|
* @typedef {{
|
||||||
|
* entity: Entity,
|
||||||
|
* item: BaseItem,
|
||||||
|
* slotIndex: number
|
||||||
|
* }} ProccessingRequirementsImplementationPayload
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {Object<string, (ProcessorImplementationPayload) => void>}
|
* @type {Object<string, (ProcessorImplementationPayload) => void>}
|
||||||
*/
|
*/
|
||||||
export const MOD_ITEM_PROCESSOR_HANDLERS = {};
|
export const MOD_ITEM_PROCESSOR_HANDLERS = {};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {Object<string, (ProccessingRequirementsImplementationPayload) => boolean>}
|
||||||
|
*/
|
||||||
|
export const MODS_PROCESSING_REQUIREMENTS = {};
|
||||||
|
|
||||||
export class ItemProcessorSystem extends GameSystemWithFilter {
|
export class ItemProcessorSystem extends GameSystemWithFilter {
|
||||||
constructor(root) {
|
constructor(root) {
|
||||||
super(root, [ItemProcessorComponent]);
|
super(root, [ItemProcessorComponent]);
|
||||||
@ -163,6 +177,14 @@ export class ItemProcessorSystem extends GameSystemWithFilter {
|
|||||||
const itemProcessorComp = entity.components.ItemProcessor;
|
const itemProcessorComp = entity.components.ItemProcessor;
|
||||||
const pinsComp = entity.components.WiredPins;
|
const pinsComp = entity.components.WiredPins;
|
||||||
|
|
||||||
|
if (MODS_PROCESSING_REQUIREMENTS[itemProcessorComp.processingRequirement]) {
|
||||||
|
return MODS_PROCESSING_REQUIREMENTS[itemProcessorComp.processingRequirement].bind(this)({
|
||||||
|
entity,
|
||||||
|
item,
|
||||||
|
slotIndex,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
switch (itemProcessorComp.processingRequirement) {
|
switch (itemProcessorComp.processingRequirement) {
|
||||||
case enumItemProcessorRequirements.painterQuad: {
|
case enumItemProcessorRequirements.painterQuad: {
|
||||||
if (slotIndex === 0) {
|
if (slotIndex === 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user