ItemEntity.cpp 773 B

1234567891011121314151617181920212223242526272829303132333435
  1. #include "ItemEntity.h"
  2. #include "ItemSlot.h"
  3. #include "Globals.h"
  4. ItemEntity::ItemEntity()
  5. : Entity( ItemEntityType::INSTANCE, 1 )
  6. {
  7. slot = new ItemSlot( INT_MAX, 0, 0, 0, ANY_DIRECTION, 0 );
  8. addSlot( slot );
  9. currentGame->setVisibility( this, 1 );
  10. // TODO: initialize model3d
  11. }
  12. bool ItemEntity::tick( double time )
  13. {
  14. lock();
  15. if( !model && slot->zStack() )
  16. {
  17. setModelDaten( slot->zStack()->zItem()->zItemType()->getItemModel() );
  18. textur = slot->zStack()->zItem()->zItemType()->getItemTextur();
  19. }
  20. unlock();
  21. return Entity::tick( time );
  22. }
  23. ItemEntityType::ItemEntityType()
  24. : EntityType( ID )
  25. {}
  26. Entity* ItemEntityType::createEntity() const
  27. {
  28. return new ItemEntity();
  29. }