Fixed ReadMapList not seeing maps in all valveFS paths (
bug 5715, r=asherkin).
4 enum Game { Game_TF, Game_SWARM }
7 public APLRes:AskPluginLoad2(Handle:myself, bool:late, String:error[], err_max)
9 decl String:gamedir[64];
10 GetGameFolderName(gamedir, sizeof(gamedir));
11 if (!strcmp(gamedir, "tf"))
14 return APLRes_Success;
17 if (!strcmp(gamedir, "swarm"))
20 return APLRes_Success;
23 strcopy(error, err_max, "These tests are only supported on TF2 and Alien Swarm");
24 return APLRes_Failure;
27 public OnPluginStart()
29 if (g_Game == Game_TF)
31 RegConsoleCmd("gr_getstate", gr_getstate);
32 RegConsoleCmd("gr_ttr", gr_ttr);
33 RegConsoleCmd("gr_tbs", gr_tbs);
34 RegConsoleCmd("gr_nextspawn", gr_nextspawn);
35 RegConsoleCmd("gr_settime", gr_settime);
36 RegConsoleCmd("gr_getgoal", gr_getgoal);
37 RegConsoleCmd("gr_setgoal", gr_setgoal);
39 else if (g_Game == Game_SWARM)
41 HookEvent("entity_killed", entity_killed);
42 RegConsoleCmd("gr_getstimmer", gr_getstimmer);
46 public Action:gr_getstate(client, argc)
48 ReplyToCommand(client, "Round state is %d", GameRules_GetRoundState());
49 return Plugin_Handled;
52 stock Float:GameRules_GetTimeUntilRndReset()
54 new Float:flRestartTime = GameRules_GetPropFloat("m_flRestartRoundTime");
55 if (flRestartTime == -1.0)
58 return flRestartTime - GetGameTime();
61 public Action:gr_ttr(client, argc)
63 ReplyToCommand(client, "Time til restart is %.2f", GameRules_GetTimeUntilRndReset());
64 return Plugin_Handled;
67 public Action:gr_tbs(client, argc)
69 ReplyToCommand(client, "Time between spawns for team2 is %.2f", GameRules_GetPropFloat("m_TeamRespawnWaveTimes", 2));
70 return Plugin_Handled;
73 public Action:gr_nextspawn(client, argc)
75 ReplyToCommand(client, "Next spawn for team2 is %.2f", GameRules_GetPropFloat("m_flNextRespawnWave", 2));
76 return Plugin_Handled;
79 public Action:gr_settime(client, argc)
81 GameRules_SetPropFloat("m_TeamRespawnWaveTimes", 2.0, 2, true);
82 return Plugin_Handled;
85 public Action:gr_getgoal(client, argc)
88 GameRules_GetPropString("m_pszTeamGoalStringRed", goal, sizeof(goal));
89 ReplyToCommand(client, "Red goal string is \"%s\"", goal);
90 return Plugin_Handled;
93 public Action:gr_setgoal(client, argc)
95 GameRules_SetPropString("m_pszTeamGoalStringRed", "urururur", true);
98 GameRules_GetPropString("m_pszTeamGoalStringRed", goal, sizeof(goal));
99 ReplyToCommand(client, "Red goal string is \"%s\"", goal);
100 return Plugin_Handled;
104 public entity_killed(Handle:event, const String:name[], bool:dontBroadcast)
106 new ent = GetEventInt(event, "entindex_killed");
107 if (!IsValidEdict(ent))
110 decl String:classname[64];
111 GetEdictClassname(ent, classname, sizeof(classname));
113 if (!!strcmp(classname, "asw_marine"))
116 decl Float:deathvec[3];
117 GameRules_GetPropVector("m_vMarineDeathPos", deathvec);
118 PrintToChatAll("Death vec is %.3f %.3f %.3f", deathvec[0], deathvec[1], deathvec[2]);
121 // you can manually induce this with asw_PermaStim (needs sv_cheats)
122 public Action:gr_getstimmer(client, argc)
124 ReplyToCommand(client, "%N (%.2f/%.2f)",
125 GameRules_GetPropEnt("m_hStartStimPlayer"),
126 GameRules_GetPropFloat("m_flStimStartTime"),
127 GameRules_GetPropFloat("m_flStimEndTime"));
128 return Plugin_Handled;