Ejemplo n.º 1
0
        ////// Hooks //////

        private void Run_FixedUpdate(On.RoR2.Run.orig_FixedUpdate orig, Run self)
        {
            orig(self);
            if (NetworkServer.active && IsActiveAndEnabled() && !shouldDeferDrops && deferredDrops.Count > 0)
            {
                lootShowerTimer -= Time.fixedDeltaTime;
                if (lootShowerTimer <= 0f)
                {
                    if (!deferredDrops[0])
                    {
                        deferredDrops.RemoveAt(0);
                        return;
                    }
                    var tgtNode = launchVelocities[0];
                    launchVelocities.RemoveAt(0);
                    launchVelocities.Add(tgtNode);
                    var rbody = deferredDrops[0].GetComponent <Rigidbody>();
                    if (rbody)
                    {
                        rbody.velocity = tgtNode;
                        rbody.drag     = 0f;
                    }
                    deferredDrops[0].GetComponent <ConstantForce>().enabled = false;
                    deferredDrops[0].transform.position = lootShowerLoc;
                    deferredDrops[0].SetActive(true);
                    deferredDrops.RemoveAt(0);
                    lootShowerTimer = 0.125f;
                }
            }
        }
Ejemplo n.º 2
0
 private void Run_FixedUpdate(On.RoR2.Run.orig_FixedUpdate orig, Run self)
 {
     orig(self);
     if (healingSourceStack.Count != 0)
     {
         TinkersSatchelPlugin._logger.LogError("Defib: HealingSourceStack was not empty on new frame (very bad!), clearing");
         healingSourceStack.Clear();
     }
 }
Ejemplo n.º 3
0
 private static void Run_FixedUpdate(On.RoR2.Run.orig_FixedUpdate orig, RoR2.Run self)
 {
     orig(self);
     runningTimer    += Time.deltaTime;
     timeSinceUpdate += Time.deltaTime;
     if (timeSinceUpdate >= 5f)
     {
         timeSinceUpdate = 0f;
         Chat.AddMessage("It's been " + runningTimer.ToString("F4") + " seconds.");
     }
 }
Ejemplo n.º 4
0
 private void Run_FixedUpdate(On.RoR2.Run.orig_FixedUpdate orig, Run self)
 {
     orig(self);
     // show sprite of targeted enemy
     if (NoticedEnemiesList.Count == 0)
     {
         return;
     }
     foreach (var enemy in NoticedEnemiesList)
     {
         EffectManager.SimpleEffect(AlertedDisplay, enemy.body.corePosition + Vector3.up * 1f, Quaternion.identity, false);
     }
 }
Ejemplo n.º 5
0
        private void On_RunFixedUpdate(On.RoR2.Run.orig_FixedUpdate orig, Run self)
        {
            orig(self);
            stopwatch -= Time.fixedDeltaTime;
            if (stopwatch > 0f)
            {
                return;
            }

            stopwatch = cooldown;
            var alive = AliveList();

            int[] totalVsTeam = { 0, 0, 0 };
            int   totalVsAll  = 0;

            foreach (var cm in alive)
            {
                var icnt = GetCount(cm);
                if (FriendlyFireManager.friendlyFireMode != FriendlyFireManager.FriendlyFireMode.Off)
                {
                    totalVsAll += icnt;
                }
                else
                {
                    if (cm.teamIndex != TeamIndex.Neutral)
                    {
                        totalVsTeam[0] += icnt;
                    }
                    if (cm.teamIndex != TeamIndex.Player)
                    {
                        totalVsTeam[1] += icnt;
                    }
                    if (cm.teamIndex != TeamIndex.Monster)
                    {
                        totalVsTeam[2] += icnt;
                    }
                }
            }
            if (totalVsAll > 0)
            {
                for (var i = 0; i < totalVsAll; i++)
                {
                    if (alive.Count <= 0)
                    {
                        break;
                    }
                    var next = itemRng.NextElementUniform(alive);
                    if (next.hasBody)
                    {
                        next.GetBody().AddTimedBuff(markDebuff, cooldown);
                    }
                    else
                    {
                        i--;
                    }
                    alive.Remove(next);
                }
            }
            else
            {
                List <CharacterMaster>[] aliveTeam =
                {
                    alive.Where(cm => cm.teamIndex == TeamIndex.Neutral).ToList(),
                    alive.Where(cm => cm.teamIndex == TeamIndex.Player).ToList(),
                    alive.Where(cm => cm.teamIndex == TeamIndex.Monster).ToList()
                };
                for (var list = 0; list <= 2; list++)
                {
                    for (var i = 0; i < totalVsTeam[list]; i++)
                    {
                        if (aliveTeam[list].Count <= 0)
                        {
                            break;
                        }
                        var next = itemRng.NextElementUniform(aliveTeam[list]);
                        if (next.hasBody)
                        {
                            next.GetBody().AddTimedBuff(markDebuff, cooldown);
                        }
                        else
                        {
                            i--;
                        }
                        aliveTeam[list].Remove(next);
                    }
                }
            }
        }