public override void onUse(WorldBase world, Item harvestTool, Vector2 location, TileType tileType, Entity user)
        {
            base.onUse(world, harvestTool, location, tileType, user);

            if (HarvestDictionary.hasGhostForTile(tileType))
            {
                world.placeTile(HarvestDictionary.getGhostForTile(tileType), location);
            }
            else
            {
                world.placeTile(TileTypeReferencer.AIR, location);
            }


            ItemDropper[] drops = HarvestDictionary.getHarvestsForTile(tileType);
            foreach (ItemDropper dropper in drops)
            {
                dropper.drop(world, harvestTool, location);
            }

            for (int i = 0; i < 7; i++)
            {
                world.addEntity(new ParticleTileBreak(location, world, new Vector2(), tileType, 150));
            }
        }
Esempio n. 2
0
        public void handleBottleAdditions()
        {
            if (!hasAddedPotionsToHarvestDictionary)
            {
                ItemDropper dropTreasuresRarely = new ItemDropper();
                dropTreasuresRarely.registerNewDrop(new Item_Rope(0), null, 1, .01f);
                dropTreasuresRarely.registerNewDrop(new Item_Bottle_Type_0(0), null, 1, .01f);
                dropTreasuresRarely.registerNewDrop(new Item_Bottle_Type_1(0), null, 1, .01f);
                dropTreasuresRarely.registerNewDrop(new Item_Bottle_Type_2(0), null, 1, .01f);
                dropTreasuresRarely.registerNewDrop(new Item_Bottle_Type_3(0), null, 1, .01f);
                dropTreasuresRarely.registerNewDrop(new Item_Meat(0), null, 1, .01f);
                HarvestDictionary.registerNewHarvest(TileTypeReferencer.POT, new ItemDropper[] { dropTreasuresRarely });

                hasAddedPotionsToHarvestDictionary = true;
            }
        }
        public TreeManager(ChunkDecorator decorator)
        {
            if (decorator.worldGenSubtype != World.WorldGenSubtype.CENOTE)
            {
                //build leaves
                Texture2D leafTexOne = decorator.content.Load <Texture2D>("Blocks/Variety/" + decorator.rand.Next(50));
                Texture2D leafTexTwo = decorator.content.Load <Texture2D>("Blocks/Variety/" + decorator.rand.Next(50));

                leaves = new TileType(new TileTag[] { TagReferencer.AIR, TagReferencer.Harvest, }, leafTexOne, false);
                leaves.harvestTicks  = 5 + getRandValuePlusOrMinus(decorator.rand, Math.Max(decorator.metaDifficulty, 1));
                leaves2              = new TileType(new TileTag[] { TagReferencer.AIR, TagReferencer.Harvest, }, leafTexTwo, false);
                leaves2.harvestTicks = 5 + getRandValuePlusOrMinus(decorator.rand, Math.Max(decorator.metaDifficulty, 1));


                //build trunks
                generateTreeTrunk(decorator, out trunk, out treeTop);
                generateTreeTrunk(decorator, out trunk2, out treeTop2);
                decorator.foliage.AddRange(generateTrees(decorator, trunk, treeTop, leaves));
                decorator.foliageBiome2.AddRange(generateTrees(decorator, trunk2, treeTop2, leaves2));

                TileType.replaceTileInDictionary(TileTypeReferencer.REACTIVE_LEAVES_0.TILEID, leaves);
                TileType.replaceTileInDictionary(TileTypeReferencer.REACTIVE_LEAVES_1.TILEID, leaves2);
                TileType.replaceTileInDictionary(TileTypeReferencer.REACTIVE_TRUNK_0.TILEID, trunk);
                TileType.replaceTileInDictionary(TileTypeReferencer.REACTIVE_TRUNK_1.TILEID, trunk2);

                ItemDropper dropSticks = new ItemDropper();
                dropSticks.registerNewDrop(new Item_Stick(0), null, 1, .1f);
                dropSticks.registerNewDrop(new Item_Stick(0), new Item_Axe(1), 1, .2f);

                if (decorator.metaDifficulty == 0)
                {
                    dropSticks.registerNewDrop(new Item_Stick(0), null, 1, .4f);
                    dropSticks.registerNewDrop(new Item_Stick(0), new Item_Axe(1), 1, .4f);
                }

                HarvestDictionary.registerNewHarvestWithGhost(trunk, new ItemDropper[] { dropSticks });
                HarvestDictionary.registerNewHarvestWithGhost(trunk2, new ItemDropper[] { dropSticks });
            }
            else
            {
                decorator.foliage.Add(new Decoration(new Point(0, -6), new TileType[, ] {
                    { TileTypeReferencer.LADDER, TileTypeReferencer.LADDER, TileTypeReferencer.LADDER, TileTypeReferencer.LADDER, TileTypeReferencer.LADDER, TileTypeReferencer.LADDER, TileTypeReferencer.LADDER, TileTypeReferencer.LADDER }
                }));
                decorator.foliage.Add(new Decoration(new Point(0, -9), new TileType[, ] {
                    { TileTypeReferencer.LADDER, TileTypeReferencer.LADDER, TileTypeReferencer.LADDER, TileTypeReferencer.LADDER, TileTypeReferencer.LADDER, TileTypeReferencer.LADDER, TileTypeReferencer.LADDER, TileTypeReferencer.LADDER, TileTypeReferencer.LADDER, TileTypeReferencer.LADDER, TileTypeReferencer.LADDER }
                }));
                decorator.foliage.Add(new Decoration(new Point(0, 6), new TileType[, ] {
                    { TileTypeReferencer.LADDER, TileTypeReferencer.LADDER, TileTypeReferencer.LADDER, TileTypeReferencer.LADDER, TileTypeReferencer.LADDER, TileTypeReferencer.LADDER, TileTypeReferencer.LADDER, TileTypeReferencer.LADDER }
                }));
                decorator.foliage.Add(new Decoration(new Point(0, 9), new TileType[, ] {
                    { TileTypeReferencer.LADDER, TileTypeReferencer.LADDER, TileTypeReferencer.LADDER, TileTypeReferencer.LADDER, TileTypeReferencer.LADDER, TileTypeReferencer.LADDER, TileTypeReferencer.LADDER, TileTypeReferencer.LADDER, TileTypeReferencer.LADDER, TileTypeReferencer.LADDER, TileTypeReferencer.LADDER }
                }));

                for (int i = 0; i < 3; i++)
                {
                    decorator.foliage.Add(new Decoration(new Point(0, 2), new TileType[, ] {
                        { TileTypeReferencer.STALAGMITE_TOP, TileTypeReferencer.STALAGMITE_MIDDLE, TileTypeReferencer.STALAGMITE_BOTTOM }
                    }));
                    decorator.foliageBiome2.Add(new Decoration(new Point(0, 2), new TileType[, ] {
                        { TileTypeReferencer.STALAGMITE_TOP, TileTypeReferencer.STALAGMITE_MIDDLE, TileTypeReferencer.STALAGMITE_BOTTOM }
                    }));
                }
            }
        }
