676bf896e59ae76059142cca0c99058a58537e58
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / turrets / turret / walker_weapon.qc
1 #ifndef TURRET_WALKER_WEAPON_H
2 #define TURRET_WALKER_WEAPON_H
3
4 CLASS(WalkerTurretAttack, PortoLaunch)
5 /* flags     */ ATTRIB(WalkerTurretAttack, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
6 /* impulse   */ ATTRIB(WalkerTurretAttack, impulse, int, 5);
7 /* refname   */ ATTRIB(WalkerTurretAttack, netname, string, "turret_walker");
8 /* wepname   */ ATTRIB(WalkerTurretAttack, message, string, _("Walker"));
9 ENDCLASS(WalkerTurretAttack)
10 REGISTER_WEAPON(WALKER, NEW(WalkerTurretAttack));
11
12 #endif
13
14 #ifdef IMPLEMENTATION
15
16 #ifdef SVQC
17
18 METHOD(WalkerTurretAttack, wr_think, void(entity thiswep, entity actor, bool fire1, bool fire2)) {
19     bool isPlayer = IS_PLAYER(actor);
20     if (fire1)
21     if (!isPlayer || weapon_prepareattack(actor, 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, WFRAME_FIRE1, WEP_CVAR_PRI(electro, animtime), w_ready);
29         }
30         sound (actor, CH_WEAPON_A, SND_UZI_FIRE, VOL_BASE, ATTEN_NORM);
31         fireBullet (actor.tur_shotorg, actor.tur_shotdir_updated, actor.shot_spread, 0, actor.shot_dmg, actor.shot_force, DEATH_TURRET_WALK_GUN, 0);
32         Send_Effect(EFFECT_BLASTER_MUZZLEFLASH, actor.tur_shotorg, actor.tur_shotdir_updated * 1000, 1);
33     }
34 }
35
36 #endif
37
38 #endif