38 lines
1001 B
C
38 lines
1001 B
C
//
|
|
// Created by bruno on 10.6.2025.
|
|
//
|
|
|
|
#ifndef FACTORYGAME_CRAFTER_H
|
|
#define FACTORYGAME_CRAFTER_H
|
|
|
|
#include "../items/item.h"
|
|
|
|
#define MATCHES(a, b, x, y) ((a == x && b == y) || (a == y && b == x))
|
|
|
|
|
|
enum {
|
|
SLOT_INPUT1 = 0,
|
|
SLOT_INPUT2 = 1,
|
|
SLOT_OUTPUT = 2,
|
|
MACHINE_SLOTS = 3
|
|
};
|
|
|
|
typedef struct MachineRecipe {
|
|
ItemType input1;
|
|
ItemType input2; // use TYPE_AIR if single-input
|
|
ItemType output;
|
|
uint16_t ticksRequired; // used for output delay
|
|
} MachineRecipe;
|
|
|
|
void updateMachine(Tile *tile,
|
|
const MachineRecipe *recipes, size_t recipeCount,
|
|
uint8_t waveform, uint16_t freqStart, uint16_t freqStep);
|
|
|
|
bool findMachineRecipe(const MachineRecipe *recipes, size_t count, ItemType in1, ItemType in2,
|
|
ItemType *out, uint16_t *ticks);
|
|
|
|
void initMachineTile(ItemType type, const MachineRecipe *recipes, size_t count,
|
|
uint8_t startFrame, uint8_t divisor);
|
|
|
|
#endif //FACTORYGAME_AMMOCRAFTER_H
|