Esempio n. 1
0
 public static void Prefix()
 {
     MPPrimaries.SpawnWeaponTimer -= RUtility.FRAMETIME_GAME;
     if (MPPrimaries.SpawnWeaponTimer <= 0f)
     {
         MPPrimaries.SpawnPrimary();
     }
 }
Esempio n. 2
0
        public static bool Prefix(ref int[] ___m_spawn_weapon_count)
        {
            // Setup the primary budget.
            MPPrimaries.Budget.Clear();
            foreach (var weapon in RobotManager.m_multiplayer_spawnable_weapons)
            {
                var weaponType = (WeaponType)weapon.type;
                if (NetworkMatch.IsWeaponAllowed(weaponType))
                {
                    MPPrimaries.Budget.Add(new PrimaryBudget
                    {
                        Type      = weaponType,
                        Budget    = weapon.percent,
                        Remaining = weapon.percent,
                        Active    = 0
                    });
                }

                Debug.Log($"MPPrimaries - Added {weaponType}, budget {weapon.percent}");
            }

            // Spawn in initial primaries.
            var primaries = MPPrimaries.GetMaxPrimaries();

            for (int i = 0; i < primaries; i++)
            {
                MPPrimaries.SpawnPrimary();
            }

            // This is the rest of the PowerupLevelStart code, currently unmodified.
            var num = RobotManager.m_multi_missile_count;

            for (int n = 0; n < num; n++)
            {
                MissileType missileType = NetworkMatch.RandomAllowedMissileSpawn();
                if (missileType != MissileType.NUM)
                {
                    ItemPrefab item2 = ChallengeManager.MissileTypeToPrefab(missileType);
                    // NetworkMatch.SpawnItem(item2, false);
                    AccessTools.Method(typeof(NetworkMatch), "SpawnItem").Invoke(null, new object[] { item2, false });
                }
            }
            NetworkMatch.SetSpawnMissileTimer();
            NetworkMatch.SetSpawnSuperTimer();
            NetworkMatch.SetSpawnBasicTimer();

            // Get rid of weapon counts so they aren't triggered by the original function.
            for (var i = 0; i < 8; i++)
            {
                ___m_spawn_weapon_count[i] = 0;
            }

            // Short circuit the original code.
            return(false);
        }