Exemple #1
0
        private void ExplodeOnLand()
        {
            SpawnExplosionParticles();

            if (sidedAPI.Side == EnumAppSide.Server)
            {
                this.entity.World.PlaySoundAt(new AssetLocation("meteoricexpansion", "sounds/effect/land_meteor_explosion_layered"), this.entity, null, true, 512, 1.0f);

                Vec3d previousPos = this.entity.PreviousServerPos.XYZ;
                Vec3d currentPos  = this.entity.ServerPos.XYZ;

                Vec3d meteorDirection   = (currentPos - previousPos).Normalize();
                Vec3d shrapnelDirection = MeteoricExpansionHelpers.InvertVector(meteorDirection);


                if (MeteoricExpansionHelpers.GetConfigDestructive() == true)
                {
                    CreateCrater(meteorDirection, shrapnelDirection);
                    InjureEntities(currentPos);
                }

                //-- The meteor has a chance to 'break apart' on impact and throw out its own drops on impact, amount based on its size --//
                foreach (BlockDropItemStack itemStack in entity.Properties.Drops)
                {
                    for (int i = 0; i < (int)(entity.Properties.Client.Size * explosionRand.Next(minMeteorDrops, maxMeteorDrops)); i++)
                    {
                        entity.World.SpawnItemEntity(itemStack.GetNextItemStack(), entity.ServerPos.XYZ, GetNewItemStackVector(shrapnelDirection, itemStackVelocityModifier));
                    }
                }
            }
        }
Exemple #2
0
        private void ExplodeInAir()
        {
            SpawnExplosionParticles();

            if (sidedAPI.Side == EnumAppSide.Server)
            {
                this.entity.World.PlaySoundAt(new AssetLocation("meteoricexpansion", "sounds/effect/air_meteor_explosion_layered"), this.entity, null, true, 512, 1.0f);

                if (MeteoricExpansionHelpers.GetConfigDestructive() == true)
                {
                    InjureEntities(this.entity.ServerPos.XYZ);
                }
            }
        }