Object respawning: Difference between revisions
→The revival map grid
imported>Leoetlino |
imported>Leoetlino |
||
Line 18: | Line 18: | ||
* or itemRow < playerRow1 | * or itemRow < playerRow1 | ||
* or itemRow > playerRow2 | * or itemRow > playerRow2 | ||
where the player column and row values are calculated as follows: | |||
<source lang="c++"> | |||
int col = std::clamp(((signed int)x + 5000) / 1000, 0, 9); | |||
int row = std::clamp(((signed int)z + 4000) / 1000, 0, 7); | |||
if ( (col + 0.5) * 1000.0 + -5000.0 >= x ) { | |||
*col1 = col - 1; | |||
*col2 = col; | |||
} else { | |||
*col1 = col; | |||
*col2 = col + 1; | |||
} | |||
if ( (row + 0.5) * 1000.0 + -4000.0 >= z ) { | |||
*row1 = row - 1; | |||
*row2 = row; | |||
} else { | |||
*row1 = row; | |||
*row2 = row + 1; | |||
} | |||
</source> | |||
== Revival during blood moons (RevivalBloodyMoon) == | == Revival during blood moons (RevivalBloodyMoon) == |