public static void SP_trigger_key(edict_t self) { if (GameBase.st.item == null) { GameBase.gi.dprintf("no key item for trigger_key at " + Lib.vtos(self.s.origin) + "\n"); return; } self.item = GameItems.FindItemByClassname(GameBase.st.item); if (null == self.item) { GameBase.gi.dprintf("item " + GameBase.st.item + " not found for trigger_key at " + Lib.vtos(self.s.origin) + "\n"); return; } if (self.target == null) { GameBase.gi.dprintf(self.classname + " at " + Lib.vtos(self.s.origin) + " has no target\n"); return; } GameBase.gi.soundindex("misc/keytry.wav"); GameBase.gi.soundindex("misc/keyuse.wav"); self.use = GameTrigger.trigger_key_use; }
public static void SP_turret_driver(edict_t self) { if (GameBase.deathmatch.value != 0) { GameUtil.G_FreeEdict(self); return; } self.movetype = Defines.MOVETYPE_PUSH; self.solid = Defines.SOLID_BBOX; self.s.modelindex = GameBase.gi.modelindex("models/monsters/infantry/tris.md2"); Math3D.VectorSet(self.mins, -16, -16, -24); Math3D.VectorSet(self.maxs, 16, 16, 32); self.health = 100; self.gib_health = 0; self.mass = 200; self.viewheight = 24; self.die = GameTurret.turret_driver_die; self.monsterinfo.stand = M_Infantry.infantry_stand; self.flags |= Defines.FL_NO_KNOCKBACK; GameBase.level.total_monsters++; self.svflags |= Defines.SVF_MONSTER; self.s.renderfx |= Defines.RF_FRAMELERP; self.takedamage = Defines.DAMAGE_AIM; self.use = GameUtil.monster_use; self.clipmask = Defines.MASK_MONSTERSOLID; Math3D.VectorCopy(self.s.origin, self.s.old_origin); self.monsterinfo.aiflags |= Defines.AI_STAND_GROUND | Defines.AI_DUCKED; if (GameBase.st.item != null) { self.item = GameItems.FindItemByClassname(GameBase.st.item); if (self.item == null) { GameBase.gi.dprintf(self.classname + " at " + Lib.vtos(self.s.origin) + " has bad item: " + GameBase.st.item + "\n"); } } self.think = GameTurret.turret_driver_link; self.nextthink = GameBase.level.time + Defines.FRAMETIME; GameBase.gi.linkentity(self); }
// ============================================================================ public static bool monster_start(edict_t self) { if (GameBase.deathmatch.value != 0) { GameUtil.G_FreeEdict(self); return(false); } if ((self.spawnflags & 4) != 0 && 0 == (self.monsterinfo.aiflags & Defines.AI_GOOD_GUY)) { self.spawnflags &= ~4; self.spawnflags |= 1; // gi.dprintf("fixed spawnflags on %s at %s\n", self.classname, // vtos(self.s.origin)); } if (0 == (self.monsterinfo.aiflags & Defines.AI_GOOD_GUY)) { GameBase.level.total_monsters++; } self.nextthink = GameBase.level.time + Defines.FRAMETIME; self.svflags |= Defines.SVF_MONSTER; self.s.renderfx |= Defines.RF_FRAMELERP; self.takedamage = Defines.DAMAGE_AIM; self.air_finished = GameBase.level.time + 12; self.use = GameUtil.monster_use; self.max_health = self.health; self.clipmask = Defines.MASK_MONSTERSOLID; self.s.skinnum = 0; self.deadflag = Defines.DEAD_NO; self.svflags &= ~Defines.SVF_DEADMONSTER; if (null == self.monsterinfo.checkattack) { self.monsterinfo.checkattack = GameUtil.M_CheckAttack; } Math3D.VectorCopy(self.s.origin, self.s.old_origin); if (GameBase.st.item != null && GameBase.st.item.Length > 0) { self.item = GameItems.FindItemByClassname(GameBase.st.item); if (self.item == null) { GameBase.gi.dprintf("monster_start:" + self.classname + " at " + Lib.vtos(self.s.origin) + " has bad item: " + GameBase.st.item + "\n"); } } // randomize what frame they start on if (self.monsterinfo.currentmove != null) { self.s.frame = self.monsterinfo.currentmove.firstframe + Lib.rand() % (self.monsterinfo.currentmove.lastframe - self.monsterinfo.currentmove.firstframe + 1); } return(true); }