Udemo reset weapon of pawns to None
SeriousBuggie opened this issue · comments
event PreRender( canvas Canvas )
// (Added by Anth) Weaponshow hax
// UTPure7G resets several values in bbPlayer.RenderOverlays, this
// prevents the weapon from rendering correctly
// => Don't let PlayerLinked.RenderOverlays do the weaponrendering
if (PlayerPawn(ViewTarget) != None && !bBehindview)
{
oldWeap = PlayerPawn(ViewTarget).Weapon;
PlayerPawn(ViewTarget).Weapon = none;
// set viewtarget to none so the engine calls RenderOverlays on the
// demoplaybackspec, rather than the viewtarget...
OldViewtarget = ViewTarget;
ViewTarget.bHidden = true;
ViewTarget = none;
}
event RenderOverLays(Canvas Canvas)
// Give weapon back. The weapon was set to none during PreRender
if (PlayerPawn(ViewTarget).Weapon == None &&
oldWeap != None &&
oldWeap.Owner == PlayerPawn(ViewTarget))
{
PlayerPawn(ViewTarget).Weapon = oldWeap;
}
In demo often owner not replicated yet. So you reset it to none, but not return back.
Enough one frame where owner is not set yet, and we get None, instead of weapon.
Normally it is not problem, because you own weapon much before it be your actual weapon.
But when you enter into vehicle it is momentary action. And weapon can be replicated faster from change owner on it.
In fact I see delay of 0.1 seconds or more when change seat between two turrets. And exists enough big gap when player "own" both turret weapons until replication not come.
In general it is not udemo business which weapon handle pawn, own it or no. So if it remove it temporary, it must return back exact as it be before without any assumption or filtering.