Skip to content

Conversation

@ACaiCat
Copy link
Contributor

@ACaiCat ACaiCat commented Dec 16, 2025

Fixed hardcore ghosts don't move server-side

  1. In HandlePlayerKillMeV2, set the player's dead state to true:
    args.Player.Dead = true;
    args.Player.RespawnTimer = TShock.Config.Settings.RespawnSeconds;
  2. The player respawns and turns into a ghost, but no respawn packet is sent.
  3. In OnGetData, most packets from "dead" ghost players are filtered out, so the server cannot detect player movement and fails to send the correct TileSquare packet.

    TShock/TShockAPI/TShock.cs

    Lines 1643 to 1648 in a867772

    if ((player.State < (int)ConnectionState.Complete || player.Dead) && (int)type > 12 && (int)type != 16 && (int)type != 42 && (int)type != 50 &&
    (int)type != 38 && (int)type != 21 && (int)type != 22 && type != PacketTypes.SyncLoadout)
    {
    e.Handled = true;
    return;
    }

@ACaiCat ACaiCat marked this pull request as draft December 17, 2025 14:54
@ACaiCat ACaiCat force-pushed the fix-hardcore-worldload branch from e5111f4 to c81936f Compare December 17, 2025 15:27
@ACaiCat ACaiCat changed the title fix: skip dead state for hardcore players fix: allow dead hardcore players to move as ghosts Dec 17, 2025
@ACaiCat ACaiCat marked this pull request as ready for review December 17, 2025 15:27
@ACaiCat ACaiCat force-pushed the fix-hardcore-worldload branch from c81936f to c0b860c Compare December 17, 2025 15:28
@ACaiCat ACaiCat force-pushed the fix-hardcore-worldload branch from c0b860c to abe3f29 Compare December 17, 2025 15:34
@lost-werewolf
Copy link

Could this PR also make changes to OnGetData to accept a lot more packets, such as killing projectiles? When a player dies while they have projectiles such as minions or drills/chainsaws, it's common for them to not be killed properly as the packet is rejected.
This "blanket block" of dead player's packets seems to cause more issues than solved problems, & doesn't respect the PreventDeadModification option - should rejection of dead player's packets instead be handling in GetDataHandlers/the Bouncer?

@lost-werewolf
Copy link

lost-werewolf commented Dec 22, 2025

I've gone through a list of packets that should be entirely ignored from dead players at all times (based on PacketTypes enum):

  • PlayerHp (Allows setting HP above 0, causing them to appear "alive" for other clients)
  • ChestGetContents
  • EffectHeal
  • EffectMana
  • SignRead
  • SignNew
  • NpcSpecial
  • ChestUnlock
  • PlayHarp
  • HitSwitch
  • UpdateNPCHome
  • SpawnBossorInvasion
  • PlayerDodge
  • Teleport (allows moving while dead)
  • PlayerHealOther
  • TeleportationPotion (allows moving while dead)
  • CreateTemporaryAnimation
  • PlayerTeleportPortal (allows moving while dead)
  • NebulaLevelUp
  • CrystalInvasionStart
  • PlayerDeathV2
  • Emoji
  • RequestTileEntityInteraction
  • FishOutNPC
  • CrystalInvasionRequestedToSkipWaitTime

The following should ideally be rejected if PreventDeadModification is set to true, which currently do not check for it:

  • TileSendSquare, aka Tile Rect (Solutions, tile entity placement, right-clicking certain furniture items)
  • ProjectileNew (keep in mind - sentries or other projectiles that split may still be able to trigger this, would look odd)
  • NpcStrike (keep in mind - sentries can still damage them or projectiles fired before death)
  • TileEntityDisplayDollItemSync
  • WeaponsRackTryPlacing
  • TileEntityHatRackItemSync
  • FoodPlatterTryPlacing
  • PaintTile
  • PaintWall
  • CatchNPC
  • ReleaseNPC
  • PlaceTileEntity
  • PlaceItemFrame
  • GemLockToggle
  • MassWireOperation
  • ToggleParty
  • PlayerHurtV2 (keep in mind - sentries can maybe still damage them or projectiles fired before death)

I'm not entirely sure if all of these have handlers in GetDataHandlers. But this list should hopefully be everything a dead player should be unable to do, that a malicious client would try to abuse. It's a bit risky to allow a lot of these from a dead player.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants