public void SpeacialWeaponEvent(MySpecialWeaponEventEnum eventType, MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum weapon) { MyEventSpeacialWeapon msg = new MyEventSpeacialWeapon(); msg.ShipEntityId = MySession.PlayerShip.EntityId.Value.NumericValue; msg.Weapon = weapon; msg.WeaponEvent = eventType; Peers.SendToAll(ref msg, NetDeliveryMethod.ReliableUnordered); }
public void OnSpecialWeaponEvent(ref MyEventSpeacialWeapon msg) { var player = (MyPlayerRemote)msg.SenderConnection.Tag; if (player != null) { MyEntity entity; if (MyEntityIdentifier.TryGetEntity(new MyEntityIdentifier(msg.ShipEntityId), out entity) && entity is MySmallShip) { MySmallShip ship = (MySmallShip)entity; switch (msg.WeaponEvent) { case MySpecialWeaponEventEnum.HARVESTER_FIRE: OnFireHarvester(msg.Weapon, ship); break; case MySpecialWeaponEventEnum.DRILL_ACTIVATED: EnsureDrill(msg.Weapon, ship).CurrentState = MyDrillStateEnum.Activated; break; case MySpecialWeaponEventEnum.DRILL_DEACTIVATED: EnsureDrill(msg.Weapon, ship).CurrentState = MyDrillStateEnum.Deactivated; break; case MySpecialWeaponEventEnum.DRILL_DRILLING: { var drill = EnsureDrill(msg.Weapon, ship); drill.Shot(null); drill.CurrentState = MyDrillStateEnum.Drilling; } break; default: break; } } } }