]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Some experiments with arc types (currently too broken for use)
authorMario <zacjardine@y7mail.com>
Thu, 12 Feb 2015 10:38:52 +0000 (21:38 +1100)
committerMario <zacjardine@y7mail.com>
Thu, 12 Feb 2015 10:38:52 +0000 (21:38 +1100)
qcsrc/common/weapons/w_arc.qc

index 5df3e6165427121faa1ff87525940c50f5784a22..09c91f24372b9a663d7f22e427cdf2cf7e5d3890 100644 (file)
@@ -62,6 +62,12 @@ vector arc_shotorigin[4];
 .vector beam_wantdir;
 .int beam_type;
 
+.int arc_type;
+const int ARC_ELECTRIC = 1;
+const int ARC_FLAME = 2;
+const int ARC_ICE = 3;
+// plasma, poison?
+
 const int ARC_BT_MISS =        0x00;
 const int ARC_BT_WALL =        0x01;
 const int ARC_BT_HEAL =        0x02;
@@ -174,6 +180,7 @@ float W_Arc_Beam_Send(entity to, float sf)
        if(sf & ARC_SF_BEAMTYPE) // beam type
        {
                WriteByte(MSG_ENTITY, self.beam_type);
+               WriteByte(MSG_ENTITY, self.arc_type);
        }
 
        return true;
@@ -213,6 +220,32 @@ void Arc_Player_SetHeat(entity player)
        //dprint("Heat: ",ftos(player.arc_heat_percent*100),"%\n");
 }
 
+.float arc_frost;
+.float arc_freezedown;
+void Arc_Player_SetFrost(entity attacker, entity targ)
+{
+       if(!targ || !attacker)
+               return;
+       float cooldown_speed = 0;
+       if ( attacker.beam_heat > WEP_CVAR(arc, overheat_min) && WEP_CVAR(arc, cooldown) > 0 )
+       {
+               cooldown_speed = WEP_CVAR(arc, cooldown);
+       }
+       else
+       {
+               cooldown_speed = attacker.beam_heat / WEP_CVAR(arc, beam_refire);
+       }
+
+       if ( cooldown_speed )
+       {
+               targ.arc_frost = time + attacker.beam_heat / cooldown_speed;
+               targ.arc_freezedown = cooldown_speed;
+       }
+
+       if(targ.arc_freezedown >= WEP_CVAR(arc, overheat_max))
+               Freeze (targ, bound(1, attacker.beam_heat / cooldown_speed, 10), 2, false);
+}
+
 void W_Arc_Beam_Think(void)
 {
        if(self != self.owner.arc_beam)
@@ -543,6 +576,20 @@ void W_Arc_Beam_Think(void)
                                        WEP_CVAR(arc, beam_force) * new_dir * coefficient * falloff
                                );
 
+                               switch(self.arc_type)
+                               {
+                                       case ARC_FLAME:
+                                       {
+                                               Fire_AddDamage(trace_ent, self.owner, rootdamage * falloff * 1, 1, WEP_ARC | HITTYPE_BOUNCE);
+                                               break;
+                                       }
+                                       case ARC_ICE:
+                                       {
+                                               Arc_Player_SetFrost(self, trace_ent);
+                                               break;
+                                       }
+                               }
+
                                new_beam_type = ARC_BT_HIT;
                        }
                        break;
@@ -584,6 +631,7 @@ void W_Arc_Beam(float burst)
        beam.think = W_Arc_Beam_Think;
        beam.owner = self;
        beam.movetype = MOVETYPE_NONE;
+       beam.arc_type = self.arc_type;
        beam.bot_dodge = true;
        beam.bot_dodgerating = WEP_CVAR(arc, beam_damage);
        beam.beam_bursting = burst;
@@ -1164,6 +1212,28 @@ void Remove_ArcBeam(void)
        sound(self, CH_SHOTS_SINGLE, "misc/null.wav", VOL_BASE, ATTEN_NORM);
 }
 
