AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugins (https://forums.alliedmods.net/forumdisplay.php?f=108)
-   -   [L4D1 & L4D2] Tank anti-stuck (anti-block) (https://forums.alliedmods.net/showthread.php?t=314741)

Dragokas 03-04-2019 21:46

[L4D1 & L4D2] Tank anti-stuck (anti-block)
 
1 Attachment(s)
Description:
Intended for intensive game.

Depending on server build complexity, sooner or later, players face a problem when tank is getting stuck (collide with another models and can't move - as a result: too easy too kill, or even loss of control).

Plugin try to resolve/prevent several problems:
- tank stuck
- losing control
- blocking tank by players (e.g. on the ladder)
- all team-rush
- player idle(stucker) /bug the tank by sitting in place where tank can't catch him (punishment)
- one player rush (punishment)

How does it work?

There are several rules (all configurable by ConVars):

- When tank spawn, plugin track for the maximum time allowed for tank to be non-angry (see "l4d_TankAntiStuck_non_angry_time").
If player didn't angry the tank during this time, it will be automatically teleported to players.
Behaviour can be disabled by "l4d_TankAntiStuck_non_angry_time" set to 0.

After become angry:
- There is a mechanism of identifying of stuck based on the origin of tank.
If he didn't move more than > X radius (see "l4d_TankAntiStuck_non_stuck_radius")
for the last Y sec. (see "l4d_TankAntiStuck_check_interval") it is considered as stucked,
and teleporting process begins.

- if all the team tried to run away from tank (rush) for some reason e.g. when tank is out of map or they rush specially,
plugin identify the distance between tank and the nearest player - if it is > X (see "l4d_TankAntiStuck_tank_distance_max")
tank will be teleported to the nearest player.
Behaviour can be disabled by "l4d_TankAntiStuck_tank_distance_max" set to 0.

- if l4d_TankAntiStuck_rusher_punish set to 1, plugin will check the distance between the nearest tank to each individual client, if he is too far, client will be punished by teleporting tank direclty in player's position.

- if l4d_TankAntiStuck_idler_punish set to 1, plugin will check is player move (see additional ConVars). If player behave himself like idle (usually due to sitting in the place where tank can't catch him) for more than (3 sec. each 3 times, see settings), client will be punished by teleporting tank direclty in player's position.

How does it teleport:
- Firstly plugin attempt to make smooth teleport applying new velocity on direction to the nearest player next to the tank.
If it is failed in X tries, plugin make instant teleport to the place under the head of the player (see "l4d_TankAntiStuck_head_height_max").
If that place is not empty (collide with something), plugin try to find another empty place around the nearest player (see "l4d_TankAntiStuck_head_height_min").

And lastly:
- plugin apply game ConVar "tank_stuck_failsafe" (untested, unproved) in attempt to fix problem when tank losing control after colliding the model for ~ 15 sec.
This part is not very necessary if you use my plugin with default settings.
Behaviour can be disabled by "l4d_TankAntiStuck_apply_convar" set to 0.

Also you can configure "l4d_TankAntiStuck_all_intellect" - to define who anti-stuck is applicable to (bots or bots + real players in infected team).

Compatibility:
- L4D1.
- L4D2 - untested. Should work ok.
Commands:
Nothing. There are several service cmds in debug mode for test reasons only.
Settings (ConVars):

- "l4d_TankAntiStuck_enable" (1) - Enable plugin (1 - On / 0 - Off)
- "l4d_TankAntiStuck_non_angry_time" (45) - Automatic tank teleport if he is not angry within specified time (in sec.) after spawn (0 - to disable)

- "l4d_TankAntiStuck_tank_distance_max" (1000) - Maximum distance allowed between tank and the nearest player (after been angered). Otherwise, it will be teleported (0 - to disable)
- "l4d_TankAntiStuck_head_height_max" (150) - Distance under the head of player, tank will be instantly teleported to, by default, when tank failed to unstuck wasting all attempts to free using smooth teleport
- "l4d_TankAntiStuck_head_height_min" (80) - Distance under the head of player, tank will be instantly teleported to, if plugin failed to find more appropriate location
- "l4d_TankAntiStuck_check_interval" (3) - Time intervals (in sec.) tank stuck should be checked
- "l4d_TankAntiStuck_non_stuck_radius" (15) - Maximum radius where tank is cosidered non-stucked when not moved during X sec. (see l4d_TankAntiStuck_check_interval ConVar)
- "l4d_TankAntiStuck_inst_tele_dist" (50) - Distance for instant type of teleport
- "l4d_TankAntiStuck_smooth_tele_dist" (150) - Distance for smooth type of teleport
- "l4d_TankAntiStuck_smooth_tele_power" (300) - Power (velocity) for smooth type of teleport
- "l4d_TankAntiStuck_dest_object" (1) - Object to teleport tank to (0 - next to current tank, 1 - next to another tank, 2 - next to player)

- "l4d_TankAntiStuck_all_intellect" (1) - 1 - Apply anti-stuck to both: when bots or real player control tank, 0 - apply to tank bot (fake) only

- "l4d_TankAntiStuck_apply_convar" (1) - 1 - Apply special ConVar in attempt to fix problem when tank losing its control after stuck (just in case). 0 - do not apply

- "l4d_TankAntiStuck_idler_punish" (1) - Punish the player who doesn't move by teleporting nearest tant to him? (0 - No / 1 - Yes)
- "l4d_TankAntiStuck_idler_radius" (30) - Maximum radius within player moves considered as idler (stucker)
- "l4d_TankAntiStuck_idler_check_times" (3) - Number of checks before finally considering player as idler (stucker)
- "l4d_TankAntiStuck_idler_check_interval" (3) - Interval (in sec.) between each check for idler (stucker)
- "l4d_TankAntiStuck_idler_minplayers" (2) - Minimum living players allowed for 'Idle player' rule to work

- "l4d_TankAntiStuck_rusher_punish" (1) - Punish the player who rush too far from the nearest tank by teleporting tank to him? (0 - No / 1 - Yes)
- "l4d_TankAntiStuck_rusher_dist" (2000) - Maximum distance to the nearest tank considered as rusher
- "l4d_TankAntiStuck_rusher_check_times" (3) - Number of checks before finally considering player as rusher
- "l4d_TankAntiStuck_rusher_check_interval" (10) - Interval (in sec.) between each check for rusher
- "l4d_TankAntiStuck_rusher_minplayers" (2) - Minimum living players allowed for 'Rusher player' rule to work
Using:

Copy smx to addons/sourcemod/plugins
Credits:

* Peace-Maker - for some examples on TraceHull filter.
* stinkyfax - for examples of teleport in direction math.
* cravenge - for some ConVar, possibly, preventing tank from losing control when stuck.
* midnight9, PatriotGames - who tried to help me with another ConVars against losing tank control.
Related topics:

[L4D] Tank gets frozen
[L4D2] Fix frozen tanks
[L4D] Give Tank control to other player
ChangeLog (pre-release)


Donate
Donates are very appreciated and welcomed for further inspiration, make me happy, and make next updates came out more often:
- Patreon (Paypal)
- BitCoin
- Ю.Money

Sev 03-05-2019 09:42

Re: [L4D] Tank anti-stuck (anti-block)
 
Good work on this.

I've wanted a plugin like this for awhile to fix stuck tanks. Whether it was finales or other areas.

This does the trick without having to manually do it.

Mi.Cura 03-05-2019 15:50

Re: [L4D] Tank anti-stuck (anti-block)
 
Great work.
I've been looking for a solution for a long time.
I tested it on my l4d2 server and got no errors so far.
I also use the pluguin supertanks ++ and it worked well.

Thank you for sharing your work.

:bacon!::bacon!:

Dragokas 05-26-2019 11:30

Re: [L4D] Tank anti-stuck (anti-block)
 
2.0 (05-May-2019)
- Collision with another clients (include other tanks) is now not considered as stuck.
- Fixed case when TR_DidHit() could return wrong result due to extracting info from global trace.
- Added "l4d_TankAntiStuck_dest_object" ConVar to control the destination,
where you want to teleport tank to:
(0 - next to current tank, 1 - next to another tank, 2 - next to player). By default: 1 (previously, it was: 2).

- Added new violations (punishment is teleporting tank directly to player):
1. Punish the player who doesn't move (tank stucker / inactive player)
2. Punish the player who rush too far from the nearest tank (and thus, from the team, including team rush).

Punishments are enabled by default. To disable, use below ConVars:
- l4d_TankAntiStuck_idler_punish
- l4d_TankAntiStuck_rusher_punish

For detail adjustments, see more new ConVars in the thread.

- Code optimization
- Tank angry detection is improved
- Tank stuck detection is improved to avoid false positives

Sev 05-26-2019 12:30

Re: [L4D] Tank anti-stuck (anti-block)
 
Good work on this.

It would be interesting if a similar plugin could be done with specials that get stuck and teleport them out of stuck spots.

moschinovac 08-27-2019 12:24

Re: [L4D] Tank anti-stuck (anti-block)
 
After update, Tank no longer teleport when stuck, only teleport to Idler so if tank stuck and survivors move around glitch spot (spot cause tank cant reach), tank cant reach them and dont teleport as long as survivors keep move around.
P/S: I enable only Tank teleport when stuck and teleport to Idler. And my bad English

Dragokas 08-27-2019 14:54

Re: [L4D] Tank anti-stuck (anti-block)
 
Technically, that doesn't mean "stuck inside another model".
However, I will change the detection method (and add additional ConVar) in the next version when I will have enough free time.

Rogilla 08-28-2019 04:27

Re: [L4D] Tank anti-stuck (anti-block)
 
using this with mutant tank plugin. On dark carnival finale with multiple tanks, sometimes they get stuck in the upper room, can it be fixed? thanks

Dragokas 08-28-2019 05:44

Re: [L4D] Tank anti-stuck (anti-block)
 
What is behaviour of that tank, does he stay in one place without any moving and does not collide with other objects?

Dragokas 08-28-2019 06:04

Re: [L4D] Tank anti-stuck (anti-block)
 
For now, use previous version if you have it. I can send you in the evening. Until i make combined version


All times are GMT -4. The time now is 03:44.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.