mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-12-24 17:02:35 +00:00
Rework and give item command
- "kartgiveitem" renamed to just "item" - partial item name matches supported, e.g. type "item ring" - item 0/none to remove your item
This commit is contained in:
parent
8893666b53
commit
05ee87ba59
1 changed files with 15 additions and 8 deletions
|
|
@ -731,7 +731,7 @@ void D_RegisterServerCommands(void)
|
||||||
|
|
||||||
COM_AddCommand("downloads", Command_Downloads_f);
|
COM_AddCommand("downloads", Command_Downloads_f);
|
||||||
|
|
||||||
COM_AddCommand("kartgiveitem", Command_KartGiveItem_f);
|
COM_AddCommand("item", Command_KartGiveItem_f);
|
||||||
|
|
||||||
COM_AddCommand("schedule_add", Command_Schedule_Add);
|
COM_AddCommand("schedule_add", Command_Schedule_Add);
|
||||||
COM_AddCommand("schedule_clear", Command_Schedule_Clear);
|
COM_AddCommand("schedule_clear", Command_Schedule_Clear);
|
||||||
|
|
@ -5840,7 +5840,7 @@ static void Command_KartGiveItem_f(void)
|
||||||
{
|
{
|
||||||
int ac;
|
int ac;
|
||||||
const char *name;
|
const char *name;
|
||||||
int item;
|
INT32 item;
|
||||||
|
|
||||||
const char * str;
|
const char * str;
|
||||||
|
|
||||||
|
|
@ -5852,7 +5852,7 @@ static void Command_KartGiveItem_f(void)
|
||||||
if (ac < 2)
|
if (ac < 2)
|
||||||
{
|
{
|
||||||
CONS_Printf(
|
CONS_Printf(
|
||||||
"kartgiveitem <item> [amount]: Give yourself an item\n"
|
"item <item> [amount]: Give yourself an item\n"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -5867,12 +5867,19 @@ static void Command_KartGiveItem_f(void)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (i = 0; ( str = kartdebugitem_cons_t[i].strvalue ); ++i)
|
/* first check exact match */
|
||||||
|
if (!CV_CompleteValue(&cv_kartdebugitem, &name, &item))
|
||||||
{
|
{
|
||||||
if (strcasecmp(name, str) == 0)
|
CONS_Printf("\x83" "Autocomplete:\n");
|
||||||
|
|
||||||
|
/* then do very loose partial matching */
|
||||||
|
for (i = 0; ( str = kartdebugitem_cons_t[i].strvalue ); ++i)
|
||||||
{
|
{
|
||||||
item = kartdebugitem_cons_t[i].value;
|
if (strcasestr(str, name) != NULL)
|
||||||
break;
|
{
|
||||||
|
CONS_Printf("\x83\t%s\n", str);
|
||||||
|
item = kartdebugitem_cons_t[i].value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -5884,7 +5891,7 @@ static void Command_KartGiveItem_f(void)
|
||||||
if (ac > 2)
|
if (ac > 2)
|
||||||
amt = atoi(COM_Argv(2));
|
amt = atoi(COM_Argv(2));
|
||||||
else
|
else
|
||||||
amt = 1;/* default to one quantity */
|
amt = (item != KITEM_NONE);/* default to one quantity, or zero, if KITEM_NONE */
|
||||||
|
|
||||||
D_Cheat(consoleplayer, CHEAT_GIVEITEM, item, amt);
|
D_Cheat(consoleplayer, CHEAT_GIVEITEM, item, amt);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue