protected override void OnHook() { Debug.Assert(MyMultiplayer.Static != null, "Should not get here without multiplayer"); base.OnHook(); m_propertySync = new StateGroups.MyPropertySyncStateGroup(this, Grid.SyncType); if (Sync.IsServer == false) { MyPlayerCollection.UpdateControl(Grid.EntityId); foreach (var block in Instance.CubeBlocks) // CubeBlocks is getter of readonly field m_cubeBlocks, should never be null (but check it!) { if (block.FatBlock is MyCockpit) { // block.FatBlock is not null MyPlayerCollection.UpdateControl(block.FatBlock.EntityId); if (MySession.Static.LocalHumanPlayer != null && MySession.Static.LocalHumanPlayer.Controller != null && MySession.Static.LocalHumanPlayer.Controller.ControlledEntity == block.FatBlock) { MySession.Static.SetCameraController(VRage.Game.MyCameraControllerEnum.Entity, block.FatBlock); break; } } } } Grid.OnBlockAdded += Grid_OnBlockAdded; Grid.OnBlockRemoved += Grid_OnBlockRemoved; }
protected override void OnHook() { Debug.Assert(MyMultiplayer.Static != null, "Should not get here without multiplayer"); base.OnHook(); m_propertySync = new StateGroups.MyPropertySyncStateGroup(this, Block.SyncType); m_propertySync.GlobalValidate = context => HasRights(context.ClientState.GetClient()); Block.OnClose += (entity) => RaiseDestroyed(); }
protected override void OnHook() { base.OnHook(); if (Inventory != null) { m_stateGroup = new StateGroups.MyEntityInventoryStateGroup(Inventory, Sync.IsServer, this); ((MyEntity)Inventory.Owner).OnClose += m_destroyEntity; Inventory.BeforeRemovedFromContainer += (component) => OnRemovedFromContainer(); m_propertySync = new StateGroups.MyPropertySyncStateGroup(this, Instance.SyncType); } }
protected override void OnHook() { base.OnHook(); m_propertySync = new StateGroups.MyPropertySyncStateGroup(this, Instance.SyncType); }