This mod will be migrated to steam workshop when available and will no longer be updated. Files will remain. This line will contain a link to the workshop page when this occurs. I apologize for the inconvenience, and thank you for your interest.
What it does:
This script allows for a generalized approach to latching doors without the need to give joints individual names and write custom scripts to look for those name specifically.
You can use this in any map without the need to ask for permission as long as you:
List credit on the mod page with a link to this page.
Do not include the script within your map itself, as this can cause problems; Instead, have your users grab the newest version from here.
How it works:
When the door is near enough to the closed position (limit "0"), it will apply a slight force to keep it closed. When you grab the door, it removes that force, allowing you to open the door. following this, it will remain loose until the door returns to its closed position. That means that if you leave a car door open, you could use your brakes to close it. This is different than other implementations that use interactions (button prompt) that switch the direction of the force. This is due mostly to my own preference, but also due to how the script checks for each door. It could probably be easily changed though if you prefer that method.
Drop the folder from the .zip into your /documents/teardown/mods/ folder.
Add "tags="Latch"" to the VOX of each shape. DO NOT TAG THE JOINT! Otherwise, the script will not work.
Add sound effects by extending the tag to "Latch=Vehicle" or "Latch=Structure".
Custom sounds can be added with "LatchOpenSound=../mod_name/path_to_sound.ogg" and "LatchCloseSound=../mod_name_path_to_sound.ogg". Ensure that the path always starts with "../" followed by the name of the FOLDER your mod is in, and then the rest of the path to the sound. If you get no sound instead of a custom one, it's probably a typo.
Please ensure that all joints you wish to latch are in the closed position at limit 0, as this is what the script considers the "closed" position. This generally means that the door is closed in the .vox file.
An example vehicle (The yellow van from the thumbnail) is included in the files.