MapInfo_Map_supportedGametypes |= MAPINFO_TYPE_CTF;
else if(v == "team_CTF_blueflag")
MapInfo_Map_supportedGametypes |= MAPINFO_TYPE_CTF;
- else if(v == "td_generator" || v == "td_spawnpoint")
- MapInfo_Map_supportedGametypes |= MAPINFO_TYPE_TD;
else if(v == "target_assault_roundend")
MapInfo_Map_supportedGametypes |= MAPINFO_TYPE_ASSAULT;
else if(v == "onslaught_generator")
REGISTER_GAMETYPE(_("Last Man Standing"),lms,g_lms,LMS,"timelimit=20 lives=9 leadlimit=0")
#define g_lms IS_GAMETYPE(LMS)
-REGISTER_GAMETYPE(_("Tower Defense"),td,g_td,TD,"timelimit=0 pointlimit=1 leadlimit=0")
-#define g_td IS_GAMETYPE(TD)
-
REGISTER_GAMETYPE(_("Arena"),arena,g_arena,ARENA,"timelimit=20 pointlimit=10 leadlimit=0")
#define g_arena IS_GAMETYPE(ARENA)
MULTITEAM_INFO(1, INFO_SCORES_, 4, 0, 0, "", "", "", _("^TC^TT ^BGteam scores!\n"), "") \
MSG_INFO_NOTIF(1, INFO_SPECTATE_WARNING, 0, 1, "f1secs", "", "", _("^F2You have to become a player within the next %s, otherwise you will be kicked, because spectating isn't allowed at this time!\n"), "") \
MSG_INFO_NOTIF(1, INFO_SUPERWEAPON_PICKUP, 1, 0, "s1", "s1", "strength", _("^BG%s^K1 picked up a Superweapon\n"), "") \
- MSG_INFO_NOTIF(1, INFO_TD_AIM_REMOVE, 0, 0, "", "", "", _("^BGYou need to aim at your turret to remove it\n"), "") \
- MSG_INFO_NOTIF(1, INFO_TD_AIM_REPAIR, 0, 0, "", "", "", _("^BGYou need to aim at your turret to repair it\n"), "") \
- MSG_INFO_NOTIF(1, INFO_TD_AIM_UPGRADE, 0, 0, "", "", "", _("^BGYou need to aim at your turret to upgrade it\n"), "") \
- MSG_INFO_NOTIF(1, INFO_TD_CANTSPAWN, 0, 0, "", "", "", _("^BGYou can't currently spawn a turret\n"), "") \
- MSG_INFO_NOTIF(1, INFO_TD_GENDESTROYED, 0, 0, "", "", "", _("^K1A generator was destroyed!\n"), "") \
- MSG_INFO_NOTIF(1, INFO_TD_INVALID, 0, 0, "", "", "", _("^K1Invalid turret. Check '^F2turretspawn list^K1' to see available turrets\n"), "") \
- MSG_INFO_NOTIF(1, INFO_TD_LIST, 1, 0, "s1", "", "", _("^BGAvailable turrets: ^F2%s\n"), "") \
- MSG_INFO_NOTIF(1, INFO_TD_MAXHEALTH, 0, 0, "", "", "", _("^BGThis turret is already at max health\n"), "") \
- MSG_INFO_NOTIF(1, INFO_TD_MAXPOWER, 0, 0, "", "", "", _("^BGThis turret is already at max power\n"), "") \
- MSG_INFO_NOTIF(1, INFO_TD_MAXTURRETS, 0, 1, "f1", "", "", _("^BGYou can't spawn more than %s turrets\n"), "") \
- MSG_INFO_NOTIF(1, INFO_TD_NOFUEL, 0, 0, "", "", "", _("^BGYou don't have enough fuel to spawn that turret\n"), "") \
- MSG_INFO_NOTIF(1, INFO_TD_NOFUEL_REPAIR, 0, 1, "f1", "", "", _("^BGYou need %s fuel to repair this turret\n"), "") \
- MSG_INFO_NOTIF(1, INFO_TD_NOFUEL_UPGRADE, 0, 1, "f1", "", "", _("^BGYou need %s fuel to increase this turret's power\n"), "") \
- MSG_INFO_NOTIF(1, INFO_TD_PHASE_BUILD, 0, 3, "f1 f2 f3", "", "", _("^BGWave ^F2%s^BG build phase... Next monsters: ^F2%s^BG, wave starts in ^F2%s seconds\n"), "") \
- MSG_INFO_NOTIF(1, INFO_TD_PHASE_COMBAT, 0, 0, "", "", "", _("^K1Combat phase!\n"), "") \
- MSG_INFO_NOTIF(1, INFO_TD_REMOVE, 0, 0, "", "", "", _("^BGTurret removed\n"), "") \
- MSG_INFO_NOTIF(1, INFO_TD_REPAIR, 0, 0, "", "", "", _("^F1Turret repaired by 100 health points!\n"), "") \
- MSG_INFO_NOTIF(1, INFO_TD_SPAWN, 0, 0, "", "", "", _("^BGYou spawned a turret\n"), "") \
- MSG_INFO_NOTIF(1, INFO_TD_DISABLED, 0, 0, "", "", "", _("^BGTurrets are disabled on this map\n"), "") \
- MSG_INFO_NOTIF(1, INFO_TD_UPGRADE, 0, 0, "", "", "", _("^F1Turret power increased by 20 percent!\n"), "") \
- MSG_INFO_NOTIF(1, INFO_TD_VICTORY, 1, 0, "s1", "", "", _("^F1%s^F1 victory!\n"), "") \
MSG_INFO_NOTIF(2, INFO_VERSION_BETA, 2, 0, "s1 s2", "", "", _("^F4NOTE: ^BGThe server is running ^F1Xonotic %s (beta)^BG, you have ^F2Xonotic %s\n"), "") \
MSG_INFO_NOTIF(2, INFO_VERSION_OLD, 2, 0, "s1 s2", "", "", _("^F4NOTE: ^BGThe server is running ^F1Xonotic %s^BG, you have ^F2Xonotic %s\n"), "") \
MSG_INFO_NOTIF(2, INFO_VERSION_OUTDATED, 2, 0, "s1 s2", "", "", _("^F4NOTE: ^F1Xonotic %s^BG is out, and you still have ^F2Xonotic %s^BG - get the update from ^F3http://www.xonotic.org/^BG!\n"), "") \
MSG_CENTER_NOTIF(1, CENTER_SUPERWEAPON_BROKEN, 0, 0, "", CPID_POWERUP, "0 0", _("^F2Superweapons have broken down"), "") \
MSG_CENTER_NOTIF(1, CENTER_SUPERWEAPON_LOST, 0, 0, "", CPID_POWERUP, "0 0", _("^F2Superweapons have been lost"), "") \
MSG_CENTER_NOTIF(1, CENTER_SUPERWEAPON_PICKUP, 0, 0, "", CPID_POWERUP, "0 0", _("^F2You now have a superweapon"), "") \
- MSG_CENTER_NOTIF(1, CENTER_TD_AIM_REMOVE, 0, 0, "", CPID_TOWERDEFENSE, "0 0", _("^BGYou need to aim at your turret to remove it"), "") \
- MSG_CENTER_NOTIF(1, CENTER_TD_AIM_REPAIR, 0, 0, "", CPID_TOWERDEFENSE, "0 0", _("^BGYou need to aim at your turret to repair it"), "") \
- MSG_CENTER_NOTIF(1, CENTER_TD_AIM_UPGRADE, 0, 0, "", CPID_TOWERDEFENSE, "0 0", _("^BGYou need to aim at your turret to upgrade it"), "") \
- MSG_CENTER_NOTIF(1, CENTER_TD_ANNOUNCE_SPAWN, 1, 0, "s1", CPID_TOWERDEFENSE, "3 0", _("^K1A ^K2%s^K1 has arrived!"), "") \
- MSG_CENTER_NOTIF(1, CENTER_TD_CANTSPAWN, 0, 0, "", CPID_TOWERDEFENSE, "0 0", _("^BGYou can't currently spawn a turret"), "") \
- MSG_CENTER_NOTIF(1, CENTER_TD_GENDAMAGED, 0, 0, "", CPID_TOWERDEFENSE, "0 0", _("^K1The generator is under attack!"), "") \
- MSG_CENTER_NOTIF(1, CENTER_TD_GENDESTROYED, 0, 0, "", CPID_TOWERDEFENSE, "0 0", _("^K1A generator was destroyed!"), "") \
- MSG_CENTER_NOTIF(1, CENTER_TD_LIST, 1, 0, "s1", CPID_TOWERDEFENSE, "0 0", _("^BGAvilable turrets: ^F2%s"), "") \
- MSG_CENTER_NOTIF(1, CENTER_TD_MAXHEALTH, 0, 0, "", CPID_TOWERDEFENSE, "0 0", _("^BGThis turret is already at max health"), "") \
- MSG_CENTER_NOTIF(1, CENTER_TD_MAXPOWER, 0, 0, "", CPID_TOWERDEFENSE, "0 0", _("^BGThis turret is already at max power"), "") \
- MSG_CENTER_NOTIF(1, CENTER_TD_MAXTURRETS, 0, 1, "f1", CPID_TOWERDEFENSE, "0 0", _("^BGYou can't spawn more than %s turrets"), "") \
- MSG_CENTER_NOTIF(1, CENTER_TD_NOFUEL, 0, 0, "", CPID_TOWERDEFENSE, "0 0", _("^BGYou don't have enough fuel to spawn that turret"), "") \
- MSG_CENTER_NOTIF(1, CENTER_TD_NOFUEL_REPAIR, 0, 1, "f1", CPID_TOWERDEFENSE, "0 0", _("^BGYou need %s fuel to repair this turret"), "") \
- MSG_CENTER_NOTIF(1, CENTER_TD_NOFUEL_UPGRADE, 0, 1, "f1", CPID_TOWERDEFENSE, "0 0", _("^BGYou need %s fuel to increase this turret's power"), "") \
- MSG_CENTER_NOTIF(1, CENTER_TD_PHASE_BUILD, 0, 3, "f1 f2 f3", CPID_TOWERDEFENSE, "5 0", _("^BGWave ^F2%s^BG build phase... Next monsters: ^F2%s\n^BG wave starts in ^F2%s seconds"), "") \
- MSG_CENTER_NOTIF(1, CENTER_TD_PHASE_COMBAT, 0, 0, "", CPID_TOWERDEFENSE, "0 0", _("^K1Combat phase\n^K2Protect the generator from monsters!"), "") \
- MSG_CENTER_NOTIF(1, CENTER_TD_PROTECT, 0, 0, "", CPID_TOWERDEFENSE, "0 0", _("^BGProtect the generator from waves of monsters!"), "") \
- MSG_CENTER_NOTIF(1, CENTER_TD_REMOVE, 0, 0, "", CPID_TOWERDEFENSE, "0 0", _("^BGTurret removed"), "") \
- MSG_CENTER_NOTIF(1, CENTER_TD_REPAIR, 0, 0, "", CPID_TOWERDEFENSE, "0 0", _("^F1Turret repaired by 100 health points!"), "") \
- MSG_CENTER_NOTIF(1, CENTER_TD_SPAWN, 0, 0, "", CPID_TOWERDEFENSE, "0 0", _("^BGYou spawned a turret"), "") \
- MSG_CENTER_NOTIF(1, CENTER_TD_DISABLED, 0, 0, "", CPID_TOWERDEFENSE, "0 0", _("^BGTurrets are disabled on this map"), "") \
- MSG_CENTER_NOTIF(1, CENTER_TD_UPGRADE, 0, 0, "", CPID_TOWERDEFENSE, "0 0", _("^F1Turret power increased by 20 percent!"), "") \
- MSG_CENTER_NOTIF(1, CENTER_TD_VICTORY, 1, 0, "s1", CPID_TOWERDEFENSE, "0 0", _("^F1%s^F1 victory!"), "") \
MULTITEAM_CENTER(1, CENTER_TEAMCHANGE_, 4, 0, 1, "", CPID_TEAMCHANGE, "1 f1", _("^K1Changing to ^TC^TT^K1 in ^COUNT"), "") \
MSG_CENTER_NOTIF(1, CENTER_TEAMCHANGE_AUTO, 0, 1, "", CPID_TEAMCHANGE, "1 f1", _("^K1Changing team in ^COUNT"), "") \
MSG_CENTER_NOTIF(1, CENTER_TEAMCHANGE_SPECTATE, 0, 1, "", CPID_TEAMCHANGE, "1 f1", _("^K1Spectating in ^COUNT"), "") \
MSG_MULTI_NOTIF(1, ITEM_WEAPON_UNAVAILABLE, NO_MSG, INFO_ITEM_WEAPON_UNAVAILABLE, CENTER_ITEM_WEAPON_UNAVAILABLE) \
MSG_MULTI_NOTIF(1, MULTI_COUNTDOWN_BEGIN, ANNCE_BEGIN, NO_MSG, CENTER_COUNTDOWN_BEGIN) \
MSG_MULTI_NOTIF(1, MULTI_MINSTA_FINDAMMO, ANNCE_NUM_10, NO_MSG, CENTER_MINSTA_FINDAMMO_FIRST) \
- MSG_MULTI_NOTIF(1, MULTI_TD_AIM_REMOVE, NO_MSG, INFO_TD_AIM_REMOVE, CENTER_TD_AIM_REMOVE) \
- MSG_MULTI_NOTIF(1, MULTI_TD_AIM_REPAIR, NO_MSG, INFO_TD_AIM_REPAIR, CENTER_TD_AIM_REPAIR) \
- MSG_MULTI_NOTIF(1, MULTI_TD_AIM_UPGRADE, NO_MSG, INFO_TD_AIM_UPGRADE, CENTER_TD_AIM_UPGRADE) \
- MSG_MULTI_NOTIF(1, MULTI_TD_CANTSPAWN, NO_MSG, INFO_TD_CANTSPAWN, CENTER_TD_CANTSPAWN) \
- MSG_MULTI_NOTIF(1, MULTI_TD_DISABLED, NO_MSG, INFO_TD_DISABLED, CENTER_TD_DISABLED) \
- MSG_MULTI_NOTIF(1, MULTI_TD_GENDESTROYED, NO_MSG, INFO_TD_GENDESTROYED, CENTER_TD_GENDESTROYED) \
- MSG_MULTI_NOTIF(1, MULTI_TD_LIST, NO_MSG, INFO_TD_LIST, CENTER_TD_LIST) \
- MSG_MULTI_NOTIF(1, MULTI_TD_MAXHEALTH, NO_MSG, INFO_TD_MAXHEALTH, CENTER_TD_MAXHEALTH) \
- MSG_MULTI_NOTIF(1, MULTI_TD_MAXPOWER, NO_MSG, INFO_TD_MAXPOWER, CENTER_TD_MAXPOWER) \
- MSG_MULTI_NOTIF(1, MULTI_TD_MAXTURRETS, NO_MSG, INFO_TD_MAXTURRETS, CENTER_TD_MAXTURRETS) \
- MSG_MULTI_NOTIF(1, MULTI_TD_NOFUEL, NO_MSG, INFO_TD_NOFUEL, CENTER_TD_NOFUEL) \
- MSG_MULTI_NOTIF(1, MULTI_TD_NOFUEL_REPAIR, NO_MSG, INFO_TD_NOFUEL_REPAIR, CENTER_TD_NOFUEL_REPAIR) \
- MSG_MULTI_NOTIF(1, MULTI_TD_NOFUEL_UPGRADE, NO_MSG, INFO_TD_NOFUEL_UPGRADE, CENTER_TD_NOFUEL_UPGRADE) \
- MSG_MULTI_NOTIF(1, MULTI_TD_PHASE_BUILD, NO_MSG, INFO_TD_PHASE_BUILD, CENTER_TD_PHASE_BUILD) \
- MSG_MULTI_NOTIF(1, MULTI_TD_PHASE_COMBAT, NO_MSG, INFO_TD_PHASE_COMBAT, CENTER_TD_PHASE_COMBAT) \
- MSG_MULTI_NOTIF(1, MULTI_TD_REMOVE, NO_MSG, INFO_TD_REMOVE, CENTER_TD_REMOVE) \
- MSG_MULTI_NOTIF(1, MULTI_TD_REPAIR, NO_MSG, INFO_TD_REPAIR, CENTER_TD_REPAIR) \
- MSG_MULTI_NOTIF(1, MULTI_TD_SPAWN, NO_MSG, INFO_TD_SPAWN, CENTER_TD_SPAWN) \
- MSG_MULTI_NOTIF(1, MULTI_TD_UPGRADE, NO_MSG, INFO_TD_UPGRADE, CENTER_TD_UPGRADE) \
- MSG_MULTI_NOTIF(1, MULTI_TD_VICTORY, NO_MSG, INFO_TD_VICTORY, CENTER_TD_VICTORY) \
MSG_MULTI_NOTIF(1, WEAPON_ACCORDEON_MURDER, NO_MSG, INFO_WEAPON_ACCORDEON_MURDER, NO_MSG) \
MSG_MULTI_NOTIF(1, WEAPON_ACCORDEON_SUICIDE, NO_MSG, INFO_WEAPON_ACCORDEON_SUICIDE, CENTER_DEATH_SELF_GENERIC) \
MSG_MULTI_NOTIF(1, WEAPON_CRYLINK_MURDER, NO_MSG, INFO_WEAPON_CRYLINK_MURDER, NO_MSG) \
#include "xonotic/dialog_settings_misc.c"
#include "xonotic/dialog_multiplayer.c"
#include "xonotic/dialog_multiplayer_playersetup.c"
-#include "xonotic/dialog_towerdefense.c"
#include "xonotic/tabcontroller.c"
#include "xonotic/textlabel.c"
#include "xonotic/slider.c"
+++ /dev/null
-#ifdef INTERFACE
-CLASS(XonoticTowerDefenseDialog) EXTENDS(XonoticRootDialog)
- METHOD(XonoticTowerDefenseDialog, fill, void(entity)) // to be overridden by user to fill the dialog with controls
- ATTRIB(XonoticTowerDefenseDialog, title, string, _("Tower Defense Control Panel"))
- ATTRIB(XonoticTowerDefenseDialog, color, vector, SKINCOLOR_DIALOG_SANDBOXTOOLS)
- ATTRIB(XonoticTowerDefenseDialog, intendedWidth, float, 0.8)
- ATTRIB(XonoticTowerDefenseDialog, rows, float, 4)
- ATTRIB(XonoticTowerDefenseDialog, columns, float, 2)
- ATTRIB(XonoticTowerDefenseDialog, name, string, "TowerDefense")
-ENDCLASS(XonoticTowerDefenseDialog)
-#endif
-
-#ifdef IMPLEMENTATION
-void XonoticTowerDefenseDialog_fill(entity me)
-{
- entity e;
-
- me.TR(me);
- me.TD(me, 1, 0.5, e = makeXonoticTextLabel(0, _("Turret:")));
- me.TR(me);
- me.TD(me, 1, 0.2, e = makeXonoticRadioButton(2, "menu_td_edit_spawn", "plasma", _("Plasma")));
- me.TD(me, 1, 0.2, e = makeXonoticRadioButton(2, "menu_td_edit_spawn", "mlrs", _("MLRS")));
- me.TD(me, 1, 0.2, e = makeXonoticRadioButton(2, "menu_td_edit_spawn", "flac", _("FLAC")));
- me.TD(me, 1, 0.2, e = makeXonoticRadioButton(2, "menu_td_edit_spawn", "barricade", _("Barricade")));
- me.TD(me, 1, 0.2, e = makeXonoticRadioButton(2, "menu_td_edit_spawn", "walker", _("Walker")));
- me.TR(me);
- me.TD(me, 1, 0.5, e = makeXonoticCommandButton(_("Spawn"), '0 0 0', "spawnturret $menu_td_edit_spawn", 0));
- me.TD(me, 1, 0.5, e = makeXonoticCommandButton(_("Remove"), '0 0 0', "rmturret", 0));
- me.TDempty(me, 0.1);
- me.TD(me, 1, 0.2, e = makeXonoticCommandButton(_("Repair"), '0 0 0', "repairturret", 0));
- me.TD(me, 1, 0.2, e = makeXonoticCommandButton(_("Upgrade"), '0 0 0', "upgradeturret", 0));
-
- me.TR(me);
-
- me.gotoRC(me, me.rows - 1, 0);
- me.TD(me, 1, me.columns, e = makeXonoticButton(_("OK"), '0 0 0'));
- e.onClick = Dialog_Close;
- e.onClickEntity = me;
-}
-#endif
-
-/* Click. The c-word is here so you can grep for it :-) */
i.configureDialog(i);
me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z * SKINALPHA_DIALOG_SANDBOXTOOLS);
- i = spawnXonoticTowerDefenseDialog();
- i.configureDialog(i);
- me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z * SKINALPHA_DIALOG_SANDBOXTOOLS);
-
// miscellaneous dialogs
i = spawnXonoticTeamSelectDialog();
GAMETYPE(MAPINFO_TYPE_RACE) \
GAMETYPE(MAPINFO_TYPE_CTS) \
GAMETYPE(MAPINFO_TYPE_TEAM_DEATHMATCH) \
- GAMETYPE(MAPINFO_TYPE_TD) \
/* nothing */
float GameType_GetID(float cnt)
float accuracy_isgooddamage(entity attacker, entity targ)
{
- float targ_isvalid = ((g_td) ? targ.flags & FL_MONSTER : IS_CLIENT(targ));
-
if(!inWarmupStage)
- if(targ_isvalid)
+ if(IS_CLIENT(targ))
if not(attacker.flags & FL_MONSTER) // no accuracy for monsters
if(targ.deadflag == DEAD_NO)
if(IsDifferentTeam(attacker, targ))
float autocvar_g_touchexplode_damage;
float autocvar_g_touchexplode_edgedamage;
float autocvar_g_touchexplode_force;
-float autocvar_g_td_debug;
else if not(autocvar_g_monsters) { Send_Notification(NOTIF_ONE, self, MSG_INFO, INFO_MONSTERS_DISABLED); }
else if(self.vehicle) { sprint(self, "You can't spawn monsters while driving a vehicle.\n"); }
else if(autocvar_g_campaign) { sprint(self, "You can't spawn monsters in campaign mode.\n"); }
- else if(g_td) { sprint(self, "You can't spawn monsters in Tower Defense mode.\n"); }
else if(self.deadflag) { sprint(self, "You can't spawn monsters while dead.\n"); }
else if(self.monstercount >= autocvar_g_monsters_max_perplayer) { sprint(self, "You have spawned too many monsters, kill some before trying to spawn any more.\n"); }
else if(totalspawned >= autocvar_g_monsters_max) { sprint(self, "The global maximum monster count has been reached, kill some before trying to spawn any more.\n"); }
{
case CMD_REQUEST_COMMAND:
{
- if(g_td) { print("This command doesn't work in Tower Defense.\n"); return; }
if(autocvar_g_campaign) { print("This command doesn't work in campaign mode.\n"); return; }
float removed_count = 0;
BADCVAR("g_freezetag_teams");
BADCVAR("g_keepaway");
BADCVAR("g_keyhunt");
- BADCVAR("g_td");
BADCVAR("g_keyhunt_teams");
BADCVAR("g_lms");
BADCVAR("g_nexball");
if(self.state != MONSTER_STATE_ATTACK_LEAP && self.state != MONSTER_STATE_ATTACK_MELEE)
turny = 20;
- if(g_td || self.flags & FL_SWIM)
+ if(self.flags & FL_SWIM)
turny = vlen(self.angles - self.moveto);
if(turny)
if(time < self.spawnshieldtime)
return;
- if((ignore_turrets && !(attacker.turrcaps_flags & TFL_TURRCAPS_ISTURRET)) || !ignore_turrets)
- if(monster_isvalidtarget(attacker, self))
- self.enemy = attacker;
-
if(deathtype != DEATH_KILL)
damage *= self.armorvalue;
+++ /dev/null
-void td_debug(string input)
-{
- switch(autocvar_g_td_debug)
- {
- case 1: dprint(input); break;
- case 2: print(input); break;
- }
-}
-
-void td_waypoint_link(float tm, vector from, vector to)
-{
- switch(tm)
- {
- case NUM_TEAM_1:
- WarpZone_TrailParticles(world, particleeffectnum("waypoint_link_red"), from, to);
- break;
- case NUM_TEAM_2:
- WarpZone_TrailParticles(world, particleeffectnum("waypoint_link_blue"), from, to);
- break;
- case NUM_TEAM_3:
- WarpZone_TrailParticles(world, particleeffectnum("waypoint_link_yellow"), from, to);
- break;
- case NUM_TEAM_4:
- WarpZone_TrailParticles(world, particleeffectnum("waypoint_link_pink"), from, to);
- break;
- }
-}
-
-void td_waypoint_think()
-{
- entity e = world;
- if(gameover)
- {
- remove(self);
- return;
- }
-
- if not(self.team)
- {
- e = find(world, target, self.targetname);
- if(e)
- self.team = e.team;
- }
- if not(self.team)
- {
- e = find(world, target2, self.targetname);
- if(e)
- self.team = e.team;
- }
- if not(self.team)
- {
- e = find(world, target3, self.targetname);
- if(e)
- self.team = e.team;
- }
- if not(self.team)
- {
- e = find(world, target4, self.targetname);
- if(e)
- self.team = e.team;
- }
-
- if not(self.team)
- {
- td_debug("Tower Defense waypoint without a team, removing it.\n");
- remove(self);
- return;
- }
-
- if(time >= self.last_trace)
- {
- entity e;
-
- e = find(world, targetname, self.target);
- if(e.classname == "td_waypoint" || e.flags & FL_GENERATOR)
- td_waypoint_link(self.team, self.origin, e.origin);
- e = find(world, targetname, self.target2);
- if(e.classname == "td_waypoint" || e.flags & FL_GENERATOR)
- td_waypoint_link(self.team, self.origin, e.origin);
- e = find(world, targetname, self.target3);
- if(e.classname == "td_waypoint" || e.flags & FL_GENERATOR)
- td_waypoint_link(self.team, self.origin, e.origin);
- e = find(world, targetname, self.target4);
- if(e.classname == "td_waypoint" || e.flags & FL_GENERATOR)
- td_waypoint_link(self.team, self.origin, e.origin);
-
- e = find(world, target, self.targetname);
- if(e.classname == "td_spawnpoint" || e.classname == "td_waypoint" || e.flags & FL_GENERATOR)
- td_waypoint_link(self.team, self.origin, e.origin);
- e = find(world, target2, self.targetname);
- if(e.classname == "td_spawnpoint" || e.classname == "td_waypoint" || e.flags & FL_GENERATOR)
- td_waypoint_link(self.team, self.origin, e.origin);
- e = find(world, target3, self.targetname);
- if(e.classname == "td_spawnpoint" || e.classname == "td_waypoint" || e.flags & FL_GENERATOR)
- td_waypoint_link(self.team, self.origin, e.origin);
- e = find(world, target4, self.targetname);
- if(e.classname == "td_spawnpoint" || e.classname == "td_waypoint" || e.flags & FL_GENERATOR)
- td_waypoint_link(self.team, self.origin, e.origin);
-
- self.last_trace = time + 0.5;
- }
-
- self.nextthink = time + 0.1;
-}
-
-void td_generator_die()
-{
- if(autocvar_sv_eventlog)
- GameLogEcho(":gendestroyed");
-
- Send_Notification(NOTIF_ALL, world, MSG_MULTI, MULTI_TD_GENDESTROYED);
-
- self.solid = SOLID_NOT;
- self.takedamage = DAMAGE_NO;
- self.event_damage = func_null;
- self.enemy = world;
- self.reset = func_null; // don't reset this generator
-
- WaypointSprite_Kill(self.sprite);
-}
-
-void td_generator_damage(entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
-{
- if(IS_PLAYER(attacker) || attacker.turrcaps_flags & TFL_TURRCAPS_ISTURRET || attacker.vehicle_flags & VHF_ISVEHICLE || self.takedamage == DAMAGE_NO)
- return;
-
- entity head;
-
- if (time > self.pain_finished)
- {
- self.pain_finished = time + 10;
- play2team(self.team, "onslaught/generator_underattack.wav");
- }
-
- if (random() < 0.5)
- spamsound(self, CH_TRIGGER, "onslaught/ons_hit1.wav", VOL_BASE, ATTN_NORM);
- else
- spamsound(self, CH_TRIGGER, "onslaught/ons_hit2.wav", VOL_BASE, ATTN_NORM);
-
-
- FOR_EACH_REALPLAYER(head)
- if(!IsDifferentTeam(head, self))
- Send_Notification(NOTIF_ONE, head, MSG_CENTER, CENTER_TD_GENDAMAGED);
-
- self.health -= damage;
-
- WaypointSprite_UpdateHealth(self.sprite, self.health);
-
- if(self.health <= 0)
- {
- FOR_EACH_PLAYER(head)
- if(!IsDifferentTeam(head, attacker))
- PlayerScore_Add(head, SP_TD_DESTROYS, 1);
-
- TeamScore_AddToTeam(attacker.team, ST_TD_DESTROYS, 1);
- td_generator_die();
- }
-
- self.SendFlags |= GSF_STATUS;
-}
-
-void td_generator_setup()
-{
- self.think = func_null;
- self.nextthink = -1;
- self.solid = SOLID_BBOX;
- self.takedamage = DAMAGE_AIM;
- self.event_damage = td_generator_damage;
- self.movetype = MOVETYPE_NONE;
- self.monster_attack = TRUE;
- self.netname = "Generator";
- self.reset = func_null;
-
- WaypointSprite_SpawnFixed(self.netname, self.origin + '0 0 90', self, sprite, RADARICON_OBJECTIVE, Team_ColorRGB(self.team));
- WaypointSprite_UpdateMaxHealth(self.sprite, self.max_health);
- WaypointSprite_UpdateHealth(self.sprite, self.health);
-}
-
-entity PickSpawn (float tm)
-{
- entity e;
- RandomSelection_Init();
- for(e = world;(e = find(e, classname, "td_spawnpoint")); )
- if(e.team == tm)
- RandomSelection_Add(e, 0, string_null, 1, 1);
-
- return RandomSelection_chosen_ent;
-}
-
-void TD_SpawnMonster(float tm, float monster)
-{
- entity e, mon;
-
- e = PickSpawn(tm);
-
- if(e == world)
- {
- td_debug("Warning: couldn't find any td_spawnpoint spawnpoints, no monsters will spawn!\n");
- return;
- }
-
- mon = spawnmonster("", monster, e, e, e.origin, FALSE, 2);
- if(e.target2)
- {
- if(random() <= 0.5 && e.target)
- mon.target2 = e.target;
- else
- mon.target2 = e.target2;
- }
- else
- mon.target2 = e.target;
-}
-
-float RandomMonster()
-{
- RandomSelection_Init();
-
- float i;
-
- for(i = MONSTER_FIRST + 1; i < MONSTER_LAST; ++i)
- {
- if(i == MONSTER_STINGRAY || i == MONSTER_WYVERN)
- continue; // flying/swimming monsters not yet supported
-
- RandomSelection_Add(world, i, "", 1, 1);
- }
-
- return RandomSelection_chosen_float;
-}
-
-void SpawnMonsters(float tm)
-{
- float whichmon;
-
- whichmon = RandomMonster();
-
- TD_SpawnMonster(tm, whichmon);
-}
-
-entity PickGenerator(float tm)
-{
- entity head;
-
- RandomSelection_Init();
- for(head = world;(head = findflags(head, flags, FL_GENERATOR)); )
- if(head.team != tm)
- RandomSelection_Add(head, 0, string_null, 1, 1);
-
- return RandomSelection_chosen_ent;
-}
-
-float td_checkfuel(entity ent, string tur)
-{
- float turcost = cvar(strcat("g_td_turret_", tur, "_cost"));
-
- if(ent.ammo_fuel < turcost)
- {
- Send_Notification(NOTIF_ONE, ent, MSG_MULTI, MULTI_TD_NOFUEL);
- return FALSE;
- }
-
- ent.ammo_fuel -= turcost;
-
- return TRUE;
-}
-
-void spawnturret(entity spawnedby, entity own, string turet, vector orig)
-{
- if not(IS_PLAYER(spawnedby)) { td_debug("Warning: A non-player entity tried to spawn a turret\n"); return; }
- if not(td_checkfuel(spawnedby, turet)) { return; }
-
- entity oldself;
-
- oldself = self;
- self = spawn();
-
- setorigin(self, orig);
- self.spawnflags = TSL_NO_RESPAWN;
- self.monster_attack = TRUE;
- self.realowner = own;
- self.playerid = own.playerid;
- self.angles_y = spawnedby.v_angle_y;
- spawnedby.turret_cnt += 1;
- self.team = own.team;
-
- switch(turet)
- {
- case "plasma": spawnfunc_turret_plasma(); break;
- case "mlrs": spawnfunc_turret_mlrs(); break;
- case "walker": spawnfunc_turret_walker(); break;
- case "flac": spawnfunc_turret_flac(); break;
- case "towerbuff": spawnfunc_turret_fusionreactor(); break;
- default: Send_Notification(NOTIF_ONE, spawnedby, MSG_INFO, INFO_TD_INVALID); remove(self); self = oldself; return;
- }
-
- Send_Notification(NOTIF_ONE, spawnedby, MSG_MULTI, MULTI_TD_SPAWN);
-
- self = oldself;
-}
-
-void buffturret(entity tur, float buff)
-{
- float refbuff = bound(0.01, buff * 0.05, 0.1);
-
- tur.turret_buff += 1;
- tur.max_health *= buff;
- tur.tur_health = tur.max_health;
- tur.health = tur.max_health;
- tur.ammo_max *= buff;
- tur.ammo_recharge *= buff;
- tur.shot_dmg *= buff;
- tur.shot_radius *= buff;
- tur.shot_speed *= buff;
- tur.shot_spread *= buff;
- tur.shot_force *= buff;
-
- if(buff < 1)
- tur.shot_refire += refbuff;
- else
- tur.shot_refire -= refbuff;
-}
-
-void spawn_td_fuel(float fuel_size)
-{
- if not(g_td) {remove(self); return; }
-
- self.ammo_fuel = fuel_size * monster_skill;
- StartItem("models/items/g_fuel.md3", "misc/itempickup.wav", g_pickup_respawntime_ammo, g_pickup_respawntimejitter_ammo, "Turret Fuel", IT_FUEL, 0, 0, commodity_pickupevalfunc, BOT_PICKUP_RATING_LOW);
-
- self.velocity = randomvec() * 175 + '0 0 325';
-}
-
-void td_generator_delayed()
-{
- generator_link(td_generator_setup);
-
- self.SendFlags = GSF_SETUP;
-}
-
-// round handling
-#define TD_ALIVE_TEAMS() ((redalive > 0) + (bluealive > 0))
-#define TD_ALIVE_TEAMS_OK() (TD_ALIVE_TEAMS() == 2)
-void TD_RoundStart()
-{
- entity head;
-
- allowed_to_spawn = TRUE;
-
- ignore_turrets = TRUE;
-
- FOR_EACH_PLAYER(head)
- head.ready = FALSE;
-
- total_killed = 0;
-}
-
-void TD_count_alive_monsters()
-{
- entity head;
-
- total_alive = 0;
- redalive = 0;
- bluealive = 0;
-
- FOR_EACH_MONSTER(head)
- {
- if(head.health <= 0) continue;
-
- ++total_alive;
-
- switch(head.team)
- {
- case NUM_TEAM_1: ++redalive; break;
- case NUM_TEAM_2: ++bluealive; break;
- }
- }
-}
-
-float TD_GetWinnerTeam()
-{
- float winner_team = 0;
- if(redalive >= 1)
- winner_team = NUM_TEAM_1;
- if(bluealive >= 1)
- {
- if(winner_team) return 0;
- winner_team = NUM_TEAM_2;
- }
- if(winner_team)
- return winner_team;
- return -1; // no monster left
-}
-
-float TD_CheckWinner()
-{
- entity head = world;
-
- if(round_handler_GetEndTime() > 0 && round_handler_GetEndTime() - time <= 0)
- {
- Send_Notification(NOTIF_ALL, world, MSG_CENTER, CENTER_ROUND_OVER);
- Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_ROUND_OVER);
- round_handler_Init(5, 10, 180);
- FOR_EACH_MONSTER(head) if(head.health > 0)
- {
- WaypointSprite_Kill(head.sprite);
- if(head.weaponentity) remove(head.weaponentity);
- if(head.iceblock) remove(head.iceblock);
- remove(head);
- }
- return 1;
- }
-
- TD_count_alive_monsters();
-
- max_perteam = max_monsters * 0.5;
-
- if(time >= last_check)
- if(total_killed < max_monsters)
- {
- if(redalive < max_perteam)
- SpawnMonsters(NUM_TEAM_1);
- if(bluealive < max_perteam)
- SpawnMonsters(NUM_TEAM_2);
-
- last_check = time + 0.5;
- }
-
- if(total_killed < max_monsters)
- return 0;
-
- if(TD_ALIVE_TEAMS_OK())
- return 0;
-
- float winner_team = TD_GetWinnerTeam();
- if(winner_team > 0)
- {
- Send_Notification(NOTIF_ALL, world, MSG_CENTER, APP_TEAM_NUM_4(winner_team, CENTER_ROUND_TEAM_WIN_));
- Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_NUM_4(winner_team, INFO_ROUND_TEAM_WIN_));
- TeamScore_AddToTeam(winner_team, ST_SCORE, +1);
- }
- else if(winner_team == -1)
- {
- Send_Notification(NOTIF_ALL, world, MSG_CENTER, CENTER_ROUND_TIED);
- Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_ROUND_TIED);
- }
-
- FOR_EACH_MONSTER(head) if(head.health > 0)
- {
- WaypointSprite_Kill(head.sprite);
- if(head.weaponentity) remove(head.weaponentity);
- if(head.iceblock) remove(head.iceblock);
- remove(head);
- }
-
- round_handler_Init(5, 10, 180);
- return 1;
-}
-
-float TD_CheckTeams()
-{
- entity head;
- float readycount = 0, num_players = 0, ready_needed_factor, ready_needed_count;
-
- FOR_EACH_REALPLAYER(head)
- {
- ++num_players;
- if(head.ready)
- ++readycount;
- }
-
- ready_needed_factor = bound(0.5, cvar("g_td_majority_factor"), 0.999);
- ready_needed_count = floor(num_players * ready_needed_factor) + 1;
-
- if(readycount >= ready_needed_count || time >= ready_timeout)
- return TRUE;
-
- allowed_to_spawn = TRUE;
-
- return FALSE;
-}
-
-// spawnfuncs
-void spawnfunc_td_generator()
-{
- if not(g_td) { remove(self); return; }
- if not(self.team)
- {
- td_debug("Generator without a team, removing it.\n");
- remove(self);
- return;
- }
-
- precache_sound("onslaught/generator_underattack.wav");
- precache_sound("onslaught/ons_hit1.wav");
- precache_sound("onslaught/ons_hit2.wav");
- precache_sound("weapons/rocket_impact.wav");
-
- if not(self.health)
- self.health = 1000;
-
- self.max_health = self.health;
- self.classname = "td_generator";
- self.flags = FL_GENERATOR;
-
- setsize(self, GENERATOR_MIN, GENERATOR_MAX);
-
- setorigin(self, self.origin + '0 0 20');
- droptofloor();
-
- InitializeEntity(self, td_generator_delayed, INITPRIO_LAST);
-}
-
-void spawnfunc_td_waypoint()
-{
- if not(g_td) { remove(self); return; }
-
- setsize(self, '-6 -6 -6', '6 6 6');
-
- if not(self.noalign)
- {
- setorigin(self, self.origin + '0 0 20');
- droptofloor();
- }
-
- self.classname = "td_waypoint";
- self.think = td_waypoint_think;
- self.nextthink = time + 0.1;
-}
-
-void spawnfunc_td_controller()
-{
- if not(g_td) { remove(self); return; }
-}
-
-void spawnfunc_td_spawnpoint()
-{
- if not(g_td) { remove(self); return; }
-
- self.classname = "td_spawnpoint";
-
- self.effects = EF_STARDUST;
-}
-
-// initialization stuff
-void td_ScoreRules()
-{
- ScoreRules_basics(2, SFL_SORT_PRIO_SECONDARY, SFL_SORT_PRIO_SECONDARY, TRUE);
- ScoreInfo_SetLabel_TeamScore(ST_TD_DESTROYS, "destroyed", SFL_SORT_PRIO_PRIMARY);
- ScoreInfo_SetLabel_PlayerScore(SP_TD_DESTROYS,"destroyed", SFL_SORT_PRIO_PRIMARY);
- ScoreRules_basics_end();
-}
-
-void td_SpawnController()
-{
- entity oldself = self;
- self = spawn();
- self.classname = "td_controller";
- spawnfunc_td_controller();
- self = oldself;
-}
-
-void td_DelayedInit()
-{
- if(find(world, classname, "td_controller") == world)
- {
- td_debug("No ""td_controller"" entity found on this map, creating it anyway.\n");
- td_SpawnController();
- }
-
- td_ScoreRules();
-}
-
-void td_Initialize()
-{
- InitializeEntity(world, td_DelayedInit, INITPRIO_GAMETYPE);
-
- readyrestart_happened = TRUE; // disable normal ready command
-
- ready_timeout = time + 30;
-
- round_handler_Spawn(TD_CheckTeams, TD_CheckWinner, TD_RoundStart);
- round_handler_Init(5, 10, 180);
-}
-
-// mutator hooks
-MUTATOR_HOOKFUNCTION(td_TurretSpawn)
-{
- if(self.realowner == world)
- return TRUE;
-
- if(self.turrcaps_flags & TFL_TURRCAPS_SUPPORT)
- self.target_range = 500;
-
- self.bot_attack = FALSE;
- buffturret(self, 0.7);
-
- return FALSE;
-}
-
-MUTATOR_HOOKFUNCTION(td_MonsterSpawn)
-{
- if(!self.team || !self.realowner)
- {
- td_debug(strcat("Removed monster ", self.netname, " with team ", ftos(self.team), "\n"));
- WaypointSprite_Kill(self.sprite);
- if(self.weaponentity) remove(self.weaponentity);
- remove(self);
- return FALSE;
- }
-
- self.candrop = FALSE;
- self.bot_attack = FALSE;
- self.ammo_fuel = bound(20, 20 * self.level, 100);
- self.target_range = 300;
- self.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_BOTCLIP | DPCONTENTS_MONSTERCLIP;
-
- return FALSE;
-}
-
-MUTATOR_HOOKFUNCTION(td_MonsterDies)
-{
- vector backuporigin;
- entity oldself;
-
- if(IS_PLAYER(frag_attacker.realowner))
- {
- PlayerScore_Add(frag_attacker.realowner, SP_SCORE, 5);
- PlayerScore_Add(frag_attacker.realowner, SP_KILLS, 1);
- }
-
- total_killed++;
-
- backuporigin = self.origin;
- oldself = self;
- self = spawn();
-
- self.gravity = 1;
- setorigin(self, backuporigin + '0 0 5');
- spawn_td_fuel(oldself.ammo_fuel);
- self.touch = M_Item_Touch;
- if(self == world)
- {
- self = oldself;
- return FALSE;
- }
- SUB_SetFade(self, time + 5, 1);
-
- self = oldself;
-
- return FALSE;
-}
-
-MUTATOR_HOOKFUNCTION(td_MonsterThink)
-{
- if(time <= game_starttime && round_handler_IsActive())
- return TRUE;
-
- if(IS_PLAYER(self.enemy))
- self.enemy = world;
-
- float tr = 100;
-
- if not(self.enemy)
- if(monster_target.flags & FL_GENERATOR)
- if(monster_target.health <= 0)
- tr = 250;
-
- if not(self.enemy) // don't change targets while attacking
- if(vlen(monster_target.origin - self.origin) <= tr)
- {
- if(monster_target.target2)
- {
- if(random() > 0.5)
- self.target2 = monster_target.target2;
- else
- self.target2 = monster_target.target;
- }
- else
- self.target2 = monster_target.target;
-
- monster_target = find(world, targetname, self.target2);
-
- if(monster_target == world)
- monster_target = PickGenerator(self.team);
-
- if(monster_target == world)
- return TRUE; // no generators or waypoints?!
- }
-
- td_debug(sprintf("Monster name: %s. Monster target: %s. Monster target2: %s. Monster target entity: %s.\n", self.netname, self.target, self.target2, etos(monster_target)));
-
- if(!self.enemy && !monster_target)
- return TRUE; // no enemy or target, must be wandering
-
- monster_speed_run = (150 + random() * 4) * monster_skill;
- monster_speed_walk = (100 + random() * 4) * monster_skill;
-
- return FALSE;
-}
-
-MUTATOR_HOOKFUNCTION(td_MonsterFindTarget)
-{
- entity e;
-
- for(e = world;(e = findflags(e, monster_attack, TRUE)); )
- {
- if(ignore_turrets)
- if(e.turrcaps_flags & TFL_TURRCAPS_ISTURRET)
- continue;
-
- if(e.flags & FL_MONSTER)
- continue; // don't attack other monsters?
-
- if(monster_isvalidtarget(e, self))
- self.enemy = e;
- }
-
- return TRUE;
-}
-
-MUTATOR_HOOKFUNCTION(td_PlayerSpawn)
-{
- self.monster_attack = FALSE;
- self.bot_attack = FALSE;
- self.solid = SOLID_CORPSE;
-
- if(self.newfuel)
- {
- self.ammo_fuel = self.newfuel;
- self.newfuel = 0;
- }
-
- return FALSE;
-}
-
-MUTATOR_HOOKFUNCTION(td_Damage)
-{
- if(IS_PLAYER(frag_attacker))
- if(frag_target.flags & FL_MONSTER || frag_target.turrcaps_flags & TFL_TURRCAPS_ISTURRET)
- frag_damage = 0;
-
- if(IS_PLAYER(frag_attacker) || frag_attacker.turrcaps_flags & TFL_TURRCAPS_ISTURRET)
- if(IS_PLAYER(frag_target))
- {
- frag_damage = 0;
- if(frag_attacker != frag_target)
- frag_force = '0 0 0';
- }
-
- return FALSE;
-}
-
-MUTATOR_HOOKFUNCTION(td_PlayerCommand)
-{
- if(MUTATOR_RETURNVALUE) { return FALSE; } // command was already handled?
-
- vector org;
-
- makevectors(self.v_angle);
-
- org = self.origin + self.view_ofs + v_forward * 100;
-
- tracebox(self.origin + self.view_ofs, '-16 -16 -16', '16 16 16', org, MOVE_NORMAL, self);
- entity targ = trace_ent;
- if(targ.owner.realowner == self)
- targ = targ.owner;
-
- if(cmd_name == "ready")
- if not(self.ready)
- {
- self.ready = TRUE;
- bprint(self.netname, "^2 is ready\n");
-
- Nagger_ReadyCounted();
-
- return TRUE;
- }
-
- if(cmd_name == "turretspawn")
- {
- if(argv(1) == "list")
- {
- Send_Notification(NOTIF_ONE, self, MSG_MULTI, MULTI_TD_LIST, "mlrs walker plasma towerbuff flac");
- return TRUE;
- }
- if(!IS_PLAYER(self) || self.health <= 0)
- {
- Send_Notification(NOTIF_ONE, self, MSG_MULTI, MULTI_TD_CANTSPAWN);
- return TRUE;
- }
- if(max_turrets <= 0)
- {
- Send_Notification(NOTIF_ONE, self, MSG_MULTI, MULTI_TD_DISABLED);
- return TRUE;
- }
- if(self.turret_cnt >= max_turrets)
- {
- Send_Notification(NOTIF_ONE, self, MSG_MULTI, MULTI_TD_MAXTURRETS, max_turrets);
- return TRUE;
- }
-
- spawnturret(self, self, argv(1), trace_endpos);
-
- return TRUE;
- }
- if(cmd_name == "turretremove")
- {
- if((targ.turrcaps_flags & TFL_TURRCAPS_ISTURRET) && (targ.playerid == self.playerid || targ.realowner == self))
- {
- self.turret_cnt -= 1;
- Send_Notification(NOTIF_ONE, self, MSG_MULTI, MULTI_TD_REMOVE);
- WaypointSprite_Kill(targ.sprite);
- remove(targ.tur_head);
- remove(targ);
- return TRUE;
- }
- Send_Notification(NOTIF_ONE, self, MSG_MULTI, MULTI_TD_AIM_REMOVE);
- return TRUE;
- }
-
- return FALSE;
-}
-
-MUTATOR_HOOKFUNCTION(td_ClientConnect)
-{
- self.newfuel = 75;
-
- entity t;
-
- self.turret_cnt = 0;
-
- for(t = world; (t = findflags(t, turrcaps_flags, TFL_TURRCAPS_ISTURRET)); )
- if(t.playerid == self.playerid)
- {
- t.realowner = self;
- self.turret_cnt += 1; // nice try
- }
-
- return FALSE;
-}
-
-MUTATOR_HOOKFUNCTION(td_DisableVehicles)
-{
- return TRUE;
-}
-
-MUTATOR_HOOKFUNCTION(td_SetModname)
-{
- g_cloaked = 1;
-
- return FALSE;
-}
-
-MUTATOR_HOOKFUNCTION(td_TurretValidateTarget)
-{
- if(time < game_starttime || (time <= game_starttime && round_handler_IsActive()) || gameover)
- {
- turret_target = world;
- return FALSE; // battle hasn't started
- }
-
- if(turret_flags & TFL_TARGETSELECT_MISSILESONLY)
- if(turret_target.flags & FL_PROJECTILE)
- if(turret_target.owner.flags & FL_MONSTER)
- return TRUE; // flac support
-
- if not(turret_target.flags & FL_MONSTER)
- turret_target = world;
-
- if(!IsDifferentTeam(turret_target, turret))
- turret_target = world;
-
- return FALSE;
-}
-
-MUTATOR_HOOKFUNCTION(td_TurretDies)
-{
- if(self.realowner)
- self.realowner.turret_cnt -= 1;
-
- return FALSE;
-}
-
-MUTATOR_HOOKFUNCTION(td_GetTeamCount)
-{
- ret_float = 2;
-
- return FALSE;
-}
-
-MUTATOR_DEFINITION(gamemode_towerdefense)
-{
- MUTATOR_HOOK(TurretSpawn, td_TurretSpawn, CBC_ORDER_ANY);
- MUTATOR_HOOK(MonsterSpawn, td_MonsterSpawn, CBC_ORDER_ANY);
- MUTATOR_HOOK(MonsterDies, td_MonsterDies, CBC_ORDER_ANY);
- MUTATOR_HOOK(MonsterMove, td_MonsterThink, CBC_ORDER_ANY);
- MUTATOR_HOOK(MonsterFindTarget, td_MonsterFindTarget, CBC_ORDER_ANY);
- MUTATOR_HOOK(PlayerSpawn, td_PlayerSpawn, CBC_ORDER_ANY);
- MUTATOR_HOOK(PlayerDamage_Calculate, td_Damage, CBC_ORDER_ANY);
- MUTATOR_HOOK(SV_ParseClientCommand, td_PlayerCommand, CBC_ORDER_ANY);
- MUTATOR_HOOK(ClientConnect, td_ClientConnect, CBC_ORDER_ANY);
- MUTATOR_HOOK(VehicleSpawn, td_DisableVehicles, CBC_ORDER_ANY);
- MUTATOR_HOOK(SetModname, td_SetModname, CBC_ORDER_ANY);
- MUTATOR_HOOK(TurretValidateTarget, td_TurretValidateTarget, CBC_ORDER_ANY);
- MUTATOR_HOOK(TurretDies, td_TurretDies, CBC_ORDER_ANY);
- MUTATOR_HOOK(GetTeamCount, td_GetTeamCount, CBC_ORDER_ANY);
-
- MUTATOR_ONADD
- {
- if(time > 1) // game loads at time 1
- error("This is a game type and it cannot be added at runtime.");
- cvar_settemp("g_monsters", "1");
- cvar_settemp("g_turrets", "1");
- td_Initialize();
- }
-
- MUTATOR_ONROLLBACK_OR_REMOVE
- {
- // we actually cannot roll back td_Initialize here
- // BUT: we don't need to! If this gets called, adding always
- // succeeds.
- }
-
- MUTATOR_ONREMOVE
- {
- error("This is a game type and it cannot be removed at runtime.");
- return -1;
- }
-
- return FALSE;
-}
+++ /dev/null
-float FL_GENERATOR = 2048;
-
-float ignore_turrets;
-
-#define SP_TD_DESTROYS 4
-#define ST_TD_DESTROYS 1
-
-float redalive, bluealive, total_alive;
-
-var float max_monsters = 20;
-var float max_alive = 10;
-
-float max_perteam;
-
-float total_killed;
-
-var float max_turrets = 10;
-
-.float turret_buff;
-
-.float newfuel; // hack to not give players fuel every time they spawn
-
-float last_check;
-
-.float turret_cnt;
-
-.float level;
-.float last_trace;
-
-float ready_timeout;
MUTATOR_DECLARATION(gamemode_ctf);
MUTATOR_DECLARATION(gamemode_nexball);
MUTATOR_DECLARATION(gamemode_onslaught);
-MUTATOR_DECLARATION(gamemode_towerdefense);
MUTATOR_DECLARATION(gamemode_domination);
MUTATOR_DECLARATION(gamemode_lms);
mutators/gamemode_nexball.qh
mutators/gamemode_lms.qh
mutators/mutator_dodging.qh
-mutators/gamemode_towerdefense.qh
//// tZork Turrets ////
tturrets/include/turrets_early.qh
mutators/gamemode_keepaway.qc
mutators/gamemode_nexball.qc
mutators/gamemode_onslaught.qc
-mutators/gamemode_towerdefense.qc
mutators/gamemode_lms.qc
mutators/mutator_invincibleproj.qc
mutators/mutator_new_toys.qc
MUTATOR_ADD(gamemode_ctf);
have_team_spawns = -1; // request team spawns
}
-
- if(g_td)
- {
- ActivateTeamplay();
- leadlimit_override = 0; // not supported by TD
- timelimit_override = 0;
- MUTATOR_ADD(gamemode_towerdefense);
- }
if(g_lms)
{
if ((_turret.target_select_missilebias > 0) && (_target.flags & FL_PROJECTILE))
m_score = 1;
- if ((_turret.target_select_playerbias > 0) && IS_CLIENT(_target) && !g_td)
- p_score = 1;
-
- if(g_td && _target.flags & FL_MONSTER)
+ if ((_turret.target_select_playerbias > 0) && IS_CLIENT(_target))
p_score = 1;
d_score = max(d_score, 0);
vector fl_org;
self.enemy.ammo = min(self.enemy.ammo + self.shot_dmg,self.enemy.ammo_max);
- if(g_td) // auto heal monsters in tower defense
- {
- self.enemy.health = min(self.enemy.health + self.shot_dmg,self.enemy.max_health);
- self.enemy.SendFlags |= MSF_STATUS;
- }
fl_org = 0.5 * (self.enemy.absmin + self.enemy.absmax);
te_smallflash(fl_org);
}
if (vlen(self.enemy.origin - self.origin) > self.target_range)
return 0;
-
- if(g_td)
- {
- if(self.enemy.health >= self.enemy.max_health)
- return 0;
-
- if(IsDifferentTeam(self.enemy, self))
- return 0;
-
- if(self.enemy.flags & FL_MONSTER)
- return 1; // the following checks are for turrets only
- }
if (self.enemy.ammo >= self.enemy.ammo_max)
return 0;
- if(teamplay && self.team != self.enemy.team)
+ if(teamplay && IsDifferentTeam(self, self.enemy))
return 0;
if not (self.enemy.ammo_flags & TFL_AMMO_ENERGY)
m_speed = vlen(self.velocity);
// Enemy dead? just keep on the current heading then.
- if (self.enemy == world || self.enemy.deadflag != DEAD_NO || (g_td && !(self.enemy.flags & FL_MONSTER || self.enemy.classname == "td_generator")) || self.enemy.classname == "td_generator")
+ if (self.enemy == world || self.enemy.deadflag != DEAD_NO || self.enemy.classname == "td_generator")
self.enemy = world;
if (self.enemy)