1
0
Fork 0

Fixed snow golems and added documentation to damage type and added damage type for damage from environment to mobs (#4877)

* made snow golems not crashing the server anymore

* changed damage type to environment

* updated damage in API dopcumentation and changed enderman damage type

* removed incidental d in the code

Co-authored-by: 12xx12 <12xx12100@gmail.com>
This commit is contained in:
12xx12 2020-09-17 20:06:41 +02:00 committed by GitHub
parent c3d2956ba5
commit ba5312c198
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 165 additions and 4 deletions

View File

@ -14330,6 +14330,166 @@ end
{ {
Notes = "Unknown click action" Notes = "Unknown click action"
}, },
dtAdmin =
{
Notes = "Damage applied by an admin command"
},
dtArrow =
{
Notes = "Damage received by being attacked by a projectile, possibly from a mob"
},
dtArrowAttack =
{
Notes = "Damage received by being attacked by a projectile, possibly from a mob"
},
dtAttack =
{
Notes = "Damage recieved by being attacked by a mob"
},
dtBurning =
{
Notes = "Damage from being on fire"
},
dtCacti =
{
Notes = "Damage from contact with a cactus block"
},
dtCactus =
{
Notes = "Damage from contact with a cactus block"
},
dtCactusContact =
{
Notes = "Damage from contact with a cactus block"
},
dtCactuses =
{
Notes = "Damage from contact with a cactus block"
},
dtDrown =
{
Notes = "Damage received by drowning in water / lava"
},
dtDrowning =
{
Notes = "Damage received by drowning in water / lava"
},
dtEnderPearl =
{
Notes = "Damage received by throwing an ender pearl and being teleported by it"
},
dtEntityAttack =
{
Notes = "Damage recieved by being attacked by a mob"
},
dtEnvironment =
{
Notes = "Damage dealt to mobs from environment: enderman in rain, snow golem in desert"
},
dtExplosion =
{
Notes = "Damage applied by an explosion"
},
dtFall =
{
Notes = "Damage from falling down. Dealt when hitting the ground"
},
dtFalling =
{
Notes = "Damage from falling down. Dealt when hitting the ground"
},
dtFireContact =
{
Notes = "Damage received by standing inside a fire block"
},
dtHunger =
{
Notes = "Damage received from hunger"
},
dtInFire =
{
Notes = "Damage received by standing inside a fire block"
},
dtInVoid =
{
Notes = "Damage received by falling into the Void (Y < 0)"
},
dtLava =
{
Notes = "Damage received by a contact with a lava block"
},
dtLavaContact =
{
Notes = "Damage received by a contact with a lava block"
},
dtLightning =
{
Notes = "Damage from being hit by a lightning strike"
},
dtMob =
{
Notes = "Damage received by being attacked by a mob"
},
dtMobAttack =
{
Notes = "Damage received by being attacked by a mob"
},
dtOnFire =
{
Notes = "Damage from being on fire"
},
dtPawnAttack =
{
Notes = "Damage received by being attacked by a mob"
},
dtPlugin =
{
Notes = "Damage applied by an admin command"
},
dtPoison =
{
Notes = "Damage applied by the poison effect"
},
dtPoisoning =
{
Notes = "Damage applied by the poison effect"
},
dtPotionOfHarming =
{
Notes = "Damage applied by the potion of harming"
},
dtProjectile =
{
Notes = "Damage received by being attacked by a projectile, possibly from a mob"
},
dtRangedAttack =
{
Notes = "Damage received by being attacked by a projectile, possibly from a mob"
},
dtStarvation =
{
Notes = "Damage received from hunger"
},
dtStarving =
{
Notes = "Damage received from hunger"
},
dtSuffocating =
{
Notes = "Damage from suffocating inside a block"
},
dtSuffocation =
{
Notes = "Damage from suffocating inside a block"
},
dtWither =
{
Notes = "Damage from the wither effect"
},
dtWithering =
{
Notes = "Damage from the wither effect"
},
E_BLOCK_ACACIA_DOOR = E_BLOCK_ACACIA_DOOR =
{ {
Notes = "The blocktype for acacia door" Notes = "The blocktype for acacia door"

View File

@ -273,6 +273,7 @@ enum eDamageType
dtEnderPearl, // Thrown an ender pearl, teleported by it dtEnderPearl, // Thrown an ender pearl, teleported by it
dtAdmin, // Damage applied by an admin command dtAdmin, // Damage applied by an admin command
dtExplosion, // Damage applied by an explosion dtExplosion, // Damage applied by an explosion
dtEnvironment, // Damage dealt to mobs from environment: enderman in rain, snow golem in desert
// Some common synonyms: // Some common synonyms:
dtPawnAttack = dtAttack, dtPawnAttack = dtAttack,

View File

@ -82,7 +82,7 @@ public:
bool TrySpawnSnowGolem(cWorld & a_World, cPlayer & a_Player, const Vector3i a_PumpkinPos) bool TrySpawnSnowGolem(cWorld & a_World, cPlayer & a_Player, const Vector3i a_PumpkinPos)
{ {
ASSERT(a_PumpkinPos.y > 1); ASSERT(a_PumpkinPos.y > 1);
ASSERT(a_World.GetBlock(a_PumpkinPos.addedY(-1)) == E_BLOCK_SNOW); ASSERT(a_World.GetBlock(a_PumpkinPos.addedY(-1)) == E_BLOCK_SNOW_BLOCK);
// Need one more snow block 2 blocks below the pumpkin: // Need one more snow block 2 blocks below the pumpkin:
if (a_World.GetBlock(a_PumpkinPos.addedY(-2)) != E_BLOCK_SNOW_BLOCK) if (a_World.GetBlock(a_PumpkinPos.addedY(-2)) != E_BLOCK_SNOW_BLOCK)

View File

@ -159,14 +159,14 @@ void cEnderman::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
return; return;
} }
// Take damage when wet, drowning damage seems to be most appropriate // Take damage when wet
if ( if (
cChunkDef::IsValidHeight(POSY_TOINT) && cChunkDef::IsValidHeight(POSY_TOINT) &&
(GetWorld()->IsWeatherWetAtXYZ(GetPosition().Floor()) || IsInWater()) (GetWorld()->IsWeatherWetAtXYZ(GetPosition().Floor()) || IsInWater())
) )
{ {
EventLosePlayer(); EventLosePlayer();
TakeDamage(dtDrowning, nullptr, 1, 0); TakeDamage(dtEnvironment, nullptr, 1, 0);
// TODO teleport to a safe location // TODO teleport to a safe location
} }
} }

View File

@ -38,7 +38,7 @@ void cSnowGolem::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
} }
if (IsBiomeNoDownfall(m_World->GetBiomeAt(POSX_TOINT, POSZ_TOINT))) if (IsBiomeNoDownfall(m_World->GetBiomeAt(POSX_TOINT, POSZ_TOINT)))
{ {
TakeDamage(*this); TakeDamage(dtEnvironment, nullptr, GetRawDamageAgainst(*this), GetKnockbackAmountAgainst(*this));
} }
else else
{ {