+string W_Arc_BeamEffect()
+{
+       switch(self.arc_type)
+       {
+               case ARC_FLAME: return "arc_beam_fire";
+               case ARC_ICE: return "arc_beam_ice";
+               default:
+               case ARC_ELECTRIC: return "arc_beam";
+       }
+}
+
+string W_Arc_HitEffect()
+{
+       switch(self.arc_type)
+       {
+               case ARC_FLAME: return "arc_fire_sparks";
+               case ARC_ICE: return "iceorglass";
+               default:
+               case ARC_ELECTRIC: return "arc_lightning";
+       }
+}
+
 void Ent_ReadArcBeam(float isnew)
 {
        int sf = ReadByte();
@@ -1270,6 +1340,7 @@ void Ent_ReadArcBeam(float isnew)
        if(sf & ARC_SF_BEAMTYPE) // beam type
        {
                self.beam_type = ReadByte();
+               self.arc_type = ReadByte();
                switch(self.beam_type)
                {
                        case ARC_BT_MISS:
@@ -1277,8 +1348,8 @@ void Ent_ReadArcBeam(float isnew)
                                self.beam_color = '1 1 1';
                                self.beam_alpha = 0.5;
                                self.beam_thickness = 8;
-                               self.beam_traileffect = particleeffectnum("arc_beam");
-                               self.beam_hiteffect = particleeffectnum("arc_lightning");
+                               self.beam_traileffect = particleeffectnum(W_Arc_BeamEffect());
+                               self.beam_hiteffect = particleeffectnum(W_Arc_HitEffect());
                                self.beam_hitlight[0] = 0;
                                self.beam_hitlight[1] = 1;
                                self.beam_hitlight[2] = 1;
@@ -1302,8 +1373,8 @@ void Ent_ReadArcBeam(float isnew)
                                self.beam_color = '1 1 1';
                                self.beam_alpha = 0.5;
                                self.beam_thickness = 8;
-                               self.beam_traileffect = particleeffectnum("arc_beam");
-                               self.beam_hiteffect = particleeffectnum("arc_lightning");
+                               self.beam_traileffect = particleeffectnum(W_Arc_BeamEffect());
+                               self.beam_hiteffect = particleeffectnum(W_Arc_HitEffect());
                                self.beam_hitlight[0] = 0;
                                self.beam_hitlight[1] = 1;
                                self.beam_hitlight[2] = 1;
@@ -1354,8 +1425,8 @@ void Ent_ReadArcBeam(float isnew)
                                self.beam_color = '1 1 1';
                                self.beam_alpha = 0.5;
                                self.beam_thickness = 8;
-                               self.beam_traileffect = particleeffectnum("arc_beam");
-                               self.beam_hiteffect = particleeffectnum("arc_lightning");
+                               self.beam_traileffect = particleeffectnum(W_Arc_BeamEffect());
+                               self.beam_hiteffect = particleeffectnum(W_Arc_HitEffect());
                                self.beam_hitlight[0] = 20;
                                self.beam_hitlight[1] = 1;
                                self.beam_hitlight[2] = 0;
@@ -1380,8 +1451,8 @@ void Ent_ReadArcBeam(float isnew)
                                self.beam_color = '1 1 1';
                                self.beam_alpha = 0.5;
                                self.beam_thickness = 14;
-                               self.beam_traileffect = particleeffectnum("arc_beam");
-                               self.beam_hiteffect = particleeffectnum("arc_lightning");
+                               self.beam_traileffect = particleeffectnum(W_Arc_BeamEffect());
+                               self.beam_hiteffect = particleeffectnum(W_Arc_HitEffect());
                                self.beam_hitlight[0] = 0;
                                self.beam_hitlight[1] = 1;
                                self.beam_hitlight[2] = 1;
@@ -1406,8 +1477,8 @@ void Ent_ReadArcBeam(float isnew)
                                self.beam_color = '1 1 1';
                                self.beam_alpha = 0.5;
                                self.beam_thickness = 14;
-                               self.beam_traileffect = particleeffectnum("arc_beam");
-                               self.beam_hiteffect = particleeffectnum("arc_lightning");
+                               self.beam_traileffect = particleeffectnum(W_Arc_BeamEffect());
+                               self.beam_hiteffect = particleeffectnum(W_Arc_HitEffect());
                                self.beam_hitlight[0] = 0;
                                self.beam_hitlight[1] = 1;
                                self.beam_hitlight[2] = 1;
@@ -1458,8 +1529,8 @@ void Ent_ReadArcBeam(float isnew)
                                self.beam_color = '1 1 1';
                                self.beam_alpha = 0.5;
                                self.beam_thickness = 14;
-                               self.beam_traileffect = particleeffectnum("arc_beam");
-                               self.beam_hiteffect = particleeffectnum("arc_lightning");
+                               self.beam_traileffect = particleeffectnum(W_Arc_BeamEffect());
+                               self.beam_hiteffect = particleeffectnum(W_Arc_HitEffect());
                                self.beam_hitlight[0] = 0;
                                self.beam_hitlight[1] = 1;
                                self.beam_hitlight[2] = 1;