1
0

Zomb-ee and Skellingtons burning improvements

They don't burn unless they are in direct view of the sun god or are
protected by the sands of the souls of the underworld.
This commit is contained in:
Tiger Wang 2013-08-27 21:11:00 +01:00
parent f1f86c46d3
commit fa7def847b
2 changed files with 14 additions and 10 deletions

View File

@ -21,12 +21,13 @@ void cSkeleton::Tick(float a_Dt, cChunk & a_Chunk)
{
cMonster::Tick(a_Dt, a_Chunk);
// TODO Outsource
// TODO should do SkyLight check, mobs in the dark don´t burn
if ((GetWorld()->GetTimeOfDay() < (12000 + 1000)) && !IsOnFire())
if ((GetWorld()->GetBlockSkyLight(GetPosX(), GetPosY(), GetPosZ()) == 15) && (GetWorld()->GetBlock(GetPosX(), GetPosY(), GetPosZ()) != E_BLOCK_SOULSAND))
{
// Burn for 10 ticks, then decide again
StartBurning(10);
if ((GetWorld()->GetTimeOfDay() < (12000 + 1000)) && !IsOnFire())
{
// Burn for 100 ticks, then decide again
StartBurning(100);
}
}
}

View File

@ -3,10 +3,12 @@
#include "Zombie.h"
#include "../World.h"
#include "../LineBlockTracer.h"
// They're eating your brains!
cZombie::cZombie(void) :
super("Zombie", 54, "mob.zombie.hurt", "mob.zombie.death", 0.6, 1.8)
@ -20,12 +22,13 @@ cZombie::cZombie(void) :
void cZombie::Tick(float a_Dt, cChunk & a_Chunk)
{
super::Tick(a_Dt, a_Chunk);
// TODO Same as in cSkeleton :D
if ((GetWorld()->GetTimeOfDay() < (12000 + 1000)) && !IsOnFire())
if ((GetWorld()->GetBlockSkyLight(GetPosX(), GetPosY(), GetPosZ()) == 15) && (GetWorld()->GetBlock(GetPosX(), GetPosY(), GetPosZ()) != E_BLOCK_SOULSAND))
{
// Burn for 10 ticks, then decide again
StartBurning(10);
if ((GetWorld()->GetTimeOfDay() < (12000 + 1000)) && !IsOnFire())
{
// Burn for 100 ticks, then decide again
StartBurning(100);
}
}
}