1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- #pragma once
- #include "BlockType.h"
- #include "BasicBlocks.h"
- #include "Block.h"
- class BasicLightSourceBlockType;
- class LightSourceItemType;
- class LightSourceItem : public BasicBlockItem
- {
- protected:
- int color;
- public:
- LightSourceItem(const ItemType* zType, const BlockType* zPlacedBlockType, const char* name);
- virtual bool canBeStackedWith(const Item* zItem) const override;
- friend LightSourceItemType;
- friend BasicLightSourceBlockType;
- };
- class LightSourceItemType : public BasicBlockItemType
- {
- protected:
- LightSourceItemType(int id, const char* name, const ModelInfo model);
- virtual void loadSuperItem(Item* zItem, Framework::StreamReader* zReader) const override;
- virtual void saveSuperItem(const Item* zItem, Framework::StreamWriter* zWriter) const override;
- void initializeItem(LightSourceItem* zItem, int color, bool transparent = 1, bool passable = 1, float hardness = 0, int toolId = 0, float speedModifier = 1) const;
- };
- class BasicLightSource : public Block
- {
- protected:
- void setLight(int light);
- public:
- BasicLightSource(const BlockType* zType, Framework::Vec3<int> pos);
- virtual bool onTick(TickQueue* zQueue, int numTicks, bool& blocked) override;
- virtual void onPostTick() override;
- friend BasicLightSourceBlockType;
- };
- class BasicLightSourceBlockType : public BlockType
- {
- private:
- int itemType;
- protected:
- bool transparent;
- bool passable;
- float hardness;
- bool interactable;
- int color;
- BasicLightSourceBlockType(int typeId, int itemTypeId, ModelInfo model);
- virtual void createSuperBlock(Block* zBlock, Item* zItem) const override;
- virtual void loadSuperBlock(Block* zBlock, Framework::StreamReader* zReader, int dimensionId) const override;
- virtual void saveSuperBlock(Block* zBlock, Framework::StreamWriter* zWriter) const override;
- public:
- virtual Block* createBlock(Framework::Vec3<int> position) const override;
- virtual Item* createItem() const override;
- };
- class TorchBlockItemType : public LightSourceItemType
- {
- REGISTRABLE(TorchBlockItemType)
- protected:
- TorchBlockItemType();
- public:
- virtual Item* createItem() const override;
- };
- REGISTER(TorchBlockItemType, ItemType)
- class TorchBlockType : public BasicLightSourceBlockType
- {
- REGISTRABLE(TorchBlockType)
- protected:
- TorchBlockType();
- };
- REGISTER(TorchBlockType, BlockType)
|