X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;ds=sidebyside;f=qcsrc%2Fserver%2Fg_hook.qc;h=b7291dee3f8cedc4c92d82846330bb930593b8de;hb=36f4b513fd7eac9b2dc37d393cebf3b7d98ac9af;hp=ce3d9b72b8fe9db1f484e27ac4bc620d90bd3b53;hpb=1216175333a1129260067a4f3ef26e9b43336ded;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/g_hook.qc b/qcsrc/server/g_hook.qc index ce3d9b72b..b7291dee3 100644 --- a/qcsrc/server/g_hook.qc +++ b/qcsrc/server/g_hook.qc @@ -47,43 +47,6 @@ And you should be done! ============================================*/ -.string aiment_classname; -.float aiment_deadflag; -void SetMovetypeFollow(entity ent, entity e) -{ - // FIXME this may not be warpzone aware - ent.movetype = MOVETYPE_FOLLOW; // make the hole follow - ent.solid = SOLID_NOT; // MOVETYPE_FOLLOW is always non-solid - this means this cannot be teleported by warpzones any more! Instead, we must notice when our owner gets teleported. - ent.aiment = e; // make the hole follow bmodel - ent.punchangle = e.angles; // the original angles of bmodel - ent.view_ofs = ent.origin - e.origin; // relative origin - ent.v_angle = ent.angles - e.angles; // relative angles - ent.aiment_classname = strzone(e.classname); - ent.aiment_deadflag = e.deadflag; -} -void UnsetMovetypeFollow(entity ent) -{ - ent.movetype = MOVETYPE_FLY; - PROJECTILE_MAKETRIGGER(ent); - ent.aiment = world; -} -float LostMovetypeFollow(entity ent) -{ -/* - if(ent.movetype != MOVETYPE_FOLLOW) - if(ent.aiment) - error("???"); -*/ - if(ent.aiment) - { - if(ent.aiment.classname != ent.aiment_classname) - return 1; - if(ent.aiment.deadflag != ent.aiment_deadflag) - return 1; - } - return 0; -} - .float hook_length; .float hook_switchweapon; @@ -175,24 +138,24 @@ void GrapplingHookThink() if(self.state == 1) { - pullspeed = cvar("g_balance_grapplehook_speed_pull");//2000; + pullspeed = autocvar_g_balance_grapplehook_speed_pull;//2000; // speed the rope is pulled with - rubberforce = cvar("g_balance_grapplehook_force_rubber");//2000; + rubberforce = autocvar_g_balance_grapplehook_force_rubber;//2000; // force the rope will use if it is stretched - rubberforce_overstretch = cvar("g_balance_grapplehook_force_rubber_overstretch");//1000; + rubberforce_overstretch = autocvar_g_balance_grapplehook_force_rubber_overstretch;//1000; // force the rope will use if it is stretched - minlength = cvar("g_balance_grapplehook_length_min");//100; + minlength = autocvar_g_balance_grapplehook_length_min;//100; // minimal rope length // if the rope goes below this length, it isn't pulled any more - ropestretch = cvar("g_balance_grapplehook_stretch");//400; + ropestretch = autocvar_g_balance_grapplehook_stretch;//400; // if the rope is stretched by more than this amount, more rope is // given to you again - ropeairfriction = cvar("g_balance_grapplehook_airfriction");//0.2 + ropeairfriction = autocvar_g_balance_grapplehook_airfriction;//0.2 // while hanging on the rope, this friction component will help you a // bit to control the rope @@ -200,7 +163,7 @@ void GrapplingHookThink() dist = vlen(dir); dir = normalize(dir); - if(cvar("g_grappling_hook_tarzan")) + if(autocvar_g_grappling_hook_tarzan) { v = v0 = WarpZone_RefSys_TransformVelocity(self.owner, self, self.owner.velocity); @@ -233,7 +196,7 @@ void GrapplingHookThink() v = v + frametime * dir * spd * rubberforce; dv = ((v - v0) * dir) * dir; - if(cvar("g_grappling_hook_tarzan") >= 2) + if(autocvar_g_grappling_hook_tarzan >= 2) { if(self.aiment.movetype == MOVETYPE_WALK) { @@ -241,7 +204,7 @@ void GrapplingHookThink() self.aiment.velocity = self.aiment.velocity - dv * 0.5; self.aiment.flags &~= FL_ONGROUND; self.aiment.pusher = self.owner; - self.aiment.pushltime = time + cvar("g_maxpushtime"); + self.aiment.pushltime = time + autocvar_g_maxpushtime; } } @@ -268,7 +231,7 @@ void GrapplingHookThink() } makevectors(self.angles_x * '-1 0 0' + self.angles_y * '0 1 0'); - myorg = WarpZone_RefSys_TransformOrigin(self, self.owner, self.origin) + v_forward * (-9); + myorg = WarpZone_RefSys_TransformOrigin(self, self.owner, self.origin); // + v_forward * (-9); if(myorg != self.hook_start) { @@ -315,7 +278,7 @@ void GrapplingHook_Damage (entity inflictor, entity attacker, float damage, floa if(attacker != self.owner) { self.owner.pusher = attacker; - self.owner.pushltime = time + cvar("g_maxpushtime"); + self.owner.pushltime = time + autocvar_g_maxpushtime; } RemoveGrapplingHook(self.owner); } @@ -332,6 +295,9 @@ void FireGrapplingHook (void) if((arena_roundbased && time < warmup) || (time < game_starttime)) return; + if(self.freezetag_frozen) + return; + makevectors(self.v_angle); s = self.cvar_cl_gunalign; @@ -343,6 +309,10 @@ void FireGrapplingHook (void) // UGLY WORKAROUND: play this on CHAN_WEAPON2 so it can't cut off fire sounds sound (self, CHAN_WEAPON2, "weapons/hook_fire.wav", VOL_BASE, ATTN_NORM); org = self.origin + self.view_ofs + v_forward * vs_x + v_right * -vs_y + v_up * vs_z; + + tracebox(self.origin + self.view_ofs, '-3 -3 -3', '3 3 3', org, MOVE_NORMAL, self); + org = trace_endpos; + pointparticles(particleeffectnum("grapple_muzzleflash"), org, '0 0 0', 1); missile = WarpZone_RefSys_SpawnSameRefSys(self); @@ -359,18 +329,18 @@ void FireGrapplingHook (void) missile.state = 0; // not latched onto anything - W_SetupProjectileVelocityEx(missile, v_forward, v_up, cvar("g_balance_grapplehook_speed_fly"), 0, 0, 0); + W_SetupProjectileVelocityEx(missile, v_forward, v_up, autocvar_g_balance_grapplehook_speed_fly, 0, 0, 0, FALSE); missile.angles = vectoangles (missile.velocity); //missile.glow_color = 250; // 244, 250 //missile.glow_size = 120; missile.touch = GrapplingHookTouch; missile.think = GrapplingHookThink; - missile.nextthink = time + 0.1; + missile.nextthink = time; missile.effects = /*EF_FULLBRIGHT | EF_ADDITIVE |*/ EF_LOWPRECISION; - missile.health = cvar("g_balance_grapplehook_health");//120 + missile.health = autocvar_g_balance_grapplehook_health;//120 missile.event_damage = GrapplingHook_Damage; missile.takedamage = DAMAGE_AIM; missile.damageforcescale = 0;