2020-08-08 13:22:16 -04:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "RedstoneSimulatorChunkData.h"
|
|
|
|
|
2020-08-28 16:42:37 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-08 13:22:16 -04:00
|
|
|
class ForEachSourceCallback
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
ForEachSourceCallback(const cChunk & Chunk, Vector3i Position, BLOCKTYPE CurrentBlock);
|
|
|
|
|
|
|
|
/** Callback invoked for each potential source position of the redstone component. */
|
|
|
|
void operator()(Vector3i Location);
|
|
|
|
|
2020-09-21 15:39:58 -04:00
|
|
|
/** Callback invoked for blocks supporting quasiconnectivity. */
|
|
|
|
void CheckIndirectPower();
|
2020-08-08 13:22:16 -04:00
|
|
|
|
2020-09-21 15:39:58 -04:00
|
|
|
// The maximum power level of all source locations.
|
2020-08-20 15:04:28 -04:00
|
|
|
PowerLevel Power;
|
2020-08-08 13:22:16 -04:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
2020-09-21 15:39:58 -04:00
|
|
|
/** Returns whether a potential source position that's occupied by Block should be treated as linked. */
|
|
|
|
static bool ShouldQueryLinkedPosition(BLOCKTYPE Block);
|
|
|
|
|
|
|
|
/** Asks redstone handlers adjacent to a solid block how much power they will deliver to the querying position, via the solid block.
|
|
|
|
Both QueryPosition and SolidBlockPosition are relative to Chunk. */
|
|
|
|
static PowerLevel QueryLinkedPower(const cChunk & Chunk, Vector3i QueryPosition, BLOCKTYPE QueryBlock, Vector3i SolidBlockPosition);
|
|
|
|
|
2020-08-08 13:22:16 -04:00
|
|
|
const cChunk & m_Chunk;
|
|
|
|
const Vector3i m_Position;
|
|
|
|
const BLOCKTYPE m_CurrentBlock;
|
|
|
|
};
|