Player spawning C++?

User avatar
0gb.us
Member
 
Posts: 841
Joined: Sun Sep 16, 2012 01:55

Player spawning C++?

by 0gb.us » Fri Jan 11, 2013 03:08

This is going to sound odd, but does anyone know where in the C++ (or Lua, but I think this is in the C++) the player spawn range is set? I found the static spawn point code, but I can't find the code for when there is no static spawn point enabled.

Thanks for the help!
 

hdastwb
Member
 
Posts: 106
Joined: Tue Jan 01, 2013 18:47
GitHub: hdastwb
IRC: hdastwb
In-game: hdastwb

by hdastwb » Fri Jan 11, 2013 04:30

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
v3f findSpawnPos(ServerMap &map)


implemented on line 4786 of server.cpp.

It looks like there isn't exactly a spawn range, though; from my interpretation of the code it looks like the function fans out from a 2x2 to a 2000x2000 range as it goes along…
 

User avatar
0gb.us
Member
 
Posts: 841
Joined: Sun Sep 16, 2012 01:55

by 0gb.us » Fri Jan 11, 2013 05:45

hdastwb wrote:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
v3f findSpawnPos(ServerMap &map)


implemented on line 4786 of server.cpp.

It looks like there isn't exactly a spawn range, though; from my interpretation of the code it looks like the function fans out from a 2x2 to a 2000x2000 range as it goes along…


Thanks a lot, that's just what I needed!

Some of that function seems cryptic to me, as I've never worked in C++, but I see what you mean about it fanning out. I've never noticed myself spawning as far as 1000 nodes away from 0,0, but it looks like it's possible.

I also sow some other interesting stuff there. I've seen that the game doesn't like to spawn players in deep water or inside solid rock, but apparently it doesn't like spawning players on top of high mountains either. Maybe this is to prevent players from spawning on top of those really high pillars you see occasionally, with no way down.
 

User avatar
Jordach
Member
 
Posts: 4412
Joined: Mon Oct 03, 2011 17:58
GitHub: Jordach
IRC: Jordach
In-game: Jordach

by Jordach » Fri Jan 11, 2013 08:03

In the past it used to be stupid and made players spawn underground.

( ͡° ͜ʖ ͡°) ( ͡o ͜ʖ ͡o) [$ ( ͡° ͜ʖ ͡°) $] ( ͡$ ͜ʖ ͡$) ヽ༼ຈل͜ຈ༽ノ



My image and media server is back online and is functioning as normal.
 

rarkenin
Member
 
Posts: 668
Joined: Tue Nov 20, 2012 20:48

by rarkenin » Fri Jan 11, 2013 11:21

It still seems to spawn me within rock, but only one layer in.
Admin pro tempore on 0gb.us:30000. Ask me if you have a problem, or just want help.
This is a signature virus. Add me to your signature so that I can multiply.
Now working on my own clone, Mosstest.
I guess I'm back for some time.
 


Return to Minetest Features

Who is online

Users browsing this forum: No registered users and 16 guests

cron