mirror of
https://github.com/Jackzmc/sourcemod-plugins.git
synced 2025-05-06 14:03:21 +00:00
Add state checks
This commit is contained in:
parent
c935aec511
commit
4285178c24
2 changed files with 29 additions and 3 deletions
|
@ -37,7 +37,14 @@ void OpenVariantsMenu(int client) {
|
||||||
char id[8], display[32];
|
char id[8], display[32];
|
||||||
menu.AddItem("new", "New Variant");
|
menu.AddItem("new", "New Variant");
|
||||||
menu.AddItem("-1", "Global Scene Variant");
|
menu.AddItem("-1", "Global Scene Variant");
|
||||||
|
if(!g_builder.selectedSceneData) {
|
||||||
|
ReplyToCommand(client, "Error: Missing scene data for %s", g_builder.selectedSceneId);
|
||||||
|
PrintToServer("[Randomizer] Warn: Scene %s has no data", g_builder.selectedSceneId);
|
||||||
|
} else if(!g_builder.selectedSceneData.HasKey("variants")) {
|
||||||
|
ReplyToCommand(client, "Error: Missing variants for %d", g_builder.selectedSceneId);
|
||||||
|
PrintToServer("[Randomizer] Warn: Selected scene %s has no variants", g_builder.selectedSceneId);
|
||||||
|
return;
|
||||||
|
}
|
||||||
JSONArray variants = view_as<JSONArray>(g_builder.selectedSceneData.Get("variants"));
|
JSONArray variants = view_as<JSONArray>(g_builder.selectedSceneData.Get("variants"));
|
||||||
JSONObject varObj;
|
JSONObject varObj;
|
||||||
JSONArray entities;
|
JSONArray entities;
|
||||||
|
@ -102,8 +109,11 @@ int BuilderHandler_ScenesMenu(Menu menu, MenuAction action, int client, int para
|
||||||
FakeClientCommand(client, "sm_rbuild scenes new");
|
FakeClientCommand(client, "sm_rbuild scenes new");
|
||||||
OpenScenesMenu(client);
|
OpenScenesMenu(client);
|
||||||
} else {
|
} else {
|
||||||
FakeClientCommand(client, "sm_rbuild scenes select %s", info);
|
if(g_builder.SelectScene(info)) {
|
||||||
OpenVariantsMenu(client);
|
OpenVariantsMenu(client);
|
||||||
|
} else {
|
||||||
|
PrintToChat(client, "Error: Scene not found");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if(action == MenuAction_Cancel) {
|
} else if(action == MenuAction_Cancel) {
|
||||||
if(param2 == MenuCancel_ExitBack) {
|
if(param2 == MenuCancel_ExitBack) {
|
||||||
|
|
|
@ -226,6 +226,10 @@ public Action Command_CycleRandom(int client, int args) {
|
||||||
if(client > 0)
|
if(client > 0)
|
||||||
PrintCenterText(client, "Cycled flags=%d", flags);
|
PrintCenterText(client, "Cycled flags=%d", flags);
|
||||||
} else {
|
} else {
|
||||||
|
if(g_MapData.activeScenes == null) {
|
||||||
|
ReplyToCommand(client, "No map data");
|
||||||
|
return Plugin_Handled;
|
||||||
|
}
|
||||||
ReplyToCommand(client, "Active Scenes (%d/%d):", g_MapData.activeScenes.Length, g_MapData.scenes.Length);
|
ReplyToCommand(client, "Active Scenes (%d/%d):", g_MapData.activeScenes.Length, g_MapData.scenes.Length);
|
||||||
ActiveSceneData scene;
|
ActiveSceneData scene;
|
||||||
for(int i = 0; i < g_MapData.activeScenes.Length; i++) {
|
for(int i = 0; i < g_MapData.activeScenes.Length; i++) {
|
||||||
|
@ -389,6 +393,18 @@ Action Command_RandomizerBuild(int client, int args) {
|
||||||
obj.SetString("model", "decals/checkpointarrow01_black.vmt");
|
obj.SetString("model", "decals/checkpointarrow01_black.vmt");
|
||||||
g_builder.AddEntityData(obj);
|
g_builder.AddEntityData(obj);
|
||||||
ReplyToCommand(client, "Added sprite to variant #%d", g_builder.selectedVariantIndex);
|
ReplyToCommand(client, "Added sprite to variant #%d", g_builder.selectedVariantIndex);
|
||||||
|
} else if(StrEqual(arg, "fire")) {
|
||||||
|
if(g_builder.selectedVariantData == null) {
|
||||||
|
ReplyToCommand(client, "Please load map data, select a scene and a variant.");
|
||||||
|
return Plugin_Handled;
|
||||||
|
}
|
||||||
|
float pos[3];
|
||||||
|
GetLookingPosition(client, Filter_IgnorePlayer, pos);
|
||||||
|
JSONObject obj = new JSONObject();
|
||||||
|
obj.SetString("type", "env_fire");
|
||||||
|
obj.Set("origin", VecToArray(pos));
|
||||||
|
g_builder.AddEntityData(obj);
|
||||||
|
ReplyToCommand(client, "Added fire to variant #%d", g_builder.selectedVariantIndex);
|
||||||
} else {
|
} else {
|
||||||
ReplyToCommand(client, "Unknown arg. Try: new, load, save, scenes, cursor");
|
ReplyToCommand(client, "Unknown arg. Try: new, load, save, scenes, cursor");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue