Beispiel #1
0
        public override void CreateRadiation(RadiationInfo fullInfo, int ticks)
        {
            foreach (CompIrradiator comp in GetIrradiators().InRandomOrder())
            {
                RadiationInfo info = new RadiationInfo();
                info.CopyFrom(fullInfo);
                comp.Irradiate(parent as Building, info, ticks);
                if (info.Empty())
                {
                    continue;
                }

                moteProps = comp.MoteProps;

                fullInfo.Add(info);
            }
        }
Beispiel #2
0
        public void Irradiate(Building target, RadiationInfo info, int ticks)
        {
            if (info.visited.Contains(this))
            {
                return;
            }
            info.visited.Add(this);

            linked = target;
            if (linked == null)
            {
                return;
            }

            CreateRadiation(info, ticks);
            if (info.Empty())
            {
                return;
            }

            ticksCooldown = ticks;
            bool playSound = props.soundIrradiate != null && info.visited.Count(x => x.props.soundIrradiate != null) < 2;

            soundSustainer = playSound ? props.soundIrradiate.TrySpawnSustainer(SoundInfo.InMap(parent, MaintenanceType.PerTick)) : null;

            motesReflectAt.Clear();
            foreach (ThingComp comp in GetModifiers <ThingComp, IRadiationModifier>(linked))
            {
                if (comp is CompBlocker)
                {
                    motesReflectAt.Add((Rotation().IsHorizontal ? comp.parent.Position.x : comp.parent.Position.z) + 0.5f);
                }

                if (info.secondHand)
                {
                    continue;
                }

                IRadiationModifier modifier = comp as IRadiationModifier;
                modifier.Modify(ref info);
            }
        }