-
Notifications
You must be signed in to change notification settings - Fork 49
Add Tribe of Tjernobyl mode #367
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
392efbc
1436378
c30967a
915a537
65960c9
f09f2b9
a2db83a
3e15c2a
c0b21be
7a3225a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -110,11 +110,21 @@ bot_t bots[MAX_BOTS] = | |
{ 0 } | ||
}; | ||
|
||
static int FrogbotSkillLevel(void) | ||
int FrogbotSkillLevel(void) | ||
{ | ||
return (int)cvar(FB_CVAR_SKILL); | ||
} | ||
|
||
int FrogbotHealth(void) | ||
{ | ||
return (int)cvar(FB_CVAR_HEALTH); | ||
} | ||
|
||
int FrogbotWeapon(void) | ||
{ | ||
return (int)cvar(FB_CVAR_WEAPON); | ||
} | ||
|
||
static team_t* AddTeamToList(int *teamsFound, char *team, int topColor, int bottomColor) | ||
{ | ||
int i; | ||
|
@@ -294,11 +304,11 @@ void FrogbotsAddbot(int skill_level, const char *specificteam, qbool error_messa | |
{ | ||
strlcpy(bots[i].name, BotNameGeneric(i), sizeof(bots[i].name)); | ||
|
||
topColor = i_rnd(0, 13); | ||
bottomColor = i_rnd(0, 13); | ||
topColor = tot_mode_enabled() ? 11 : i_rnd(0, 13); | ||
bottomColor = tot_mode_enabled() ? 12 : i_rnd(0, 13); | ||
} | ||
|
||
entity = trap_AddBot(bots[i].name, bottomColor, topColor, "base"); | ||
entity = trap_AddBot(bots[i].name, bottomColor, topColor, "base", skill_level); | ||
|
||
if (entity == 0) | ||
{ | ||
|
@@ -1860,12 +1870,27 @@ static void FrogbotsFillServer(void) | |
{ | ||
int max_clients = cvar("maxclients"); | ||
int plr_count = CountPlayers(); | ||
int skill_level = FrogbotSkillLevel(); | ||
int i; | ||
|
||
if (trap_CmdArgc() >= 3) | ||
{ | ||
char temp[10]; | ||
|
||
trap_CmdArgv(2, temp, sizeof(temp)); | ||
|
||
if (isdigit(temp[0])) | ||
{ | ||
skill_level = atoi(temp); | ||
} | ||
} | ||
|
||
for (i = 0; i < min(max_clients - plr_count, 8); ++i) | ||
{ | ||
FrogbotsAddbot(FrogbotSkillLevel(), "", true); | ||
FrogbotsAddbot(skill_level, "", true); | ||
} | ||
|
||
cvar_fset(FB_CVAR_SKILL, skill_level); | ||
} | ||
|
||
static void FrogbotsRemoveAll(void) | ||
|
@@ -2108,6 +2133,94 @@ static void FrogbotsDisable(void) | |
} | ||
} | ||
|
||
static void FrogbotsSetHealth(void) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These functions introduce mode agnostic bot customizations unrelated to ToT. Would be nice to have their implementations and usages in a separate commit. This could even be a separate PR that's merged swiftly as they're isolated and clean, no need for separate PR if there are no questions about ToT though. |
||
{ | ||
if (!bots_enabled()) | ||
{ | ||
G_sprint(self, 2, "Bots are disabled by the server.\n"); | ||
return; | ||
} | ||
|
||
if (trap_CmdArgc() <= 2) | ||
{ | ||
G_sprint(self, 2, "Usage: /botcmd health <health>\n"); | ||
G_sprint(self, 2, " <health> must be in range %d and %d\n", 1, 300); | ||
G_sprint(self, 2, "health is currently \"%d\"\n", FrogbotHealth()); | ||
} | ||
else | ||
{ | ||
char argument[32]; | ||
int new_health = 0; | ||
int old_health = FrogbotHealth(); | ||
|
||
trap_CmdArgv(2, argument, sizeof(argument)); | ||
new_health = bound(1, atoi(argument), 300); | ||
|
||
if (new_health != old_health) | ||
{ | ||
cvar_fset(FB_CVAR_HEALTH, new_health); | ||
G_sprint(self, 2, "health changed to \"%d\"\n", new_health); | ||
} | ||
} | ||
} | ||
|
||
static void FrogbotsSetWeapon(void) | ||
{ | ||
if (!bots_enabled()) | ||
{ | ||
G_sprint(self, 2, "Bots are disabled by the server.\n"); | ||
return; | ||
} | ||
|
||
if (trap_CmdArgc() <= 2) | ||
{ | ||
G_sprint(self, 2, "Usage: /botcmd weapon <weapon>\n"); | ||
G_sprint(self, 2, " <weapon> must be in range %d and %d\n", 2, 8); | ||
G_sprint(self, 2, "weapon is currently \"%d\"\n", FrogbotWeapon()); | ||
} | ||
else | ||
{ | ||
char argument[32]; | ||
int new_weapon = 0; | ||
int old_weapon = FrogbotWeapon(); | ||
|
||
trap_CmdArgv(2, argument, sizeof(argument)); | ||
new_weapon = bound(2, atoi(argument), 8); | ||
|
||
if (new_weapon != old_weapon) | ||
{ | ||
cvar_fset(FB_CVAR_WEAPON, new_weapon); | ||
G_sprint(self, 2, "weapon changed to \"%d\"\n", new_weapon); | ||
} | ||
} | ||
} | ||
|
||
static void FrogbotsSetBreakOnDeath(void) | ||
{ | ||
if (!bots_enabled()) | ||
{ | ||
G_sprint(self, 2, "Bots are disabled by the server.\n"); | ||
return; | ||
} | ||
|
||
cvar_fset(FB_CVAR_BREAK_ON_DEATH, !cvar(FB_CVAR_BREAK_ON_DEATH)); | ||
G_sprint(self, 2, "break on death changed to \"%s\"\n", (int)cvar(FB_CVAR_BREAK_ON_DEATH) ? "on" : "off"); | ||
|
||
} | ||
|
||
static void FrogbotsToggleQuad(void) | ||
{ | ||
if ((int)self->s.v.items & IT_QUAD) { | ||
self->s.v.items = (int)self->s.v.items & ~IT_QUAD; | ||
self->super_time = 0; | ||
self->super_damage_finished = 0; | ||
} else { | ||
self->s.v.items = (int)self->s.v.items | IT_QUAD; | ||
self->super_time = 1; | ||
self->super_damage_finished = g_globalvars.time + 3600 * 20; | ||
} | ||
} | ||
|
||
typedef struct frogbot_cmd_s | ||
{ | ||
char *name; | ||
|
@@ -2123,7 +2236,11 @@ static frogbot_cmd_t std_commands[] = | |
{ "removebot", FrogbotsRemovebot_f, "Removes a single bot" }, | ||
{ "removeall", FrogbotsRemoveAll, "Removes all bots from server" }, | ||
{ "debug", FrogbotsDebug, "Debugging commands" }, | ||
{ "disable", FrogbotsDisable, "Disable frogbots" } }; | ||
{ "disable", FrogbotsDisable, "Disable frogbots" }, | ||
{ "health", FrogbotsSetHealth, "Set initial health for the bot" }, | ||
{ "weapon", FrogbotsSetWeapon, "Set which weapon the bot should use" }, | ||
{ "breakondeath", FrogbotsSetBreakOnDeath, "Automatically break when you die" }, | ||
{ "togglequad", FrogbotsToggleQuad, "Toggle quad damage" } }; | ||
|
||
static frogbot_cmd_t editor_commands[] = | ||
{ | ||
|
Uh oh!
There was an error while loading. Please reload this page.