Update h&s to new gamemode system

This commit is contained in:
Jackz 2022-07-06 22:59:25 -05:00
parent bc8069ac48
commit e0e3a0adef
No known key found for this signature in database
GPG key ID: E0BBD94CF657F603
5 changed files with 25 additions and 21 deletions

View file

@ -3,11 +3,11 @@ public Action Command_HideAndSeek(int client, int args) {
char subcmd[16];
GetCmdArg(1, subcmd, sizeof(subcmd));
if(StrEqual(subcmd, "r") || StrEqual(subcmd, "reload", false)) {
GetCurrentMap(currentMap, sizeof(currentMap));
GetCurrentMap(g_currentMap, sizeof(g_currentMap));
char arg[16];
GetCmdArg(2, arg, sizeof(arg));
if(ReloadMapDB()) {
if(!LoadConfigForMap(currentMap)) {
if(!LoadConfigForMap(g_currentMap)) {
ReplyToCommand(client, "Warn: Map has no config file");
}
Cleanup();
@ -22,7 +22,7 @@ public Action Command_HideAndSeek(int client, int args) {
} else if(StrEqual(subcmd, "set", false)) {
char set[16];
if(args == 1) {
ReplyToCommand(client, "Current Map Set: \"%s\" (Specify with /hs set <set>)", currentSet);
ReplyToCommand(client, "Current Map Set: \"%s\" (Specify with /hs set <set>)", g_currentSet);
if(validSets.Length == 0) ReplyToCommand(client, "Available Sets: (no map config found)");
else {
ReplyToCommand(client, "Available Sets: ");
@ -32,16 +32,16 @@ public Action Command_HideAndSeek(int client, int args) {
}
}
} else {
GetCmdArg(2, currentSet, sizeof(currentSet));
GetCmdArg(2, g_currentSet, sizeof(g_currentSet));
for(int i = 0; i < validSets.Length; i++) {
validSets.GetString(i, set, sizeof(set));
if(StrEqual(set, currentSet)) {
if(!LoadConfigForMap(currentMap)) {
if(StrEqual(set, g_currentSet)) {
if(!LoadConfigForMap(g_currentMap)) {
ReplyToCommand(client, "Warn: Map has no config file");
}
Cleanup();
SetupEntities(isNavBlockersEnabled, isPropsEnabled, isPortalsEnabled);
PrintToChatAll("[H&S] Map set has been changed to \"%s\"", currentSet);
PrintToChatAll("[H&S] Map set has been changed to \"%s\"", g_currentSet);
return Plugin_Handled;
}
}
@ -135,7 +135,7 @@ public Action Command_HideAndSeek(int client, int args) {
do {
int mapIndex = GetURandomInt() % validMaps.Length;
validMaps.GetString(mapIndex, map, sizeof(map));
if(!StrEqual(currentMap, map, false)) {
if(!StrEqual(g_currentMap, map, false)) {
foundMap = true;
}
} while(!foundMap);
@ -262,7 +262,7 @@ public Action Command_HideAndSeek(int client, int args) {
ReplyToCommand(client, "State: %d | Tick: %d", view_as<int>(GetState()), GetTick());
ReplyToCommand(client, "- Map Info -");
ReplyToCommand(client, "Map: %s (set %s)", currentMap, currentSet);
ReplyToCommand(client, "Map: %s (set %s)", g_currentMap, g_currentSet);
if(mapConfig.hasSpawnpoint)
ReplyToCommand(client, "Has Spawnpoint: yes (%f %f %f)", mapConfig.spawnpoint[0], mapConfig.spawnpoint[1], mapConfig.spawnpoint[2]);
else

View file

@ -44,10 +44,10 @@ bool LoadConfigForMap(const char[] map) {
validSets.Clear();
static char buffer[64];
if(StrEqual(currentSet, "default") && kv.GetString("defaultset", buffer, sizeof(buffer)) && buffer[0] != '\0') {
strcopy(currentSet, sizeof(currentSet), buffer);
if(StrEqual(g_currentSet, "default") && kv.GetString("defaultset", buffer, sizeof(buffer)) && buffer[0] != '\0') {
strcopy(g_currentSet, sizeof(g_currentSet), buffer);
}
PrintToServer("[H&S] Loading config data for set %s on %s", currentSet, map);
PrintToServer("[H&S] Loading config data for set %s on %s", g_currentSet, map);
if(kv.JumpToKey("ents")) {
kv.GotoFirstSubKey();
@ -65,7 +65,7 @@ bool LoadConfigForMap(const char[] map) {
if(validSets.FindString(buffer) == -1) {
validSets.PushString(buffer);
}
if(StrEqual(buffer, "default") || StrEqual(currentSet, buffer, false)) {
if(StrEqual(buffer, "default") || StrEqual(g_currentSet, buffer, false)) {
config.entities.PushArray(entCfg);
} else {
@ -94,7 +94,7 @@ bool LoadConfigForMap(const char[] map) {
config.hasSpawnpoint = false;
config.canClimb = true;
config.pressButtons = true;
if(!StrEqual(currentSet, "default") && kv.JumpToKey("sets")) {
if(!StrEqual(g_currentSet, "default") && kv.JumpToKey("sets")) {
char set[16];
kv.GotoFirstSubKey(true);
do {
@ -102,10 +102,10 @@ bool LoadConfigForMap(const char[] map) {
if(validSets.FindString(set) == -1) {
validSets.PushString(set);
}
if(StrEqual(currentSet, set, false)) {
if(StrEqual(g_currentSet, set, false)) {
kv.GetVector("spawnpoint", config.spawnpoint);
if(config.spawnpoint[0] != 0.0 && config.spawnpoint[1] != 0.0 && config.spawnpoint[2] != 0.0) {
PrintToServer("[H&S] Using provided custom spawnpoint for set %s at %0.1f, %0.1f, %0.1f", currentSet, config.spawnpoint[0], config.spawnpoint[1], config.spawnpoint[2]);
PrintToServer("[H&S] Using provided custom spawnpoint for set %s at %0.1f, %0.1f, %0.1f", g_currentSet, config.spawnpoint[0], config.spawnpoint[1], config.spawnpoint[2]);
config.hasSpawnpoint = true;
}
char buf[8];

View file

@ -237,7 +237,7 @@ void SetupEntities(bool blockers = true, bool props = true, bool portals = true)
}
#endif
if(mapConfig.entities != null) {
PrintToServer("[H&S] Deploying %d custom entities (Set: %s) (blockers:%b props:%b portals:%b)", mapConfig.entities.Length, currentSet, blockers, props, portals);
PrintToServer("[H&S] Deploying %d custom entities (Set: %s) (blockers:%b props:%b portals:%b)", mapConfig.entities.Length, g_currentSet, blockers, props, portals);
for(int i = 0; i < mapConfig.entities.Length; i++) {
EntityConfig config;
mapConfig.entities.GetArray(i, config);