Esempio n. 4
0
        public ShrubManager(ChunkDecorator decorator)
        {
            if (decorator.worldGenSubtype != World.WorldGenSubtype.CENOTE)
            {
                //build grass and bushes
                grass              = generateGrass(decorator);
                bush               = generateBush(decorator);
                bush.harvestTicks += getRandValuePlusOrMinus(decorator.rand, Math.Max(decorator.metaDifficulty, 1) * 8);

                grass2              = generateGrass(decorator);
                bush2               = generateBush(decorator);
                bush2.harvestTicks += getRandValuePlusOrMinus(decorator.rand, Math.Max(decorator.metaDifficulty, 1) * 8);

                TileType.replaceTileInDictionary(TileTypeReferencer.REACTIVE_GRASS.TILEID, grass);
                TileType.replaceTileInDictionary(TileTypeReferencer.REACTIVE_BUSH_0.TILEID, bush);
                TileType.replaceTileInDictionary(TileTypeReferencer.REACTIVE_BUSH_1.TILEID, bush2);

                ItemDropper bushDrops = new ItemDropper();
                bushDrops.registerNewDrop(new Item_Grass(0), null, 1, 1f);
                ItemDropper bushDrops2 = new ItemDropper();
                bushDrops2.registerNewDrop(new Item_Grass(0), null, 1, 1f);

                if (decorator.world is World)
                {
                    if (decorator.rand.NextDouble() < .15)//chance to give the bush an interesting drop.
                    {
                        Item_Berry bushBerry = UniverseProperties.availableBerries[decorator.rand.Next(3)];

                        bushDrops.registerNewDrop(bushBerry, null, 1 + decorator.rand.Next(4), (float)(.05 + decorator.rand.NextDouble() * .3));
                    }
                    if (decorator.rand.NextDouble() < .15)//chance to give the bush an interesting drop.
                    {
                        Item_Berry bushBerry = UniverseProperties.availableBerries[decorator.rand.Next(3)];

                        bushDrops2.registerNewDrop(bushBerry, null, 1 + decorator.rand.Next(4), (float)(.05 + decorator.rand.NextDouble() * .3));
                    }
                }



                HarvestDictionary.registerNewHarvest(bush, new ItemDropper[] { bushDrops });
                HarvestDictionary.registerNewHarvest(bush2, new ItemDropper[] { bushDrops2 });

                for (int i = 0; i < 7 + decorator.rand.Next(7); i++)
                {
                    decorator.foliage.Add(new Decoration(new Point(0, 0), new TileType[, ] {
                        { bush },
                    }));
                    decorator.foliageBiome2.Add(new Decoration(new Point(0, 0), new TileType[, ] {
                        { bush2 },
                    }));
                }
            }
            else
            {
                for (int i = 0; i < 7 + decorator.rand.Next(7); i++)
                {
                    decorator.foliage.Add(new Decoration(new Point(0, 0), new TileType[, ] {
                        { TileTypeReferencer.STALAGMITE_TINY },
                    }));
                    decorator.foliageBiome2.Add(new Decoration(new Point(0, 0), new TileType[, ] {
                        { TileTypeReferencer.STALAGMITE_TINY },
                    }));
                }
            }

            //
        }