Hi. Can you please tell me if there is a hook in Oxide that will work when the workcart makes a sound when approaching a collision?
How to detect collisions?Solved
Does that question have something to do with this plugin? If you want to know general things about workcarts, there are multiple ways to ask, such as the Rust section or DMs (prefer forums over DMs unless it needs to be private). I scan all new posts on the website several times per day for topics that I'm knowledgeable in.
The way the collision warning works is that each workcart will check every few seconds whether there is something on the tracks ahead of it that it night collide with. If there is, the workcart will toggle a flag which is networked. Upon the client receiving that flag, the client will play the warning sound in a continuous loop until that flag is toggled off. There is not currently any hook to detect when entity flags are toggled.
This plugin disables the collision check for workcarts while they are automated and then enables the checks when the conductors are removed. You can see the code for that by searching the plugin code for the word "hazard". You can also look at the code of the TrainEngine class in the Rust assemblies using a decompiler.
Thanks for the info. Wanted to complement your plugin, I have a custom map with a railroad on the surface, wanted to add AI conductors =)
Locked automatically