Пример #1
0
    public IEnumerator _Execute(List <string> _params, CommandSenderInfo _senderInfo)
    {
        EntityPlayerLocal player = GameManager.Instance.World.GetLocalPlayers()[0];
        int    eb       = int.Parse(_params[0]);
        string buffname = buffs[eb];

        Printer.Print("ConsoleCmdExplShowExplo", _params, buffname);
        // todo: surface

        Emplacement place = Emplacement.At(player.GetPosition() + new Vector3(0, 1, 10), Vectors.Float.Zero); // N

        Entity Requested = SdtdUtils.EntityCreation.Spawn(place.position, "zombieMoe");
        int    eid       = Requested.entityId;

        yield return(SdtdUtils.EntityCreation.WaitEntity(Requested));

        Entity ent = GameManager.Instance.World.GetEntity(eid);

        if (ent == null)
        {
            Debug.Log(String.Format("SpawnAndbuff failed entity {0} {1}", eid, Requested));
            yield break;
        }
        EntityAlive entity = ent as EntityAlive;

        if (entity != null)
        {
            if (!entity.Buffs.HasBuff(buffname))
            {
                entity.Buffs.AddBuff(buffname);
            }
        }
    }
Пример #2
0
    /*
     *  1: petite explo (mine qui pete, small smoke trail only, no fire)
     *  2: med/Large explo orange / rouge + etincelles (pas vraiment explo)
     *  3: redish fire, flamme rouge montante + bcp black smoke
     *  4: redish idem, larger
     *  5: yellow/orange expl, +bcp black smoke
     *  6 :idem
     *  7: vomit, 8: gore block explo
     *  9: like 6
     *
     *  10: molotov (fire ball when in the air)
     *  11-12: yellow etincelles only, no smoke
     *  13: orange boom no smoke, like 1
     *  14-19: crée un bout de bidons détruit
     *  14: le bout part en l'air avec une trainée de flamme ("napalm")
     *  15/ 16: additionnal "napalm"
     */

    public override void Execute(List <string> _params, CommandSenderInfo _senderInfo)
    {
        Printer.Print("ConsoleCmdExplShowExplo", _params);
        EntityPlayerLocal player = GameManager.Instance.World.GetLocalPlayers()[0];

        if (_params[0] == "p")
        {
            Color color = Color.white;
            if (_params.Count >= 3)
            {
                string[] split = _params[2].Split(',');
                float[]  def   = new float[] { 0, 0, 0, 1 };
                for (int k = 0; k < split.Length; k++)
                {
                    def[k] = float.Parse(split[k]);
                }
                color = new Color(def[0], def[1], def[2], def[3]);
            }
            Printer.Print(color);
            ExecuteParticle(_params[1], player.GetPosition() + new Vector3(0, 0, 6), color);
            return;
        }
        else if (_params[0] == "pa")
        {
            ExecuteParticleAttach(_params[1], player.GetPosition());
            return;
        }
        else if (_params[0] == "pg")
        {
            ExecuteParticleGhost(_params[1], player.GetPosition());
            return;
        }
        else if (_params[0] == "s")
        {
            float intens = 1f;
            if (_params.Count > 0)
            {
                intens = float.Parse(_params[1]);
            }
            ExecuteScreenEffect(_params[1]);
            return;
        }
        int ei = int.Parse(_params[0]);

        Emplacement place = Emplacement.At(player.GetPosition() + new Vector3(0, 1, 10), Vectors.Float.Zero); // N

        ItemClass         itemClass = ItemClass.GetItemClass("thrownAmmoMolotovCocktail", false);
        DynamicProperties baseProps = itemClass.Properties;
        ExplosionData     ed        = new ExplosionData(baseProps);

        ed.ParticleIndex = ei;
        GameManager.Instance.ExplosionServer(0, place.position, place.ipos, Quaternion.identity, ed, player.entityId, 0.1f, false, null); // try -1
    }
