So big ms canbetargeted
When it says [GARBAGE COLLECT], that means it was probably a coincidence that a garbage collection happened while the hook was being called, so it's not the fault of the plugin. If you see these messages often, that is because the CanBeTargeted hook is called so often that it's more likely to be running at the time of a garbage collection than other hooks.
That being said, it is possible for some hooks to be more likely to actually trigger a garbage collection, especially if the plugin is allocating memory during the hook call. Looking at the implementation of the CanBeTargeted hook in True PVE, I do see some obvious garbage allocations.
- A new array is created to call the
CanEntityBeTargetedhook. - Every time the hook returns
false, that value is being boxed as an object. - When the plugin calls its internal
CheckExclusionmethod, it uses LINQ which is creating some garbage objects.
CanBeTargeted hook were changed to not allocate memory, that this warning would probably go away. thanks, so.. i will waiting for refactoring and must not to do something with it?
I can't say whether it's appropriate to the plugin on your server in it's current state. Up to you, depending on whether this issue is causing problems that players notice, and depends on how critical this plugin is for the experience you are trying to provide.
You will have to talk to nivex about the above suggested performance improvements. Unclear if he has seen this thread or plans on making those changes. I would contribute a patch but I'm too busy with many other plugins.
thank you for your time, I'm waiting for nivex to find time for this forum, I have questions in other plugins too:)
the only solution is to remove the hook (and LINQ because it's so terrible in its currently implemented version). implementing your suggestions would help some but would not fix the issue (lets not forget that OnNpcTarget(BasePlayer player, HTNPlayer npc) in the past) because of how often its called
i've already removed this hook and the linq in the next update but i haven't gotten around to finishing the update. though i believe it works fine if you want to try it.
https://pastebin.com/shZvWQya
save as TruePVE.cs
- Fixed SamSitesIgnoreMLRS flag
- Fixed potential NRE when tpve.trace is toggled on
- Fixed npc auto turrets being unable to target players
- Fixed trace not showing initiator if it was found later in the method
- Fixed animals ignore sleepers config option not blocking targetting of npcs
- Fixed a few issues where fire damage was allowed due to Death Notes plugin
- Fixed trap and turret flags not applying to some entities mounted with a player
- Fixed exception when using `tpve trace` instead of `tpve.trace` (can use either now)
- Fixed debug.refillvitals command being blocked
- Excluded radiation damage
- Added `Allow Killing Sleepers (Ally Only)` (false)
- Added `Ignore Firework Damage` (true)
- Added flag `NoPlayerDamageToMini`
- Added flag `NoPlayerDamageToScrap`
- Added flag `NoPlayerDamageToCar`
- Added flag `NpcsCanHurtAnything` - allows npcs to deal damage to anything (including players buildings)
- Added flag `StaticTurretsIgnorePlayers` - TurretsIgnorePlayers will no longer prevent static turrets from targeting unless this flag is added (monuments with turrets can now hurt players)
- Updated StaticSamSitesIgnorePlayers and PlayerSamSitesIgnorePlayers to ignore mountables not mounted by a player
- Updated `AuthorizedDamage` flag to use rules for modular car and other mountables (AuthorizedDamageRequiresOwnership STILL overrides AuthorizedDamage!)
- Updated `AuthorizedDamage` flag to allow ally damage when `CupboardOwnership` flag is not added and the entity is not a modular car or other mountable
- Updated `AuthorizedDamageRequiresOwnership` flag missing some deployables, modular cars and other mountables
- Updated default configuration to include SkyLantern in `dispensers` entity group
- Updated default configuration to include CustomScientistNPC in `npcs` entity group
- Updated default configuration to include snowmobiles entity group (snowmobile, tomahasnowmobile) with rule `nothing can hurt snowmobiles`
- Updated default configuration to separate bradley entity group (BradleyAPC, maincannonshell and exclude BasePlayer) from the npcs entity group with rule `bradley cannot hurt anything` (exclusion allows BasePlayer to take damage)
- Updated TwigDamage to take damage from any source instead of players only
- Allowed damage from all `assets/bundled/prefabs/modding/volumes_and_triggers/hurt/` map prefab triggers
- Blocked MLRS rocket damage when initiator is lost
- Blocked arrow, blunt, generic and heat damage when inititator is lost
- Removed SamSitesIgnorePlayers and added PlayerSamSitesIgnorePlayers and StaticSamSitesIgnorePlayers retroactively
- Updated OnSamSiteTarget to return true as it's a non-bool hook
- Removed LINQ
Not sure why I was directed to post in this thread, but the turrets not targeting players was fixed. It was a misconfiguration in the config.
because if it were a bug in the current version then it would have most likely been fixed in the update. no sense in me trying to chase the rabbit without trying to bury it in the hole to start with.