Пример #1
0
            public override void Touch(edict_t self, edict_t other, cplane_t plane, csurface_t surf)
            {
                if (other.client != null)
                {
                    if ((self.spawnflags & 2) != 0)
                    {
                        return;
                    }
                }
                else if ((other.svflags & Defines.SVF_MONSTER) != 0)
                {
                    if (0 == (self.spawnflags & 1))
                    {
                        return;
                    }
                }
                else
                {
                    return;
                }
                if (!Math3D.VectorEquals(self.movedir, Globals.vec3_origin))
                {
                    float[] forward = new float[] { 0, 0, 0 };
                    Math3D.AngleVectors(other.s.angles, forward, null, null);
                    if (Math3D.DotProduct(forward, self.movedir) < 0)
                    {
                        return;
                    }
                }

                self.activator = other;
                Multi_trigger(self);
            }
Пример #2
0
            public override void Touch(edict_t self, edict_t other, cplane_t plane, csurface_t surf)
            {
                if (Lib.Strcmp(other.classname, "grenade") == 0)
                {
                    Math3D.VectorScale(self.movedir, self.speed * 10, other.velocity);
                }
                else if (other.health > 0)
                {
                    Math3D.VectorScale(self.movedir, self.speed * 10, other.velocity);
                    if (other.client != null)
                    {
                        Math3D.VectorCopy(other.velocity, other.client.oldvelocity);
                        if (other.fly_sound_debounce_time < GameBase.level.time)
                        {
                            other.fly_sound_debounce_time = GameBase.level.time + 1.5F;
                            GameBase.gi.Sound(other, Defines.CHAN_AUTO, windsound, 1, Defines.ATTN_NORM, 0);
                        }
                    }
                }

                if ((self.spawnflags & PUSH_ONCE) != 0)
                {
                    GameUtil.G_FreeEdict(self);
                }
            }
Пример #3
0
 public virtual void Set(cplane_t c)
 {
     Math3D.Set(normal, c.normal);
     dist     = c.dist;
     type     = c.type;
     signbits = c.signbits;
     pad[0]   = c.pad[0];
     pad[1]   = c.pad[1];
 }
Пример #4
0
            public override void Touch(edict_t self, edict_t other, cplane_t plane, csurface_t surf)
            {
                int mod;

                if (other == self.owner)
                {
                    return;
                }
                if (surf != null && (surf.flags & Defines.SURF_SKY) != 0)
                {
                    GameUtil.G_FreeEdict(self);
                    return;
                }

                if (self.owner.client != null)
                {
                    PlayerWeapon.PlayerNoise(self.owner, self.s.origin, Defines.PNOISE_IMPACT);
                }
                if (other.takedamage != 0)
                {
                    if ((self.spawnflags & 1) != 0)
                    {
                        mod = Defines.MOD_HYPERBLASTER;
                    }
                    else
                    {
                        mod = Defines.MOD_BLASTER;
                    }
                    float[] normal;
                    if (plane == null)
                    {
                        normal = new float[3];
                    }
                    else
                    {
                        normal = plane.normal;
                    }
                    GameCombat.T_Damage(other, self, self.owner, self.velocity, self.s.origin, normal, self.dmg, 1, Defines.DAMAGE_ENERGY, mod);
                }
                else
                {
                    GameBase.gi.WriteByte(Defines.svc_temp_entity);
                    GameBase.gi.WriteByte(Defines.TE_BLASTER);
                    GameBase.gi.WritePosition(self.s.origin);
                    if (plane == null)
                    {
                        GameBase.gi.WriteDir(Globals.vec3_origin);
                    }
                    else
                    {
                        GameBase.gi.WriteDir(plane.normal);
                    }
                    GameBase.gi.Multicast(self.s.origin, Defines.MULTICAST_PVS);
                }

                GameUtil.G_FreeEdict(self);
            }
Пример #5
0
            public override void Touch(edict_t ent, edict_t other, cplane_t plane, csurface_t surf)
            {
                float[] origin = new float[] { 0, 0, 0 };
                int     n;

                if (other == ent.owner)
                {
                    return;
                }
                if (surf != null && (surf.flags & Defines.SURF_SKY) != 0)
                {
                    GameUtil.G_FreeEdict(ent);
                    return;
                }

                if (ent.owner.client != null)
                {
                    PlayerWeapon.PlayerNoise(ent.owner, ent.s.origin, Defines.PNOISE_IMPACT);
                }
                Math3D.VectorMA(ent.s.origin, -0.02F, ent.velocity, origin);
                if (other.takedamage != 0)
                {
                    GameCombat.T_Damage(other, ent, ent.owner, ent.velocity, ent.s.origin, plane.normal, ent.dmg, 0, 0, Defines.MOD_ROCKET);
                }
                else
                {
                    if (GameBase.deathmatch.value == 0 && 0 == GameBase.coop.value)
                    {
                        if ((surf != null) && 0 == (surf.flags & (Defines.SURF_WARP | Defines.SURF_TRANS33 | Defines.SURF_TRANS66 | Defines.SURF_FLOWING)))
                        {
                            n = Lib.Rand() % 5;
                            while (n-- > 0)
                            {
                                GameMisc.ThrowDebris(ent, "models/objects/debris2/tris.md2", 2, ent.s.origin);
                            }
                        }
                    }
                }

                GameCombat.T_RadiusDamage(ent, ent.owner, ent.radius_dmg, other, ent.dmg_radius, Defines.MOD_R_SPLASH);
                GameBase.gi.WriteByte(Defines.svc_temp_entity);
                if (ent.waterlevel != 0)
                {
                    GameBase.gi.WriteByte(Defines.TE_ROCKET_EXPLOSION_WATER);
                }
                else
                {
                    GameBase.gi.WriteByte(Defines.TE_ROCKET_EXPLOSION);
                }
                GameBase.gi.WritePosition(origin);
                GameBase.gi.Multicast(ent.s.origin, Defines.MULTICAST_PHS);
                GameUtil.G_FreeEdict(ent);
            }