Пример #3
0
        public override IEnumerator Apply(EntityPlayer player, EntityAlive target, OptionEffect opt)
        {
            Vector3     pos   = target.GetPosition();
            Emplacement place = Emplacement.At(pos, Placer.directions.Generate(pos));

            Printer.Log(40, "Peak Effect1", place.position, place.ipos, opt.OptionBlock.blocks, opt.OptionShape.shape);
            Zombiome.Routines.Named("PeakAt").Start(
                Routines.Call(biome.groundParticleEffect, place.ipos),
                new WaitForSeconds(1f),
                EffectsGround.Peak(player, place, opt)
                );
            yield break;
        }
Пример #4
0
        public override IEnumerator Regen(EntityPlayer player, Vector3i zchunk, int iniguess)
        {
            Bounds        bounds   = ZChunk.Bounds4(zchunk, iniguess);
            List <Entity> existing = GameManager.Instance.World.GetEntitiesInBounds(
                EntityGhost.Concretes[this.concreteIdx],
                bounds,
                new List <Entity>()
                );

            yield return(Iterating.Repeater.Frame); // listent may be costly

            Vector3i min = Vectors.ToInt(bounds.min);
            Vector3i max = Vectors.ToInt(bounds.max);

            int current = existing.Count;
            int gen     = ZChunk.Size(this.gen);
            // gen = 1; // DEBUG
            int regen = ZChunk.Size(this.regen);
            int iniy  = (int)Math.Floor(player.GetPosition().y);

            Zombiome.Routines.Start(Routines.IfNotRunning(
                                        LockRenew,
                                        EffectExisting(player, existing)
                                        ), "Ghost-Existing");

            int nnew = Math.Min(limit_new, gen - current);

            Entity[] Tracker = new Entity[] { null };
            if (current < regen)
            {
                Printer.Log(45, "Ghost regen", regen, current, gen, "=>", gen - current);
                for (int k = 0; k < nnew; k++)
                {
                    Vector3i pos = new Vector3i(rand.RandomRange(min.x, max.x), 0, rand.RandomRange(min.z, max.z));
                    pos = Geo3D.Surface(pos, iniy);
                    if (GameManager.Instance.World.GetTerrainHeight(pos.x, pos.z) > 2)
                    {
                        Printer.Log(40, "Ghost", pos, opt.OptionEntity.entity, opt.OptionEntity.buff);
                        Emplacement place = Emplacement.At(Vectors.ToFloat(pos) + 2f * Vectors.Float.UnitY, Vectors.Float.UnitY);
                        GhostData   gdata = (ghost_type == "") ? this.GhostData : GhostData.Ghosts[ghost_type];
                        yield return(EntityGhost.Create(gdata, place, opt.OptionEntity.entity));
                    }
                    yield return(Repeater.Yield);
                }
            }
        }
Пример #5
0
        public override IEnumerator Regen(EntityPlayer player, Vector3i zchunk, int iniguess)
        {
            yield return(ZBActivity.Environment.ZBSounds.Play(ZBiomeInfo.NoiseWater, player.GetPosition(), player, World, 2, 0, 0.5f));

            int gen = ZChunk.Size(this.gen);

            Vector3[] positions = ZChunk.Positions(Zombiome.worldSeed, zchunk, gen);

            foreach (Vector3 pos in positions)
            {
                Printer.Log(40, "Flood regen", zchunk, pos);
                Vector3i    surfaced = Geo3D.Surface(Vectors.ToInt(pos), iniguess);
                Emplacement place    = Emplacement.At(Vectors.ToFloat(surfaced), Vectors.Float.UnitY);
                /* Generate Emplacement => apply filter from gth */
                int  th = GameManager.Instance.World.GetTerrainHeight(surfaced.x, surfaced.z);
                bool go = th > 5;
                if (go)
                {
                    go = surfaced.y < th + Placer.pOffSurface;
                }
                if (go)
                {
                    go = surfaced.y > th - Placer.nOffSurface;
                }
                if (go)
                {
                    go = !(IsWater(World.GetBlock(surfaced + Vectors.Up).Block) &&
                           IsWater(World.GetBlock(surfaced + 2 * Vectors.Up).Block));
                }
                if (go)
                {
                    Printer.Log(40, "Flood at", place);
                    // Dont do it if already water, surtout qu'on affaisse la surface !!
                    // Cave allows to bound water by ground
                    yield return(EffectsCollapse.Cave(player, place, opt));
                }
                yield return(Repeater.Yield);
            }
        }