5 void W_Blaster_Touch(entity this, entity toucher)
7 PROJECTILE_TOUCH(this, toucher);
9 this.event_damage = func_null;
15 this.blaster_edgedamage,
20 this.projectiledeathtype,
21 this.weaponentity_fld,
28 void W_Blaster_Think(entity this)
30 set_movetype(this, MOVETYPE_FLY);
31 setthink(this, SUB_Remove);
32 this.nextthink = time + this.blaster_lifetime;
33 CSQCProjectile(this, true, PROJECTILE_BLASTER, true);
36 void W_Blaster_Attack(
50 vector s_forward = v_forward * cos(atk_shotangle * DEG2RAD) + v_up * sin(atk_shotangle * DEG2RAD);
52 W_SetupShot_Dir(actor, weaponentity, s_forward, false, 3, SND_LASERGUN_FIRE, CH_WEAPON_B, atk_damage);
53 Send_Effect(EFFECT_BLASTER_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
55 entity missile = new(blasterbolt);
56 missile.owner = missile.realowner = actor;
57 missile.bot_dodge = true;
58 missile.bot_dodgerating = atk_damage;
59 PROJECTILE_MAKETRIGGER(missile);
61 missile.blaster_damage = atk_damage;
62 missile.blaster_edgedamage = atk_edgedamage;
63 missile.blaster_radius = atk_radius;
64 missile.blaster_force = atk_force;
65 missile.blaster_lifetime = atk_lifetime;
67 setorigin(missile, w_shotorg);
68 setsize(missile, '0 0 0', '0 0 0');
70 W_SetupProjVelocity_Explicit(
81 missile.angles = vectoangles(missile.velocity);
83 //missile.glow_color = 250; // 244, 250
84 //missile.glow_size = 120;
86 settouch(missile, W_Blaster_Touch);
87 missile.flags = FL_PROJECTILE;
88 IL_PUSH(g_projectiles, missile);
89 IL_PUSH(g_bot_dodge, missile);
90 missile.missile_flags = MIF_SPLASH;
91 missile.projectiledeathtype = atk_deathtype;
92 missile.weaponentity_fld = weaponentity;
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); }