From 2837143a1ae7af27226694639a4ead77bb4f9adb Mon Sep 17 00:00:00 2001 From: wootguy Date: Fri, 31 Jul 2020 02:23:24 -0700 Subject: [PATCH] fix func_train/path_track bugs func_train responds to toggle triggers differently when spawned late. path_track doesn't work at all if spawned late. Also info_nodes aren't spawned late to make testing going quicker. --- scripts/bspguy.as | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/scripts/bspguy.as b/scripts/bspguy.as index 0f525a16..836791ef 100644 --- a/scripts/bspguy.as +++ b/scripts/bspguy.as @@ -353,11 +353,17 @@ namespace bspguy { string classname; g_ent_defs[i].get("classname", classname); - if (no_delete_ents.exists(classname)) { + if (no_delete_ents.exists(classname) || classname == "info_node" || classname == "info_node_air") { continue; } - g_EntityFuncs.CreateEntity(classname, g_ent_defs[i], true); + CBaseEntity@ ent = g_EntityFuncs.CreateEntity(classname, g_ent_defs[i], true); + + // the initial toggle trigger effect is inverted for trains that are spawned late + // (needs to be toggle twice before it starts moving) + if (ent !is null && string(ent.pev.classname) == "func_train") { + ent.Use(null, null, USE_TOGGLE); + } } } @@ -392,6 +398,7 @@ namespace bspguy { g_CustomEntityFuncs.RegisterCustomEntity( "bspguy::bspguy_equip", "bspguy_equip" ); no_delete_ents["multi_manager"] = true; // never triggers anything if spawned late + no_delete_ents["path_track"] = true; // messes up track_train if spawned late } void MapActivate() {