Closed rube200 closed 1 week ago
Maybe consider using a struct or class for the arguments so you can add more later.
Vanilla should probably be using FindBarricadeByRootFast
. This isn't something I really want to touch at the moment because there are soo many items in need of rewrite there, but for the next update I will change vanilla's use of FindBarricadeByRootTransform
so with plugins it at least cuts it in half.
This is not my main point but if it helps performance seems good. The point is vanilla calls for that method and since plugins receive transform they need to call it again. (Doubling the calls to it). Even worst if server have multiple plugin that use that event, it would be 1 vanilla + 1 per plugin
For a long time unturned have these two events:
But those events pass transform instead of Drop. Example:
The problem is any plugin using these methods need to call FindBarricadeByRootTransform/FindStructureByRootTransform, making server with alot of barricade hitting the performance a bit, but the thing is in the event caller already resolve this and have the data.
Is it possible to edit the original or make a v2? I know editing the original may lead to breaking changes but i think in next update it will be since you are working with vehicles related code.
TLDR: make a v2 of
BarricadeManager.onDamageBarricadeRequested
andStructureManager.onDamageStructureRequested
passing BarricadeDrop/StructureDrop instead of Transform.