示例#1
0
        public static void Fire_rail(edict_t self, float[] start, float[] aimdir, int damage, int kick)
        {
            float[] from = new float[] { 0, 0, 0 };
            float[] end  = new float[] { 0, 0, 0 };
            trace_t tr   = null;
            edict_t ignore;
            int     mask;
            bool    water;

            Math3D.VectorMA(start, 8192F, aimdir, end);
            Math3D.VectorCopy(start, from);
            ignore = self;
            water  = false;
            mask   = Defines.MASK_SHOT | Defines.CONTENTS_SLIME | Defines.CONTENTS_LAVA;
            while (ignore != null)
            {
                tr = GameBase.gi.Trace(from, null, null, end, ignore, mask);
                if ((tr.contents & (Defines.CONTENTS_SLIME | Defines.CONTENTS_LAVA)) != 0)
                {
                    mask &= ~(Defines.CONTENTS_SLIME | Defines.CONTENTS_LAVA);
                    water = true;
                }
                else
                {
                    if ((tr.ent.svflags & Defines.SVF_MONSTER) != 0 || (tr.ent.client != null) || (tr.ent.solid == Defines.SOLID_BBOX))
                    {
                        ignore = tr.ent;
                    }
                    else
                    {
                        ignore = null;
                    }
                    if ((tr.ent != self) && (tr.ent.takedamage != 0))
                    {
                        GameCombat.T_Damage(tr.ent, self, self, aimdir, tr.endpos, tr.plane.normal, damage, kick, 0, Defines.MOD_RAILGUN);
                    }
                }

                Math3D.VectorCopy(tr.endpos, from);
            }

            GameBase.gi.WriteByte(Defines.svc_temp_entity);
            GameBase.gi.WriteByte(Defines.TE_RAILTRAIL);
            GameBase.gi.WritePosition(start);
            GameBase.gi.WritePosition(tr.endpos);
            GameBase.gi.Multicast(self.s.origin, Defines.MULTICAST_PHS);
            if (water)
            {
                GameBase.gi.WriteByte(Defines.svc_temp_entity);
                GameBase.gi.WriteByte(Defines.TE_RAILTRAIL);
                GameBase.gi.WritePosition(start);
                GameBase.gi.WritePosition(tr.endpos);
                GameBase.gi.Multicast(tr.endpos, Defines.MULTICAST_PHS);
            }

            if (self.client != null)
            {
                PlayerWeapon.PlayerNoise(self, tr.endpos, Defines.PNOISE_IMPACT);
            }
        }
示例#2
0
 public virtual void Set(trace_t from)
 {
     allsolid   = from.allsolid;
     startsolid = from.allsolid;
     fraction   = from.fraction;
     Math3D.VectorCopy(from.endpos, endpos);
     plane.Set(from.plane);
     surface  = from.surface;
     contents = from.contents;
     ent      = from.ent;
 }