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:
parent
9b62379645
commit
941f9502e9
6 changed files with 44 additions and 11 deletions
|
|
@ -361,6 +361,7 @@ void player_t::CopyFrom(player_t &p, bool copyPSP)
|
|||
MUSINFOactor = p.MUSINFOactor;
|
||||
MUSINFOtics = p.MUSINFOtics;
|
||||
SoundClass = p.SoundClass;
|
||||
LastSafePos = p.LastSafePos;
|
||||
angleOffsetTargets = p.angleOffsetTargets;
|
||||
if (copyPSP)
|
||||
{
|
||||
|
|
@ -1291,6 +1292,13 @@ void P_PlayerThink (player_t *player)
|
|||
player->SubtitleCounter--;
|
||||
}
|
||||
|
||||
if (player->playerstate == PST_LIVE
|
||||
&& player->mo->Z() <= player->mo->floorz
|
||||
&& !player->mo->Sector->IsDangerous(player->mo->Pos(), player->mo->Height))
|
||||
{
|
||||
player->LastSafePos = player->mo->Pos();
|
||||
}
|
||||
|
||||
// Bots do not think in freeze mode.
|
||||
if (player->mo->Level->isFrozen() && player->Bot != nullptr)
|
||||
{
|
||||
|
|
@ -1779,7 +1787,8 @@ void player_t::Serialize(FSerializer &arc)
|
|||
("onground", onground)
|
||||
("musinfoactor", MUSINFOactor)
|
||||
("musinfotics", MUSINFOtics)
|
||||
("soundclass", SoundClass);
|
||||
("soundclass", SoundClass)
|
||||
("lastsafepos", LastSafePos);
|
||||
|
||||
if (arc.isWriting ())
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue