4 spawnfunc(weapon_blaster) { weapon_defaultspawnfunc(this, WEP_BLASTER); }
5 spawnfunc(weapon_laser) { spawnfunc_weapon_blaster(this); }
7 void W_Blaster_Touch(entity this, entity toucher)
9 PROJECTILE_TOUCH(this, toucher);
11 this.event_damage = func_null;
17 this.blaster_edgedamage,
22 this.projectiledeathtype,
29 void W_Blaster_Think(entity this)
31 set_movetype(this, MOVETYPE_FLY);
32 setthink(this, SUB_Remove);
33 this.nextthink = time + this.blaster_lifetime;
34 CSQCProjectile(this, true, PROJECTILE_BLASTER, true);
37 void W_Blaster_Attack(
51 vector s_forward = v_forward * cos(atk_shotangle * DEG2RAD) + v_up * sin(atk_shotangle * DEG2RAD);
53 W_SetupShot_Dir(actor, weaponentity, s_forward, false, 3, SND_LASERGUN_FIRE, CH_WEAPON_B, atk_damage);
54 Send_Effect(EFFECT_BLASTER_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
56 entity missile = new(blasterbolt);
57 missile.owner = missile.realowner = actor;
58 missile.bot_dodge = true;
59 missile.bot_dodgerating = atk_damage;
60 PROJECTILE_MAKETRIGGER(missile);
62 missile.blaster_damage = atk_damage;
63 missile.blaster_edgedamage = atk_edgedamage;
64 missile.blaster_radius = atk_radius;
65 missile.blaster_force = atk_force;
66 missile.blaster_lifetime = atk_lifetime;
68 setorigin(missile, w_shotorg);
69 setsize(missile, '0 0 0', '0 0 0');
71 W_SetupProjVelocity_Explicit(
82 missile.angles = vectoangles(missile.velocity);
84 //missile.glow_color = 250; // 244, 250
85 //missile.glow_size = 120;
87 settouch(missile, W_Blaster_Touch);
88 missile.flags = FL_PROJECTILE;
89 IL_PUSH(g_projectiles, missile);
90 IL_PUSH(g_bot_dodge, missile);
91 missile.missile_flags = MIF_SPLASH;
92 missile.projectiledeathtype = atk_deathtype;
93 setthink(missile, W_Blaster_Think);
94 missile.nextthink = time + atk_delay;
96 MUTATOR_CALLHOOK(EditProjectile, actor, missile);
98 if (time >= missile.nextthink)
100 getthink(missile)(missile);
104 METHOD(Blaster, wr_aim, void(entity thiswep, entity actor, .entity weaponentity))
106 if(WEP_CVAR(blaster, secondary))
108 if((random() * (WEP_CVAR_PRI(blaster, damage) + WEP_CVAR_SEC(blaster, damage))) > WEP_CVAR_PRI(blaster, damage))
109 { PHYS_INPUT_BUTTON_ATCK2(actor) = bot_aim(actor, weaponentity, WEP_CVAR_SEC(blaster, speed), 0, WEP_CVAR_SEC(blaster, lifetime), false); }
111 { PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(actor, weaponentity, WEP_CVAR_PRI(blaster, speed), 0, WEP_CVAR_PRI(blaster, lifetime), false); }
114 { PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(actor, weaponentity, WEP_CVAR_PRI(blaster, speed), 0, WEP_CVAR_PRI(blaster, lifetime), false); }
117 METHOD(Blaster, wr_think, void(Blaster thiswep, entity actor, .entity weaponentity, int fire))
121 if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(blaster, refire)))
127 WEP_CVAR_PRI(blaster, shotangle),
128 WEP_CVAR_PRI(blaster, damage),
129 WEP_CVAR_PRI(blaster, edgedamage),
130 WEP_CVAR_PRI(blaster, radius),
131 WEP_CVAR_PRI(blaster, force),
132 WEP_CVAR_PRI(blaster, speed),
133 WEP_CVAR_PRI(blaster, spread),
134 WEP_CVAR_PRI(blaster, delay),
135 WEP_CVAR_PRI(blaster, lifetime)
137 weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(blaster, animtime), w_ready);
142 switch(WEP_CVAR(blaster, secondary))
144 case 0: // switch to last used weapon
146 if(actor.(weaponentity).m_switchweapon == WEP_BLASTER) // don't do this if already switching
147 W_LastWeapon(actor, weaponentity);
151 case 1: // normal projectile secondary
153 if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(blaster, refire)))
158 WEP_BLASTER.m_id | HITTYPE_SECONDARY,
159 WEP_CVAR_SEC(blaster, shotangle),
160 WEP_CVAR_SEC(blaster, damage),
161 WEP_CVAR_SEC(blaster, edgedamage),
162 WEP_CVAR_SEC(blaster, radius),
163 WEP_CVAR_SEC(blaster, force),
164 WEP_CVAR_SEC(blaster, speed),
165 WEP_CVAR_SEC(blaster, spread),
166 WEP_CVAR_SEC(blaster, delay),
167 WEP_CVAR_SEC(blaster, lifetime)
169 weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(blaster, animtime), w_ready);
178 METHOD(Blaster, wr_checkammo1, bool(entity thiswep, entity actor, .entity weaponentity))
180 return true; // infinite ammo
183 METHOD(Blaster, wr_checkammo2, bool(entity thiswep, entity actor, .entity weaponentity))
185 return true; // blaster has infinite ammo
188 METHOD(Blaster, wr_suicidemessage, Notification(entity thiswep))
190 return WEAPON_BLASTER_SUICIDE;
193 METHOD(Blaster, wr_killmessage, Notification(entity thiswep))
195 return WEAPON_BLASTER_MURDER;
201 METHOD(Blaster, wr_impacteffect, void(entity thiswep, entity actor))
204 org2 = w_org + w_backoff * 6;
205 pointparticles(EFFECT_BLASTER_IMPACT, org2, w_backoff * 1000, 1);
206 if(!w_issilent) { sound(actor, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTN_NORM); }