Пример #6
0
            public override void Touch(edict_t self, edict_t other, cplane_t plane, csurface_t surf)
            {
                int dflags;

                if (other.takedamage == 0)
                {
                    return;
                }
                if (self.timestamp > GameBase.level.time)
                {
                    return;
                }
                if ((self.spawnflags & 16) != 0)
                {
                    self.timestamp = GameBase.level.time + 1;
                }
                else
                {
                    self.timestamp = GameBase.level.time + Defines.FRAMETIME;
                }
                if (0 == (self.spawnflags & 4))
                {
                    if ((GameBase.level.framenum % 10) == 0)
                    {
                        GameBase.gi.Sound(other, Defines.CHAN_AUTO, self.noise_index, 1, Defines.ATTN_NORM, 0);
                    }
                }

                if ((self.spawnflags & 8) != 0)
                {
                    dflags = Defines.DAMAGE_NO_PROTECTION;
                }
                else
                {
                    dflags = 0;
                }
                GameCombat.T_Damage(other, self, self, Globals.vec3_origin, other.s.origin, Globals.vec3_origin, self.dmg, self.dmg, dflags, Defines.MOD_TRIGGER_HURT);
            }
Пример #7
0
            public override void Touch(edict_t self, edict_t other, cplane_t plane, csurface_t surf)
            {
                if (other == self.owner)
                {
                    return;
                }
                if (surf != null && (surf.flags & Defines.SURF_SKY) != 0)
                {
                    GameUtil.G_FreeEdict(self);
                    return;
                }

                if (self.owner.client != null)
                {
                    PlayerWeapon.PlayerNoise(self.owner, self.s.origin, Defines.PNOISE_IMPACT);
                }
                if (other.takedamage != 0)
                {
                    GameCombat.T_Damage(other, self, self.owner, self.velocity, self.s.origin, plane.normal, 200, 0, 0, Defines.MOD_BFG_BLAST);
                }
                GameCombat.T_RadiusDamage(self, self.owner, 200, other, 100, Defines.MOD_BFG_BLAST);
                GameBase.gi.Sound(self, Defines.CHAN_VOICE, GameBase.gi.Soundindex("weapons/bfg__x1b.wav"), 1, Defines.ATTN_NORM, 0);
                self.solid = Defines.SOLID_NOT;
                self.touch = null;
                Math3D.VectorMA(self.s.origin, -1 * Defines.FRAMETIME, self.velocity, self.s.origin);
                Math3D.VectorClear(self.velocity);
                self.s.modelindex = GameBase.gi.Modelindex("sprites/s_bfg3.sp2");
                self.s.frame      = 0;
                self.s.sound      = 0;
                self.s.effects   &= ~Defines.EF_ANIM_ALLFAST;
                self.think        = bfg_explode;
                self.nextthink    = GameBase.level.time + Defines.FRAMETIME;
                self.enemy        = other;
                GameBase.gi.WriteByte(Defines.svc_temp_entity);
                GameBase.gi.WriteByte(Defines.TE_BFG_BIGEXPLOSION);
                GameBase.gi.WritePosition(self.s.origin);
                GameBase.gi.Multicast(self.s.origin, Defines.MULTICAST_PVS);
            }
Пример #8
0
 public override void Touch(edict_t self, edict_t other, cplane_t plane, csurface_t surf)
 {
     if ((other.flags & (Defines.FL_FLY | Defines.FL_SWIM)) != 0)
     {
         return;
     }
     if ((other.svflags & Defines.SVF_DEADMONSTER) != 0)
     {
         return;
     }
     if (0 == (other.svflags & Defines.SVF_MONSTER))
     {
         return;
     }
     other.velocity[0] = self.movedir[0] * self.speed;
     other.velocity[1] = self.movedir[1] * self.speed;
     if (other.groundentity != null)
     {
         return;
     }
     other.groundentity = null;
     other.velocity[2]  = self.movedir[2];
 }
Пример #9
0
            public override void Touch(edict_t ent, edict_t other, cplane_t plane, csurface_t surf)
            {
                if (other == ent.owner)
                {
                    return;
                }
                if (surf != null && 0 != (surf.flags & Defines.SURF_SKY))
                {
                    GameUtil.G_FreeEdict(ent);
                    return;
                }

                if (other.takedamage == 0)
                {
                    if ((ent.spawnflags & 1) != 0)
                    {
                        if (Lib.Random() > 0.5F)
                        {
                            GameBase.gi.Sound(ent, Defines.CHAN_VOICE, GameBase.gi.Soundindex("weapons/hgrenb1a.wav"), 1, Defines.ATTN_NORM, 0);
                        }
                        else
                        {
                            GameBase.gi.Sound(ent, Defines.CHAN_VOICE, GameBase.gi.Soundindex("weapons/hgrenb2a.wav"), 1, Defines.ATTN_NORM, 0);
                        }
                    }
                    else
                    {
                        GameBase.gi.Sound(ent, Defines.CHAN_VOICE, GameBase.gi.Soundindex("weapons/grenlb1b.wav"), 1, Defines.ATTN_NORM, 0);
                    }

                    return;
                }

                ent.enemy = other;
                Grenade_Explode.Think(ent);
            }
Пример #10
0
 public override void Touch(edict_t self, edict_t other, cplane_t plane, csurface_t surf)
 {
     other.gravity = self.gravity;
 }
Пример #11
0
 public abstract void Touch(edict_t self, edict_t other, cplane_t plane, csurface_t surf);