public override void Use(edict_t self, edict_t other, edict_t activator) { if (self.enemy == null) { edict_t e; e = null; EdictIterator es = null; while (true) { es = GameBase.G_Find(es, GameBase.findByTarget, self.target); if (es == null) { break; } e = es.o; if (Lib.Strcmp(e.classname, "light") != 0) { GameBase.gi.Dprintf(self.classname + " at " + Lib.Vtos(self.s.origin)); GameBase.gi.Dprintf("target " + self.target + " (" + e.classname + " at " + Lib.Vtos(e.s.origin) + ") is not a light\\n"); } else { self.enemy = e; } } if (null == self.enemy) { GameBase.gi.Dprintf(self.classname + " target " + self.target + " not found at " + Lib.Vtos(self.s.origin) + "\\n"); GameUtil.G_FreeEdict(self); return; } } self.timestamp = GameBase.level.time; target_lightramp_think.Think(self); }
public override Boolean Think(edict_t self) { self.movetype = Defines.MOVETYPE_NONE; self.solid = Defines.SOLID_NOT; self.s.renderfx |= Defines.RF_BEAM | Defines.RF_TRANSLUCENT; self.s.modelindex = 1; if ((self.spawnflags & 64) != 0) { self.s.frame = 16; } else { self.s.frame = 4; } if ((self.spawnflags & 2) != 0) { self.s.skinnum = unchecked (( Int32 )0xf2f2f0f0); } else if ((self.spawnflags & 4) != 0) { self.s.skinnum = unchecked (( Int32 )0xd0d1d2d3); } else if ((self.spawnflags & 8) != 0) { self.s.skinnum = unchecked (( Int32 )0xf3f3f1f1); } else if ((self.spawnflags & 16) != 0) { self.s.skinnum = unchecked (( Int32 )0xdcdddedf); } else if ((self.spawnflags & 32) != 0) { self.s.skinnum = unchecked (( Int32 )0xe0e1e2e3); } if (null == self.enemy) { if (self.target != null) { EdictIterator edit = GameBase.G_Find(null, GameBase.findByTarget, self.target); if (edit == null) { GameBase.gi.Dprintf(self.classname + " at " + Lib.Vtos(self.s.origin) + ": " + self.target + " is a bad target\\n"); } self.enemy = edit.o; } else { GameBase.G_SetMovedir(self.s.angles, self.movedir); } } self.use = target_laser_use; self.think = target_laser_think; if (0 == self.dmg) { self.dmg = 1; } Math3D.VectorSet(self.mins, -8, -8, -8); Math3D.VectorSet(self.maxs, 8, 8, 8); GameBase.gi.Linkentity(self); if ((self.spawnflags & 1) != 0) { Target_laser_on(self); } else { Target_laser_off(self); } return(true); }
public static void Monster_start_go(edict_t self) { float[] v = new float[] { 0, 0, 0 }; if (self.health <= 0) { return; } if (self.target != null) { bool notcombat; bool fixup; edict_t target = null; notcombat = false; fixup = false; EdictIterator edit = null; while ((edit = GameBase.G_Find(edit, GameBase.findByTarget, self.target)) != null) { target = edit.o; if (Lib.Strcmp(target.classname, "point_combat") == 0) { self.combattarget = self.target; fixup = true; } else { notcombat = true; } } if (notcombat && self.combattarget != null) { GameBase.gi.Dprintf(self.classname + " at " + Lib.Vtos(self.s.origin) + " has target with mixed types\\n"); } if (fixup) { self.target = null; } } if (self.combattarget != null) { edict_t target = null; EdictIterator edit = null; while ((edit = GameBase.G_Find(edit, GameBase.findByTarget, self.combattarget)) != null) { target = edit.o; if (Lib.Strcmp(target.classname, "point_combat") != 0) { GameBase.gi.Dprintf(self.classname + " at " + Lib.Vtos(self.s.origin) + " has bad combattarget " + self.combattarget + " : " + target.classname + " at " + Lib.Vtos(target.s.origin)); } } } if (self.target != null) { self.goalentity = self.movetarget = GameBase.G_PickTarget(self.target); if (null == self.movetarget) { GameBase.gi.Dprintf(self.classname + " can't find target " + self.target + " at " + Lib.Vtos(self.s.origin) + "\\n"); self.target = null; self.monsterinfo.pausetime = 100000000; self.monsterinfo.stand.Think(self); } else if (Lib.Strcmp(self.movetarget.classname, "path_corner") == 0) { Math3D.VectorSubtract(self.goalentity.s.origin, self.s.origin, v); self.ideal_yaw = self.s.angles[Defines.YAW] = Math3D.Vectoyaw(v); self.monsterinfo.walk.Think(self); self.target = null; } else { self.goalentity = self.movetarget = null; self.monsterinfo.pausetime = 100000000; self.monsterinfo.stand.Think(self); } } else { self.monsterinfo.pausetime = 100000000; self.monsterinfo.stand.Think(self); } self.think = Monster.monster_think; self.nextthink = GameBase.level.time + Defines.FRAMETIME; }
public static void BeginIntermission(edict_t targ) { int i, n; edict_t ent, client; if (GameBase.level.intermissiontime != 0) { return; } GameBase.game.autosaved = false; for (i = 0; i < GameBase.maxclients.value; i++) { client = GameBase.g_edicts[1 + i]; if (!client.inuse) { continue; } if (client.health <= 0) { PlayerClient.Respawn(client); } } GameBase.level.intermissiontime = GameBase.level.time; GameBase.level.changemap = targ.map; if (GameBase.level.changemap.IndexOf('*') > -1) { if (GameBase.coop.value != 0) { for (i = 0; i < GameBase.maxclients.value; i++) { client = GameBase.g_edicts[1 + i]; if (!client.inuse) { continue; } for (n = 1; n < GameItemList.itemlist.Length; n++) { if (GameItemList.itemlist[n] != null) { if ((GameItemList.itemlist[n].flags & Defines.IT_KEY) != 0) { client.client.pers.inventory[n] = 0; } } } } } } else { if (0 == GameBase.deathmatch.value) { GameBase.level.exitintermission = true; return; } } GameBase.level.exitintermission = false; ent = GameBase.G_FindEdict(null, GameBase.findByClass, "info_player_intermission"); if (ent == null) { ent = GameBase.G_FindEdict(null, GameBase.findByClass, "info_player_start"); if (ent == null) { ent = GameBase.G_FindEdict(null, GameBase.findByClass, "info_player_deathmatch"); } } else { i = Lib.Rand() & 3; EdictIterator es = null; while (i-- > 0) { es = GameBase.G_Find(es, GameBase.findByClass, "info_player_intermission"); if (es == null) { continue; } ent = es.o; } } Math3D.VectorCopy(ent.s.origin, GameBase.level.intermission_origin); Math3D.VectorCopy(ent.s.angles, GameBase.level.intermission_angle); for (i = 0; i < GameBase.maxclients.value; i++) { client = GameBase.g_edicts[1 + i]; if (!client.inuse) { continue; } MoveClientToIntermission(client); } }
public static void G_UseTargets(edict_t ent, edict_t activator) { edict_t t; CheckClassname(ent); if (ent.delay != 0) { t = G_Spawn(); t.classname = "DelayedUse"; t.nextthink = GameBase.level.time + ent.delay; t.think = Think_Delay; t.activator = activator; if (activator == null) { GameBase.gi.Dprintf("Think_Delay with no activator\\n"); } t.message = ent.message; t.target = ent.target; t.killtarget = ent.killtarget; return; } if ((ent.message != null) && (activator.svflags & Defines.SVF_MONSTER) == 0) { GameBase.gi.Centerprintf(activator, "" + ent.message); if (ent.noise_index != 0) { GameBase.gi.Sound(activator, Defines.CHAN_AUTO, ent.noise_index, 1, Defines.ATTN_NORM, 0); } else { GameBase.gi.Sound(activator, Defines.CHAN_AUTO, GameBase.gi.Soundindex("misc/talk1.wav"), 1, Defines.ATTN_NORM, 0); } } EdictIterator edit = null; if (ent.killtarget != null) { while ((edit = GameBase.G_Find(edit, GameBase.findByTarget, ent.killtarget)) != null) { t = edit.o; G_FreeEdict(t); if (!ent.inuse) { GameBase.gi.Dprintf("entity was removed while using killtargets\\n"); return; } } } if (ent.target != null) { edit = null; while ((edit = GameBase.G_Find(edit, GameBase.findByTarget, ent.target)) != null) { t = edit.o; if (Lib.Q_stricmp("func_areaportal", t.classname) == 0 && (Lib.Q_stricmp("func_door", ent.classname) == 0 || Lib.Q_stricmp("func_door_rotating", ent.classname) == 0)) { continue; } if (t == ent) { GameBase.gi.Dprintf("WARNING: Entity used itself.\\n"); } else { if (t.use != null) { t.use.Use(t, ent, activator); } } if (!ent.inuse) { GameBase.gi.Dprintf("entity was removed while using targets\\n"); return; } } } }