SteveTownsend/SmartHarvestSE

Rework Actor Detection checking in theft logic to use Papyrus Extender

SteveTownsend opened this issue · 4 comments

Papyrus Extender has a function IsDetectedByAnyone which should massively simplify things

Testing speed of pickup in Bards College - this is very slow as it stands. Prioritizing higher.

	Line 1130687: 2024-03-18 20:25:23.985    trace  54012 Steal 66 items/containers under the nose of 9 Actors
	Line 1134826: 2024-03-18 20:25:24.604    trace  44844 Detected = false for stealing of 66 items/containers
	Line 1140260: 2024-03-18 20:25:25.040    trace  54012 Steal 70 items/containers under the nose of 9 Actors
	Line 1210034: 2024-03-18 20:25:34.112    trace  41400 Detected = false for stealing of 70 items/containers
	Line 1215410: 2024-03-18 20:25:34.509    trace  54012 Steal 58 items/containers under the nose of 9 Actors
	Line 1303271: 2024-03-18 20:25:46.507    trace  10960 Detected = false for stealing of 58 items/containers

This need not be scripted at all. Use the logic here inline, if it's thread-safe - use Task Interface, if not.
https://github.com/powerof3/PapyrusExtenderSSE/blob/0d5d48485b444e73b641b43a99db35e7c5dcef4a/include/Papyrus/Functions/Detection.h#L61

After changing to use TaskInterface, the same item theft completes very fast:

	Line 1143648: 2024-03-19 07:36:51.893    trace  51404 Detected = false for stealing of 66 items/containers
	Line 1149025: 2024-03-19 07:36:52.426    trace  21036 Detected = false for stealing of 70 items/containers
	Line 1154577: 2024-03-19 07:36:52.940    trace  51404 Detected = false for stealing of 58 items/containers
	Line 1159683: 2024-03-19 07:36:53.475    trace  51404 Detected = false for stealing of 73 items/containers
	Line 1164983: 2024-03-19 07:36:53.992    trace  56736 Detected = false for stealing of 70 items/containers
	Line 1170408: 2024-03-19 07:36:54.525    trace   9204 Detected = false for stealing of 73 items/containers
	Line 1175777: 2024-03-19 07:36:55.058    trace  51404 Detected = false for stealing of 69 items/containers

This is re-implemented in C++ and working. Theft still may not be completely bulletproof, but it's way faster and less likely to get you arrested now.