About This File
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.
Permissions:
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.
For Users:
Drop the folder from the .zip into your /documents/teardown/mods/ folder.
For developers:
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.
Edited by Magnymbus
Added migration disclaimer
What's New in Version 1.5.2 See changelog
Released
NEW FEATURES
Custom sounds now have a fallback if the Latch tag has a value and only one custom sound is listed. Currently, this does not check if the file and path are valid, as I have no idea how to do that. Once I figure that out, it will be a PROPER fallback system. Syntax below.
tags="Latch=Vehicle LatchOpenSound=../mod_name/path_to_sound.ogg LatchCloseSound=../mod_name/path_to_sound.ogg"
BUG FIXES
If the Latch tag has a value, the script will attempt to use that as a fallback if you included either LatchOpen/CloseSound tags but did not give them values. Fallbacks do not currently work if the file path is simply invalid.
Error reports should be slightly more verbose now.
UNDER THE HOOD
A few systems were completely rewritten in order to fix how tables were being handled and to slightly increase the potential verbosity of debugging. Other than the (admittedly not very useful yet) fallback system, this shouldn't effect how users or developers interact with the script.
Recommended Comments
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.