|
@@ -27,6 +27,30 @@ Player::Player( Framework::Vec3<float> location, int dimensionId, int entityId )
|
|
|
targetDistanceLimit = 4;
|
|
|
}
|
|
|
|
|
|
+void Player::afterPullStack( ItemSlot* zSlot, Direction dir, const Item* zItem, int count )
|
|
|
+{
|
|
|
+ for( auto slot : itemBar )
|
|
|
+ {
|
|
|
+ if( slot == zSlot )
|
|
|
+ {
|
|
|
+ needUpdate = 1;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void Player::afterPushStack( ItemSlot* zSlot, Direction dir, const Item* zItem, int count )
|
|
|
+{
|
|
|
+ for( auto slot : itemBar )
|
|
|
+ {
|
|
|
+ if( slot == zSlot )
|
|
|
+ {
|
|
|
+ needUpdate = 1;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
void Player::useItemSlot( ItemSlot* zSlot )
|
|
|
{
|
|
|
if( zSlot->zStack() )
|
|
@@ -243,6 +267,7 @@ void Player::api( Framework::StreamReader* zRequest, NetworkResponse* zResponse
|
|
|
case 3:
|
|
|
zRequest->lese( (char*)&leftHandPosition, 4 );
|
|
|
leftHandPosition = leftHandPosition % itemBar.getEintragAnzahl();
|
|
|
+ needUpdate = 1;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -259,11 +284,19 @@ PlayerEntityType::PlayerEntityType()
|
|
|
|
|
|
void PlayerEntityType::loadSuperEntity( Entity* zEntity, Framework::StreamReader* zReader ) const
|
|
|
{
|
|
|
- EntityType::loadSuperEntity( zEntity, zReader );
|
|
|
+ Player* zPlayer = dynamic_cast<Player*>(zEntity);
|
|
|
+ if( !zPlayer )
|
|
|
+ throw "PlayerEntityType::loadSuperEntity was called with an entity witch is not an instance of Player";
|
|
|
+ zReader->lese( (char*)&zPlayer->leftHandPosition, 4 );
|
|
|
+ EntityType::loadSuperEntity( zPlayer, zReader );
|
|
|
}
|
|
|
|
|
|
void PlayerEntityType::saveSuperEntity( Entity* zEntity, Framework::StreamWriter* zWriter ) const
|
|
|
{
|
|
|
+ Player* zPlayer = dynamic_cast<Player*>(zEntity);
|
|
|
+ if( !zPlayer )
|
|
|
+ throw "PlayerEntityType::saveSuperEntity was called with an entity witch is not an instance of Player";
|
|
|
+ zWriter->schreibe( (char*)&zPlayer->leftHandPosition, 4 );
|
|
|
EntityType::saveSuperEntity( zEntity, zWriter );
|
|
|
}
|
|
|
|