public void sendUserEquipmentOnEnterLobby(NodeAddedEvent e, UserInMatchMakingLobby user, [Context, JoinByUser] Weapon weapon, [Context, JoinByUser] Hull hull, [JoinByUser] UserInMatchMakingLobby user2Lobby, [JoinByBattleLobby] SingleNode <BattleLobbyComponent> lobby) { SetEquipmentEvent eventInstance = new SetEquipmentEvent { WeaponId = weapon.marketItemGroup.Key, HullId = hull.marketItemGroup.Key }; base.ScheduleEvent(eventInstance, lobby); user.Entity.RemoveComponentIfPresent <InitUserEquipmentComponent>(); user.Entity.AddComponent <InitUserEquipmentComponent>(); }
public void sendUserEquipmentOnEnterLobby(NodeAddedEvent e, UserInMatchMakingLobbyPrototype user, [Context, JoinByUser] Weapon weapon, [Context, JoinByUser] Hull hull, [JoinByUser] UserInMatchMakingLobby user2Lobby, [JoinByBattleLobby] SingleNode <BattleLobbyComponent> lobby) { SetEquipmentEvent eventInstance = new SetEquipmentEvent(); if (user.userUseItemsPrototype.Preset.HasComponent <PresetEquipmentComponent>()) { PresetEquipmentComponent component = user.userUseItemsPrototype.Preset.GetComponent <PresetEquipmentComponent>(); eventInstance.WeaponId = Flow.Current.EntityRegistry.GetEntity(component.WeaponId).GetComponent <MarketItemGroupComponent>().Key; eventInstance.HullId = Flow.Current.EntityRegistry.GetEntity(component.HullId).GetComponent <MarketItemGroupComponent>().Key; base.ScheduleEvent(eventInstance, lobby); } }