Commit 4c8a51e5 authored by Mikleo's avatar Mikleo
Browse files

backward compatibility with "BaseSwap" now removed. Use "CanBaseSwap"

removed several old scenarios.
baseswap should now work on ammo boxes not associated with flags.

duststorm koth: 5-> 8 minutes (lowering by 20 each reset)
Added engi wall restrict and comm restrict.
(barracks has to be a little further away from flag, can still be in middle)
parent 9f8892d0
Pipeline #10861 passed with stages
in 33 seconds
......@@ -10,7 +10,7 @@
#include <SteamWorks>
#define PluginVersion "1.19"
#define PluginVersion "1.20"
float pVersion;
// note linearmap field is unstable
......@@ -195,8 +195,6 @@ public void OnPluginStart()
RegAdminCmd("sm_settickets", Command_Set_TeamData, ADMFLAG_SLAY);
RegAdminCmd("sm_setresources", Command_Set_TeamData, ADMFLAG_SLAY);
RegAdminCmd("sm_gamedesc", Command_Set_GameDesc, ADMFLAG_SLAY);
RegConsoleCmd("sm_scenario", Command_Scenario_Info);
......@@ -408,6 +406,12 @@ public OnGameStart()
}
}
Funcs_OnGameStart();
if(CancelScenarioVote())
{
PrintToChatAll("The scenario vote has been cancelled because an admin has started the game prematurely. ");
}
}
public OnGameEnd()
{
......@@ -2215,11 +2219,12 @@ ExecuteRemoveEntity(int entity)
}
else if(StrEqual(className,"emp_imp_ammo_crate") || StrEqual(className,"emp_nf_ammo_crate") || StrEqual(className,"emp_nf_health_crate") || StrEqual(className,"emp_imp_health_crate") || StrEqual(className,"emp_cap_model",true))
{
// all cap models are inebitably linked. they can only be moved and ignored.
// all cap models are inebitably linked. they can only be moved and ignored. same with ammo crates
bool isCapModel = StrEqual(className,"emp_cap_model",true);
if(isCapModel || GetEntProp(entity,Prop_Data,"m_iCapNumber") > 0)
if(isCapModel || FlagExistsAtIndex(GetEntProp(entity,Prop_Data,"m_iCapNumber")))
{
//if is flag or is ammo/health box with cap number
if(isCapModel)
{
SetEntProp(entity,Prop_Data,"m_bMapVisible",0);
......@@ -2231,10 +2236,12 @@ ExecuteRemoveEntity(int entity)
// hide in corner to prevent id overlap
float cornerPosition[3] = {-16000.0,-16000.0,-16000.0};
TeleportEntity(entity,cornerPosition, NULL_VECTOR, NULL_VECTOR);
return;
}
return;
}
else if(StrEqual(className,"emp_info_player_NF",true) || StrEqual(className,"emp_info_player_Imp",true))
{
......@@ -3442,6 +3449,23 @@ public int Create_Flag(int client,int args,float position[3], float angles[3])
return -2;
}
// neccesary because some flags use index 0.
bool FlagExistsAtIndex(int index)
{
int ent = 0;
while((ent = FindEntityByClassname(ent, "emp_cap_point")) != -1)
{
if(IsValidEntity(ent))
{
int flagIndex = GetEntProp(ent,Prop_Data,"m_iCapNumber");
if(flagIndex == index)
{
return true;
}
}
}
return false;
}
int GetNewFlagIndex()
{
int ent = 0;
......@@ -4153,10 +4177,6 @@ bool LoadScenario(int client,char[] filename)
//-1 or blank default, never and always.
currentScenarioKV.GetString("CanBaseSwap",baseSwapValue,sizeof(baseSwapValue),"-1");
if(StrEqual(baseSwapValue,"-1",false))
{
currentScenarioKV.GetString("BaseSwap",baseSwapValue,sizeof(baseSwapValue),"-1");
}
......@@ -5744,6 +5764,9 @@ public Action Command_Scenario_File(int client, int args)
return Plugin_Handled;
}
public Action Timer_Console_Log(Handle timer, int client)
{
......@@ -5832,13 +5855,7 @@ public Action Command_Set_TeamData(int client, int args)
return Plugin_Handled;
}
public Action Command_Set_GameDesc(int client, int args)
{
char arg[128];
GetCmdArg(1, arg, sizeof(arg));
SteamWorks_SetGameDescription(arg);
return Plugin_Handled;
}
void reloadMapConfig()
......@@ -5949,6 +5966,23 @@ public Action Timer_Base_Swap(Handle timer,int entity)
SwitchFactions();
}
SwitchFactionString(char[] rString,int rStringSize)
{
if(ReplaceString(rString, rStringSize, "/NF/", "/Imperial/", true) == 0 )
{
ReplaceString(rString, rStringSize, "/Imperial/", "/NF/", true);
}
if(ReplaceString(rString, rStringSize, "nf", "imp", true) == 0)
{
ReplaceString(rString, rStringSize, "imp", "nf", true);
}
return false;
}
int SwitchFaction(int entity,char[] classname)
{
if(StrEqual(classname,"emp_eng_map_model",true) || StrEqual(classname,"emp_eng_map_brush",true))
......@@ -5962,19 +5996,19 @@ int SwitchFaction(int entity,char[] classname)
if(ReplaceString(classname, 64, "nf", "imp", false) == 0)
{
ReplaceString(classname, 64, "imp", "nf", false);
}
//PrintToServer("%s start",classname);
SwitchFactionString(classname,64);
//PrintToServer("%s end",classname);
any classInfo[classdataenum];
// don't switch flag entities for now. And only do cap entities with no cap number.
// don't reload ref points
// don't do ammo boxes for now until we can fix issues with existing flags. i.e. homeland crashes.
if(GetEntitySavingKeys(classname,pVersion,classInfo) && ShouldSave(entity,classname,classInfo) && classInfo[data_group] != 2 && (classInfo[data_group] !=1 || GetEntProp(entity,Prop_Data,"m_iCapNumber") != 0) && !StrEqual(classname,"emp_cap_model",false) && !StrEqual(classname,"emp_cap_point",false) )
// don't swap ammo boxes on flag for now until we can fix issues with existing flags. i.e. homeland crashes.
if(GetEntitySavingKeys(classname,pVersion,classInfo) && ShouldSave(entity,classname,classInfo) && classInfo[data_group] != 2 && (classInfo[data_group] !=1 || !FlagExistsAtIndex(GetEntProp(entity,Prop_Data,"m_iCapNumber"))))
{
PrintToServer("%s",classname);
KeyValues kv = new KeyValues("save");
SaveEntity(entity,kv,classInfo,classname);
......@@ -5991,6 +6025,20 @@ int SwitchFaction(int entity,char[] classname)
{
kv.SetNum("teamOwner",OppositeTeam(kv.GetNum("teamOwner")));
}
// switch ammo box models.
if(classInfo[data_group] ==1)
{
char modelPath[128];
if(kv.GetString("model",modelPath,sizeof(modelPath)))
{
PrintToServer(modelPath);
SwitchFactionString(modelPath,sizeof(modelPath));
PrintToServer(modelPath);
kv.SetString("model",modelPath);
}
}
kv.Rewind();
int newEntity = RestoreEntity(-1,kv,classInfo,classname);
......
......@@ -116,6 +116,19 @@ public Action Command_Exec_Script(int client, int args)
// todo -- make sure it prints to chat for accountability.
char execString[1000];
GetCmdArgString(execString, sizeof(execString));
if(CheckScriptForErrors(execString,""))
PrintToChat(client,"script has errors check console for details");
else
RunEntityFunctionInternal(EU_ParamEntity(),execString);
char clientName[64];
GetClientName(client,clientName,sizeof(clientName));
PrintToChatAll("%s executed script: %s",clientName,execString);
return Plugin_Handled;
}
......@@ -391,6 +404,23 @@ void LoadScriptBeginning(char[] token,int entRef)
kv.Rewind();
}
// allows you to run a script in a different context.
bool BreakScriptContext( char[] context,char[] input,int inputSize)
{
// find the first index of a '/'
int breakIndex = StrContains(input, "/");
if(breakIndex != -1)
{
strcopy(context,breakIndex,input);
strcopy(input,inputSize,input[breakIndex + 1]);
return true;
}
return false;
}
bool LoadScript(char[] scriptname,int entRef)
{
KeyValues kv = currentScenarioKV;
......@@ -398,6 +428,7 @@ bool LoadScript(char[] scriptname,int entRef)
bool found = false;
if(kv.JumpToKey("Scripts"))
{
BreakScriptContext(scriptContext,scriptname,32);
if(strlen(scriptContext) > 0)
kv.JumpToKey(scriptContext);
char buffer[400];
......@@ -410,7 +441,11 @@ bool LoadScript(char[] scriptname,int entRef)
RunEntityFunctionInternal(entRef,buffer);
found = true;
}
}
else
{
PrintToServer("script %s not found",scriptname);
}
}
kv.Rewind();
return found;
......@@ -424,6 +459,7 @@ bool HasScript(char[] scriptname)
bool hasScript = false;
if(kv.JumpToKey("Scripts"))
{
BreakScriptContext(scriptContext,scriptname,32);
if(strlen(scriptContext) > 0)
kv.JumpToKey(scriptContext);
hasScript = KVHasKey(kv,scriptname);
......@@ -1769,6 +1805,21 @@ void ReadPackVector(DataPack dataPack,float[3] vector)
vector[2] = ReadPackFloat(dataPack);
}
// TODO
bool GetGlobalVariableInt(char[] variable, int &value)
{
if(StrEqual(variable,"g_int_clients_in_server",false))
{
// return the playercount
}
else if(StrEqual(variable,"g_int_clients_in_teams",false))
{
// return the playercount in teams.
}
}
int FindPropOffset(int entRef,char[] variableName, PropType &propType, PropFieldType &type)
{
......@@ -1787,6 +1838,14 @@ int FindPropOffset(int entRef,char[] variableName, PropType &propType, PropField
type = PropField_String;
return -2;
}
else if(StringBegins(variableName, "g_"))
{
if(StringBegins(variableName, "g_int"))
{
}
}
int offset = FindDataMapInfo(entRef, variableName, type);
......
......@@ -856,6 +856,6 @@
}
}
"Author" "Mikleo"
"BaseSwap" "0"
"CanBaseSwap" "no"
"version" "0.430000"
}
This diff is collapsed.
// Do not edit this file as votelist_base.txt, it will be overriden, rename this file to votelist.txt before editing.
"VoteList"
{
"scenarios"
{
"mik_destructablerocks"
{
"min_players" "0"
"max_players" "64"
"tags_override" "-"
"description_override" "-"
"chance" "0.1"
}
}
"enabled" "1"
}
......@@ -611,6 +611,6 @@
}
}
"Author" "Mikleo"
"BaseSwap" "0"
"CanBaseSwap" "no"
"version" "0.430000"
}
"Scenario"
{
"Description" "King of the hill: Hold onto both flags for 5 minutes to win"
"Description" "King of the hill: Hold onto both flags for 8 minutes to win"
"Details" "Flags also give resources"
"NF_Research"
{
......@@ -14,10 +14,10 @@
{
"KOTHS"
{
"$string_MainText" "King of the Hill\Hold both flags for 5 minutes to win"
"$string_MainText" "King of the Hill\Hold both flags for 8 minutes to win"
"$string_NeutralText" "King of the hill"
"$string_Warning" "King of the hill:TXTCLR_DF Hold onto both flags for 5 minutes to win. TXTCLR_G/scenario"
"$string_Warning" "King of the hill:TXTCLR_DF Hold onto both flags for 8 minutes to win. TXTCLR_G!scenario"
"$int_TimerLength" "480"
//automatically calculated
"$int_FlagNumber" "0"
......@@ -27,8 +27,8 @@
"FlagsChanged" "After 0.1 -> Run CountFlags -> If *$int_BEFlags == $int_FlagNumber* BEHasFlags *$int_NFFlags == $int_FlagNumber* NFHasFlags ELSE NooneHasFlags"
"i_StartingTimer" "Cancel KOTHTimer -> TextTimer -1 *$string_MainText* _ KOTHTimer"
"s_OnStart" "Run NooneHasFlags"
"BEHasFlags" "Cancel KOTHTimer -> TextTimer 300 *BE Victory in TIME_LEFT* _ KOTHTimer -> TargetParams -> Input InputImpWin 0 "
"NFHasFlags" "Cancel KOTHTimer -> TextTimer 300 *NF Victory in TIME_LEFT* _ KOTHTimer -> TargetParams -> Input InputNFWin 0 "
"BEHasFlags" "Cancel KOTHTimer -> TextTimer $int_TimerLength *BE Victory in TIME_LEFT* _ KOTHTimer -> TargetParams -> Input InputImpWin 0 "
"NFHasFlags" "Cancel KOTHTimer -> TextTimer $int_TimerLength *NF Victory in TIME_LEFT* _ KOTHTimer -> TargetParams -> Input InputNFWin 0 "
"NooneHasFlags" "Cancel KOTHTimer -> TextTimer -1 *$string_NeutralText* _ KOTHTimer"
"i_Warn" "Every 240 -> ChatText *$string_Warning*"
......@@ -646,6 +646,6 @@
}
"Author" "Mikleo"
"Description" "Hold both flags for 5 minutes to win"
"BaseSwap" "0"
"CanBaseSwap" "no"
"version" "0.430000"
}
......@@ -2228,7 +2228,6 @@
"Description" "3 Additional flags"
"details" " "
"Author" "Mikleo"
"BaseSwap" "-1"
"CommFreezeTime" "-1"
"PlayerRefineryMultiplier" "-1.000000"
"RefineryMultiplier" "-1.000000"
......
......@@ -5,9 +5,8 @@
"NF_Tickets" "402.000000"
"BE_Tickets" "402.000000"
"Description" "Hold the middle flag for 5 minutes to win."
"details" " "
"details" "The timer will decrease by 20 seconds each reset (Min: 4 minutes)"
"Author" "Mikleo"
"BaseSwap" "-1"
"CommFreezeTime" "-1"
"PlayerRefineryMultiplier" "-1.000000"
"RefineryMultiplier" "-1.000000"
......@@ -15,13 +14,22 @@
"hLimit" "172105"
"Scripts"
{
"OnScenarioLoaded" "Run Setup"
"Setup" "TargetName MainFlag -> HookOutput OnNeutral NeutralTimer -> HookOutput OnImpCap BETimer -> HookOutput OnNFCap NFTimer -> Run StartingTimer"
"OnGameStart" "Run NeutralTimer"
"StartingTimer" "Cancel MainTimer -> TextTimer -1 *King of the Hill\Hold the flag for 5 minutes to win* _ MainTimer"
"NeutralTimer" "Cancel MainTimer -> TextTimer -1 *Flag Neutral* _ MainTimer"
"BETimer" "Cancel MainTimer -> TextTimer 300 *BE Victory in TIME_LEFT\* _ MainTimer -> TargetParams -> Input InputImpWin 0 "
"NFTimer" "Cancel MainTimer -> TextTimer 300 *NF Victory in TIME_LEFT\* _ MainTimer -> TargetParams -> Input InputNFWin 0 "
"KOTH"
{
"$string_MainText" "King of the Hill\Hold the middle flag for 8 minutes to win"
"$string_NeutralText" "King Of The Hill"
"$int_TimerLength" "480"
"$int_TimerDecrease" "20"
"$int_TimerLengthMin" "260"
"i_HookFlag" "TargetName KOTHFlag -> HookOutput OnNeutral NeutralTimer -> HookOutput OnImpCap BETimer -> HookOutput OnNFCap NFTimer"
"i_StartingTimer" "Cancel KOTHTimer -> TextTimer -1 *$string_MainText* _ KOTHTimer"
"s_EnableTimer" "Run NeutralTimer"
"NeutralTimer" "Cancel KOTHTimer -> Run ReduceTime -> TextTimer -1 *$string_NeutralText* _ KOTHTimer"
"BETimer" "Cancel KOTHTimer -> TextTimer $int_TimerLength *BE Victory in TIME_LEFT* _ KOTHTimer -> TargetParams -> Run TeleportAboveFlag -> Input InputImpWin 0 "
"NFTimer" "Cancel KOTHTimer -> TextTimer $int_TimerLength *NF Victory in TIME_LEFT* _ KOTHTimer -> TargetParams -> Run TeleportAboveFlag -> Input InputNFWin 0 "
"ReduceTime" "Set $int_TimerLength = $int_TimerLength - $int_TimerDecrease -> If *$int_TimerLength < $int_TimerLengthMin* -> Set $int_TimerLength = $int_TimerLengthMin"
"TeleportAboveFlag" "Teleport 0 0 300 KOTHFlag"
}
}
"NF_Research"
{
......@@ -667,7 +675,7 @@
"position" "327.940552 824.389648 347.780518"
"angles" "0.000000 0.000000 0.000000"
"coords" "C3"
"name" "MainFlag"
"name" "KOTHFlag"
"effects" "32"
"Mins" "-202.825683 -200.249969 -128.249969"
"Maxs" "250.250000 200.250015 194.250030"
......@@ -1005,5 +1013,26 @@
"MoveType" "0"
"SolidType" "6"
}
"5001076"
{
"className" "emp_comm_restrict"
"position" "327.940552 824.389648 347.780518"
"angles" "0.000000 0.000000 0.000000"
"coords" "C2"
"Mins" "-900.000000 -900.000000 -900.000000"
"Maxs" "900.000000 900.000000 900.000000"
}
"5001075"
{
"className" "emp_eng_restrict"
"position" "327.940552 824.389648 347.780518"
"angles" "0.000000 0.000000 0.000000"
"coords" "C2"
"Mins" "-600.000000 -600.000000 -600.000000"
"Maxs" "600.000000 600.000000 600.000000"
"restrictNF" "1"
"restrictImp" "1"
"turretRestrict" "0"
}
}
}
......@@ -1373,6 +1373,5 @@
"Description" " "
"details" " "
"Author" "Mikleo"
"BaseSwap" "-1"
"version" "0.530000"
}
This diff is collapsed.
// Do not edit this file as votelist_base.txt, it will be overriden, rename this file to votelist.txt before editing.
"VoteList"
{
"scenarios"
{
"mik_superapcs"
{
"min_players" "0"
"max_players" "64"
"tags_override" "-"
"description_override" "-"
}
}
"enabled" "1"
}
This diff is collapsed.
This diff is collapsed.
// Do not edit this file as votelist_base.txt, it will be overriden, rename this file to votelist.txt before editing.
"VoteList"
{
"scenarios"
{
"mik_dam"
{
"min_players" "0"
"max_players" "64"
"tags_override" "-"
"description_override" "-"
}
"mik_hills"
{
"min_players" "0"
"max_players" "64"
"tags_override" "-"
"description_override" "-"
}
}
"enabled" "1"
}
This diff is collapsed.
// Do not edit this file as votelist_base.txt, it will be overriden, rename this file to votelist.txt before editing.
"VoteList"
{
"scenarios"
{
"mik_boats"
{
"chance" "0.25"
"min_players" "0"
"max_players" "64"
"tags_override" "-"
"description_override" "-"
}
}
"enabled" "1"
}
"Scenario"
{
"Description" "Hold the middle flag for 8 minutes to win."
"details" "The temple will open after 5 minutes\The timer will decrease by 20 seconds each reset (Min: 4 minutes)"
"details" " "
"details" "The temple will open after 8 minutes\The timer will decrease by 20 seconds each reset (Min: 4 minutes)"
"Tags" " "
"Author" "Mikleo"
"NF_Res" "300.000000"
......@@ -22,7 +21,7 @@
"$string_NeutralText" "Flag Neutral"
"$int_TimerLength" "480"
"$int_TimerDecrease" "20"
"$int_TimerLengthMin" "240"
"$int_TimerLengthMin" "260"
"i_HookFlag" "TargetName KOTHFlag -> HookOutput OnNeutral NeutralTimer -> HookOutput OnImpCap BETimer -> HookOutput OnNFCap NFTimer"
"i_StartingTimer" "Cancel KOTHTimer -> TextTimer -1 *$string_MainText* _ KOTHTimer"
"s_EnableTimer" "Cancel KOTHTimer -> Run DisableFlag -> TextTimer $int_EnableLength *$string_EnableTimerText* _ KOTHTimer -> Run DestroyBlockers EnableFlag KOTHOpenEffect NeutralTimer"
......
This diff is collapsed.
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