12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- #pragma once
- #include "Block.h"
- #include "BlockType.h"
- #include "Item.h"
- #include "TypeRegistry.h"
- class BlockType;
- class ItemType;
- class BasicBlockType;
- class BasicBlock : public Block
- {
- public:
- BasicBlock(int typeId, Framework::Vec3<int> pos, int dimensionId);
- BasicBlock(int typeId,
- Framework::Vec3<int> pos,
- int dimensionId,
- bool hasInventory);
- virtual bool onTick(
- TickQueue* zQueue, int numTicks, bool& blocked) override;
- virtual void onPostTick() override;
- friend BasicBlockType;
- };
- class BasicBlockType : public BlockType
- {
- private:
- Framework::Text itemTypeName;
- int itemTypeId;
- bool transparent;
- bool passable;
- float speedModifier;
- bool interactable;
- protected:
- virtual void createSuperBlock(Block* zBlock, Item* zItem) const override;
- public:
- BasicBlockType();
- virtual bool initialize(Game* zGame) override;
- virtual Block* createBlock(
- Framework::Vec3<int> position, int dimensionId) const override;
- virtual Item* createItem() const override;
- Framework::Text getItemTypeName() const;
- virtual ItemType* createItemType() const override;
- void setItemTypeName(Framework::Text itemTypeName);
- int getItemTypeId() const;
- void setTransparent(bool transparent);
- bool isTransparent() const;
- void setPassable(bool passable);
- bool isPassable() const;
- void setSpeedModifier(float speedModifier);
- float getSpeedModifier() const;
- void setInteractable(bool interactable);
- bool isInteractable() const;
- };
- class BasicBlockTypeFactory : public BlockTypeFactoryBase<BasicBlockType>
- {
- public:
- BasicBlockTypeFactory();
- virtual BasicBlockType* createValue(
- Framework::JSON::JSONObject* zJson) const override;
- virtual BasicBlockType* fromJson(
- Framework::JSON::JSONObject* zJson) const override;
- virtual Framework::JSON::JSONObject* toJsonObject(
- BasicBlockType* zObject) const override;
- virtual JSONObjectValidationBuilder* addToValidator(
- JSONObjectValidationBuilder* builder) const override;
- virtual const char* getTypeToken() const override;
- };
|