Improved "respawn where died" functionality (#2831)

Now uses a "last safe position" system instead. This:
-Prevents players from slipping into places they shouldn't via their dead body and then respawning there
-No longer sends players back to spawn if they fall into kill pits
-Adds a safety feature where the kill command always resets back to spawn should a player ever get stuck somewhere
This commit is contained in:
Boondorl 2024-11-24 09:44:47 -05:00 committed by GitHub
commit 941f9502e9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 44 additions and 11 deletions

View file

@ -129,6 +129,28 @@ DEFINE_ACTION_FUNCTION_NATIVE(_Sector, NextSpecialSector, P_NextSpecialSector)
ACTION_RETURN_POINTER(P_NextSpecialSector(self, type, nogood));
}
bool sector_t::IsDangerous(const DVector3& pos, double height) const
{
if (damageamount > 0)
return true;
auto cl = dyn_cast<DCeiling>(ceilingdata.Get());
if (cl != nullptr && cl->getCrush() > 0)
return true;
for (auto rover : e->XFloor.ffloors)
{
if ((rover->flags & FF_EXISTS) && rover->model->damageamount > 0
&& pos.Z <= rover->top.plane->ZatPoint(pos)
&& pos.Z + height >= rover->bottom.plane->ZatPoint(pos))
{
return true;
}
}
return false;
}
//
// P_FindLowestFloorSurrounding()
// FIND LOWEST FLOOR HEIGHT IN SURROUNDING SECTORS