less likely to destroy dropped stuff

This commit is contained in:
darkrose 2017-08-23 14:51:41 +10:00
parent 1bfaf70f3b
commit 623a11e24a
1 changed files with 8 additions and 4 deletions

View File

@ -900,15 +900,19 @@ bool ServerEnvironment::dropToParcel(v3s16 pos, InventoryItem *item)
// if underground, go up to first air_equivalent and buildable_to // if underground, go up to first air_equivalent and buildable_to
if (!content_features(m_map->getNodeNoEx(pos).getContent()).air_equivalent) { if (!content_features(m_map->getNodeNoEx(pos).getContent()).air_equivalent) {
if (!getCollidedPosition(pos,v3s16(0,1,0),&ppos)) { if (!getCollidedPosition(pos,v3s16(0,1,0),&ppos)) {
delete item; if (!searchNear(pos,v3s16(2,0,2),CONTENT_AIR,&ppos)) {
return false; delete item;
return false;
}
} }
pos = ppos; pos = ppos;
// otherwise go down to first non-air_equivalent and buildable_to // otherwise go down to first non-air_equivalent and buildable_to
}else{ }else{
if (!getCollidedPosition(pos,v3s16(0,-1,0),&ppos)) { if (!getCollidedPosition(pos,v3s16(0,-1,0),&ppos)) {
delete item; if (!searchNear(pos,v3s16(2,0,2),CONTENT_AIR,&ppos)) {
return false; delete item;
return false;
}
} }
pos = ppos; pos = ppos;
} }