Commit e5280eef authored by Mikleo's avatar Mikleo
Browse files

/scenariovar renamed to /snr. e.g. /snr Description "My Description"

Automatically preview info panel on /snr changes.
parent ea43c37b
Pipeline #12457 passed with stages
in 16 seconds
......@@ -71,7 +71,7 @@ https://github.com/Xiaminou/HardcoreEmpires/wiki/Empfun
**Saving a scenario**
/scenariovar description "2 bases close together in the middle of the map"
/snr description "2 bases close together in the middle of the map"
......
......@@ -10,7 +10,7 @@
#include <SteamWorks>
#define PluginVersion "1.34"
#define PluginVersion "1.35"
float pVersion;
// note linearmap field is unstable
......@@ -23,6 +23,8 @@ float pVersion;
char currentScenario[64];
KeyValues currentScenarioKV;
StringMap scenarioEditingSet;
bool editedAuthor = false;
......@@ -52,6 +54,8 @@ float playerSnapRadius [MAXPLAYERS+1] = {0.1, ...};
float playerSnapAngle[MAXPLAYERS+1] = {0.1, ...};
char lastCommand[64];
bool usedFlagIndex[32] = {false,...};
......@@ -192,7 +196,7 @@ public void OnPluginStart()
// save a preset here
RegAdminCmd("sm_saveprefab", Command_Save_Prefab, ADMFLAG_SLAY);
RegAdminCmd("sm_scenariovar", Command_Scenario_Var, ADMFLAG_SLAY);
RegAdminCmd("sm_snr", Command_Scenario_Var, ADMFLAG_SLAY);
RegAdminCmd("sm_editingset", Command_EditingSet, ADMFLAG_SLAY);
RegAdminCmd("sm_scenariovote", Command_Scenario_Vote, ADMFLAG_SLAY);
......@@ -321,6 +325,7 @@ public OnClientConnected(int client)
}
public OnMapStart()
{
editedAuthor = false;
currentScenarioKV = new KeyValues("Scenario");
// set up some default properties so they can be edited in file
currentScenarioKV.SetString("Description"," ");
......@@ -1574,7 +1579,7 @@ public int Load_Prefab(int client,char[] presetName,bool isVehicle,float positio
if(!GetCmdArg(2, arg, sizeof(arg)))
{
if(isVehicle)
PrintToChat(client,"/create vehicle [presetname] \n look at console for a list of presets");
PrintToChat(client,"/create vehicle [presetname] \nlook at console for a list of presets");
else
PrintToChat(client,"/create prefab [presetname] [optional:teamOverride] [optional:pointNumberOverride] \n look at console for a list of presets");
......@@ -2410,11 +2415,11 @@ public Action Select_Entity(int client,int entity,bool toggle,bool report)
{
if(StrEqual(className,"emp_cap_point",false) || StrEqual(className,"emp_cap_model",false))
{
PrintToChatAll("Warning: Moving emp_cap_point and emp_cap_model can cause issues, Do not do this unless you know what you are doing.");
PrintToChatAll("\x07b30000Warning\x01: Moving emp_cap_point and emp_cap_model can cause issues, Do not do this unless you know what you are doing.");
}
if(classInfo[data_group] == 3)
{
PrintToChatAll("Warning: Moving refinery entities can cause issues, Do not do this unless you know what you are doing.");
PrintToChatAll("\x07b30000Warning\x01: Moving refinery entities can cause issues, Do not do this unless you know what you are doing.");
}
}
......@@ -3792,9 +3797,19 @@ public Action Command_Scenario_Var(int client, int args)
char matching[128];
if(!GetCmdArg(1, arg1, sizeof(arg1)) || !GetCmdArg(2, arg2, sizeof(arg2)))
{
PrintToChat(client,"Options: Description,Details,CommFreezeTime,RefineryMultiplier,PlayerRefineryMultiplier CanBaseSwap(yes/no/-1(default)). eg /scenariovar description \"This is My Description\"");
PrintToChat(client,"\x01Look at console for more info\n\x04Options: Description Details CommFreezeTime RefineryMultiplier PlayerRefineryMultiplier CanBaseSwap(yes/no/-1(default)) \n\x01eg. /snr Description \"This is My Description\"");
PrintScenarioToConsoleSimple(client,currentScenarioKV);
return Plugin_Handled;
}
if(StrEqual(arg1,"Author",false))
{
editedAuthor = true;
strcopy(matching,sizeof(matching),"Author");
}
if(StrEqual(arg1,"Tags",false))
strcopy(matching,sizeof(matching),"Tags");
if(StrEqual(arg1,"Description",false))
strcopy(matching,sizeof(matching),"Description");
if(StrEqual(arg1,"Details",false))
......@@ -3815,6 +3830,9 @@ public Action Command_Scenario_Var(int client, int args)
currentScenarioKV.Rewind();
if(strlen(matching) > 0)
{
if(StrEqual(arg2,"delete",false))
......@@ -3826,10 +3844,14 @@ public Action Command_Scenario_Var(int client, int args)
currentScenarioKV.SetString(matching,arg2);
}
PrintToChat(client,"Set %s to:%s",matching,arg2);
PrintToChat(client,"\x01Set \x04%s\x01 to: \x04%s\x01",matching,arg2);
}
PrintToChat(client,"Remember: You will need to save the scenario for your variables to be saved.");
ShowScenarioInfo(client,20);
PrintScenarioToConsoleSimple(client,currentScenarioKV);
PrintToChat(client,"\x01look at console for further info\n\x07b30000Remember\x01: You will need to save the scenario for your variables to be saved.");
return Plugin_Handled;
......@@ -4124,9 +4146,13 @@ SaveScenario(int client,char [] filename,bool saveMetaData = true)
// save the author
char ScenarioAuthor[32];
GetClientName(client,ScenarioAuthor,sizeof(ScenarioAuthor));
kv.SetString("Author",ScenarioAuthor);
if(!editedAuthor)
{
char ScenarioAuthor[32];
GetClientName(client,ScenarioAuthor,sizeof(ScenarioAuthor));
kv.SetString("Author",ScenarioAuthor);
}
if(saveMetaData)
SaveMetaData(kv);
......@@ -4243,6 +4269,8 @@ LoadEditingSet(KeyValues kv)
bool LoadScenario(int client,char[] filename)
{
char path[256];
GetScenarioPath(filename,path,sizeof(path));
bool succeeded = false;
......@@ -4264,6 +4292,8 @@ bool LoadScenario(int client,char[] filename)
OnMapEdited();
delete currentScenarioKV;
currentScenarioKV = kv;
editedAuthor = false;
Funcs_PreLoadScenario();
char cfgName[64];
......@@ -5972,6 +6002,30 @@ public Action Command_Editor_info(int client, int args)
return Plugin_Handled;
}
// prints everything but entities to console.
public void PrintScenarioToConsoleSimple(int client,KeyValues scenarioKV)
{
scenarioKV.Rewind();
KeyValues copy = new KeyValues("Scenario");
KvCopySubkeys(scenarioKV, copy);
copy.JumpToKey("Entities");
copy.DeleteThis();
copy.Rewind();
if(copy.JumpToKey("Scripts",false))
{
copy.DeleteThis();
copy.Rewind();
}
char buffer[1000];
copy.ExportToString(buffer,sizeof(buffer));
PrintToConsole(client,buffer);
delete copy;
}
public Action Command_Scenario_File(int client, int args)
{
char arg1 [128];
......@@ -6892,8 +6946,8 @@ public Action Event_PlayerTeam(Event event, const char[] name, bool dontBroadcas
int client = GetClientOfUserId(cuid);
int team = GetEventInt(event, "team");
//hide the joining scenario panel
if(team >=2)
//hide the joining scenario panel, players need to be able to switch weapons
if(team >=2 && EU_GetWaitTime() <10)
{
HidePanel(client);
}
......
......@@ -1167,7 +1167,7 @@
"spawnflags" "64"
"Mins" "-16000.000000 -16000.000000 -4000.000000"
"Maxs" "16000.000000 16000.000000 0.000000"
"Damage" "1000.000000"
"Damage" "2000.000000"
"DamageType" "8"
"StartDisabled" "1"
}
......
......@@ -4,7 +4,7 @@
{
"Version"
{
"Latest" "1.34"
"Latest" "1.35"
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment