Skip to content

Commit

Permalink
Simplify editor command info responses.
Browse files Browse the repository at this point in the history
  • Loading branch information
splewis committed Sep 19, 2015
1 parent e293a50 commit cecadf0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
7 changes: 7 additions & 0 deletions scripting/retakes/editor.sp
Expand Up @@ -206,3 +206,10 @@ public void DeleteMapSpawns() {
g_NumSpawns = 0;
Retakes_MessageToAll("All spawns for this map have been deleted");
}

public void MoveToSpawnInEditor(int client, int spawnIndex) {
TeleportEntity(client, g_SpawnPoints[spawnIndex], g_SpawnAngles[spawnIndex], NULL_VECTOR);
Retakes_Message(client, "Teleporting to spawn {GREEN}%d", spawnIndex);
Retakes_Message(client, " Team: {MOSS_GREEN}%s", TEAMSTRING(g_SpawnTeams[spawnIndex]));
Retakes_Message(client, " Site: {MOSS_GREEN}%s", SITESTRING(g_SpawnSites[spawnIndex]));
}
12 changes: 3 additions & 9 deletions scripting/retakes/editor_commands.sp
Expand Up @@ -167,7 +167,7 @@ public Action Timer_IterateSpawns(Handle timer, Handle data) {
if (!IsPlayer(client))
return Plugin_Handled;

FakeClientCommand(client, "sm_goto %d", spawnIndex);
MoveToSpawnInEditor(client, spawnIndex);

spawnIndex++;
while (g_SpawnDeleted[spawnIndex] && spawnIndex < g_NumSpawns) {
Expand Down Expand Up @@ -198,10 +198,7 @@ public Action Command_GotoSpawn(int client, int args) {
if (args >= 1 && GetCmdArg(1, buffer, sizeof(buffer))) {
int spawn = StringToInt(buffer);
if (IsValidSpawn(spawn)) {
Retakes_Message(client, "Teleporting to spawn {GREEN}%d", spawn);
Retakes_Message(client, " Team: {MOSS_GREEN}%s", TEAMSTRING(g_SpawnTeams[spawn]));
Retakes_Message(client, " Site: {MOSS_GREEN}%s", SITESTRING(g_SpawnSites[spawn]));
MoveToSpawn(client, spawn);
MoveToSpawnInEditor(client, spawn);
}
}

Expand All @@ -220,10 +217,7 @@ public Action Command_GotoNearestSpawn(int client, int args) {

int spawn = FindClosestSpawn(client);
if (IsValidSpawn(spawn)) {
Retakes_Message(client, "Teleporting to spawn {GREEN}%d", spawn);
Retakes_Message(client, " Team: {MOSS_GREEN}%s", TEAMSTRING(g_SpawnTeams[spawn]));
Retakes_Message(client, " Site: {MOSS_GREEN}%s", SITESTRING(g_SpawnSites[spawn]));
MoveToSpawn(client, spawn);
MoveToSpawnInEditor(client, spawn);
}

return Plugin_Handled;
Expand Down
2 changes: 1 addition & 1 deletion scripting/retakes/editor_menus.sp
Expand Up @@ -39,7 +39,7 @@ public int EditorMenuHandler(Menu menu, MenuAction action, int param1, int param

} else if (StrEqual(choice, "goto_nearest_spawn")) {
int spawn = FindClosestSpawn(client);
MoveToSpawn(client, spawn);
MoveToSpawnInEditor(client, spawn);
GiveEditorMenu(client, menuPosition);

}else if (StrEqual(choice, "delete_nearest_spawn")) {
Expand Down

0 comments on commit cecadf0

Please sign in to comment.