Slime spawinig in swamps (#5281)
* test commit * hook test/ .gitignore * Slime add light limitation * Slime spawning moon light * Casting fix for clang * Removal of redundant changes Extracted moon phases amount to const
This commit is contained in:
parent
383867b6b0
commit
503b3c220f
@ -31,6 +31,7 @@ ion232 (Arran Ireland)
|
||||
jan64
|
||||
jasperarmstrong
|
||||
jclever77 (Jon Clever)
|
||||
JK2K
|
||||
kevinr (Kevin Riggle)
|
||||
keyboard
|
||||
KingCol13
|
||||
|
@ -208,12 +208,29 @@ bool cMobSpawner::CanSpawnHere(cChunk * a_Chunk, Vector3i a_RelPos, eMonsterType
|
||||
case mtMagmaCube:
|
||||
case mtSlime:
|
||||
{
|
||||
const int AMOUNT_MOON_PHASES = 8;
|
||||
auto maxLight = Random.RandInt(0, 7);
|
||||
auto moonPhaseNumber = static_cast<int>(std::floor(a_Chunk->GetWorld()->GetWorldAge().count() / 24000)) % AMOUNT_MOON_PHASES;
|
||||
auto moonThreshold = static_cast<float>(std::abs(moonPhaseNumber - (AMOUNT_MOON_PHASES / 2)) / (AMOUNT_MOON_PHASES / 2));
|
||||
return
|
||||
(
|
||||
(TargetBlock == E_BLOCK_AIR) &&
|
||||
(BlockAbove == E_BLOCK_AIR) &&
|
||||
((!cBlockInfo::IsTransparent(BlockBelow)) || (a_DisableSolidBelowCheck)) &&
|
||||
((a_RelPos.y <= 40) || (a_Biome == biSwampland))
|
||||
(
|
||||
(!cBlockInfo::IsTransparent(BlockBelow)) ||
|
||||
(a_DisableSolidBelowCheck)) &&
|
||||
(
|
||||
(a_RelPos.y <= 40) ||
|
||||
(
|
||||
(a_Biome == biSwampland) &&
|
||||
(a_RelPos.y >= 50) &&
|
||||
(a_RelPos.y <= 70) &&
|
||||
(SkyLight <= maxLight) &&
|
||||
(BlockLight <= maxLight) &&
|
||||
(Random.RandBool(moonThreshold)) &&
|
||||
(Random.RandBool(0.5))
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user