Commit 40952bf7 authored by Mikleo's avatar Mikleo

--

parent 0cd38d99
Pipeline #9644 passed with stages
in 13 seconds
......@@ -10,7 +10,7 @@
#include <SteamWorks>
#define PluginVersion "1.12"
#define PluginVersion "1.13"
float pVersion;
// note linearmap field is unstable
......@@ -58,6 +58,8 @@ ConVar ef_editlock,ef_baseswap,ef_scenario_vote_delay,ef_scenario_vote_duration,
ConVar emp_sv_commander_freeze_time, emp_sv_player_refinery_multiplier, emp_sv_refinery_multiplier;
ConVar sc_gamedesc_scenario;
bool mapHasBeenEdited = false;
char nextMapScenario[64];
......@@ -239,6 +241,23 @@ public void OnPluginStart()
Funcs_OnPluginStart();
}
public void SetScenarioName(char[] scenarioName)
{
strcopy(currentScenario,sizeof(currentScenario),scenarioName);
if(sc_gamedesc_scenario != INVALID_HANDLE)
{
sc_gamedesc_scenario.SetString(scenarioName);
}
}
public void OnAllPluginsLoaded()
{
sc_gamedesc_scenario = FindConVar("sc_gamedesc_scenario");
}
public OnMapEnd()
{
if(ScenarioVoteTimer != INVALID_HANDLE)
......@@ -302,6 +321,9 @@ public OnMapStart()
currentScenarioKV.SetString("Details"," ");
currentScenarioKV.SetString("Tags"," ");
// reset currentscenario;
SetScenarioName("");
int ef_baseswap_temp = ef_baseswap.IntValue;
AutoExecConfig(true, "empfun");
ef_baseswap.IntValue = ef_baseswap_temp;
......@@ -4062,7 +4084,9 @@ bool LoadScenario(int client,char[] filename)
Format(cfgName,sizeof(cfgName),"%s_revert",currentScenario);
execScenarioConfig(cfgName);
}
strcopy(currentScenario,sizeof(currentScenario),filename);
SetScenarioName(filename);
// reload the map config first.
if(ef_scenario_reload_map_config.IntValue == 1)
{
......
......@@ -67,7 +67,7 @@ void Funcs_OnPluginStart()
AddCommand("SetHealth",SetHealthCommand,1);
AddCommand("TakeDamage",TakeDamageCommand,1);
AddCommand("Cancel",CancelCommand,100);
AddCommand("RunIf",RunIfCommand,6);
AddCommand("RunIf",RunIfCommand,4);
AddCommand("AddDamageFilter",AddDamageFilterCommand,100);
AddCommand("OnCommand",HookCommand,4);
AddCommand("PrintToTarget",PrintToTarget,1);
......@@ -454,26 +454,20 @@ public int RunCommand(int entity,char[] args,char[] remainder)
return entity;
}
// format RunIf $(var) == 2 TEST ELSE TEST2
public int RunIfCommand(int entity,char[] args,char[] remainder)
public bool EvaluateCondition(int entity,char[] condition)
{
int argIndex;
// that is the preset name
char value1[32];
BreakVariableArg(entity,args,value1,sizeof(value1),argIndex);
BreakVariableArg(entity,condition,value1,sizeof(value1),argIndex);
char conditionType[32];
BreakArg(args,conditionType,sizeof(conditionType),argIndex);
BreakArg(condition,conditionType,sizeof(conditionType),argIndex);
char value2[32];
BreakVariableArg(entity,args,value2,sizeof(value2),argIndex);
BreakVariableArg(entity,condition,value2,sizeof(value2),argIndex);
char script1[32];
BreakArg(args,script1,sizeof(script1),argIndex);
int matches = false;
bool matches = false;
// check condition
if(StrEqual(conditionType,"==",false) || StrEqual(conditionType,"=",false))
matches = StrEqual(value1,value2);
......@@ -494,7 +488,25 @@ public int RunIfCommand(int entity,char[] args,char[] remainder)
}
if(matches)
return matches;
}
// format RunIf $(var) == 2 TEST ELSE TEST2
public int RunIfCommand(int entity,char[] args,char[] remainder)
{
int argIndex;
// that is the preset name
char condition[32];
BreakArg(args,condition,sizeof(condition),argIndex);
char script1[32];
BreakArg(args,script1,sizeof(script1),argIndex);
if(EvaluateCondition(entity,condition))
{
LoadScript(script1,entity);
}
......@@ -513,8 +525,6 @@ public int RunIfCommand(int entity,char[] args,char[] remainder)
}
return entity;
}
......
......@@ -4,7 +4,7 @@
{
"Version"
{
"Latest" "1.12"
"Latest" "1.13"
}
}
......
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