Skip to content

Commit

Permalink
fix func_train/path_track bugs
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
wootguy committed Jul 31, 2020
1 parent da31d9d commit 2837143
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions scripts/bspguy.as
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}

Expand Down Expand Up @@ -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() {
Expand Down

0 comments on commit 2837143

Please sign in to comment.