]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Some hook & nade stuff
authorMario <zacjardine@y7mail.com>
Sat, 29 Aug 2015 15:14:04 +0000 (01:14 +1000)
committerMario <zacjardine@y7mail.com>
Sat, 29 Aug 2015 15:14:04 +0000 (01:14 +1000)
balance-nexuiz25.cfg
balance-overkill.cfg
balance-samual.cfg
balance-xdf.cfg
balance-xonotic.cfg
balance-xpm.cfg
qcsrc/server/autocvars.qh
qcsrc/server/g_hook.qc
qcsrc/server/mutators/events.qh
qcsrc/server/mutators/mutator_nades.qc

index 95680da377dd1cf40d9b67819b9d4840e2c35ce9..6e18dc092a59d488192a2ca693d6f54de37d7e03 100644 (file)
@@ -218,6 +218,10 @@ set g_balance_grapplehook_airfriction 0.2
 set g_balance_grapplehook_health 130
 set g_balance_grapplehook_damagedbycontents 0
 set g_balance_grapplehook_refire 0.2
+set g_balance_grapplehook_nade_time 0.7
+set g_balance_grapplehook_crouchslide 0
+set g_balance_grapplehook_gravity 0
+set g_balance_grapplehook_pull_frozen 0
 // }}}
 
 // {{{ port-o-launch
index bf390c2197ac126c23cf6acf59b6e5e3fe03d676..a99d342babf184895cccd11fa4b8a875ebaea505 100644 (file)
@@ -218,6 +218,10 @@ set g_balance_grapplehook_airfriction 0.2
 set g_balance_grapplehook_health 50
 set g_balance_grapplehook_damagedbycontents 1
 set g_balance_grapplehook_refire 0.2
+set g_balance_grapplehook_nade_time 0.7
+set g_balance_grapplehook_crouchslide 0
+set g_balance_grapplehook_gravity 0
+set g_balance_grapplehook_pull_frozen 0
 // }}}
 
 // {{{ port-o-launch
index cb4949762f0fa3c3371f3a0a4a0c226ded153b81..379bc207d199b19c71cd247520369be06ad6af2b 100644 (file)
@@ -218,6 +218,10 @@ set g_balance_grapplehook_airfriction 0.2
 set g_balance_grapplehook_health 50
 set g_balance_grapplehook_damagedbycontents 1
 set g_balance_grapplehook_refire 0.2
+set g_balance_grapplehook_nade_time 0.7
+set g_balance_grapplehook_crouchslide 0
+set g_balance_grapplehook_gravity 0
+set g_balance_grapplehook_pull_frozen 0
 // }}}
 
 // {{{ port-o-launch
index 4852a59d6ff8fbdeef2a927f3460dbe116d285eb..07d4c6c723c83c83ea65f3e08ba6543a03a849e8 100644 (file)
@@ -218,6 +218,10 @@ set g_balance_grapplehook_airfriction 0.2
 set g_balance_grapplehook_health 130
 set g_balance_grapplehook_damagedbycontents 0
 set g_balance_grapplehook_refire 0.2
+set g_balance_grapplehook_nade_time 0.7
+set g_balance_grapplehook_crouchslide 0
+set g_balance_grapplehook_gravity 0
+set g_balance_grapplehook_pull_frozen 0
 // }}}
 
 // {{{ port-o-launch
index 76ba515256438d98b65dbf5d694a78d121e64029..3bc87d607c34a08143d71700a183ea4f348f2383 100644 (file)
@@ -218,6 +218,10 @@ set g_balance_grapplehook_airfriction 0.2
 set g_balance_grapplehook_health 50
 set g_balance_grapplehook_damagedbycontents 1
 set g_balance_grapplehook_refire 0.2
+set g_balance_grapplehook_nade_time 0.7
+set g_balance_grapplehook_crouchslide 0
+set g_balance_grapplehook_gravity 0
+set g_balance_grapplehook_pull_frozen 0
 // }}}
 
 // {{{ port-o-launch
index e7855280edc2b2541c9895ecf5d6fd3a336279c7..a99044add9757a9e03474911c400b3ef0d6badde 100644 (file)
@@ -218,6 +218,10 @@ set g_balance_grapplehook_airfriction 0.2
 set g_balance_grapplehook_health 50
 set g_balance_grapplehook_damagedbycontents 1
 set g_balance_grapplehook_refire 0.2
+set g_balance_grapplehook_nade_time 0.7
+set g_balance_grapplehook_crouchslide 0
+set g_balance_grapplehook_gravity 0
+set g_balance_grapplehook_pull_frozen 0
 // }}}
 
 // {{{ port-o-launch
index 37d4bfdd8357e30283d1edb324ab3d0933f8d8c1..f6ac64efe3cc27186b3becde997f6aac98be02b6 100644 (file)
@@ -337,6 +337,10 @@ bool autocvar_g_fullbrightitems;
 bool autocvar_g_fullbrightplayers;
 #define autocvar_g_grappling_hook cvar("g_grappling_hook")
 int autocvar_g_grappling_hook_tarzan;
