X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fserver%2Fmutators%2Fgamemode_onslaught.qc;h=74cba2897387862d8893b708cd263c1c8b8c8c69;hp=c31d53efca3f4f98c9b73d637f4189023b548d46;hb=a6a3b0cebd6928e3678ee4e97de4093f1b61c58b;hpb=e8b6542f46abb4c4ae2afde8d37eff347ab8a33e diff --git a/qcsrc/server/mutators/gamemode_onslaught.qc b/qcsrc/server/mutators/gamemode_onslaught.qc index c31d53efca..74cba28973 100644 --- a/qcsrc/server/mutators/gamemode_onslaught.qc +++ b/qcsrc/server/mutators/gamemode_onslaught.qc @@ -391,13 +391,12 @@ void onslaught_generator_think() { if (!overtime_msg_time) { - FOR_EACH_PLAYER(e) - centerprint(e, "^3Now playing ^1OVERTIME^3!\n^3Generators start now to decay.\n^3The more control points your team holds,\n^3the faster the enemy generator decays."); + Send_Notification(NOTIF_ALL, world, MSG_CENTER, CENTER_OVERTIME_CONTROLPOINT); overtime_msg_time = time; } // self.max_health / 300 gives 5 minutes of overtime. // control points reduce the overtime duration. - sound(self, CH_TRIGGER, "onslaught/generator_decay.wav", VOL_BASE, ATTN_NORM); + sound(self, CH_TRIGGER, "onslaught/generator_decay.wav", VOL_BASE, ATTEN_NORM); d = 1; e = findchain(classname, "onslaught_controlpoint"); while (e) @@ -407,12 +406,12 @@ void onslaught_generator_think() d = d + 1; e = e.chain; } - + if(autocvar_g_campaign && autocvar__campaign_testrun) d = d * self.max_health; else d = d * self.max_health / max(30, 60 * autocvar_timelimit_suddendeath); - + Damage(self, self, self, d, DEATH_HURTTRIGGER, self.origin, '0 0 0'); } else if (overtime_msg_time) @@ -423,10 +422,10 @@ void onslaught_generator_think() self.wait = time + 5; FOR_EACH_REALPLAYER(e) { - if(e.team == self.team) + if(SAME_TEAM(e, self)) { - centerprint(e, "^1Your generator is NOT shielded!\n^7Re-capture controlpoints to shield it!"); - soundto(MSG_ONE, e, CHAN_AUTO, "kh/alarm.wav", VOL_BASE, ATTN_NONE); // FIXME: Uniqe sound? + Send_Notification(NOTIF_ONE, e, MSG_CENTER, CENTER_ONS_NOTSHIELDED); + soundto(MSG_ONE, e, CHAN_AUTO, "kh/alarm.wav", VOL_BASE, ATTEN_NONE); // FIXME: Uniqe sound? } } } @@ -488,7 +487,7 @@ void onslaught_generator_damage_think() if(random() < 0.01) { pointparticles(particleeffectnum("electro_ballexplode"), self.origin + randompos('-50 -50 -20', '50 50 50'), '0 0 0', 1); - sound(self, CH_TRIGGER, "onslaught/electricity_explode.wav", VOL_BASE, ATTN_NORM); + sound(self, CH_TRIGGER, "onslaught/electricity_explode.wav", VOL_BASE, ATTEN_NORM); } else pointparticles(particleeffectnum("torch_small"), self.origin + randompos('-60 -60 -20', '60 60 60'), '0 0 0', 1); @@ -510,14 +509,14 @@ void onslaught_generator_deaththink() vector org; float i; - if not (self.count) + if (!self.count) self.count = 40; // White shockwave if(self.count==40||self.count==20) { onslaught_generator_ring_spawn(self.origin); - sound(self, CH_TRIGGER, "onslaught/shockwave.wav", VOL_BASE, ATTN_NORM); + sound(self, CH_TRIGGER, "onslaught/shockwave.wav", VOL_BASE, ATTEN_NORM); } // Throw some gibs @@ -543,7 +542,7 @@ void onslaught_generator_deaththink() if(random() < 0.25) { te_explosion(self.origin); - sound(self, CH_TRIGGER, "weapons/grenade_impact.wav", VOL_BASE, ATTN_NORM); + sound(self, CH_TRIGGER, "weapons/grenade_impact.wav", VOL_BASE, ATTEN_NORM); } // Particles @@ -563,7 +562,7 @@ void onslaught_generator_deaththink() te_explosion(org); onslaught_generator_shockwave_spawn(org); pointparticles(particleeffectnum("onslaught_generator_finalexplosion"), org, '0 0 0', 1); - sound(self, CH_TRIGGER, "weapons/rocket_impact.wav", VOL_BASE, ATTN_NORM); + sound(self, CH_TRIGGER, "weapons/rocket_impact.wav", VOL_BASE, ATTEN_NORM); } else self.nextthink = time + 0.05; @@ -576,7 +575,7 @@ void onslaught_generator_damage(entity inflictor, entity attacker, float damage, float i; if (damage <= 0) return; - if(inWarmupStage) + if(warmup_stage) return; if (attacker != self) { @@ -614,7 +613,7 @@ void onslaught_generator_damage(entity inflictor, entity attacker, float damage, #endif self.lasthealth = self.health; } - else if not(inWarmupStage) + else if (!warmup_stage) { if (attacker == self) bprint(Team_ColoredFullName(self.team), " generator spontaneously exploded due to overtime!\n"); @@ -639,10 +638,32 @@ void onslaught_generator_damage(entity inflictor, entity attacker, float damage, onslaught_updatelinks(); } + if(self.health <= 0) + setmodel(self, "models/onslaught/generator_dead.md3"); + else if(self.health < self.max_health * 0.10) + setmodel(self, "models/onslaught/generator_dmg9.md3"); + else if(self.health < self.max_health * 0.20) + setmodel(self, "models/onslaught/generator_dmg8.md3"); + else if(self.health < self.max_health * 0.30) + setmodel(self, "models/onslaught/generator_dmg7.md3"); + else if(self.health < self.max_health * 0.40) + setmodel(self, "models/onslaught/generator_dmg6.md3"); + else if(self.health < self.max_health * 0.50) + setmodel(self, "models/onslaught/generator_dmg5.md3"); + else if(self.health < self.max_health * 0.60) + setmodel(self, "models/onslaught/generator_dmg4.md3"); + else if(self.health < self.max_health * 0.70) + setmodel(self, "models/onslaught/generator_dmg3.md3"); + else if(self.health < self.max_health * 0.80) + setmodel(self, "models/onslaught/generator_dmg2.md3"); + else if(self.health < self.max_health * 0.90) + setmodel(self, "models/onslaught/generator_dmg1.md3"); + setsize(self, '-52 -52 -14', '52 52 75'); + // Throw some flaming gibs on damage, more damage = more chance for gib if(random() < damage/220) { - sound(self, CH_TRIGGER, "weapons/rocket_impact.wav", VOL_BASE, ATTN_NORM); + sound(self, CH_TRIGGER, "weapons/rocket_impact.wav", VOL_BASE, ATTEN_NORM); i = random(); if(i < 0.3) ons_throwgib(hitloc + '0 0 20', force * -1, "models/onslaught/gen_gib1.md3", 5, TRUE); @@ -658,17 +679,15 @@ void onslaught_generator_damage(entity inflictor, entity attacker, float damage, //sound on every hit if (random() < 0.5) - sound(self, CH_TRIGGER, "onslaught/ons_hit1.wav", VOL_BASE, ATTN_NORM); + sound(self, CH_TRIGGER, "onslaught/ons_hit1.wav", VOL_BASE, ATTEN_NORM); else - sound(self, CH_TRIGGER, "onslaught/ons_hit2.wav", VOL_BASE, ATTN_NORM); + sound(self, CH_TRIGGER, "onslaught/ons_hit2.wav", VOL_BASE, ATTEN_NORM); } //throw some gibs on damage if(random() < damage/200+0.2) if(random() < 0.5) ons_throwgib(hitloc + '0 0 20', randomvec()*360, "models/onslaught/gen_gib1.md3", 5, FALSE); - - self.SendFlags |= GSF_STATUS; } // update links after a delay @@ -676,9 +695,8 @@ void onslaught_generator_delayed() { onslaught_updatelinks(); // now begin normal thinking - generator_link(onslaught_generator_think); - - self.SendFlags = GSF_SETUP; + self.think = onslaught_generator_think; + self.nextthink = time; } string onslaught_generator_waypointsprite_for_team(entity e, float t) @@ -833,9 +851,7 @@ void onslaught_generator_reset() self.think = onslaught_generator_delayed; self.nextthink = time + 0.2; setmodel(self, "models/onslaught/generator.md3"); - setsize(self, GENERATOR_MIN, GENERATOR_MAX); - - self.SendFlags |= GSF_STATUS; + setsize(self, '-52 -52 -14', '52 52 75'); if(!self.noalign) { @@ -867,6 +883,16 @@ void spawnfunc_onslaught_generator() //entity e; precache_model("models/onslaught/generator.md3"); precache_model("models/onslaught/generator_shield.md3"); + precache_model("models/onslaught/generator_dmg1.md3"); + precache_model("models/onslaught/generator_dmg2.md3"); + precache_model("models/onslaught/generator_dmg3.md3"); + precache_model("models/onslaught/generator_dmg4.md3"); + precache_model("models/onslaught/generator_dmg5.md3"); + precache_model("models/onslaught/generator_dmg6.md3"); + precache_model("models/onslaught/generator_dmg7.md3"); + precache_model("models/onslaught/generator_dmg8.md3"); + precache_model("models/onslaught/generator_dmg9.md3"); + precache_model("models/onslaught/generator_dead.md3"); precache_model("models/onslaught/shockwave.md3"); precache_model("models/onslaught/shockwavetransring.md3"); precache_model("models/onslaught/gen_gib1.md3"); @@ -881,23 +907,22 @@ void spawnfunc_onslaught_generator() precache_sound("onslaught/ons_hit1.wav"); precache_sound("onslaught/ons_hit2.wav"); precache_sound("onslaught/electricity_explode.wav"); - precache_sound("onslaught/generator_underattack.wav"); if (!self.team) objerror("team must be set"); - + if(self.team == NUM_TEAM_1) ons_red_generator = self; if(self.team == NUM_TEAM_2) ons_blue_generator = self; - + self.team_saved = self.team; self.colormap = 1024 + (self.team - 1) * 17; self.solid = SOLID_BBOX; self.movetype = MOVETYPE_NONE; self.lasthealth = self.max_health = self.health = autocvar_g_onslaught_gen_health; setmodel(self, "models/onslaught/generator.md3"); - setsize(self, GENERATOR_MIN, GENERATOR_MAX); + setsize(self, '-52 -52 -14', '52 52 75'); setorigin(self, self.origin); self.takedamage = DAMAGE_AIM; self.bot_attack = TRUE; @@ -930,7 +955,7 @@ void spawnfunc_onslaught_generator() waypoint_spawnforitem(self); onslaught_updatelinks(); - + self.reset = onslaught_generator_reset; } @@ -1000,13 +1025,13 @@ void onslaught_controlpoint_icon_damage(entity inflictor, entity attacker, float pointparticles(particleeffectnum("sparks"), hitloc, force*-1, 1); //sound on every hit if (random() < 0.5) - sound(self, CH_TRIGGER, "onslaught/ons_hit1.wav", VOL_BASE+0.3, ATTN_NORM); + sound(self, CH_TRIGGER, "onslaught/ons_hit1.wav", VOL_BASE+0.3, ATTEN_NORM); else - sound(self, CH_TRIGGER, "onslaught/ons_hit2.wav", VOL_BASE+0.3, ATTN_NORM); + sound(self, CH_TRIGGER, "onslaught/ons_hit2.wav", VOL_BASE+0.3, ATTEN_NORM); if (self.health < 0) { - sound(self, CH_TRIGGER, "weapons/grenade_impact.wav", VOL_BASE, ATTN_NORM); + sound(self, CH_TRIGGER, "weapons/grenade_impact.wav", VOL_BASE, ATTEN_NORM); pointparticles(particleeffectnum("rocket_explode"), self.origin, '0 0 0', 1); { string t; @@ -1058,7 +1083,7 @@ void onslaught_controlpoint_icon_think() float _friendly_count = 0; float _dist; entity _player; - + FOR_EACH_PLAYER(_player) { if(!_player.deadflag) @@ -1183,9 +1208,9 @@ void onslaught_controlpoint_icon_think() pointparticles(particleeffectnum("electricity_sparks"), self.origin + randompos('-10 -10 -20', '10 10 20'), '0 0 0', 1); if(random() > 0.8) - sound(self, CH_PAIN, "onslaught/ons_spark1.wav", VOL_BASE, ATTN_NORM); + sound(self, CH_PAIN, "onslaught/ons_spark1.wav", VOL_BASE, ATTEN_NORM); else if (random() > 0.5) - sound(self, CH_PAIN, "onslaught/ons_spark2.wav", VOL_BASE, ATTN_NORM); + sound(self, CH_PAIN, "onslaught/ons_spark2.wav", VOL_BASE, ATTEN_NORM); } } @@ -1200,7 +1225,7 @@ void onslaught_controlpoint_icon_buildthink() a = onslaught_controlpoint_can_be_linked(self.owner, self.owner.team); if(!a) return; - + self.health = self.health + self.count; if (self.health >= self.max_health) @@ -1208,7 +1233,7 @@ void onslaught_controlpoint_icon_buildthink() self.health = self.max_health; self.count = autocvar_g_onslaught_cp_regen * sys_frametime; // slow repair rate from now on self.think = onslaught_controlpoint_icon_think; - sound(self, CH_TRIGGER, "onslaught/controlpoint_built.wav", VOL_BASE, ATTN_NORM); + sound(self, CH_TRIGGER, "onslaught/controlpoint_built.wav", VOL_BASE, ATTEN_NORM); bprint(Team_ColoredFullName(self.team), " captured ", self.owner.message, " control point\n"); self.owner.iscaptured = TRUE; @@ -1245,7 +1270,7 @@ void onslaught_controlpoint_touch() { entity e; float a; - if not(IS_PLAYER(other)) + if (!IS_PLAYER(other)) return; a = onslaught_controlpoint_attackable(self, other.team); if(a != 2 && a != 4) @@ -1271,13 +1296,19 @@ void onslaught_controlpoint_touch() e.think = onslaught_controlpoint_icon_buildthink; e.nextthink = time + sys_frametime; e.count = (e.max_health - e.health) * sys_frametime / autocvar_g_onslaught_cp_buildtime; // how long it takes to build - sound(e, CH_TRIGGER, "onslaught/controlpoint_build.wav", VOL_BASE, ATTN_NORM); + sound(e, CH_TRIGGER, "onslaught/controlpoint_build.wav", VOL_BASE, ATTEN_NORM); self.team = e.team; self.colormap = e.colormap; WaypointSprite_UpdateBuildFinished(self.sprite, time + (e.max_health - e.health) / (e.count / sys_frametime)); onslaught_updatelinks(); } +void onslaught_controlpoint_think() +{ + self.nextthink = time; + CSQCMODEL_AUTOUPDATE(); +} + void onslaught_controlpoint_reset() { if(self.goalentity && self.goalentity != world) @@ -1290,8 +1321,9 @@ void onslaught_controlpoint_reset() self.isshielded = TRUE; self.enemy.solid = SOLID_NOT; self.enemy.colormap = self.colormap; - self.think = self.enemy.think = func_null; - self.nextthink = 0; // don't like func_null :P + self.think = onslaught_controlpoint_think; + self.enemy.think = func_null; + self.nextthink = time; // don't like func_null :P setmodel(self, "models/onslaught/controlpoint_pad.md3"); //setsize(self, '-32 -32 0', '32 32 8'); @@ -1301,6 +1333,8 @@ void onslaught_controlpoint_reset() activator = self; SUB_UseTargets(); // to reset the structures, playerspawns etc. + + CSQCMODEL_AUTOUPDATE(); } /*QUAKED spawnfunc_onslaught_controlpoint (0 .5 .8) (-32 -32 0) (32 32 128) @@ -1371,6 +1405,9 @@ void spawnfunc_onslaught_controlpoint() self.enemy.colormap = self.colormap; waypoint_spawnforitem(self); + + self.think = onslaught_controlpoint_think; + self.nextthink = time; WaypointSprite_SpawnFixed(string_null, self.origin + '0 0 128', self, sprite, RADARICON_NONE, '0 0 0'); WaypointSprite_UpdateRule(self.sprite, NUM_TEAM_2, SPRITERULE_TEAMPLAY); @@ -1378,6 +1415,8 @@ void spawnfunc_onslaught_controlpoint() onslaught_updatelinks(); self.reset = onslaught_controlpoint_reset; + + CSQCMODEL_AUTOINIT(); } float onslaught_link_send(entity to, float sendflags) @@ -1498,24 +1537,24 @@ MUTATOR_HOOKFUNCTION(ons_BuildMutatorsPrettyString) MUTATOR_HOOKFUNCTION(ons_Spawn_Score) { - + /* float _neer_home = (random() > 0.5 ? TRUE : FALSE); - + RandomSelection_Init(); - + if(self.team == NUM_TEAM_1) RandomSelection_Add(ons_red_generator, 0, string_null, 1, 1); - + if(self.team == NUM_TEAM_2) RandomSelection_Add(ons_blue_generator, 0, string_null, 1, 1); - + entity _cp = findchain(classname, "onslaught_controlpoint"): while _cp; { - if(_cp.team == self.team) + if(_cp.team == self.team) RandomSelection_Add(_cp, 0, string_null, 1, 1); - + _cp = _cp.chain; } @@ -1526,9 +1565,9 @@ MUTATOR_HOOKFUNCTION(ons_Spawn_Score) } else if(self.team == spawn_spot.team) spawn_score_x += SPAWN_PRIO_NEAR_TEAMMATE_SAMETEAM; // prefer same team, if we can't find a spawn near teammate - + */ - + return 0; } @@ -1536,55 +1575,55 @@ MUTATOR_HOOKFUNCTION(ons_PlayerSpawn) { if(!autocvar_g_onslaught_spawn_at_controlpoints) return 0; - + if(random() < 0.5) // 50/50 chane to use default spawnsystem. return 0; - + float _close_to_home = ((random() > 0.5) ? TRUE : FALSE); entity _best = world, _trg_gen = world; float _score, _best_score = MAX_SHOT_DISTANCE; - + RandomSelection_Init(); - + if(self.team == NUM_TEAM_1) { if(!_close_to_home) _trg_gen = ons_blue_generator; - else - _trg_gen = ons_red_generator; + else + _trg_gen = ons_red_generator; } - + if(self.team == NUM_TEAM_2) { if(_close_to_home) _trg_gen = ons_blue_generator; - else - _trg_gen = ons_red_generator; + else + _trg_gen = ons_red_generator; } - + entity _cp = findchain(classname, "onslaught_controlpoint"); while(_cp) { - if(_cp.team == self.team) - { + if(_cp.team == self.team) + { _score = vlen(_trg_gen.origin - _cp.origin); if(_score < _best_score) { _best = _cp; - _best_score = _score; + _best_score = _score; } - } + } _cp = _cp.chain; } - - vector _loc; - float i; + + vector _loc; + float i; if(_best) { for(i = 0; i < 10; ++i) { _loc = _best.origin + '0 0 96'; - _loc += ('0 1 0' * random()) * 128; + _loc += ('0 1 0' * random()) * 128; tracebox(_loc, PL_MIN, PL_MAX, _loc, MOVE_NORMAL, self); if(trace_fraction == 1.0 && !trace_startsolid) { @@ -1598,13 +1637,13 @@ MUTATOR_HOOKFUNCTION(ons_PlayerSpawn) { if(!autocvar_g_onslaught_spawn_at_generator) return 0; - + _trg_gen = ((self.team == NUM_TEAM_1) ? ons_red_generator : ons_blue_generator); - + for(i = 0; i < 10; ++i) { _loc = _trg_gen.origin + '0 0 96'; - _loc += ('0 1 0' * random()) * 128; + _loc += ('0 1 0' * random()) * 128; tracebox(_loc, PL_MIN, PL_MAX, _loc, MOVE_NORMAL, self); if(trace_fraction == 1.0 && !trace_startsolid) { @@ -1614,7 +1653,7 @@ MUTATOR_HOOKFUNCTION(ons_PlayerSpawn) } } } - + return 0; } @@ -1623,8 +1662,6 @@ MUTATOR_HOOKFUNCTION(ons_MonsterThink) entity e = find(world, targetname, self.target); if (e != world) self.team = e.team; - - self.SendFlags |= MSF_STATUS; // update team return FALSE; } @@ -1639,7 +1676,6 @@ MUTATOR_HOOKFUNCTION(ons_MonsterSpawn) if(e != world) { self.team = e.team; - self.SendFlags |= MSF_STATUS; ee = e; } }