public void DoSettingsWindowContents(Rect inRect)
        {
            Listing_Standard listing_Standard = new Listing_Standard();

            listing_Standard.Begin(inRect);
            listing_Standard.CheckboxLabeled("TraderShipsDisableOrbitalName".Translate(), ref disableOrbital, "TraderShipsDisableOrbitalDesc".Translate());
            listing_Standard.CheckboxLabeled("TraderShipsRequireCommssConsoleName".Translate(), ref requireCommsConsole, "TraderShipsRequireCommssConsoleDesc".Translate());
            listing_Standard.CheckboxLabeled("TraderShipsEnableQuestsName".Translate(), ref enableQuests, "TraderShipsEnableQuestsDesc".Translate());

            listing_Standard.GapLine();
            listing_Standard.CheckboxLabeled("TraderShipsColorsName".Translate(), ref colors, "TraderShipsColorsDesc".Translate());
            if (colors)
            {
                listing_Standard.Label("TraderShipsSaturationName".Translate(), -1, "TraderShipsSaturationDesc".Translate());
                listing_Standard.IntRange(ref shipColorSaturation, -100, 200);
                listing_Standard.Label("TraderShipsValueName".Translate(), -1, "TraderShipsValueDesc".Translate());
                listing_Standard.IntRange(ref shipColorValue, -100, 200);

                if (colorValues[0] == 0)
                {
                    RedoColors();
                }

                listing_Standard.Gap(24);

                Rect row = listing_Standard.GetRect(64).TopHalf();

                for (int i = 0; i < colorSaturations.Length; i++)
                {
                    Rect rect = new Rect(row.x + i * (row.height + 11), row.y, row.height, row.height);
                    if (rect.x + rect.width >= row.width)
                    {
                        break;
                    }

                    GUI.color = Color.white;
                    GUI.DrawTexture(rect, BaseContent.WhiteTex);
                    GUI.color = Color.HSVToRGB(colorHues[i], Mathf.Clamp(shipColorSaturation.Lerped(colorSaturations[i]) * 0.01f, 0f, 1f), Mathf.Clamp(shipColorValue.Lerped(colorValues[i]) * 0.01f, 0f, 1f));
                    GUI.DrawTexture(rect.ContractedBy(1), BaseContent.WhiteTex);
                }
                GUI.color = Color.white;


                Rect rowButton = listing_Standard.GetRect(48);
                rowButton.width = 180;
                if (Widgets.ButtonText(rowButton, "TraderShipsRerollColors".Translate()))
                {
                    RedoColors();
                }
            }

            listing_Standard.End();
        }
Exemple #2
0
        private void SpawnSmokeParticles()
        {
            if (fireCount < 15)
            {
                MoteMaker.ThrowSmoke(DrawPos, base.Map, fireSize);
            }
            if (fireSize > 0.5f && parent == null)
            {
                MoteMaker.ThrowFireGlow(base.Position, base.Map, fireSize);
            }
            float num = fireSize / 2f;

            if (num > 1f)
            {
                num = 1f;
            }
            num             = 1f - num;
            ticksUntilSmoke = SmokeIntervalRange.Lerped(num) + (int)(10f * Rand.Value);
        }
Exemple #3
0
        private static void SpawnSmokeParticles(Fire __instance)
        {
            if (fireCount < 15)
            {
                MoteMaker.ThrowSmoke(__instance.DrawPos, __instance.Map, __instance.fireSize);
            }
            if ((double)__instance.fireSize > 0.5 && __instance.parent == null)
            {
                MoteMaker.ThrowFireGlow(__instance.Position, __instance.Map, __instance.fireSize);
            }
            float num = __instance.fireSize / 2f;

            if ((double)num > 1.0)
            {
                num = 1f;
            }
            float lerpFactor = 1f - num;

            ticksUntilSmoke(__instance) = SmokeIntervalRange.Lerped(lerpFactor) + (int)(10.0 * (double)Rand.Value);
        }
Exemple #4
0
        private void SpawnSmokeParticles()
        {
            if (fireCount < FireCountParticlesOff)
            {
                MoteMaker.ThrowSmoke(DrawPos, Map, fireSize);
            }

            if (fireSize > 0.5f && parent == null)
            {
                MoteMaker.ThrowFireGlow(Position, Map, fireSize);
            }

            float firePct = fireSize / 2;

            if (firePct > 1)
            {
                firePct = 1;
            }
            firePct         = 1f - firePct;
            ticksUntilSmoke = SmokeIntervalRange.Lerped(firePct) + (int)(SmokeIntervalRandomAddon * Rand.Value);
        }
