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 "trigger":
case "input": case "input":
case "listBotProfiles": case "listBotProfiles":
case "listMapTweaks":
case "listTargets": case "listTargets":
case "teleport": case "teleport":
case "teleportToClass": case "teleportToClass":
@ -565,6 +566,7 @@ Cmd_Init(void)
registercommand("respawnEntities"); registercommand("respawnEntities");
registercommand("spawnDef"); registercommand("spawnDef");
registercommand("listBotProfiles"); registercommand("listBotProfiles");
registercommand("listMapTweaks");
/* nav editing */ /* nav editing */
registercommand("nodeAdd"); registercommand("nodeAdd");

View file

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

View file

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

View file

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

View file

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