Пример #1
0
        public static void UpdateMotes(this InnerShineItem ISI, InnerShineRecord ISR, Pawn pawn, bool debug = false)
        {
            if (ISR.spawned.NullOrEmpty())
            {
                return;
            }
            for (int i = ISR.spawned.Count - 1; i >= 0; i--)
            {
                Thing curT = ISR.spawned[i];

                if (curT.DestroyedOrNull())
                {
                    ISR.spawned.RemoveAt(i);
                    continue;
                }
                if (!ISI.HasCompatibleActivity(pawn))
                {
                    curT.Destroy();
                    ISR.spawned.RemoveAt(i);
                    continue;
                }
                if (curT is Mote mote)
                {
                    mote.exactPosition = pawn.DrawPos + pawn.GetLinkOffset(ISI.linkType) + ISI.GetDrawOffset(pawn);
                    //if (debug) Log.Warning(ISR.label + $" => mote.exactPosition: {mote.exactPosition} mote.DrawPos:{mote.DrawPos}");
                }
            }
        }
        public static bool ShouldSpawnMote(this InnerShineItem ISI, InnerShineRecord ISR, Pawn p)
        {
            if (!ISI.HasCompatibleActivity(p))
            {
                return(false);
            }

            if (ISI.HasMoteNumLimit())
            {
                return(!ISR.AlreadyReachedMax(ISI.spawningRules.spawnedMax));
            }

            return(true);
        }