X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fmutators%2Fmutator_nades.qc;h=40f4f7247db6fb284d272732724c71e0aff6e0d5;hb=c14f2b067c9ab0b4fb8a5b7805c8679be61f1fe0;hp=3932ce407d885c2ccb01d7c5f0a236aceac775a2;hpb=e3507f4fdbc2b3e15b663365e57e0aa60f3cf1a6;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/mutators/mutator_nades.qc b/qcsrc/server/mutators/mutator_nades.qc index 3932ce407..40f4f7247 100644 --- a/qcsrc/server/mutators/mutator_nades.qc +++ b/qcsrc/server/mutators/mutator_nades.qc @@ -1,3 +1,16 @@ +#include "mutator_nades.qh" +#include "../_all.qh" + +#include "mutator.qh" + +#include "gamemode_keyhunt.qh" +#include "gamemode_freezetag.qh" +#include "../../common/nades.qh" +#include "../../common/monsters/spawn.qh" +#include "../../common/monsters/sv_monsters.qh" + +.float lifetime; + .entity nade_spawnloc; void nade_timer_think() @@ -10,7 +23,7 @@ void nade_timer_think() void nade_burn_spawn(entity _nade) { - CSQCProjectile(_nade, true, Nade_ProjectileFromID(_nade.nade_type, true), true); + CSQCProjectile(_nade, true, NADES[_nade.nade_type].m_projectile[true], true); } void nade_spawn(entity _nade) @@ -29,7 +42,7 @@ void nade_spawn(entity _nade) _nade.effects |= EF_LOWPRECISION; - CSQCProjectile(_nade, true, Nade_ProjectileFromID(_nade.nade_type, false), true); + CSQCProjectile(_nade, true, NADES[_nade.nade_type].m_projectile[false], true); } void napalm_damage(float dist, float damage, float edgedamage, float burntime) @@ -347,13 +360,9 @@ void nade_translocate_boom() makevectors(self.realowner.angles); - entity oldself = self; - self = self.realowner; - MUTATOR_CALLHOOK(PortalTeleport); - self.realowner = self; - self = oldself; + MUTATOR_CALLHOOK(PortalTeleport, self.realowner); - TeleportPlayer(self, self.realowner, locout, self.realowner.mangle, v_forward * vlen(self.realowner.velocity), '0 0 0', '0 0 0', TELEPORT_FLAGS_TELEPORTER); + TeleportPlayer(self, self.realowner, locout, self.realowner.angles, v_forward * vlen(self.realowner.velocity), '0 0 0', '0 0 0', TELEPORT_FLAGS_TELEPORTER); } void nade_spawn_boom() @@ -475,25 +484,25 @@ void nade_monster_boom() void nade_boom() { string expef; - float nade_blast = 1; + bool nade_blast = true; - switch ( self.nade_type ) + switch ( NADES[self.nade_type] ) { case NADE_TYPE_NAPALM: nade_blast = autocvar_g_nades_napalm_blast; expef = "explosion_medium"; break; case NADE_TYPE_ICE: - nade_blast = 0; + nade_blast = false; expef = "electro_combo"; // hookbomb_explode electro_combo bigplasma_impact break; case NADE_TYPE_TRANSLOCATE: - nade_blast = 0; + nade_blast = false; expef = ""; break; case NADE_TYPE_MONSTER: case NADE_TYPE_SPAWN: - nade_blast = 0; + nade_blast = false; switch(self.realowner.team) { case NUM_TEAM_1: expef = "spawn_event_red"; break; @@ -504,7 +513,7 @@ void nade_boom() } break; case NADE_TYPE_HEAL: - nade_blast = 0; + nade_blast = false; expef = "spawn_event_red"; break; @@ -536,7 +545,7 @@ void nade_boom() } if(self.takedamage) - switch ( self.nade_type ) + switch ( NADES[self.nade_type] ) { case NADE_TYPE_NAPALM: nade_napalm_boom(); break; case NADE_TYPE_ICE: nade_ice_boom(); break; @@ -551,12 +560,12 @@ void nade_boom() void nade_touch() { - float is_weapclip = 0; + /*float is_weapclip = 0; if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NODRAW) if (!(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NONSOLID)) if (!(trace_dphitcontents & DPCONTENTS_OPAQUE)) - is_weapclip = 1; - if(ITEM_TOUCH_NEEDKILL() || is_weapclip) + is_weapclip = 1;*/ + if(ITEM_TOUCH_NEEDKILL()) // || is_weapclip) { remove(self); return; @@ -583,7 +592,7 @@ void nade_beep() self.nextthink = max(self.wait, time); } -void nade_damage(entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force) +void nade_damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) { if(ITEM_DAMAGE_NEEDKILL(deathtype)) { @@ -592,7 +601,7 @@ void nade_damage(entity inflictor, entity attacker, float damage, float deathtyp return; } - if(self.nade_type == NADE_TYPE_TRANSLOCATE || self.nade_type == NADE_TYPE_SPAWN) + if(self.nade_type == NADE_TYPE_TRANSLOCATE.m_id || self.nade_type == NADE_TYPE_SPAWN.m_id) return; if(DEATH_ISWEAPON(deathtype, WEP_BLASTER)) @@ -640,7 +649,7 @@ void nade_damage(entity inflictor, entity attacker, float damage, float deathtyp self.health -= damage; - if ( self.nade_type != NADE_TYPE_HEAL || IS_PLAYER(attacker) ) + if ( self.nade_type != NADE_TYPE_HEAL.m_id || IS_PLAYER(attacker) ) self.realowner = attacker; if(self.health <= 0) @@ -666,7 +675,13 @@ void toss_nade(entity e, vector _velocity, float _time) Kill_Notification(NOTIF_ONE_ONLY, e, MSG_CENTER_CPID, CPID_NADES); - setorigin(_nade, w_shotorg + (v_right * 25) * -1); + vector offset = (v_forward * autocvar_g_nades_throw_offset.x) + + (v_right * autocvar_g_nades_throw_offset.y) + + (v_up * autocvar_g_nades_throw_offset.z); + if(autocvar_g_nades_throw_offset == '0 0 0') + offset = '0 0 0'; + + setorigin(_nade, w_shotorg + offset + (v_right * 25) * -1); //setmodel(_nade, "models/weapons/v_ok_grenade.md3"); //setattachment(_nade, world, ""); PROJECTILE_MAKETRIGGER(_nade); @@ -677,7 +692,7 @@ void toss_nade(entity e, vector _velocity, float _time) if (trace_startsolid) setorigin(_nade, e.origin); - if(self.v_angle.x >= 70 && self.v_angle.x <= 110) + if(self.v_angle.x >= 70 && self.v_angle.x <= 110 && self.BUTTON_CROUCH) _nade.velocity = '0 0 100'; else if(autocvar_g_nades_nade_newton_style == 1) _nade.velocity = e.velocity + _velocity; @@ -705,7 +720,7 @@ void toss_nade(entity e, vector _velocity, float _time) _nade.toss_time = time; _nade.solid = SOLID_CORPSE; //((_nade.nade_type == NADE_TYPE_TRANSLOCATE) ? SOLID_CORPSE : SOLID_BBOX); - if(_nade.nade_type == NADE_TYPE_TRANSLOCATE || _nade.nade_type == NADE_TYPE_SPAWN) + if(_nade.nade_type == NADE_TYPE_TRANSLOCATE.m_id || _nade.nade_type == NADE_TYPE_SPAWN.m_id) _nade.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_PLAYERCLIP | DPCONTENTS_BOTCLIP; else _nade.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY; @@ -764,7 +779,7 @@ float nade_customize() { //self.effects = EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION; if(!self.traileffectnum) - self.traileffectnum = particleeffectnum(Nade_TrailEffect(Nade_ProjectileFromID(self.nade_type, false), self.team)); + self.traileffectnum = particleeffectnum(Nade_TrailEffect(NADES[self.nade_type].m_projectile[false], self.team)); self.alpha = 1; } @@ -798,14 +813,14 @@ void nade_prime() n.pokenade_type = ((autocvar_g_nades_client_select) ? self.cvar_cl_pokenade_type : autocvar_g_nades_pokenade_monster_type); } - n.nade_type = bound(1, n.nade_type, NADE_TYPE_LAST); + n.nade_type = bound(1, n.nade_type, NADES_COUNT); setmodel(n, "models/weapons/v_ok_grenade.md3"); //setattachment(n, self, "bip01 l hand"); n.exteriormodeltoclient = self; n.customizeentityforclient = nade_customize; - n.traileffectnum = particleeffectnum(Nade_TrailEffect(Nade_ProjectileFromID(n.nade_type, false), self.team)); - n.colormod = Nade_Color(n.nade_type); + n.traileffectnum = particleeffectnum(Nade_TrailEffect(NADES[n.nade_type].m_projectile[false], self.team)); + n.colormod = NADES[n.nade_type].m_color; n.realowner = self; n.colormap = self.colormap; n.glowmod = self.glowmod; @@ -818,7 +833,7 @@ void nade_prime() setmodel(fn, "models/weapons/h_ok_grenade.iqm"); setattachment(fn, self.weaponentity, ""); fn.realowner = fn.owner = self; - fn.colormod = Nade_Color(n.nade_type); + fn.colormod = NADES[n.nade_type].m_color; fn.colormap = self.colormap; fn.glowmod = self.glowmod; fn.think = SUB_Remove; @@ -976,7 +991,7 @@ MUTATOR_HOOKFUNCTION(nades_PlayerPreThink) self.pokenade_type = autocvar_g_nades_pokenade_monster_type; } - self.nade_type = bound(1, self.nade_type, NADE_TYPE_LAST); + self.nade_type = bound(1, self.nade_type, NADES_COUNT); if(self.bonus_nade_score >= 0 && autocvar_g_nades_bonus_score_max) nades_GiveBonus(self, time_score / autocvar_g_nades_bonus_score_max);