Exemple #5
0
    public override void Tick()
    {
        sustainer.Maintain();

        //Do micro sparks
        if (fireSize > 0.7f)
        {
            if (Random.value < fireSize * 0.01f)
            {
                MoteMaker.ThrowMicroSparks(DrawPos);
            }
        }

        //Do smoke and glow
        ticksUntilSmoke--;
        if (ticksUntilSmoke <= 0)
        {
            MoteMaker.ThrowSmoke(DrawPos, fireSize);

            if (parent == null)             //No fire glow for moving things (it trails them)
            {
                Vector3 glowLoc = DrawPos + fireSize * (new Vector3(Random.value - 0.5f, 0, Random.value - 0.5f));
                MoteMaker.ThrowFireGlow(glowLoc, fireSize);
            }

            float firePct = fireSize / 2;
            if (firePct > 1)
            {
                firePct = 1;
            }
            firePct         = 1f - firePct;
            ticksUntilSmoke = SmokeIntervalRange.Lerped(firePct) + (int)(SmokeIntervalRandomAddon * Random.value);
        }



        ticksUntilFrameChange--;
        if (ticksUntilFrameChange <= 0)
        {
            ticksUntilFrameChange = FrameChangeIntervalRange.RandomInRange;

            //Choose a new draw frame
            Material oldFrame = curDrawFrame;
            while (curDrawFrame == oldFrame)
            {
                curDrawFrame = def.folderDrawMats.RandomListElement();
            }

            //Apply random offset (it adds some life)
            const float MaxOff = 0.05f;
            curDrawOffset = new Vector3(Random.Range(-MaxOff, MaxOff), 0, Random.Range(-MaxOff, MaxOff));
        }


        //Static fires: Ignite pawns in my square
        if (parent == null)
        {
            if (fireSize > MinSizeForSquareIgnite)
            {
                float igniteChance = fireSize * SquareIgniteChancePerTickPerSize;
                foreach (Thing t in Find.ThingGrid.ThingsAt(Position).ToList())
                {
                    if (Random.value < igniteChance &&
                        t.CanEverAttachFire())
                    {
                        t.TryIgnite(fireSize / 2f);
                    }
                }
            }
        }


        //Perhaps I should unify the below with square ignition

        //Damage whatever I'm burning
        ticksSinceDamage++;
        if (ticksSinceDamage >= TicksBeforeDamage)
        {
            Thing damTarget = null;
            if (parent != null)
            {
                damTarget = parent;
            }
            else
            {
                //Burn random flammable thing in square
                List <Thing> burnables = Find.ThingGrid.ThingsAt(Position)
                                         .Where(t => t.def.Flammable)
                                         .ToList();

                if (burnables.Count > 0)
                {
                    damTarget = burnables.RandomListElement();
                }

                //Destroy if nothing to burn in square
                if (damTarget == null)
                {
                    Destroy();
                    return;
                }
            }

            //If it's a mobile burner, we only ignite it when we are above minimum square ignite size
            if (!damTarget.CanEverAttachFire() || fireSize > MinSizeForSquareIgnite)
            {
                damTarget.TakeDamage(new DamageInfo(DamageTypeDefOf.Flame, 1, this));
            }


            ticksSinceDamage = 0;
        }


        //Emit sparks
        ticksSinceSpark++;
        if (ticksSinceSpark >= TicksBeforeSpark)
        {
            ThrowSpark();
            ticksSinceSpark = 0;
        }

        //Try to grow the fire
        fireSize += FireBaseGrowthPerTick;

        if (fireSize > MaxFireSize)
        {
            fireSize = MaxFireSize;
        }

        //Extinguish from sky (rain etc)
        if (Find.WeatherManager.RainRate > 0.01f)
        {
            Thing building         = Position.GetBuilding();
            bool  roofHolderIsHere = building != null && building.def.holdsRoof;

            if (roofHolderIsHere || !Find.RoofGrid.Roofed(Position))
            {
                if (Random.value < BaseSkyExtinguishChance)
                {
                    TakeDamage(new DamageInfo(DamageTypeDefOf.Extinguish, BaseSkyExtinguishDamage, null));
                }
            }
        }
    }