Ejemplo n.º 1
0
        public override void Start(ICoreAPI api)
        {
            base.Start(api);
            this.api = api;


            texts = new Dictionary <EnumTempStormStrength, TemporalStormText>()
            {
                { EnumTempStormStrength.Light, new TemporalStormText()
                  {
                      Approaching = Lang.Get("A light temporal storm is approaching"), Imminent = Lang.Get("A light temporal storm is imminent"), Waning = Lang.Get("The temporal storm seems to be waning")
                  } },
                { EnumTempStormStrength.Medium, new TemporalStormText()
                  {
                      Approaching = Lang.Get("A medium temporal storm is approaching"), Imminent = Lang.Get("A medium temporal storm is imminent"), Waning = Lang.Get("The temporal storm seems to be waning")
                  } },
                { EnumTempStormStrength.Heavy, new TemporalStormText()
                  {
                      Approaching = Lang.Get("A heavy temporal storm is approaching"), Imminent = Lang.Get("A heavy temporal storm is imminent"), Waning = Lang.Get("The temporal storm seems to be waning")
                  } },
            };

            configs = new Dictionary <string, TemporalStormConfig>()
            {
                { "veryrare", new TemporalStormConfig()
                  {
                      Frequency           = NatFloat.create(EnumDistribution.UNIFORM, 30, 5),
                      StrengthIncrease    = 2.5f / 100,
                      StrengthIncreaseCap = 25f / 100
                  } },

                { "rare", new TemporalStormConfig()
                  {
                      Frequency           = NatFloat.create(EnumDistribution.UNIFORM, 25, 5),
                      StrengthIncrease    = 5f / 100,
                      StrengthIncreaseCap = 50f / 100
                  } },

                { "sometimes", new TemporalStormConfig()
                  {
                      Frequency           = NatFloat.create(EnumDistribution.UNIFORM, 15, 5),
                      StrengthIncrease    = 10f / 100,
                      StrengthIncreaseCap = 100f / 100
                  } },

                { "often", new TemporalStormConfig()
                  {
                      Frequency           = NatFloat.create(EnumDistribution.UNIFORM, 7.5f, 2.5f),
                      StrengthIncrease    = 15f / 100,
                      StrengthIncreaseCap = 150f / 100
                  } },

                { "veryoften", new TemporalStormConfig()
                  {
                      Frequency           = NatFloat.create(EnumDistribution.UNIFORM, 4.5f, 1.5f),
                      StrengthIncrease    = 20f / 100,
                      StrengthIncreaseCap = 200f / 100
                  } }
            };
        }
Ejemplo n.º 2
0
        public override void OnBlockPlaced(ItemStack byItemStack = null)
        {
            Block block = Api.World.BlockAccessor.GetBlock(Pos);

            NatFloat growthDays = NatFloat.create(EnumDistribution.UNIFORM, 6.5f, 1.5f);

            if (block?.Attributes != null)
            {
                growthDays = block.Attributes["growthDays"].AsObject(growthDays);
            }

            totalHoursTillGrowth = Api.World.Calendar.TotalHours + growthDays.nextFloat(1, Api.World.Rand) * 24;
        }