BlockType.cpp 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #include "BlockType.h"
  2. #include "Block.h"
  3. using namespace Framework;
  4. BlockType::BlockType(int id,
  5. bool needsInstance,
  6. ModelInfo model,
  7. int initialMaxHP,
  8. bool needModelSubscription,
  9. bool fluid,
  10. char maxFlowDistance)
  11. : ReferenceCounter(),
  12. id(id),
  13. needsInstance(needsInstance),
  14. model(model),
  15. initialMaxHP(initialMaxHP),
  16. needModelSubscription(needModelSubscription),
  17. fluid(fluid),
  18. maxFlowDistance(maxFlowDistance)
  19. {}
  20. BlockType::~BlockType() {}
  21. Block* BlockType::createBlock(
  22. 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(),
  32. passable,
  33. speedModifier);
  34. }
  35. int BlockType::getId() const
  36. {
  37. return id;
  38. }
  39. bool BlockType::doesNeedInstance() const
  40. {
  41. return needsInstance;
  42. }
  43. bool BlockType::doesNeedModelSubscription() const
  44. {
  45. return needModelSubscription;
  46. }
  47. bool BlockType::isFluid() const
  48. {
  49. return fluid;
  50. }
  51. char BlockType::getMaxFlowDistance() const
  52. {
  53. return maxFlowDistance;
  54. }
  55. const ModelInfo& BlockType::getModelInfo() const
  56. {
  57. return model;
  58. }