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:
parent
502d211174
commit
2f82eca889
1 changed files with 19 additions and 0 deletions
|
@ -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 ()
|
||||
|
|
Loading…
Add table
Reference in a new issue