BlockType.cpp 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #include "BlockType.h"
  2. #include "Block.h"
  3. #include "Registries.h"
  4. using namespace Framework;
  5. BlockType::BlockType(int id,
  6. bool needsInstance,
  7. ModelInfo model,
  8. int initialMaxHP,
  9. bool needModelSubscription,
  10. bool fluid,
  11. char maxFlowDistance)
  12. : ReferenceCounter(),
  13. id(id),
  14. needsInstance(needsInstance),
  15. model(model),
  16. initialMaxHP(initialMaxHP),
  17. needModelSubscription(needModelSubscription),
  18. fluid(fluid),
  19. maxFlowDistance(maxFlowDistance)
  20. {}
  21. BlockType::~BlockType() {}
  22. Block* BlockType::createBlock(Framework::Vec3<int> position, bool passable, float speedModifier)
  23. {
  24. return new Block(this,
  25. position,
  26. model.getModel(),
  27. model.getTexture(),
  28. initialMaxHP,
  29. model.isTransparent(),
  30. needModelSubscription,
  31. model.getSize(), passable, speedModifier);
  32. }
  33. int BlockType::getId() const
  34. {
  35. return id;
  36. }
  37. bool BlockType::doesNeedInstance() const
  38. {
  39. return needsInstance;
  40. }
  41. bool BlockType::doesNeedModelSubscription() const
  42. {
  43. return needModelSubscription;
  44. }
  45. bool BlockType::isFluid() const
  46. {
  47. return fluid;
  48. }
  49. char BlockType::getMaxFlowDistance() const
  50. {
  51. return maxFlowDistance;
  52. }
  53. const ModelInfo& BlockType::getModelInfo() const
  54. {
  55. return model;
  56. }