]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/turrets/turret/plasma_weapon.qc
Merge branch 'terencehill/hide_motd' into 'master'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / turrets / turret / plasma_weapon.qc
1 #ifndef TURRET_PLASMA_WEAPON_H
2 #define TURRET_PLASMA_WEAPON_H
3
4 CLASS(PlasmaAttack, PortoLaunch)
5 /* flags     */ ATTRIB(PlasmaAttack, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
6 /* impulse   */ ATTRIB(PlasmaAttack, impulse, int, 5);
7 /* refname   */ ATTRIB(PlasmaAttack, netname, string, "turret_plasma");
8 /* wepname   */ ATTRIB(PlasmaAttack, m_name, string, _("Plasma"));
9 ENDCLASS(PlasmaAttack)
10 REGISTER_WEAPON(PLASMA, NEW(PlasmaAttack));
11
12 #endif
13
14 #ifdef IMPLEMENTATION
15
16 #ifdef SVQC
17
18 METHOD(PlasmaAttack, wr_think, void(entity thiswep, entity actor, int slot, int fire)) {
19         bool isPlayer = IS_PLAYER(actor);
20         if (fire & 1)
21         if (!isPlayer || weapon_prepareattack(thiswep, actor, slot, false, WEP_CVAR_PRI(electro, refire))) {
22                 if (isPlayer) {
23             turret_initparams(actor);
24             W_SetupShot_Dir(actor, v_forward, false, 0, W_Sound("electro_fire"), CH_WEAPON_B, 0);
25             actor.tur_shotdir_updated = w_shotdir;
26             actor.tur_shotorg = w_shotorg;
27             actor.tur_head = actor;
28             weapon_thinkf(actor, slot, WFRAME_FIRE1, WEP_CVAR_PRI(electro, animtime), w_ready);
29         }
30         entity missile = turret_projectile(SND(HAGAR_FIRE), 1, 0, DEATH_TURRET_PLASMA.m_id, PROJECTILE_ELECTRO_BEAM, true, true);
31         missile.missile_flags = MIF_SPLASH;
32         Send_Effect(EFFECT_BLASTER_MUZZLEFLASH, actor.tur_shotorg, actor.tur_shotdir_updated * 1000, 1);
33         }
34 }
35
36 #endif
37
38 #endif