X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fweapons%2Fweapon%2Fvaporizer.qc;h=4a9475a9ccebc212ebfc9ff36016c546865a1aef;hb=9e113dae328809b5e7432f434649a35ebb185a52;hp=7866f1b828e27d55312b3952c0b164a837b01e11;hpb=d365412f17cdfe9f8cc49fbeb54f9a636352fab5;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/weapons/weapon/vaporizer.qc b/qcsrc/common/weapons/weapon/vaporizer.qc index 7866f1b82..4a9475a9c 100644 --- a/qcsrc/common/weapons/weapon/vaporizer.qc +++ b/qcsrc/common/weapons/weapon/vaporizer.qc @@ -1,67 +1,4 @@ #include "vaporizer.qh" -#ifndef IMPLEMENTATION -CLASS(Vaporizer, Weapon) -/* ammotype */ ATTRIB(Vaporizer, ammo_field, .int, ammo_cells); -/* impulse */ ATTRIB(Vaporizer, impulse, int, 7); -/* flags */ ATTRIB(Vaporizer, spawnflags, int, WEP_FLAG_RELOADABLE | WEP_FLAG_CANCLIMB | WEP_FLAG_SUPERWEAPON | WEP_TYPE_HITSCAN); -/* rating */ ATTRIB(Vaporizer, bot_pickupbasevalue, float, BOT_PICKUP_RATING_HIGH); -/* color */ ATTRIB(Vaporizer, wpcolor, vector, '0.5 1 1'); -/* modelname */ ATTRIB(Vaporizer, mdl, string, "minstanex"); -#ifdef GAMEQC -/* model */ ATTRIB(Vaporizer, m_model, Model, MDL_VAPORIZER_ITEM); -#endif -/* crosshair */ ATTRIB(Vaporizer, w_crosshair, string, "gfx/crosshairminstanex"); -/* crosshair */ ATTRIB(Vaporizer, w_crosshair_size, float, 0.6); -/* reticle */ ATTRIB(Vaporizer, w_reticle, string, "gfx/reticle_nex"); -/* wepimg */ ATTRIB(Vaporizer, model2, string, "weaponminstanex"); -/* refname */ ATTRIB(Vaporizer, netname, string, "vaporizer"); -/* wepname */ ATTRIB(Vaporizer, m_name, string, _("Vaporizer")); - -#define X(BEGIN, P, END, class, prefix) \ - BEGIN(class) \ - P(class, prefix, ammo, float, PRI) \ - P(class, prefix, animtime, float, PRI) \ - P(class, prefix, damage, float, PRI) \ - P(class, prefix, refire, float, PRI) \ - P(class, prefix, ammo, float, SEC) \ - P(class, prefix, animtime, float, SEC) \ - P(class, prefix, damage, float, SEC) \ - P(class, prefix, delay, float, SEC) \ - P(class, prefix, edgedamage, float, SEC) \ - P(class, prefix, force, float, SEC) \ - P(class, prefix, lifetime, float, SEC) \ - P(class, prefix, radius, float, SEC) \ - P(class, prefix, refire, float, SEC) \ - P(class, prefix, shotangle, float, SEC) \ - P(class, prefix, speed, float, SEC) \ - P(class, prefix, spread, float, SEC) \ - P(class, prefix, reload_ammo, float, NONE) \ - P(class, prefix, reload_time, float, NONE) \ - P(class, prefix, switchdelay_raise, float, NONE) \ - P(class, prefix, switchdelay_drop, float, NONE) \ - P(class, prefix, weaponreplace, string, NONE) \ - P(class, prefix, weaponstart, float, NONE) \ - P(class, prefix, weaponstartoverride, float, NONE) \ - P(class, prefix, weaponthrowable, float, NONE) \ - END() - W_PROPS(X, Vaporizer, vaporizer) -#undef X - -ENDCLASS(Vaporizer) -REGISTER_WEAPON(VAPORIZER, vaporizer, NEW(Vaporizer)); - - -#ifdef SVQC -.float vaporizer_lasthit; -.float jump_interval; -.float jump_interval2; -.bool held_down; -.float rm_force; -.float rm_damage; -.float rm_edmg; -#endif -#endif -#ifdef IMPLEMENTATION REGISTER_NET_TEMP(TE_CSQC_VAPORBEAMPARTICLE) @@ -168,8 +105,6 @@ NET_HANDLE(TE_CSQC_VAPORBEAMPARTICLE, bool isNew) #endif #ifdef SVQC -spawnfunc(weapon_vaporizer) { weapon_defaultspawnfunc(this, WEP_VAPORIZER); } -spawnfunc(weapon_minstanex) { spawnfunc_weapon_vaporizer(this); } void W_RocketMinsta_Explosion(entity actor, vector loc) { @@ -178,7 +113,7 @@ void W_RocketMinsta_Explosion(entity actor, vector loc) entity dmgent = spawn(); dmgent.owner = dmgent.realowner = actor; setorigin(dmgent, loc); - RadiusDamage (dmgent, actor, autocvar_g_rm_damage, autocvar_g_rm_edgedamage, autocvar_g_rm_radius, NULL, NULL, autocvar_g_rm_force, WEP_DEVASTATOR.m_id | HITTYPE_SPLASH, other); + RadiusDamage (dmgent, actor, autocvar_g_rm_damage, autocvar_g_rm_edgedamage, autocvar_g_rm_radius, NULL, NULL, autocvar_g_rm_force, WEP_DEVASTATOR.m_id | HITTYPE_SPLASH, NULL); delete(dmgent); } @@ -194,7 +129,7 @@ void W_Vaporizer_Attack(Weapon thiswep, entity actor, .entity weaponentity) yoda = 0; damage_goodhits = 0; - FireRailgunBullet(actor, weaponentity, w_shotorg, w_shotorg + w_shotdir * MAX_SHOT_DISTANCE, vaporizer_damage, 800, 0, 0, 0, 0, WEP_VAPORIZER.m_id); + FireRailgunBullet(actor, weaponentity, w_shotorg, w_shotorg + w_shotdir * max_shot_distance, vaporizer_damage, 800, 0, 0, 0, 0, WEP_VAPORIZER.m_id); // do this now, as goodhits is disabled below SendCSQCVaporizerBeamParticle(actor, damage_goodhits); @@ -216,24 +151,24 @@ void W_Vaporizer_Attack(Weapon thiswep, entity actor, .entity weaponentity) W_DecreaseAmmo(thiswep, actor, ((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo)), weaponentity); } -void W_RocketMinsta_Laser_Explode (entity this) +void W_RocketMinsta_Laser_Explode (entity this, entity directhitentity) { - if(other.takedamage == DAMAGE_AIM) - if(IS_PLAYER(other)) - if(DIFF_TEAM(this.realowner, other)) - if(!IS_DEAD(other)) - if(IsFlying(other)) + if(directhitentity.takedamage == DAMAGE_AIM) + if(IS_PLAYER(directhitentity)) + if(DIFF_TEAM(this.realowner, directhitentity)) + if(!IS_DEAD(directhitentity)) + if(IsFlying(directhitentity)) Send_Notification(NOTIF_ONE, this.realowner, MSG_ANNCE, ANNCE_ACHIEVEMENT_ELECTROBITCH); this.event_damage = func_null; this.takedamage = DAMAGE_NO; - RadiusDamage (this, this.realowner, this.rm_damage, this.rm_edmg, autocvar_g_rm_laser_radius, NULL, NULL, this.rm_force, this.projectiledeathtype, other); + RadiusDamage (this, this.realowner, this.rm_damage, this.rm_edmg, autocvar_g_rm_laser_radius, NULL, NULL, this.rm_force, this.projectiledeathtype, directhitentity); delete(this); } void W_RocketMinsta_Laser_Explode_use(entity this, entity actor, entity trigger) { - W_RocketMinsta_Laser_Explode(this); + W_RocketMinsta_Laser_Explode(this, trigger); // we probably don't want trigger used here, but this matches closest to old behaviour } void W_RocketMinsta_Laser_Touch(entity this, entity toucher) @@ -354,7 +289,7 @@ void W_RocketMinsta_Attack3 (entity actor, .entity weaponentity) METHOD(Vaporizer, wr_aim, void(entity thiswep, entity actor, .entity weaponentity)) { - if(actor.(thiswep.ammo_field) > 0) + if(GetResourceAmount(actor, thiswep.ammo_type) > 0) PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(actor, weaponentity, 1000000, 0, 1, false); else PHYS_INPUT_BUTTON_ATCK2(actor) = bot_aim(actor, weaponentity, WEP_CVAR_SEC(vaporizer, speed), 0, WEP_CVAR_SEC(vaporizer, lifetime), false); // WEAPONTODO: replace with proper vaporizer cvars @@ -441,7 +376,7 @@ METHOD(Vaporizer, wr_setup, void(entity thiswep, entity actor, .entity weaponent METHOD(Vaporizer, wr_checkammo1, bool(entity thiswep, entity actor, .entity weaponentity)) { float vaporizer_ammo = ((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo)); - float ammo_amount = actor.(thiswep.ammo_field) >= vaporizer_ammo; + float ammo_amount = GetResourceAmount(actor, thiswep.ammo_type) >= vaporizer_ammo; ammo_amount += actor.(weaponentity).(weapon_load[WEP_VAPORIZER.m_id]) >= vaporizer_ammo; return ammo_amount; } @@ -449,7 +384,7 @@ METHOD(Vaporizer, wr_checkammo2, bool(entity thiswep, entity actor, .entity weap { if(!WEP_CVAR_SEC(vaporizer, ammo)) return true; - float ammo_amount = actor.(thiswep.ammo_field) >= WEP_CVAR_SEC(vaporizer, ammo); + float ammo_amount = GetResourceAmount(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(vaporizer, ammo); ammo_amount += actor.(weaponentity).(weapon_load[WEP_VAPORIZER.m_id]) >= WEP_CVAR_SEC(vaporizer, ammo); return ammo_amount; } @@ -515,4 +450,3 @@ METHOD(Vaporizer, wr_zoom, bool(entity thiswep, entity actor)) } #endif -#endif