1
0

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:
JK2K 2021-08-20 13:58:08 +02:00 committed by GitHub
parent 383867b6b0
commit 503b3c220f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 2 deletions

View File

@ -31,6 +31,7 @@ ion232 (Arran Ireland)
jan64
jasperarmstrong
jclever77 (Jon Clever)
JK2K
kevinr (Kevin Riggle)
keyboard
KingCol13

View File

@ -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))
)
)
);
}