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

Add mod hook for adding custom input requirements

This commit is contained in:
Sense101 2022-02-08 14:43:18 +00:00
parent 0cacbcd267
commit e7a4307a5e

View File

@ -56,6 +56,8 @@ export const enumInputRequirements = {
storage: "storage", storage: "storage",
}; };
export const MOD_INPUT_REQUIREMENTS = [];
export class ItemAcceptorComponent extends Component { export class ItemAcceptorComponent extends Component {
static getId() { static getId() {
return "ItemAcceptor"; return "ItemAcceptor";
@ -138,6 +140,14 @@ export class ItemAcceptorComponent extends Component {
// make sure there is a slot and we match the filter // make sure there is a slot and we match the filter
if (slot && !(slot.filter && slot.filter != item.getItemType())) { if (slot && !(slot.filter && slot.filter != item.getItemType())) {
if (MOD_INPUT_REQUIREMENTS[this.inputRequirement]) {
return MOD_INPUT_REQUIREMENTS[this.inputRequirement].bind(this)({
entity,
item,
slotIndex,
});
}
switch (this.inputRequirement) { switch (this.inputRequirement) {
case null: { case null: {
return true; return true;