prop_physics can generate OnAwakened outputs when an external force is applied to it, which we can use to "disable" entities related to the escape route, thus destroying the escape route.
Specifically, we need to create two entities, one being the entity that acts as the escape route (hereafter referred to as the "bridge"), and the other being the prop_physics entity that acts as the support of the bridge for the bridge (hereafter referred to as the "car").
* Both entities are prop_physics entities, but since the "bridge" model itself does not support being a prop_physics entity (using that classname causes the entity to disappear), you must use prop_physics_override as its classname.
Our goal is simple: we want the bridge to collapse when the car is hit by a tank. this is similar to the bridge in chapter 3 of Blood Harvest, except that we want to destroy an escape route instead of creating one.
* If we don't disable the bridge's motion, it might fly to somewhere else when OnMapSpawn is finished;
* We just need to make the bridge collapse when the car is hit by a tank;
Then we need to prevent players from applying force to the car to prevent the bridge from collapsing from players *scaring* the car:
"spawnflags" "1025" consists of 1 and 1024 and has two functions:
* 1: Start Asleep. This will disable the motion of the car, but it will re-enable its motion when external forces are applied to it.
** This is mainly to avoid interactions between solid models that would cause the "car" to bounce out of its intended position.
* 1024: Prevents players from applying force to it. (unverified)
* In the code above, "physical_gate_wall_road,EnableMotion,,0,-1" is used to enable motion of the bridge named physical_gate_wall_road, which will cause it to collapse.
1) Use "OnAwakened" to generate outputs: the car will cause the bridge to collapse (generate outputs) by all forces from boomer, charger and tank;
2) Use "OnHitByTank" to generate outputs: the car will cause the bridge to collapse only if it is hit by a tank. The rock from the tank will not cause the car to collapse the bridge, although it will knock the car away.
* The process can be summarized as follows: the car gets hit by a tank >> which generates output / EnableMotion to enable bridge motion >> bridge collapses due to gravity and loss of support.
Using "OnAwakened" as the method to generate the output would make the game harder or cause the escape route associated with the bridge to be destroyed earlier, while using OnHitByTank would affect the realism of the bridge collapse event.
* Screenshot: Rocks from a tank will not cause the car to generate outputs related to OnHitByTank, such as causing a bridge to collapse.
* If you have an alternate escape route for survivors (e.g. put a ladder down here for survivors to climb), then I recommend using OnAwakened as the method for the output generation.
In order for survivor bots to recognize the bridge and be able to use it to jump, we need to create a navmesh area for them on the bridge:
1) Use nav_create_area_at_feet 1 to create a navmesh area on the surface of prop_physics entity(ies) (the bridge);
* This will also allow you to create navmesh areas on the various prop_dynamic entities that you create via stripper, allowing bots to use or bypass the appropriate entities in their paths.
2) Create a navmesh area by setting the start point of the navmesh area with nav_begin_area and the end point with nav_end_area;
3) Select the other area(s) with nav_mark, aim at the navmesh area we created, and use nav_connect to create a connection between the other area and the navmesh area we created, allowing bots to move from the other area to the navmesh area we created.
* Screenshot: It looks like this.
* If you're using a model for the car that survivors can't jump onto directly, you'll need to place an entity near it to allow survivors to jump onto the car (don't forget to create new navmesh areas associated with that entity).
Then we also need to block the navmesh area(s) of the bridge when it collapses, so that bots don't use the non-existent navmesh area(s) (escape route), which requires us to create a (few) func_nav_blocker(s):
* infected, including common, also use navmesh areas for routing; the users of navmesh areas are not limited to survivor bots.
* Move the position (origin) of func_nav_blocker(s) to the navmesh area(s) so that it can be blocked, then block the navmesh area with "bus_station_saferoom_door_nav_blocker_02,Blo ckNav,,0,-1".
** You need to add "bus_station_saferoom_door_nav_blocker_02,Blo ckNav,,0,-1" to the car as "OnAwakened" or "OnHitByTank".
** The navmesh area on top of the car (if there is one) also needs to be blocked. Simply create a new func_nav_blocker entity with the same name and move it to the navmesh area on top of the car by setting its origin.
That way, if the bridge collapses because the car has been hit by a tank (or a charger), the bots won't try to walk on the entities that are no longer available.
prop_physics will cause tanks (and also survivor bots) to tend to go through other navmesh areas instead of trying to go through where the prop_physics is, which will cause them to tend to jump on top of the car instead of breaking, hitting the car and causing the bridge to collapse. While it is still possible for them to hit the car and cause the bridge to collapse, they would look pretty stupid because of the pathfinding problems in those areas.
Considering that func_nav_blocker's blocking effect on navmesh areas can be targeted to only disable pathfinding for infected or survivors, just put a (few) func_nav_blocker(s) on the boxes (or any other navmesh area(s) used to jump to the top of the car) and block the navmesh area when OnMapSpawn:
However, common needs an available navmesh path before it will try to climb the car, so you'll also need to create a (few) navmesh connection(s) between the bottom of the car and the top of the car, or else common will *cheer* for the survivor(s) that at the top of the car due to the lack of available paths (it seems like dropping a bile on an unreachable location).