spawnguard

This commit is contained in:
darkrose 2016-04-12 18:13:31 +10:00
parent ed1b5d942e
commit e960050620
1 changed files with 12 additions and 0 deletions

View File

@ -2450,6 +2450,18 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
v3f pp = player->getPosition();
if (pp.getDistanceFrom(p_underf) > 8.0*BS)
return;
if (
(getPlayerPrivs(player) & PRIV_SERVER) == 0
&& g_settings->exists("static_spawnpoint")
&& g_settings->exists("spawnguard_radius")
) {
v3f sp = g_settings->getV3F("static_spawnpoint");
f32 sg = g_settings->getFloat("spawnguard_radius");
sp *= BS;
sg *= BS;
if (pp.getDistanceFrom(sp) <= sg)
return;
}
}
InventoryItem *wielditem = (InventoryItem*)player->getWieldItem();