Server: new command: listMapTweaks

This commit is contained in:
Marco Cawthorne 2024-11-02 02:53:45 -07:00
parent 26f81235c8
commit 70d6302808
5 changed files with 36 additions and 7 deletions

View file

@ -472,6 +472,7 @@ Cmd_Parse(string sCMD)
case "trigger":
case "input":
case "listBotProfiles":
case "listMapTweaks":
case "listTargets":
case "teleport":
case "teleportToClass":
@ -565,6 +566,7 @@ Cmd_Init(void)
registercommand("respawnEntities");
registercommand("spawnDef");
registercommand("listBotProfiles");
registercommand("listMapTweaks");
/* nav editing */
registercommand("nodeAdd");

View file

@ -78,6 +78,7 @@ func_ladder::Respawn(void)
m_collisionEntity.solid = SOLID_BSP;
setmodel(m_collisionEntity, model);
setorigin(m_collisionEntity, origin);
m_collisionEntity.effects = EF_NODRAW;
}
SetMovetype(MOVETYPE_NONE);

View file

@ -264,6 +264,9 @@ Cmd_ParseServerCommand(void)
case "listSoundDef":
Sound_DebugList();
break;
case "listMapTweaks":
MapTweak_ListActive();
break;
case "traceMaterial":
CMD_TraceMaterial();
break;

View file

@ -61,6 +61,7 @@ At this time, `when-cvar` and `when-serverinfo` only do comparisons on numbers.
/** Data holding MapTweak entries. */
typedef struct
{
string name;
string cvarCheck;
string serverinfoCheck;
string itemTable;
@ -72,4 +73,6 @@ void MapTweaks_Init(void);
/** Will take an existing entity, and apply the currently valid map tweaks to it. */
bool MapTweak_EntitySpawn(entity);
/** @} */ // end of maptweaks
void MapTweak_ListActive(void);
/** @} */ // end of maptweaks

View file

@ -38,7 +38,7 @@ MapTweaks_Init(void)
{
filestream tweakFile;
string tempString;
string newCvar, newInfo, newItem;
string newCvar, newInfo, newItem, newName;
int atTweak = 0i;
InitStart();
@ -68,6 +68,7 @@ MapTweaks_Init(void)
int segments = tokenize_console(tempString);
if (segments == 1) {
if (argv(0) == "}") {
g_mapTweakTable[atTweak].name = newName;
g_mapTweakTable[atTweak].cvarCheck = newCvar;
g_mapTweakTable[atTweak].serverinfoCheck = newInfo;
g_mapTweakTable[atTweak].itemTable = newItem;
@ -75,6 +76,8 @@ MapTweaks_Init(void)
atTweak++;
} else if (argv(0) == "{") {
/* ??? */
} else {
newName = argv(0);
}
} else if (segments == 4) {
switch (argv(0)) {
@ -164,7 +167,7 @@ static bool
MapTweak_FinishSpawn(entity targetEntity, string newClassname)
{
/* found the edef alternative. */
if (ents.ChangeToClass((NSEntity)targetEntity, newClassname) != __NULL__) {
if (EntityDef_SwitchClass((NSEntity)targetEntity, newClassname) != __NULL__) {
return (true);
}
@ -179,11 +182,9 @@ MapTweak_EntitySpawn(entity targetEntity)
if (g_mapTweakCount <= 0) {
return (false);
}
for (int i = 0; i < g_mapTweakCount; i++) {
int segments = tokenize(g_mapTweakTable[i].itemTable);
for (int y = 0; y < segments; y += 2) {
for (int i = 0; i < g_mapTweakCount; i++) {
for (int y = 0; y < tokenize(g_mapTweakTable[i].itemTable); y += 2) {
string newEnt, oldEnt;
oldEnt = argv(y);
@ -201,3 +202,22 @@ MapTweak_EntitySpawn(entity targetEntity)
return (false);
}
void
MapTweak_ListActive(void)
{
for (int i = 0; i < g_mapTweakCount; i++) {
if (MapTweak_Check(i) == true) {
printf("%i %S:\n", i, g_mapTweakTable[i].name);
for (int y = 0; y < tokenize(g_mapTweakTable[i].itemTable); y += 2) {
string newEnt, oldEnt;
oldEnt = argv(y);
newEnt = argv(y + 1);
printf("\t%s > %s\n", oldEnt, newEnt);
}
}
}
}