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=9ad119166dd6b15374b5c327e2449beb944b43e6;hp=b5b6594d70d384b89ed595692240acd4edf0b3be;hb=82dbcadfd0556053b74638f2e3ae2e57103ddf26;hpb=94cd32389004162a325b9e08cfb39bbae156eb0e diff --git a/qcsrc/server/mutators/gamemode_onslaught.qc b/qcsrc/server/mutators/gamemode_onslaught.qc index b5b6594d70..9ad119166d 100644 --- a/qcsrc/server/mutators/gamemode_onslaught.qc +++ b/qcsrc/server/mutators/gamemode_onslaught.qc @@ -1,8 +1,8 @@ float autocvar_g_onslaught_spawn_at_controlpoints; float autocvar_g_onslaught_spawn_at_generator; float autocvar_g_onslaught_cp_proxydecap; -var float autocvar_g_onslaught_cp_proxydecap_distance = 512; -var float autocvar_g_onslaught_cp_proxydecap_dps = 100; +float autocvar_g_onslaught_cp_proxydecap_distance = 512; +float autocvar_g_onslaught_cp_proxydecap_dps = 100; void onslaught_generator_updatesprite(entity e); void onslaught_controlpoint_updatesprite(entity e); @@ -102,12 +102,12 @@ void onslaught_updatelinks() l = findchain(classname, "onslaught_controlpoint"); while (l) { - l.islinked = FALSE; - l.isshielded = TRUE; - l.isgenneighbor_red = FALSE; - l.isgenneighbor_blue = FALSE; - l.iscpneighbor_red = FALSE; - l.iscpneighbor_blue = FALSE; + l.islinked = false; + l.isshielded = true; + l.isgenneighbor_red = false; + l.isgenneighbor_blue = false; + l.iscpneighbor_red = false; + l.iscpneighbor_blue = false; dprint(etos(l), " (point) belongs to team ", ftos(l.team), "\n"); l = l.chain; } @@ -118,10 +118,10 @@ void onslaught_updatelinks() dprint(etos(l), " (link) connects ", etos(l.goalentity), " with ", etos(l.enemy), "\n"); l = l.chain; } - stop = FALSE; + stop = false; while (!stop) { - stop = TRUE; + stop = true; l = links; while (l) { @@ -133,14 +133,14 @@ void onslaught_updatelinks() { if (!l.goalentity.islinked) { - stop = FALSE; - l.goalentity.islinked = TRUE; + stop = false; + l.goalentity.islinked = true; dprint(etos(l), " (link) is marking ", etos(l.goalentity), " (point) because its team matches ", etos(l.enemy), " (point)\n"); } else if (!l.enemy.islinked) { - stop = FALSE; - l.enemy.islinked = TRUE; + stop = false; + l.enemy.islinked = true; dprint(etos(l), " (link) is marking ", etos(l.enemy), " (point) because its team matches ", etos(l.goalentity), " (point)\n"); } } @@ -157,21 +157,21 @@ void onslaught_updatelinks() if (l.goalentity.team != l.enemy.team) { dprint(etos(l), " (link) is unshielding ", etos(l.enemy), " (point) because its team does not match ", etos(l.goalentity), " (point)\n"); - l.enemy.isshielded = FALSE; + l.enemy.isshielded = false; } if(l.goalentity.classname == "onslaught_generator") { if(l.goalentity.team == NUM_TEAM_1) - l.enemy.isgenneighbor_red = TRUE; + l.enemy.isgenneighbor_red = true; else if(l.goalentity.team == NUM_TEAM_2) - l.enemy.isgenneighbor_blue = TRUE; + l.enemy.isgenneighbor_blue = true; } else { if(l.goalentity.team == NUM_TEAM_1) - l.enemy.iscpneighbor_red = TRUE; + l.enemy.iscpneighbor_red = true; else if(l.goalentity.team == NUM_TEAM_2) - l.enemy.iscpneighbor_blue = TRUE; + l.enemy.iscpneighbor_blue = true; } } if (l.enemy.islinked) @@ -179,21 +179,21 @@ void onslaught_updatelinks() if (l.goalentity.team != l.enemy.team) { dprint(etos(l), " (link) is unshielding ", etos(l.goalentity), " (point) because its team does not match ", etos(l.enemy), " (point)\n"); - l.goalentity.isshielded = FALSE; + l.goalentity.isshielded = false; } if(l.enemy.classname == "onslaught_generator") { if(l.enemy.team == NUM_TEAM_1) - l.goalentity.isgenneighbor_red = TRUE; + l.goalentity.isgenneighbor_red = true; else if(l.enemy.team == NUM_TEAM_2) - l.goalentity.isgenneighbor_blue = TRUE; + l.goalentity.isgenneighbor_blue = true; } else { if(l.enemy.team == NUM_TEAM_1) - l.goalentity.iscpneighbor_red = TRUE; + l.goalentity.iscpneighbor_red = true; else if(l.enemy.team == NUM_TEAM_2) - l.goalentity.iscpneighbor_blue = TRUE; + l.goalentity.iscpneighbor_blue = true; } } l = l.chain; @@ -207,14 +207,14 @@ void onslaught_updatelinks() dprint(etos(l), " (generator) is shielded\n"); l.enemy.alpha = 1; l.takedamage = DAMAGE_NO; - l.bot_attack = FALSE; + l.bot_attack = false; } else { dprint(etos(l), " (generator) is not shielded\n"); l.enemy.alpha = -1; l.takedamage = DAMAGE_AIM; - l.bot_attack = TRUE; + l.bot_attack = true; } l = l.chain; } @@ -229,7 +229,7 @@ void onslaught_updatelinks() if (l.goalentity) { l.goalentity.takedamage = DAMAGE_NO; - l.goalentity.bot_attack = FALSE; + l.goalentity.bot_attack = false; } } else @@ -239,7 +239,7 @@ void onslaught_updatelinks() if (l.goalentity) { l.goalentity.takedamage = DAMAGE_AIM; - l.goalentity.bot_attack = TRUE; + l.goalentity.bot_attack = true; } } onslaught_controlpoint_updatesprite(l); @@ -391,8 +391,7 @@ 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. @@ -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,9 +422,9 @@ 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!"); + 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? } } @@ -510,7 +509,7 @@ void onslaught_generator_deaththink() vector org; float i; - if not (self.count) + if (!self.count) self.count = 40; // White shockwave @@ -525,11 +524,11 @@ void onslaught_generator_deaththink() { i = random(); if(i < 0.3) - ons_throwgib(self.origin + '0 0 40', (100 * randomvec() - '1 1 1') * 11 + '0 0 20', "models/onslaught/gen_gib1.md3", 6, TRUE); + ons_throwgib(self.origin + '0 0 40', (100 * randomvec() - '1 1 1') * 11 + '0 0 20', "models/onslaught/gen_gib1.md3", 6, true); else if(i > 0.7) - ons_throwgib(self.origin + '0 0 40', (100 * randomvec() - '1 1 1') * 12 + '0 0 20', "models/onslaught/gen_gib2.md3", 6, TRUE); + ons_throwgib(self.origin + '0 0 40', (100 * randomvec() - '1 1 1') * 12 + '0 0 20', "models/onslaught/gen_gib2.md3", 6, true); else - ons_throwgib(self.origin + '0 0 40', (100 * randomvec() - '1 1 1') * 13 + '0 0 20', "models/onslaught/gen_gib3.md3", 6, TRUE); + ons_throwgib(self.origin + '0 0 40', (100 * randomvec() - '1 1 1') * 13 + '0 0 20', "models/onslaught/gen_gib3.md3", 6, true); } // Spawn fire balls @@ -614,7 +613,7 @@ void onslaught_generator_damage(entity inflictor, entity attacker, float damage, #endif self.lasthealth = self.health; } - else if not(warmup_stage) + else if (!warmup_stage) { if (attacker == self) bprint(Team_ColoredFullName(self.team), " generator spontaneously exploded due to overtime!\n"); @@ -624,9 +623,9 @@ void onslaught_generator_damage(entity inflictor, entity attacker, float damage, t = Team_ColoredFullName(attacker.team); bprint(Team_ColoredFullName(self.team), " generator destroyed by ", t, "!\n"); } - self.iscaptured = FALSE; - self.islinked = FALSE; - self.isshielded = FALSE; + self.iscaptured = false; + self.islinked = false; + self.isshielded = false; self.takedamage = DAMAGE_NO; // can't be hurt anymore self.event_damage = func_null; // won't do anything if hurt self.count = 0; // reset counter @@ -667,11 +666,11 @@ void onslaught_generator_damage(entity inflictor, entity attacker, float damage, 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); + ons_throwgib(hitloc + '0 0 20', force * -1, "models/onslaught/gen_gib1.md3", 5, true); else if(i > 0.7) - ons_throwgib(hitloc + '0 0 20', force * -1, "models/onslaught/gen_gib2.md3", 5, TRUE); + ons_throwgib(hitloc + '0 0 20', force * -1, "models/onslaught/gen_gib2.md3", 5, true); else - ons_throwgib(hitloc + '0 0 20', force * -1, "models/onslaught/gen_gib3.md3", 5, TRUE); + ons_throwgib(hitloc + '0 0 20', force * -1, "models/onslaught/gen_gib3.md3", 5, true); } else { @@ -688,7 +687,7 @@ void onslaught_generator_damage(entity inflictor, entity attacker, float damage, //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); + ons_throwgib(hitloc + '0 0 20', randomvec()*360, "models/onslaught/gen_gib1.md3", 5, false); } // update links after a delay @@ -733,14 +732,14 @@ void onslaught_generator_updatesprite(entity e) if(e.lastshielded) { if(e.team == NUM_TEAM_1 || e.team == NUM_TEAM_2) - WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_GENERATOR, 0.5 * colormapPaletteColor(e.team - 1, FALSE)); + WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_GENERATOR, 0.5 * colormapPaletteColor(e.team - 1, false)); else WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_GENERATOR, '0.5 0.5 0.5'); } else { if(e.team == NUM_TEAM_1 || e.team == NUM_TEAM_2) - WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_GENERATOR, colormapPaletteColor(e.team - 1, FALSE)); + WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_GENERATOR, colormapPaletteColor(e.team - 1, false)); else WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_GENERATOR, '0.75 0.75 0.75'); } @@ -820,14 +819,14 @@ void onslaught_controlpoint_updatesprite(entity e) if(e.lastshielded) { if(e.team == NUM_TEAM_1 || e.team == NUM_TEAM_2) - WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_CONTROLPOINT, 0.5 * colormapPaletteColor(e.team - 1, FALSE)); + WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_CONTROLPOINT, 0.5 * colormapPaletteColor(e.team - 1, false)); else WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_CONTROLPOINT, '0.5 0.5 0.5'); } else { if(e.team == NUM_TEAM_1 || e.team == NUM_TEAM_2) - WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_CONTROLPOINT, colormapPaletteColor(e.team - 1, FALSE)); + WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_CONTROLPOINT, colormapPaletteColor(e.team - 1, false)); else WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_CONTROLPOINT, '0.75 0.75 0.75'); } @@ -844,10 +843,10 @@ void onslaught_generator_reset() self.team = self.team_saved; self.lasthealth = self.max_health = self.health = autocvar_g_onslaught_gen_health; self.takedamage = DAMAGE_AIM; - self.bot_attack = TRUE; - self.iscaptured = TRUE; - self.islinked = TRUE; - self.isshielded = TRUE; + self.bot_attack = true; + self.iscaptured = true; + self.islinked = true; + self.isshielded = true; self.enemy.solid = SOLID_NOT; self.think = onslaught_generator_delayed; self.nextthink = time + 0.2; @@ -910,13 +909,13 @@ void spawnfunc_onslaught_generator() precache_sound("onslaught/electricity_explode.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; @@ -926,11 +925,11 @@ void spawnfunc_onslaught_generator() setsize(self, '-52 -52 -14', '52 52 75'); setorigin(self, self.origin); self.takedamage = DAMAGE_AIM; - self.bot_attack = TRUE; + self.bot_attack = true; self.event_damage = onslaught_generator_damage; - self.iscaptured = TRUE; - self.islinked = TRUE; - self.isshielded = TRUE; + self.iscaptured = true; + self.islinked = true; + self.isshielded = true; // helper entity that create fx when generator is damaged onslaught_generator_damage_spawn(self); // spawn shield model which indicates whether this can be damaged @@ -956,7 +955,7 @@ void spawnfunc_onslaught_generator() waypoint_spawnforitem(self); onslaught_updatelinks(); - + self.reset = onslaught_generator_reset; } @@ -988,12 +987,12 @@ void onslaught_controlpoint_icon_damage(entity inflictor, entity attacker, float if (IS_PLAYER(attacker)) { - nag = FALSE; + nag = false; if(self.team == NUM_TEAM_1) { if(time - ons_notification_time_team1 > 10) { - nag = TRUE; + nag = true; ons_notification_time_team1 = time; } } @@ -1001,12 +1000,12 @@ void onslaught_controlpoint_icon_damage(entity inflictor, entity attacker, float { if(time - ons_notification_time_team2 > 10) { - nag = TRUE; + nag = true; ons_notification_time_team2 = time; } } else - nag = TRUE; + nag = true; if(nag) play2team(self.team, "onslaught/controlpoint_underattack.wav"); @@ -1038,17 +1037,17 @@ void onslaught_controlpoint_icon_damage(entity inflictor, entity attacker, float string t; t = Team_ColoredFullName(attacker.team); bprint(Team_ColoredFullName(self.team), " ", self.message, " control point destroyed by ", t, "\n"); - ons_throwgib(self.origin, (2 * randomvec() - '1 1 1') * 25, "models/onslaught/controlpoint_icon_gib1.md3", 3, FALSE); - ons_throwgib(self.origin, (2 * randomvec() - '1 1 1') * 45, "models/onslaught/controlpoint_icon_gib2.md3", 3, FALSE); - ons_throwgib(self.origin, (2 * randomvec() - '1 1 1') * 45, "models/onslaught/controlpoint_icon_gib2.md3", 3, FALSE); - ons_throwgib(self.origin, (2 * randomvec() - '1 1 1') * 75, "models/onslaught/controlpoint_icon_gib4.md3", 3, FALSE); - ons_throwgib(self.origin, (2 * randomvec() - '1 1 1') * 75, "models/onslaught/controlpoint_icon_gib4.md3", 3, FALSE); - ons_throwgib(self.origin, (2 * randomvec() - '1 1 1') * 75, "models/onslaught/controlpoint_icon_gib4.md3", 3, FALSE); - ons_throwgib(self.origin, (2 * randomvec() - '1 1 1') * 75, "models/onslaught/controlpoint_icon_gib4.md3", 3, FALSE); + ons_throwgib(self.origin, (2 * randomvec() - '1 1 1') * 25, "models/onslaught/controlpoint_icon_gib1.md3", 3, false); + ons_throwgib(self.origin, (2 * randomvec() - '1 1 1') * 45, "models/onslaught/controlpoint_icon_gib2.md3", 3, false); + ons_throwgib(self.origin, (2 * randomvec() - '1 1 1') * 45, "models/onslaught/controlpoint_icon_gib2.md3", 3, false); + ons_throwgib(self.origin, (2 * randomvec() - '1 1 1') * 75, "models/onslaught/controlpoint_icon_gib4.md3", 3, false); + ons_throwgib(self.origin, (2 * randomvec() - '1 1 1') * 75, "models/onslaught/controlpoint_icon_gib4.md3", 3, false); + ons_throwgib(self.origin, (2 * randomvec() - '1 1 1') * 75, "models/onslaught/controlpoint_icon_gib4.md3", 3, false); + ons_throwgib(self.origin, (2 * randomvec() - '1 1 1') * 75, "models/onslaught/controlpoint_icon_gib4.md3", 3, false); } self.owner.goalentity = world; - self.owner.islinked = FALSE; - self.owner.iscaptured = FALSE; + self.owner.islinked = false; + self.owner.iscaptured = false; self.owner.team = 0; self.owner.colormap = 1024; @@ -1084,7 +1083,7 @@ void onslaught_controlpoint_icon_think() float _friendly_count = 0; float _dist; entity _player; - + FOR_EACH_PLAYER(_player) { if(!_player.deadflag) @@ -1151,54 +1150,54 @@ void onslaught_controlpoint_icon_think() self.owner.waslinked = self.owner.islinked; } - if (self.punchangle_x > 0) + if (self.punchangle.x > 0) { - self.punchangle_x = self.punchangle_x - 60 * sys_frametime; - if (self.punchangle_x < 0) + self.punchangle_x = self.punchangle.x - 60 * sys_frametime; + if (self.punchangle.x < 0) self.punchangle_x = 0; } - else if (self.punchangle_x < 0) + else if (self.punchangle.x < 0) { - self.punchangle_x = self.punchangle_x + 60 * sys_frametime; - if (self.punchangle_x > 0) + self.punchangle_x = self.punchangle.x + 60 * sys_frametime; + if (self.punchangle.x > 0) self.punchangle_x = 0; } - if (self.punchangle_y > 0) + if (self.punchangle.y > 0) { - self.punchangle_y = self.punchangle_y - 60 * sys_frametime; - if (self.punchangle_y < 0) + self.punchangle_y = self.punchangle.y - 60 * sys_frametime; + if (self.punchangle.y < 0) self.punchangle_y = 0; } - else if (self.punchangle_y < 0) + else if (self.punchangle.y < 0) { - self.punchangle_y = self.punchangle_y + 60 * sys_frametime; - if (self.punchangle_y > 0) + self.punchangle_y = self.punchangle.y + 60 * sys_frametime; + if (self.punchangle.y > 0) self.punchangle_y = 0; } - if (self.punchangle_z > 0) + if (self.punchangle.z > 0) { - self.punchangle_z = self.punchangle_z - 60 * sys_frametime; - if (self.punchangle_z < 0) + self.punchangle_z = self.punchangle.z - 60 * sys_frametime; + if (self.punchangle.z < 0) self.punchangle_z = 0; } - else if (self.punchangle_z < 0) + else if (self.punchangle.z < 0) { - self.punchangle_z = self.punchangle_z + 60 * sys_frametime; - if (self.punchangle_z > 0) + self.punchangle_z = self.punchangle.z + 60 * sys_frametime; + if (self.punchangle.z > 0) self.punchangle_z = 0; } - self.angles_x = self.punchangle_x; - self.angles_y = self.punchangle_y + self.mangle_y; - self.angles_z = self.punchangle_z; - self.mangle_y = self.mangle_y + 45 * sys_frametime; + self.angles_x = self.punchangle.x; + self.angles_y = self.punchangle.y + self.mangle.y; + self.angles_z = self.punchangle.z; + self.mangle_y = self.mangle.y + 45 * sys_frametime; self.cp_bob_origin_z = 4 * PI * (1 - cos(self.cp_bob_spd)); self.cp_bob_spd = self.cp_bob_spd + 1.875 * sys_frametime; - if(self.cp_bob_dmg_z > 0) - self.cp_bob_dmg_z = self.cp_bob_dmg_z - 3 * sys_frametime; + if(self.cp_bob_dmg.z > 0) + self.cp_bob_dmg_z = self.cp_bob_dmg.z - 3 * sys_frametime; else self.cp_bob_dmg_z = 0; setorigin(self,self.cp_origin + self.cp_bob_origin + self.cp_bob_dmg); @@ -1226,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) @@ -1236,7 +1235,7 @@ void onslaught_controlpoint_icon_buildthink() self.think = onslaught_controlpoint_icon_think; 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; + self.owner.iscaptured = true; WaypointSprite_UpdateMaxHealth(self.owner.sprite, self.max_health); WaypointSprite_UpdateHealth(self.owner.sprite, self.health); @@ -1271,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) @@ -1290,7 +1289,7 @@ void onslaught_controlpoint_touch() setsize(e, '-32 -32 -32', '32 32 32'); setorigin(e, self.origin + '0 0 96'); e.takedamage = DAMAGE_AIM; - e.bot_attack = TRUE; + e.bot_attack = true; e.event_damage = onslaught_controlpoint_icon_damage; e.team = other.team; e.colormap = 1024 + (e.team - 1) * 17; @@ -1304,6 +1303,12 @@ void onslaught_controlpoint_touch() onslaught_updatelinks(); } +void onslaught_controlpoint_think() +{ + self.nextthink = time; + CSQCMODEL_AUTOUPDATE(); +} + void onslaught_controlpoint_reset() { if(self.goalentity && self.goalentity != world) @@ -1311,13 +1316,14 @@ void onslaught_controlpoint_reset() self.goalentity = world; self.team = 0; self.colormap = 1024; - self.iscaptured = FALSE; - self.islinked = FALSE; - self.isshielded = TRUE; + self.iscaptured = false; + self.islinked = false; + 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'); @@ -1327,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) @@ -1378,9 +1386,9 @@ void spawnfunc_onslaught_controlpoint() self.touch = onslaught_controlpoint_touch; self.team = 0; self.colormap = 1024; - self.iscaptured = FALSE; - self.islinked = FALSE; - self.isshielded = TRUE; + self.iscaptured = false; + self.islinked = false; + self.isshielded = true; // spawn shield model which indicates whether this can be damaged self.enemy = spawn(); @@ -1398,12 +1406,17 @@ void spawnfunc_onslaught_controlpoint() 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); onslaught_updatelinks(); self.reset = onslaught_controlpoint_reset; + + CSQCMODEL_AUTOINIT(); } float onslaught_link_send(entity to, float sendflags) @@ -1412,21 +1425,21 @@ float onslaught_link_send(entity to, float sendflags) WriteByte(MSG_ENTITY, sendflags); if(sendflags & 1) { - WriteCoord(MSG_ENTITY, self.goalentity.origin_x); - WriteCoord(MSG_ENTITY, self.goalentity.origin_y); - WriteCoord(MSG_ENTITY, self.goalentity.origin_z); + WriteCoord(MSG_ENTITY, self.goalentity.origin.x); + WriteCoord(MSG_ENTITY, self.goalentity.origin.y); + WriteCoord(MSG_ENTITY, self.goalentity.origin.z); } if(sendflags & 2) { - WriteCoord(MSG_ENTITY, self.enemy.origin_x); - WriteCoord(MSG_ENTITY, self.enemy.origin_y); - WriteCoord(MSG_ENTITY, self.enemy.origin_z); + WriteCoord(MSG_ENTITY, self.enemy.origin.x); + WriteCoord(MSG_ENTITY, self.enemy.origin.y); + WriteCoord(MSG_ENTITY, self.enemy.origin.z); } if(sendflags & 4) { WriteByte(MSG_ENTITY, self.clientcolors); // which is goalentity's color + enemy's color * 16 } - return TRUE; + return true; } void onslaught_link_checkupdate() @@ -1507,7 +1520,7 @@ void spawnfunc_onslaught_link() if (self.target == "" || self.target2 == "") objerror("target and target2 must be set\n"); InitializeEntity(self, onslaught_link_delayed, INITPRIO_FINDTARGET); - Net_LinkEntity(self, FALSE, 0, onslaught_link_send); + Net_LinkEntity(self, false, 0, onslaught_link_send); } MUTATOR_HOOKFUNCTION(ons_BuildMutatorsString) @@ -1524,24 +1537,24 @@ MUTATOR_HOOKFUNCTION(ons_BuildMutatorsPrettyString) MUTATOR_HOOKFUNCTION(ons_Spawn_Score) { - + /* - float _neer_home = (random() > 0.5 ? TRUE : FALSE); - + 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; } @@ -1552,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; } @@ -1562,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); + + 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) { @@ -1624,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) { @@ -1640,15 +1653,64 @@ MUTATOR_HOOKFUNCTION(ons_PlayerSpawn) } } } - + return 0; } +MUTATOR_HOOKFUNCTION(ons_TurretSpawn) +{ + entity e, ee = world; + if(self.targetname) + { + e = find(world, target, self.targetname); + + if(e != world) + { + self.team = e.team; + ee = e; + } + } + + if(ee) + { + activator = ee; + self.use(); + } + + return FALSE; +} + +MUTATOR_HOOKFUNCTION(ons_MonsterThink) +{ + entity e = find(world, targetname, self.target); + if (e != world) + self.team = e.team; + + return false; +} + +MUTATOR_HOOKFUNCTION(ons_MonsterSpawn) +{ + entity e, ee = world; + + if(self.targetname) + { + e = find(world,target,self.targetname); + activator = ee; + self.use(); + } + + return false; +} + MUTATOR_DEFINITION(gamemode_onslaught) { MUTATOR_HOOK(BuildMutatorsPrettyString, ons_BuildMutatorsPrettyString, CBC_ORDER_ANY); MUTATOR_HOOK(BuildMutatorsString, ons_BuildMutatorsString, CBC_ORDER_ANY); MUTATOR_HOOK(PlayerSpawn, ons_PlayerSpawn, CBC_ORDER_ANY); + MUTATOR_HOOK(TurretSpawn, ons_TurretSpawn, CBC_ORDER_ANY); + MUTATOR_HOOK(MonsterMove, ons_MonsterThink, CBC_ORDER_ANY); + MUTATOR_HOOK(MonsterSpawn, ons_MonsterSpawn, CBC_ORDER_ANY); //MUTATOR_HOOK(Spawn_Score, ons_Spawn_Score, CBC_ORDER_ANY); MUTATOR_ONADD