ItemEntity.cpp 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #include "ItemEntity.h"
  2. ItemEntity::ItemEntity( Framework::Vec3<float> location, int dimensionId, int entityId )
  3. : Entity( ItemEntityType::INSTANCE, location, dimensionId, entityId )
  4. {
  5. ItemSlot* slot = new ItemSlot( __INT32_MAX__, 0, 0, 0, ANY_DIRECTION, 0 );
  6. addSlot( slot );
  7. faceOffset = { 0.f, 0.f, 0.f };
  8. maxHP = 10;
  9. currentHP = 10;
  10. stamina = 10;
  11. maxStamina = 10;
  12. hunger = 10;
  13. maxHunger = 10;
  14. thirst = 10;
  15. maxThirst = 10;
  16. targetDistanceLimit = 4;
  17. }
  18. void ItemEntity::tick( const Dimension* zDimension )
  19. {
  20. // TODO: add speed to next entity with free inventory
  21. }
  22. void ItemEntity::api( Framework::StreamReader* zRequest, NetworkResponse* zResponse )
  23. {
  24. }
  25. void ItemEntity::onFall( float collisionSpeed )
  26. {
  27. if( collisionSpeed >= 50.f )
  28. this->currentHP = 0;
  29. }
  30. ItemEntityType::ItemEntityType()
  31. : EntityType( ID )
  32. {}
  33. Entity* ItemEntityType::createEntity( Framework::Vec3<float> position, int dimensionId, int entityId ) const
  34. {
  35. return new ItemEntity( position, dimensionId, entityId );
  36. }