add something to migrate cvars from shavit-replay and shavit-misc

This commit is contained in:
rtldg 2021-11-02 15:49:13 +00:00
parent 849bc0ed76
commit 3c46d9c257
3 changed files with 58 additions and 0 deletions

View File

@ -115,6 +115,26 @@ public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max
CreateNative("Shavit_GetTimesTeleported", Native_GetTimesTeleported); CreateNative("Shavit_GetTimesTeleported", Native_GetTimesTeleported);
CreateNative("Shavit_HasSavestate", Native_HasSavestate); CreateNative("Shavit_HasSavestate", Native_HasSavestate);
if (!FileExists("cfg/sourcemod/plugin.shavit-checkpoints.cfg") && FileExists("cfg/sourcemod/plugin.shavit-misc.cfg"))
{
File source = OpenFile("cfg/sourcemod/plugin.shavit-misc.cfg", "r");
File destination = OpenFile("cfg/sourcemod/plugin.shavit-checkpoints.cfg", "w");
if (source && destination)
{
char line[512];
while (!source.EndOfFile() && source.ReadLine(line, sizeof(line)))
{
ReplaceString(line, sizeof(line), "_misc_", "_checkpoints_");
destination.WriteLine("%s", line);
}
}
delete destination;
delete source;
}
RegPluginLibrary("shavit-checkpoints"); RegPluginLibrary("shavit-checkpoints");
gB_Late = late; gB_Late = late;

View File

@ -285,6 +285,25 @@ public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max
CreateNative("Shavit_GetLoopingBotByName", Native_GetLoopingBotByName); CreateNative("Shavit_GetLoopingBotByName", Native_GetLoopingBotByName);
CreateNative("Shavit_SetReplayCacheName", Native_SetReplayCacheName); CreateNative("Shavit_SetReplayCacheName", Native_SetReplayCacheName);
if (!FileExists("cfg/sourcemod/plugin.shavit-replay-playback.cfg") && FileExists("cfg/sourcemod/plugin.shavit-replay.cfg"))
{
File source = OpenFile("cfg/sourcemod/plugin.shavit-replay.cfg", "r");
File destination = OpenFile("cfg/sourcemod/plugin.shavit-replay-playback.cfg", "w");
if (source && destination)
{
char line[512];
while (!source.EndOfFile() && source.ReadLine(line, sizeof(line)))
{
destination.WriteLine("%s", line);
}
}
delete destination;
delete source;
}
// registers library, check "bool LibraryExists(const char[] name)" in order to use with other plugins // registers library, check "bool LibraryExists(const char[] name)" in order to use with other plugins
RegPluginLibrary("shavit-replay-playback"); RegPluginLibrary("shavit-replay-playback");

View File

@ -106,6 +106,25 @@ public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max
CreateNative("Shavit_SetReplayData", Native_SetReplayData); CreateNative("Shavit_SetReplayData", Native_SetReplayData);
CreateNative("Shavit_SetPlayerPreFrames", Native_SetPlayerPreFrames); CreateNative("Shavit_SetPlayerPreFrames", Native_SetPlayerPreFrames);
if (!FileExists("cfg/sourcemod/plugin.shavit-replay-recorder.cfg") && FileExists("cfg/sourcemod/plugin.shavit-replay.cfg"))
{
File source = OpenFile("cfg/sourcemod/plugin.shavit-replay.cfg", "r");
File destination = OpenFile("cfg/sourcemod/plugin.shavit-replay-recorder.cfg", "w");
if (source && destination)
{
char line[512];
while (!source.EndOfFile() && source.ReadLine(line, sizeof(line)))
{
destination.WriteLine("%s", line);
}
}
delete destination;
delete source;
}
RegPluginLibrary("shavit-replay-recorder"); RegPluginLibrary("shavit-replay-recorder");
gB_Late = late; gB_Late = late;