mirror of
https://github.com/GTA-ASM/SanAndreasUnity
synced 2025-03-05 07:37:17 +00:00
ped owner is fully synced ?
This commit is contained in:
parent
989793e4ca
commit
cb2ce01463
2 changed files with 8 additions and 1 deletions
Assets/Scripts/Behaviours
|
@ -31,6 +31,8 @@ namespace SanAndreasUnity.Behaviours
|
|||
|
||||
public static int NumStateChangesReceived { get; private set; }
|
||||
|
||||
[SyncVar] internal GameObject m_net_weaponGameObject;
|
||||
|
||||
|
||||
|
||||
void Awake_Net()
|
||||
|
@ -51,6 +53,10 @@ namespace SanAndreasUnity.Behaviours
|
|||
if (m_net_playerOwnerGameObject != null)
|
||||
m_net_playerOwnerGameObject.GetComponent<Player>().OwnedPed = this;
|
||||
|
||||
// assign ped owner in current weapon
|
||||
if (m_net_weaponGameObject != null)
|
||||
m_net_weaponGameObject.GetComponent<Weapons.NetworkedWeapon>().PedOwner = this;
|
||||
|
||||
this.TryToLoadNewModel(m_net_pedId);
|
||||
|
||||
this.ChangeStateBasedOnSyncData(new StateSyncData(){state = m_net_state, additionalData = m_net_additionalStateData});
|
||||
|
|
|
@ -79,7 +79,8 @@ namespace SanAndreasUnity.Behaviours {
|
|||
#endregion
|
||||
|
||||
|
||||
public Weapon CurrentWeapon { get ; private set ; }
|
||||
private Weapon m_currentWeapon;
|
||||
public Weapon CurrentWeapon { get => m_currentWeapon; private set { m_currentWeapon = value; if (NetStatus.IsServer) m_ped.m_net_weaponGameObject = value != null ? value.gameObject : null; } }
|
||||
private Transform CurrentWeaponTransform { get { return CurrentWeapon != null ? CurrentWeapon.transform : null; } }
|
||||
|
||||
private int m_frameWhenSwitchedWeapon = 0;
|
||||
|
|
Loading…
Add table
Reference in a new issue