View Single Post
Author Message
glhf3000
Member
Join Date: Aug 2010
Location: middle-universe
Old 02-17-2024 , 13:34   [L4D2] Fix Saferoom door +USE bug
Reply With Quote #1

Info
Sometimes, if there are several players standing in front of a safe room door, or if weapons/medkits are scattered around, pressing "E" might not work or might interact with items instead, even if you are right in front of it, which can be incredibly frustrating. This plugin fixes the issue, making doors work as intended. It should theoretically be compatible with most door-related plugins. There is a native for unscramblers or lockers if you need to allow operation only after a certain event.
CVARS
l4d2_fix_safedoor_use_distance_to_open [100] - You will be able to OPEN doors from this distance
l4d2_fix_safedoor_use_distance_to_close [115] - You will be able to CLOSE doors from this distance
l4d2_fix_safedoor_use_wait_permission_from_ot her_plugin [0] - In case you use unscrambler or door locker, wait for it (to use native)
Natives
native void FixSafedoorUseEnable(true/false=enable/disable);
Short video
Tech
The plugin places and saves three points on each door: left, center, and right. It monitors their coordinates when the door's position changes. If the player presses "E" near these points, it uses trace ray to ensure the player is looking at the door. In case of player_use triggered by the engine, some decisions are taken in the next frame to avoid conflicts with other plugins. Then, AcceptInput is used for opening/closing and sends a player_use event for other plugins. If the door has DOOR_FLAG_IGNORE_USE enabled, or if last door has DOOR_FLAG_STARTS_LOCKED like c10m3 church, it also won't work.
Changelog
Code:
1.1/1.2 - fixed wrong door entity errors and added l4d2_fix_safedoor_use_debug cvar
1.3 - fixed c10m3 church door; added native param "value" true/false to enable/disable for last door gameplay ideas, which is true by default if not specified
Attached Files
File Type: inc fix_safedoor_use.inc (550 Bytes, 26 views)
File Type: sp Get Plugin or Get Source (l4d2_fix_safedoor_use.sp - 26 views - 13.8 KB)

Last edited by glhf3000; 03-18-2024 at 10:44.
glhf3000 is offline