From: Mario Date: Sat, 29 Aug 2015 15:14:04 +0000 (+1000) Subject: Some hook & nade stuff X-Git-Tag: xonotic-v0.8.2~1972^2~3 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=d55679c21627cd51c59a1e329917308f360312f6;p=xonotic%2Fxonotic-data.pk3dir.git Some hook & nade stuff --- diff --git a/balance-nexuiz25.cfg b/balance-nexuiz25.cfg index 95680da37..6e18dc092 100644 --- a/balance-nexuiz25.cfg +++ b/balance-nexuiz25.cfg @@ -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 diff --git a/balance-overkill.cfg b/balance-overkill.cfg index bf390c219..a99d342ba 100644 --- a/balance-overkill.cfg +++ b/balance-overkill.cfg @@ -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 diff --git a/balance-samual.cfg b/balance-samual.cfg index cb4949762..379bc207d 100644 --- a/balance-samual.cfg +++ b/balance-samual.cfg @@ -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 diff --git a/balance-xdf.cfg b/balance-xdf.cfg index 4852a59d6..07d4c6c72 100644 --- a/balance-xdf.cfg +++ b/balance-xdf.cfg @@ -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 diff --git a/balance-xonotic.cfg b/balance-xonotic.cfg index 76ba51525..3bc87d607 100644 --- a/balance-xonotic.cfg +++ b/balance-xonotic.cfg @@ -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 diff --git a/balance-xpm.cfg b/balance-xpm.cfg index e7855280e..a99044add 100644 --- a/balance-xpm.cfg +++ b/balance-xpm.cfg @@ -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 diff --git a/qcsrc/server/autocvars.qh b/qcsrc/server/autocvars.qh index 37d4bfdd8..f6ac64efe 100644 --- a/qcsrc/server/autocvars.qh +++ b/qcsrc/server/autocvars.qh @@ -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; diff --git a/qcsrc/server/g_hook.qc b/qcsrc/server/g_hook.qc index a9b16d002..d63a2ade0 100644 --- a/qcsrc/server/g_hook.qc +++ b/qcsrc/server/g_hook.qc @@ -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); diff --git a/qcsrc/server/mutators/events.qh b/qcsrc/server/mutators/events.qh index d6f009897..25a8d12c5 100644 --- a/qcsrc/server/mutators/events.qh +++ b/qcsrc/server/mutators/events.qh @@ -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 diff --git a/qcsrc/server/mutators/mutator_nades.qc b/qcsrc/server/mutators/mutator_nades.qc index bd8cb1896..9199fe1ea 100644 --- a/qcsrc/server/mutators/mutator_nades.qc +++ b/qcsrc/server/mutators/mutator_nades.qc @@ -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; }