X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fturrets%2Fturret%2Fphaser_weapon.qc;h=e4d09d193f7981338fa3f71429cf1a9bc529d768;hb=0514f7948727cfa572b33bd29d1bdf2c13cd866d;hp=2e08f5eb3d723cedefe9d790dbea66ee1c572f4e;hpb=67db56b06d6333621dc19ba3b8dcf8976f5acfbb;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/turrets/turret/phaser_weapon.qc b/qcsrc/common/turrets/turret/phaser_weapon.qc index 2e08f5eb3..e4d09d193 100644 --- a/qcsrc/common/turrets/turret/phaser_weapon.qc +++ b/qcsrc/common/turrets/turret/phaser_weapon.qc @@ -1,7 +1,5 @@ #include "phaser_weapon.qh" -#ifdef IMPLEMENTATION - #ifdef SVQC void beam_think(entity this); @@ -14,14 +12,14 @@ METHOD(PhaserTurretAttack, wr_think, void(entity thiswep, entity actor, .entity if (!isPlayer || weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(electro, refire))) { if (isPlayer) { turret_initparams(actor); - W_SetupShot_Dir(actor, weaponentity, v_forward, false, 0, SND_PhaserTurretAttack_FIRE, CH_WEAPON_B, 0); + W_SetupShot_Dir(actor, weaponentity, v_forward, false, 0, SND_PhaserTurretAttack_FIRE, CH_WEAPON_B, 0, DEATH_TURRET_PHASER.m_id); actor.tur_shotdir_updated = w_shotdir; actor.tur_shotorg = w_shotorg; actor.tur_head = actor; actor.shot_speed = 1; weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(electro, animtime), w_ready); } - entity beam = spawn(); + entity beam = new(PhaserTurret_beam); beam.ticrate = 0.1; //autocvar_sys_ticrate; setmodel(beam, MDL_TUR_PHASER_BEAM); beam.effects = EF_LOWPRECISION; @@ -36,6 +34,7 @@ METHOD(PhaserTurretAttack, wr_think, void(entity thiswep, entity actor, .entity set_movetype(beam, MOVETYPE_NONE); beam.enemy = actor.enemy; beam.bot_dodge = true; + IL_PUSH(g_bot_dodge, beam); beam.bot_dodgerating = beam.shot_dmg; sound (beam, CH_SHOTS_SINGLE, SND_TUR_PHASER, VOL_BASE, ATTEN_NORM); actor.fireflag = 1; @@ -43,7 +42,7 @@ METHOD(PhaserTurretAttack, wr_think, void(entity thiswep, entity actor, .entity beam.attack_finished_single[0] = actor.attack_finished_single[0]; actor.attack_finished_single[0] = time; // + autocvar_sys_ticrate; - setattachment(beam,actor.tur_head, "tag_fire"); + setattachment(beam, actor.tur_head, "tag_fire"); soundat (actor, trace_endpos, CH_SHOTS, SND(NEXIMPACT), VOL_BASE, ATTEN_NORM); if (!isPlayer) @@ -54,17 +53,18 @@ METHOD(PhaserTurretAttack, wr_think, void(entity thiswep, entity actor, .entity void beam_think(entity this) { - if ((time > this.cnt) || (IS_DEAD(this.owner))) + entity actor = this.owner; + if ((time > this.cnt) || (IS_DEAD(actor))) { - this.owner.attack_finished_single[0] = time + this.owner.shot_refire; - this.owner.fireflag = 2; - this.owner.tur_head.frame = 10; + actor.attack_finished_single[0] = time + actor.shot_refire; + actor.fireflag = 2; + actor.tur_head.frame = 10; sound (this, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, ATTEN_NORM); delete(this); return; } - turret_do_updates(this.owner); + turret_do_updates(actor); if (time - this.shot_spread > 0) { @@ -72,22 +72,18 @@ void beam_think(entity this) sound (this, CH_SHOTS_SINGLE, SND_TUR_PHASER, VOL_BASE, ATTEN_NORM); } - this.nextthink = time + this.ticrate; - this.owner.attack_finished_single[0] = time + frametime; - FireImoBeam ( this.owner, this.tur_shotorg, - this.tur_shotorg + this.tur_shotdir_updated * this.target_range, - '-1 -1 -1' * this.shot_radius, - '1 1 1' * this.shot_radius, - this.shot_force, + actor.attack_finished_single[0] = time + frametime; + FireImoBeam ( actor, actor.tur_shotorg, + actor.tur_shotorg + actor.tur_shotdir_updated * actor.target_range, + '-1 -1 -1' * actor.shot_radius, + '1 1 1' * actor.shot_radius, + actor.shot_force, this.shot_dmg, 0.75, DEATH_TURRET_PHASER.m_id); - this.scale = vlen(this.owner.tur_shotorg - trace_endpos) / 256; - + this.scale = vlen(actor.tur_shotorg - trace_endpos) / 256; } #endif - -#endif