2
0
Fork 0
mirror of https://github.com/GTA-ASM/SanAndreasUnity synced 2025-03-05 07:37:17 +00:00

Register ped as Cell focus point

This commit is contained in:
in0finite 2019-05-22 00:58:28 +02:00
parent 502d211174
commit 2f82eca889

View file

@ -134,6 +134,25 @@ namespace SanAndreasUnity.Behaviours
if (null == this.CurrentState)
this.SwitchState<Peds.States.StandState> ();
// register Cell focus point
if (this.Cell != null)
{
if (NetStatus.IsServer)
{
// only register if this ped is owned by some player
if (Player.GetOwningPlayer(this) != null)
this.Cell.focusPoints.AddIfNotPresent(this.transform);
}
else if (NetStatus.IsClientActive())
{
// only register if this ped is owned by local player
// TODO: IsControlledByLocalPlayer may not return true, because syncvar in Player script may
// not be updated yet
if (this.IsControlledByLocalPlayer)
this.Cell.focusPoints.AddIfNotPresent(this.transform);
}
}
}
void OnEnable ()