+int autocvar_g_balance_grapplehook_pull_frozen;
+float autocvar_g_balance_grapplehook_nade_time;
+bool autocvar_g_balance_grapplehook_gravity;
+bool autocvar_g_balance_grapplehook_crouchslide;
 bool autocvar_g_hitplots;
 string autocvar_g_hitplots_individuals;
 float autocvar_g_jetpack_acceleration_side;
index a9b16d002f567c7edb91852f666826f8c7fd4c0a..d63a2ade0d8453e809204465d9f9acdd35c3369d 100644 (file)
@@ -138,7 +138,7 @@ void GrapplingHookThink()
                error("Owner lost the hook!\n");
                return;
        }
-       if(LostMovetypeFollow(self) || intermission_running || (round_handler_IsActive() && !round_handler_IsRoundStarted()))
+       if(LostMovetypeFollow(self) || intermission_running || (round_handler_IsActive() && !round_handler_IsRoundStarted()) || ((self.aiment.flags & FL_PROJECTILE) && self.aiment.classname != "nade"))
        {
                RemoveGrapplingHook(self.realowner);
                return;
@@ -161,6 +161,14 @@ void GrapplingHookThink()
        if(self.hook_length < 0)
                self.hook_length = vlen(myorg - self.origin);
 
+       int tarzan = autocvar_g_grappling_hook_tarzan;
+       entity pull_entity = self.realowner;
+       float velocity_multiplier = 1;
+       MUTATOR_CALLHOOK(GrappleHookThink, self, tarzan, pull_entity, velocity_multiplier);
+       tarzan = hook_tarzan;
+       pull_entity = hook_pullentity;
+       velocity_multiplier = hook_velmultiplier;
+
        if(self.state == 1)
        {
                pullspeed = autocvar_g_balance_grapplehook_speed_pull;//2000;
@@ -184,13 +192,15 @@ void GrapplingHookThink()
                // while hanging on the rope, this friction component will help you a
                // bit to control the rope
 
+               bool frozen_pulling = (autocvar_g_grappling_hook_tarzan >= 2 && autocvar_g_balance_grapplehook_pull_frozen);
+
                dir = self.origin - myorg;
                dist = vlen(dir);
                dir = normalize(dir);
 
-               if(autocvar_g_grappling_hook_tarzan)
+               if(tarzan)
                {
-                       v = v0 = WarpZone_RefSys_TransformVelocity(self.realowner, self, self.realowner.velocity);
+                       v = v0 = WarpZone_RefSys_TransformVelocity(pull_entity, self, pull_entity.velocity);
 
                        // first pull the rope...
                        if(self.realowner.hook_state & HOOK_PULLING)
@@ -208,6 +218,9 @@ void GrapplingHookThink()
                                self.hook_length = newlength;
                        }
 
+                       if(pull_entity.movetype == MOVETYPE_FLY)
+                               pull_entity.movetype = MOVETYPE_WALK;
+
                        if(self.realowner.hook_state & HOOK_RELEASING)
                        {
                                newlength = dist;
@@ -221,23 +234,38 @@ void GrapplingHookThink()
                                v = v + frametime * dir * spd * rubberforce;
 
                                dv = ((v - v0) * dir) * dir;
-                               if(autocvar_g_grappling_hook_tarzan >= 2)
+                               if(tarzan >= 2)
                                {
-                                       if(self.aiment.movetype == MOVETYPE_WALK)
+                                       if(self.aiment.movetype == MOVETYPE_WALK || self.aiment.classname == "nade")
                                        {
+                                               entity aim_ent = ((IS_VEHICLE(self.aiment) && self.aiment.owner) ? self.aiment.owner : self.aiment);
                                                v = v - dv * 0.5;
-                                               self.aiment.velocity = self.aiment.velocity - dv * 0.5;
-                                               self.aiment.flags &= ~FL_ONGROUND;
-                                               self.aiment.pusher = self.realowner;
-                                               self.aiment.pushltime = time + autocvar_g_maxpushtime;
-                                               self.aiment.istypefrag = self.aiment.BUTTON_CHAT;
+                                               if((frozen_pulling && self.aiment.frozen) || !frozen_pulling)
+                                               {
+                                                       self.aiment.velocity = self.aiment.velocity - dv * 0.5;
+                                                       self.aiment.flags &= ~FL_ONGROUND;
+                                                       if(self.aiment.flags & FL_PROJECTILE)
+                                                               UpdateCSQCProjectile(self.aiment);
+                                               }
+                                               if(self.aiment.classname == "nade")
+                                                       self.aiment.nextthink = time + autocvar_g_balance_grapplehook_nade_time; // set time after letting go?
+                                               aim_ent.pusher = self.realowner;
+                                               aim_ent.pushltime = time + autocvar_g_maxpushtime;
+                                               aim_ent.istypefrag = aim_ent.BUTTON_CHAT;
                                        }
                                }
 
-                               self.realowner.flags &= ~FL_ONGROUND;
+                               pull_entity.flags &= ~FL_ONGROUND;
                        }
 
-                       self.realowner.velocity = WarpZone_RefSys_TransformVelocity(self, self.realowner, v);
+                       if(!frozen_pulling && !(self.aiment.flags & FL_PROJECTILE))
+                               pull_entity.velocity = WarpZone_RefSys_TransformVelocity(self, pull_entity, v * velocity_multiplier);
+
+                       if(frozen_pulling && autocvar_g_balance_grapplehook_pull_frozen == 2 && !self.aiment.frozen)
+                       {
+                               RemoveGrapplingHook(self.realowner);
+                               return;
+                       }
                }
                else
                {
@@ -273,6 +301,8 @@ void GrapplingHookThink()
 
 void GrapplingHookTouch (void)
 {
+       if(other.movetype == MOVETYPE_FOLLOW)
+               return;
        PROJECTILE_TOUCH;
 
        GrapplingHook_Stop();
@@ -342,7 +372,7 @@ void FireGrapplingHook (void)
        missile.classname = "grapplinghook";
        missile.flags = FL_PROJECTILE;
 
-       missile.movetype = MOVETYPE_FLY;
+       missile.movetype = ((autocvar_g_balance_grapplehook_gravity) ? MOVETYPE_TOSS : MOVETYPE_FLY);
        PROJECTILE_MAKETRIGGER(missile);
 
        //setmodel (missile, "models/hook.md3"); // precision set below
@@ -394,7 +424,7 @@ void FireGrapplingHook (void)
 
 void GrapplingHookFrame()
 {
-       if(g_grappling_hook && timeout_status != TIMEOUT_ACTIVE && self.weapon != WEP_HOOK.m_id)
+       if(g_grappling_hook && timeout_status != TIMEOUT_ACTIVE && self.weapon != WEP_HOOK.m_id && !self.vehicle)
        {
                // offhand hook controls
                if(self.BUTTON_HOOK)
@@ -412,7 +442,7 @@ void GrapplingHookFrame()
                }
 
                self.hook_state &= ~HOOK_RELEASING;
-               if(self.BUTTON_CROUCH)
+               if(self.BUTTON_CROUCH && autocvar_g_balance_grapplehook_crouchslide)
                {
                        self.hook_state &= ~HOOK_PULLING;
                        //self.hook_state |= HOOK_RELEASING;
@@ -423,7 +453,7 @@ void GrapplingHookFrame()
                        //self.hook_state &= ~HOOK_RELEASING;
                }
        }
-       else if(!g_grappling_hook && self.switchweapon != WEP_HOOK.m_id)
+       else if(!g_grappling_hook && self.switchweapon != WEP_HOOK.m_id && !self.vehicle)
        {
                if(self.BUTTON_HOOK && !self.hook_switchweapon)
                        W_SwitchWeapon(WEP_HOOK.m_id);
index d6f00989792b19d3b7694ef86a2db3dbffce9dca..25a8d12c56948eab8d8ab32770e06b68a5af3f96 100644 (file)
@@ -589,4 +589,18 @@ MUTATOR_HOOKABLE(FixPlayermodel, EV_FixPlayermodel);
 
 /** Return error to play frag remaining announcements */
 MUTATOR_HOOKABLE(Scores_CountFragsRemaining, EV_NO_ARGS);
+
+#define EV_GrappleHookThink(i, o) \
+    /**/ i(entity, self) \
+    /**/ i(int, hook_tarzan) \
+    /**/ o(int, hook_tarzan) \
+    /**/ i(entity, hook_pullentity) \
+    /**/ o(entity, hook_pullentity) \
+    /**/ i(float, hook_velmultiplier) \
+    /**/ o(float, hook_velmultiplier) \
+    /**/
+int hook_tarzan;
+entity hook_pullentity;
+float hook_velmultiplier;
+MUTATOR_HOOKABLE(GrappleHookThink, EV_GrappleHookThink);
 #endif
index bd8cb189616244a34f22619ab452cf2d959cd19c..9199fe1eaf032f5343cd07f421e9fd2a178ecaaf 100644 (file)
@@ -290,7 +290,6 @@ void nade_ice_think()
        {
                self.nade_special_time = time+0.7;
 
-
                Send_Effect(EFFECT_ELECTRO_IMPACT, self.origin, '0 0 0', 1);
                Send_Effect(EFFECT_ICEFIELD, self.origin, '0 0 0', 1);
        }
@@ -554,6 +553,11 @@ void nade_boom()
                case NADE_TYPE_MONSTER: nade_monster_boom(); break;
        }
 
+       entity head;
+       for(head = world; (head = find(head, classname, "grapplinghook")); )
+       if(head.aiment == self)
+               RemoveGrapplingHook(head.realowner);
+
        remove(self);
 }
 
@@ -566,6 +570,10 @@ void nade_touch()
                is_weapclip = 1;*/
        if(ITEM_TOUCH_NEEDKILL()) // || is_weapclip)
        {
+               entity head;
+               for(head = world; (head = find(head, classname, "grapplinghook")); )
+               if(head.aiment == self)
+                       RemoveGrapplingHook(head.realowner);
                remove(self);
                return;
        }