public boolean think(edict_t self) { float range; float[] v = {0, 0, 0}; // a small safe zone Math3D.VectorSubtract(self.s.origin, self.enemy.s.origin, v); range = Math3D.VectorLength(v); if (range <= (Defines.MELEE_DISTANCE + 32)) return true; // charge up the railgun GameBase.gi.sound(self, Defines.CHAN_WEAPON, sound_gun, 1, Defines.ATTN_NORM, 0); Math3D.VectorCopy(self.enemy.s.origin, self.pos1); // save for aiming the shot self.pos1[2] += self.enemy.viewheight; self.monsterinfo.currentmove = gladiator_move_attack_gun; return true; }
public boolean think(edict_t self) { float[] start = {0, 0, 0}; float[] dir = {0, 0, 0}; float[] forward = {0, 0, 0}, right = {0, 0, 0}; Math3D.AngleVectors(self.s.angles, forward, right, null); Math3D.G_ProjectSource( self.s.origin, M_Flash.monster_flash_offset[Defines.MZ2_GLADIATOR_RAILGUN_1], forward, right, start); // calc direction to where we targted Math3D.VectorSubtract(self.pos1, start, dir); Math3D.VectorNormalize(dir); Monster.monster_fire_railgun(self, start, dir, 50, 100, Defines.MZ2_GLADIATOR_RAILGUN_1); return true; }