Fixed Enderman, monster aggro in creative (#1051)
Fixed endermans by making a invulnerable check
This commit is contained in:
@@ -410,9 +410,14 @@ bool EnderMan::hurt(DamageSource *source, float damage)
|
|||||||
|
|
||||||
if ( dynamic_cast<EntityDamageSource *>(source) != nullptr && source->getEntity()->instanceof(eTYPE_PLAYER))
|
if ( dynamic_cast<EntityDamageSource *>(source) != nullptr && source->getEntity()->instanceof(eTYPE_PLAYER))
|
||||||
{
|
{
|
||||||
aggroedByPlayer = true;
|
if (!dynamic_pointer_cast<Player>(source->getEntity())->abilities.invulnerable)
|
||||||
|
{
|
||||||
|
aggroedByPlayer = true;
|
||||||
|
}
|
||||||
|
else setCreepy(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (dynamic_cast<IndirectEntityDamageSource *>(source) != nullptr)
|
if (dynamic_cast<IndirectEntityDamageSource *>(source) != nullptr)
|
||||||
{
|
{
|
||||||
aggroedByPlayer = false;
|
aggroedByPlayer = false;
|
||||||
|
|||||||
@@ -60,7 +60,14 @@ bool Monster::hurt(DamageSource *source, float dmg)
|
|||||||
|
|
||||||
if (sourceEntity != shared_from_this())
|
if (sourceEntity != shared_from_this())
|
||||||
{
|
{
|
||||||
attackTarget = sourceEntity;
|
if (sourceEntity->instanceof(eTYPE_PLAYER))
|
||||||
|
{
|
||||||
|
if (!dynamic_pointer_cast<Player>(sourceEntity)->abilities.invulnerable)
|
||||||
|
{
|
||||||
|
attackTarget = sourceEntity;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else attackTarget = sourceEntity;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user