Hi, is it possible to remove all turrets from all cars when unloading the plugin?
Remove Turrets on unloading PluginSolved
It's possible to implement, but it could be intrusive to servers where players had used their items to add the turrets, any time the plugin is updated or reloaded for any other reason. For this reason, I recommend running an explicit command to remove turrets before unloading. That command is in the documentation. Also thanks for the DM pointing out the typo in the command, will take a look!
One possibility is to implement a config option that optionally removes turrets on unload. But I would like to head more about your use case for needing it first.
Oh hi, thanks for the fast reply.
I was just testing around with this plugin and noticed that after uninstalling the plugin, the turrets were still there.
I always thought that plugins should remove their functions once they get unloaded/uninstalled.
Aren't turrets loaded from a list/db when the plugin is reloaded/updated ?
No, it's by design that this plugin leaves the turrets around. I agree that it's a great practice for plugins to restore vanilla state on unload when possible, and I do implement that pattern as often as makes sense. The pattern can be problematic to implement for certain plugin designs such as this one, so it shouldn't be taken for granted that many plugins do that.TolimanI was just testing around with this plugin and noticed that after uninstalling the plugin, the turrets were still there.
I always thought that plugins should remove their functions once they get unloaded/uninstalled.
Aren't turrets loaded from a list/db when the plugin is reloaded/updated ?
One point is that auto removal on unload requires that the plugin implement persistence for the turret position, health, weapon, attachments, condition, weapon ammo type and amount, reserve ammo types and amounts, and switch on/off state. Not only is that a lot of work, but all of that logic is then subject to breakage when the game updates, increasing the burden on plugin maintenance, all for an edge case of uninstalling. If the admin is just playing around with a plugin, they should be doing it with a test server where it doesn't matter, and/or they should be only allowing themselves to create the turrets, so they can easily identify the turrets and remove them.
Additionally, uninstalling the plugin can delete player items, including the turrets themselves which they may have worked hard to obtain. If the turrets are left around, players can at least reacquire the items. You could say that the turrets should drop their items on unload, but then players would then have to add the items back in, any time the admin reloaded the plugin. There simply isn't a correct answer for how a plugin like this should behave when unloading.
All fine! I did it on my testserver and still was able to pick them up with my hammer after unloading.
If anyone needs to clean up they should just use the command before unloading
Locked automatically