feat: hit to shear
This commit is contained in:
1 parent
7a19924d1d
commit
533640cafd
5 files changed
+18
-34
No files matched your search
@@ -162,32 +162,6 @@ float Sheep::getHeadEatAngleScale(float a)
|
||||
|
||||
bool Sheep::interact(shared_ptr<Player> player)
|
||||
{
|
||||
shared_ptr<ItemInstance> item = player->inventory->getSelected();
|
||||
|
||||
// 4J-JEV: Fix for #88212,
|
||||
// Untrusted players shouldn't be able to sheer sheep.
|
||||
if (!player->isAllowedToInteract( shared_from_this() ))
|
||||
return false; //Animal::interact(player);
|
||||
|
||||
if (item != NULL && item->id == Item::shears->id && !isSheared() && !isBaby())
|
||||
{
|
||||
if (!level->isClientSide)
|
||||
{
|
||||
setSheared(true);
|
||||
int count = 1 + random->nextInt(3);
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
shared_ptr<ItemEntity> ie = spawnAtLocation(shared_ptr<ItemInstance>( new ItemInstance(Tile::cloth_Id, 1, getColor()) ), 1.0f);
|
||||
ie->yd += random->nextFloat() * 0.05f;
|
||||
ie->xd += (random->nextFloat() - random->nextFloat()) * 0.1f;
|
||||
ie->zd += (random->nextFloat() - random->nextFloat()) * 0.1f;
|
||||
}
|
||||
|
||||
player->awardStat( GenericStats::shearedEntity(eTYPE_SHEEP), GenericStats::param_shearedEntity(eTYPE_SHEEP) );
|
||||
}
|
||||
item->hurt(1, player);
|
||||
}
|
||||
|
||||
return Animal::interact(player);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user