X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fw_laser.qc;h=47e79bcaabee8ba211071a692ec0c07ab03ba76e;hb=43528747368b3c2395edc28dc9298059a5542e40;hp=70cf072fb5fab8e2eea91bc49d0332bf71c1ca25;hpb=cad7a84d59626dceb9653c62451702843b00b334;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/w_laser.qc b/qcsrc/server/w_laser.qc index 70cf072fb..47e79bcaa 100644 --- a/qcsrc/server/w_laser.qc +++ b/qcsrc/server/w_laser.qc @@ -4,20 +4,15 @@ REGISTER_WEAPON(LASER, w_laser, 0, 1, WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WE #ifdef SVQC void(float imp) W_SwitchWeapon; -void W_Laser_Reload() -{ - W_Reload(zero_ammo, 0, autocvar_g_balance_laser_reload_ammo, autocvar_g_balance_laser_reload_time, "weapons/reload.wav"); -} - void W_Laser_Touch (void) { PROJECTILE_TOUCH; self.event_damage = SUB_Null; if (self.dmg) - RadiusDamage (self, self.owner, autocvar_g_balance_laser_secondary_damage, autocvar_g_balance_laser_secondary_edgedamage, autocvar_g_balance_laser_secondary_radius, world, autocvar_g_balance_laser_secondary_force, self.projectiledeathtype, other); + RadiusDamage (self, self.realowner, autocvar_g_balance_laser_secondary_damage, autocvar_g_balance_laser_secondary_edgedamage, autocvar_g_balance_laser_secondary_radius, world, autocvar_g_balance_laser_secondary_force, self.projectiledeathtype, other); else - RadiusDamage (self, self.owner, autocvar_g_balance_laser_primary_damage, autocvar_g_balance_laser_primary_edgedamage, autocvar_g_balance_laser_primary_radius, world, autocvar_g_balance_laser_primary_force, self.projectiledeathtype, other); + RadiusDamage (self, self.realowner, autocvar_g_balance_laser_primary_damage, autocvar_g_balance_laser_primary_edgedamage, autocvar_g_balance_laser_primary_radius, world, autocvar_g_balance_laser_primary_force, self.projectiledeathtype, other); remove (self); } @@ -57,7 +52,7 @@ void W_Laser_Attack (float issecondary) pointparticles(particleeffectnum("laser_muzzleflash"), w_shotorg, w_shotdir * 1000, 1); missile = spawn (); - missile.owner = self; + missile.owner = missile.realowner = self; missile.classname = "laserbolt"; missile.dmg = 0; if(!nodamage) @@ -100,12 +95,12 @@ float gauntletbeam_send(entity to, float sf) { WriteByte(MSG_ENTITY, ENT_CLIENT_GAUNTLET); sf = sf & 0x7F; - if(sound_allowed(MSG_BROADCAST, self.owner)) + if(sound_allowed(MSG_BROADCAST, self.realowner)) sf |= 0x80; WriteByte(MSG_ENTITY, sf); if(sf & 1) { - WriteByte(MSG_ENTITY, num_for_edict(self.owner)); + WriteByte(MSG_ENTITY, num_for_edict(self.realowner)); } if(sf & 2) { @@ -123,6 +118,7 @@ float gauntletbeam_send(entity to, float sf) } .entity gauntletbeam; .float prevgauntletfire; +entity lgbeam_owner_ent; void gauntletbeam_think() { float damage, myforce, myradius; @@ -130,8 +126,8 @@ void gauntletbeam_think() myforce = autocvar_g_balance_laser_secondary_force; myradius = autocvar_g_balance_laser_secondary_radius; - self.owner.prevgauntletfire = time; - if (self.owner.weaponentity.state != WS_INUSE || self != self.owner.gauntletbeam || self.owner.deadflag != DEAD_NO || !self.owner.BUTTON_ATCK2) + self.realowner.prevgauntletfire = time; + if (self.realowner.weaponentity.state != WS_INUSE || self != self.realowner.gauntletbeam || self.realowner.deadflag != DEAD_NO || !self.realowner.BUTTON_ATCK2) { remove(self); return; @@ -139,13 +135,18 @@ void gauntletbeam_think() self.nextthink = time; - makevectors(self.owner.v_angle); + makevectors(self.realowner.v_angle); float dt; dt = frametime; - W_SetupShot_Range(self.owner, TRUE, 0, "", 0, damage * dt, myradius); - WarpZone_traceline_antilag(self.owner, w_shotorg, w_shotend, MOVE_NORMAL, self.owner, ANTILAG_LATENCY(self.owner)); + W_SetupShot_Range(self.realowner, TRUE, 0, "", 0, damage * dt, myradius); + if(!lgbeam_owner_ent) + { + lgbeam_owner_ent = spawn(); + lgbeam_owner_ent.classname = "lgbeam_owner_ent"; + } + WarpZone_traceline_antilag(lgbeam_owner_ent, w_shotorg, w_shotend, MOVE_NORMAL, lgbeam_owner_ent, ANTILAG_LATENCY(self.owner)); // apply the damage if(trace_ent) @@ -232,20 +233,12 @@ float w_laser(float req) else if (req == WR_THINK) { if(autocvar_g_balance_laser_reload_ammo && self.clip_load < 1) // forced reload - W_Laser_Reload(); + weapon_action(self.weapon, WR_RELOAD); else if (self.BUTTON_ATCK) { if (weapon_prepareattack(0, autocvar_g_balance_laser_primary_refire)) { - // if this weapon is reloadable, decrease its load - if not(self.items & IT_UNLIMITED_WEAPON_AMMO) - { - if(autocvar_g_balance_laser_reload_ammo) - { - self.clip_load -= 1; - self.weapon_load[WEP_LASER] = self.clip_load; - } - } + W_DecreaseAmmo(ammo_none, 1, TRUE); W_Laser_Attack(0); weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_laser_primary_animtime, w_ready); @@ -255,15 +248,7 @@ float w_laser(float req) { if(autocvar_g_balance_laser_secondary) { - // if this weapon is reloadable, decrease its load - if not(self.items & IT_UNLIMITED_WEAPON_AMMO) - { - if(autocvar_g_balance_laser_reload_ammo) - { - self.clip_load -= 1; - self.weapon_load[WEP_LASER] = self.clip_load; - } - } + W_DecreaseAmmo(ammo_none, 1, TRUE); if (weapon_prepareattack(0, 0)) { @@ -285,11 +270,12 @@ float w_laser(float req) precache_model ("models/weapons/h_laser.iqm"); precache_sound ("weapons/lasergun_fire.wav"); precache_sound ("weapons/gauntlet_fire.wav"); - precache_sound ("weapons/reload.wav"); + //precache_sound ("weapons/reload.wav"); // until weapons have individual reload sounds, precache the reload sound somewhere else } else if (req == WR_SETUP) { weapon_setup(WEP_LASER); + self.current_ammo = ammo_none; } else if (req == WR_CHECKAMMO1) { @@ -301,7 +287,7 @@ float w_laser(float req) } else if (req == WR_RELOAD) { - W_Laser_Reload(); + W_Reload(0, autocvar_g_balance_laser_reload_ammo, autocvar_g_balance_laser_reload_time, "weapons/reload.wav"); } return TRUE; };