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,
27 void W_Blaster_Think(entity this)
29 set_movetype(this, MOVETYPE_FLY);
30 setthink(this, SUB_Remove);
31 this.nextthink = time + this.blaster_lifetime;
32 CSQCProjectile(this, true, PROJECTILE_BLASTER, true);
35 void W_Blaster_Attack(
49 vector s_forward = v_forward * cos(atk_shotangle * DEG2RAD) + v_up * sin(atk_shotangle * DEG2RAD);
51 W_SetupShot_Dir(actor, weaponentity, s_forward, false, 3, SND_LASERGUN_FIRE, CH_WEAPON_B, atk_damage);
52 Send_Effect(EFFECT_BLASTER_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
54 entity missile = new(blasterbolt);
55 missile.owner = missile.realowner = actor;
56 missile.bot_dodge = true;
57 missile.bot_dodgerating = atk_damage;
58 PROJECTILE_MAKETRIGGER(missile);
60 missile.blaster_damage = atk_damage;
61 missile.blaster_edgedamage = atk_edgedamage;
62 missile.blaster_radius = atk_radius;
63 missile.blaster_force = atk_force;
64 missile.blaster_lifetime = atk_lifetime;
66 setorigin(missile, w_shotorg);
67 setsize(missile, '0 0 0', '0 0 0');
69 W_SetupProjVelocity_Explicit(
80 missile.angles = vectoangles(missile.velocity);
82 //missile.glow_color = 250; // 244, 250
83 //missile.glow_size = 120;
85 settouch(missile, W_Blaster_Touch);
86 missile.flags = FL_PROJECTILE;
87 IL_PUSH(g_projectiles, missile);
88 IL_PUSH(g_bot_dodge, missile);
89 missile.missile_flags = MIF_SPLASH;
90 missile.projectiledeathtype = atk_deathtype;
91 setthink(missile, W_Blaster_Think);
92 missile.nextthink = time + atk_delay;
94 MUTATOR_CALLHOOK(EditProjectile, actor, missile);
96 if (time >= missile.nextthink)
98 getthink(missile)(missile);
102 METHOD(Blaster, wr_aim, void(entity thiswep, entity actor, .entity weaponentity))
104 if(WEP_CVAR(blaster, secondary))
106 if((random() * (WEP_CVAR_PRI(blaster, damage) + WEP_CVAR_SEC(blaster, damage))) > WEP_CVAR_PRI(blaster, damage))
107 { PHYS_INPUT_BUTTON_ATCK2(actor) = bot_aim(actor, weaponentity, WEP_CVAR_SEC(blaster, speed), 0, WEP_CVAR_SEC(blaster, lifetime), false); }
109 { PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(actor, weaponentity, WEP_CVAR_PRI(blaster, speed), 0, WEP_CVAR_PRI(blaster, lifetime), false); }
112 { PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(actor, weaponentity, WEP_CVAR_PRI(blaster, speed), 0, WEP_CVAR_PRI(blaster, lifetime), false); }
115 METHOD(Blaster, wr_think, void(Blaster thiswep, entity actor, .entity weaponentity, int fire))
119 if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(blaster, refire)))
125 WEP_CVAR_PRI(blaster, shotangle),
126 WEP_CVAR_PRI(blaster, damage),
127 WEP_CVAR_PRI(blaster, edgedamage),
128 WEP_CVAR_PRI(blaster, radius),
129 WEP_CVAR_PRI(blaster, force),
130 WEP_CVAR_PRI(blaster, speed),
131 WEP_CVAR_PRI(blaster, spread),
132 WEP_CVAR_PRI(blaster, delay),
133 WEP_CVAR_PRI(blaster, lifetime)
135 weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(blaster, animtime), w_ready);
140 switch(WEP_CVAR(blaster, secondary))
142 case 0: // switch to last used weapon
144 if(actor.(weaponentity).m_switchweapon == WEP_BLASTER) // don't do this if already switching
145 W_LastWeapon(actor, weaponentity);
149 case 1: // normal projectile secondary
151 if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(blaster, refire)))
156 WEP_BLASTER.m_id | HITTYPE_SECONDARY,
157 WEP_CVAR_SEC(blaster, shotangle),
158 WEP_CVAR_SEC(blaster, damage),
159 WEP_CVAR_SEC(blaster, edgedamage),
160 WEP_CVAR_SEC(blaster, radius),
161 WEP_CVAR_SEC(blaster, force),
162 WEP_CVAR_SEC(blaster, speed),
163 WEP_CVAR_SEC(blaster, spread),
164 WEP_CVAR_SEC(blaster, delay),
165 WEP_CVAR_SEC(blaster, lifetime)
167 weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(blaster, animtime), w_ready);
176 METHOD(Blaster, wr_checkammo1, bool(entity thiswep, entity actor, .entity weaponentity))
178 return true; // infinite ammo
181 METHOD(Blaster, wr_checkammo2, bool(entity thiswep, entity actor, .entity weaponentity))
183 return true; // blaster has infinite ammo
186 METHOD(Blaster, wr_suicidemessage, Notification(entity thiswep))
188 return WEAPON_BLASTER_SUICIDE;
191 METHOD(Blaster, wr_killmessage, Notification(entity thiswep))
193 return WEAPON_BLASTER_MURDER;
199 METHOD(Blaster, wr_impacteffect, void(entity thiswep, entity actor))
202 org2 = w_org + w_backoff * 6;
203 pointparticles(EFFECT_BLASTER_IMPACT, org2, w_backoff * 1000, 1);
204 if(!w_issilent) { sound(actor, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTN_NORM); }