Block.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #pragma once
  2. #include <Model3D.h>
  3. #include "Area.h"
  4. #include "BlockType.h"
  5. #include "FactoryCraftModel.h"
  6. #include "ModelInfo.h"
  7. using namespace Framework;
  8. class BasicBlockItemType;
  9. class Chunk;
  10. class Block : public FactoryCraftModel
  11. {
  12. protected:
  13. float hp;
  14. float maxHP;
  15. const BlockType* zType;
  16. bool sideVisible[6];
  17. Vec3<int> location;
  18. unsigned char lightData[6 * 6];
  19. char needRequestModelInfo;
  20. char flowOptions;
  21. char distanceToSource;
  22. bool passable;
  23. float speedModifier;
  24. Direction frontDirection;
  25. ModelInfo* currentModelInfo;
  26. public:
  27. Block(const BlockType* zType,
  28. Vec3<int> position,
  29. Model3DData* model,
  30. Model3DTexture* texture,
  31. int maxHp,
  32. bool transparent,
  33. bool needRequestModelInfo,
  34. float size,
  35. bool passable,
  36. float speedModifier,
  37. Direction frontDirection);
  38. virtual ~Block();
  39. bool tick(double time) override;
  40. void setFlow(char flowOptions, char distanceToSource);
  41. void api(char* message);
  42. void copyLightTo(Block* zB);
  43. void setLightData(Direction dir, unsigned char* data, Chunk* zC);
  44. __int64 getMaxLight() const;
  45. const unsigned char* getLightData(Direction dir) const;
  46. bool isVisible() const;
  47. Direction getFrontDirection() const;
  48. Vec3<int> getLocation() const;
  49. const BlockType* zBlockType() const;
  50. Skeleton* zSkeleton() const;
  51. Text printLightInfo();
  52. char getFlowOptions() const;
  53. char getDistanceToSource() const;
  54. const ModelInfo& getCurrentModelInfo() const;
  55. friend Chunk;
  56. };