Skip to content

Fix/restream streamout collision gap#4978

Open
naouh wants to merge 2 commits into
multitheftauto:masterfrom
naouh:fix/restream-streamout-collision-gap
Open

Fix/restream streamout collision gap#4978
naouh wants to merge 2 commits into
multitheftauto:masterfrom
naouh:fix/restream-streamout-collision-gap

Conversation

@naouh

@naouh naouh commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Summary

StreamOutForABit is used for deliberate restreams (engineReplaceModel, and
model restore via RestreamObjects / RestreamPeds / RestreamVehicles / etc).
It is documented to stream the element back in on the next frame.

Since #4744 added an anti-thrash cooldown (minStreamInDelayAfterOutMs, 1200ms)
before an element can stream back in after a stream-out, these deliberate
restreams were blocked for over a second too.

This clears m_lastStreamOutTime in StreamOutForABit so the restream path is
exempt from the cooldown and streams back in right away again. The distance
based stream-out keeps its timestamp, so the #4744 ping-pong fix stays intact.

Motivation

After #4744, replacing or restoring a model at runtime (for example
engineReplaceModel on a road/object, or destroyElement on a custom DFF) keeps
the affected objects streamed out for about 1.2 seconds. During that gap the
collision is gone, so any player standing on or driving over that model falls
through the world. It used to be instant before #4744.

This is a regression from #4744.

Test plan

  1. Have the player stand on (or drive over) an object model, for example a road piece.
  2. At runtime, call engineReplaceModel on that model id, then destroyElement
    the replacement DFF to restore the original.
  3. Before this PR: the object stays streamed out for about 1.2s, and the player
    falls through the object during the gap.
  4. After this PR: the object streams back in on the next frame, collision stays,
    no fall-through.

Before:
https://streamable.com/4gyu8i

After:
https://streamable.com/z3x3n4

Checklist

  • Your code should follow the coding guidelines.
  • Smaller pull requests are easier to review. If your pull request is beefy, your pull request should be reviewable commit-by-commit.

naouh added 2 commits June 22, 2026 20:47
The anti-thrash cooldown added in multitheftauto#4744 (minStreamInDelayAfterOutMs, 1200ms in
CClientStreamer::Restream) also delayed deliberate restreams that go through
StreamOutForABit (engineReplaceModel, and model restore via
RestreamObjects/RestreamPeds/RestreamVehicles/etc).

This kept restreamed elements - and their collision - streamed out for over a
second, so players standing on / driving over a model that was replaced or
restored at runtime would fall through the world during the gap.

StreamOutForABit is documented to stream back in next frame, so clear
m_lastStreamOutTime to exempt the deliberate restream path from the
distance-based cooldown. The multitheftauto#4744 ping-pong only occurs through the
distance-based InternalStreamOut calls, which keep their timestamp, so that
fix is preserved.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant