]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/weapons/weapon/arc.qc
Merge branch 'Mario/qc_physics_cleanup_v2'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / weapons / weapon / arc.qc
index 91aece258e0defa4272e82ffe663245a7aca2640..1eaf4062d462d6860df66d0001b719e4ec0eeb27 100644 (file)
@@ -231,17 +231,17 @@ void Arc_Player_SetHeat(entity player)
        //dprint("Heat: ",ftos(player.arc_heat_percent*100),"%\n");
 }
 
-void W_Arc_Bolt_Explode(entity this)
+void W_Arc_Bolt_Explode(entity this, entity directhitentity)
 {
        this.event_damage = func_null;
-       RadiusDamage(this, this.realowner, WEP_CVAR(arc, bolt_damage), WEP_CVAR(arc, bolt_edgedamage), WEP_CVAR(arc, bolt_radius), world, world, WEP_CVAR(arc, bolt_force), this.projectiledeathtype, other);
+       RadiusDamage(this, this.realowner, WEP_CVAR(arc, bolt_damage), WEP_CVAR(arc, bolt_edgedamage), WEP_CVAR(arc, bolt_radius), NULL, NULL, WEP_CVAR(arc, bolt_force), this.projectiledeathtype, directhitentity);
 
        remove(this);
 }
 
 void W_Arc_Bolt_Explode_use(entity this, entity actor, entity trigger)
 {
-       WITHSELF(this, W_Arc_Bolt_Explode(this));
+       W_Arc_Bolt_Explode(this, trigger);
 }
 
 void W_Arc_Bolt_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
@@ -259,10 +259,10 @@ void W_Arc_Bolt_Damage(entity this, entity inflictor, entity attacker, float dam
                W_PrepareExplosionByDamage(this, attacker, getthink(this));
 }
 
-void W_Arc_Bolt_Touch(entity this)
+void W_Arc_Bolt_Touch(entity this, entity toucher)
 {
-       PROJECTILE_TOUCH(this);
-       this.use(this, NULL, NULL);
+       PROJECTILE_TOUCH(this, toucher);
+       this.use(this, NULL, toucher);
 }
 
 void W_Arc_Attack_Bolt(Weapon thiswep, entity actor)
@@ -295,7 +295,7 @@ void W_Arc_Attack_Bolt(Weapon thiswep, entity actor)
        setorigin(missile, w_shotorg);
        setsize(missile, '0 0 0', '0 0 0');
 
-       missile.movetype = MOVETYPE_FLY;
+       set_movetype(missile, MOVETYPE_FLY);
        W_SetupProjVelocity_PRE(missile, arc, bolt_);
 
        missile.angles = vectoangles(missile.velocity);
@@ -333,12 +333,10 @@ void W_Arc_Beam_Think(entity this)
                ||
                IS_DEAD(this.owner)
                ||
-               gameover
+               forbidWeaponUse(this.owner)
                ||
                (!PHYS_INPUT_BUTTON_ATCK(this.owner) && !burst )
                ||
-               STAT(FROZEN, this.owner)
-               ||
                this.owner.vehicle
                ||
                (WEP_CVAR(arc, overheat_max) > 0 && this.beam_heat >= WEP_CVAR(arc, overheat_max))
@@ -371,7 +369,7 @@ void W_Arc_Beam_Think(entity this)
                        }
                }
 
-               if(this == this.owner.arc_beam) { this.owner.arc_beam = world; }
+               if(this == this.owner.arc_beam) { this.owner.arc_beam = NULL; }
                entity own = this.owner;
                Weapon w = WEP_ARC;
                if(!w.wr_checkammo1(w, own) && !w.wr_checkammo2(w, own))
@@ -685,13 +683,13 @@ void W_Arc_Beam(float burst, entity actor)
        beam.solid = SOLID_NOT;
        setthink(beam, W_Arc_Beam_Think);
        beam.owner = actor;
-       beam.movetype = MOVETYPE_NONE;
+       set_movetype(beam, MOVETYPE_NONE);
        beam.bot_dodge = true;
        beam.bot_dodgerating = WEP_CVAR(arc, beam_damage);
        beam.beam_bursting = burst;
        Net_LinkEntity(beam, false, 0, W_Arc_Beam_Send);
 
-       WITHSELF(beam, getthink(beam)(beam));
+       getthink(beam)(beam);
 }
 void Arc_Smoke(entity actor)
 {
@@ -857,6 +855,7 @@ METHOD(Arc, wr_drop, void(entity thiswep, entity actor))
     weapon_dropevent_item.arc_cooldown = actor.arc_cooldown;
     actor.arc_overheat = 0;
     actor.arc_cooldown = 0;
+    actor.arc_BUTTON_ATCK_prev = false;
 }
 METHOD(Arc, wr_pickup, void(entity thiswep, entity actor))
 {
@@ -867,6 +866,18 @@ METHOD(Arc, wr_pickup, void(entity thiswep, entity actor))
         actor.arc_cooldown = weapon_dropevent_item.arc_cooldown;
     }
 }
+METHOD(Arc, wr_resetplayer, void(entity thiswep, entity actor))
+{
+    actor.arc_overheat = 0;
+    actor.arc_cooldown = 0;
+    actor.arc_BUTTON_ATCK_prev = false;
+}
+METHOD(Arc, wr_playerdeath, void(entity thiswep, entity actor))
+{
+    actor.arc_overheat = 0;
+    actor.arc_cooldown = 0;
+    actor.arc_BUTTON_ATCK_prev = false;
+}
 #endif
 #ifdef CSQC
 bool autocvar_cl_arcbeam_teamcolor = true;
@@ -965,10 +976,10 @@ void Draw_ArcBeam_callback(vector start, vector hit, vector end)
 void Reset_ArcBeam()
 {
        entity e;
-       for (e = world; (e = findfloat(e, beam_usevieworigin, 1)); ) {
+       for (e = NULL; (e = findfloat(e, beam_usevieworigin, 1)); ) {
                e.beam_initialized = false;
        }
-       for (e = world; (e = findfloat(e, beam_usevieworigin, 2)); ) {
+       for (e = NULL; (e = findfloat(e, beam_usevieworigin, 2)); ) {
                e.beam_initialized = false;
        }
 }
@@ -1193,8 +1204,8 @@ void Draw_ArcBeam(entity this)
                        '0 0 0',
                        new_origin,
                        MOVE_NORMAL,
-                       world,
-                       world,
+                       NULL,
+                       NULL,
                        Draw_ArcBeam_callback
                );
 
@@ -1260,7 +1271,7 @@ void Draw_ArcBeam(entity this)
        }
 
        // cleanup
-       Draw_ArcBeam_callback_entity = world;
+       Draw_ArcBeam_callback_entity = NULL;
        Draw_ArcBeam_callback_last_thickness = 0;
        Draw_ArcBeam_callback_last_top = '0 0 0';
        Draw_ArcBeam_callback_last_bottom = '0 0 0';
@@ -1279,7 +1290,7 @@ NET_HANDLE(ENT_CLIENT_ARC_BEAM, bool isnew)
 
        if(isnew)
        {
-               int gunalign = W_GetGunAlignment(world);
+               int gunalign = W_GetGunAlignment(NULL);
 
                this.beam_shotorigin = arc_shotorigin[gunalign];