@@ -4951,36 +4951,28 @@ v3f findSpawnPos(ServerMap &map)
4951
4951
{
4952
4952
s32 range = 1 + i;
4953
4953
// We're going to try to throw the player to this position
4954
- v2s16 nodepos2d = v2s16 (-range + (myrand ()%(range*2 )),
4955
- -range + (myrand ()%(range*2 )));
4956
- // v2s16 sectorpos = getNodeSectorPos(nodepos2d);
4957
- // Get ground height at point (fallbacks to heightmap function)
4954
+ v2s16 nodepos2d = v2s16 (
4955
+ -range + (myrand () % (range * 2 )),
4956
+ -range + (myrand () % (range * 2 )));
4957
+
4958
+ // Get ground height at point
4958
4959
s16 groundheight = map.findGroundLevel (nodepos2d);
4959
- // Don't go underwater
4960
- if (groundheight <= water_level)
4961
- {
4962
- // infostream<<"-> Underwater"<<std::endl;
4960
+ if (groundheight <= water_level) // Don't go underwater
4963
4961
continue ;
4964
- }
4965
- // Don't go to high places
4966
- if (groundheight > water_level + 6 )
4967
- {
4968
- // infostream<<"-> Underwater"<<std::endl;
4962
+ if (groundheight > water_level + 6 ) // Don't go to high places
4969
4963
continue ;
4970
- }
4971
4964
4972
- nodepos = v3s16 (nodepos2d.X , groundheight- 2 , nodepos2d.Y );
4965
+ nodepos = v3s16 (nodepos2d.X , groundheight, nodepos2d.Y );
4973
4966
bool is_good = false ;
4974
4967
s32 air_count = 0 ;
4975
- for (s32 i= 0 ; i< 10 ; i++){
4968
+ for (s32 i = 0 ; i < 10 ; i++) {
4976
4969
v3s16 blockpos = getNodeBlockPos (nodepos);
4977
4970
map.emergeBlock (blockpos, true );
4978
- MapNode n = map.getNodeNoEx (nodepos);
4979
- if (n. getContent () == CONTENT_AIR) {
4971
+ content_t c = map.getNodeNoEx (nodepos). getContent ( );
4972
+ if (c == CONTENT_AIR || c == CONTENT_IGNORE) {
4980
4973
air_count++;
4981
- if (air_count >= 2 ){
4974
+ if (air_count >= 2 ){
4982
4975
is_good = true ;
4983
- nodepos.Y -= 1 ;
4984
4976
break ;
4985
4977
}
4986
4978
}
0 commit comments