LabAPI icon indicating copy to clipboard operation
LabAPI copied to clipboard

[IDEA] Add custom fields to Footprint

Open hatulaile opened this issue 1 year ago • 4 comments

Goal Description

Perhaps we can add a string field to store data. It's very troublesome to ask Footprint to save other states, such as asking FlashbangGrenade to determine the player's health when thrown.

Notes

However, it may affect performance

hatulaile avatar Oct 29 '25 16:10 hatulaile

You can create a ConditionalWeakTable and use the footprint's Stopwatch field as a key. This lets you attach your own classes to the footprint while letting the stopwatch be collected by the GC.

Axwabo avatar Oct 29 '25 17:10 Axwabo

You can create a ConditionalWeakTable and use the footprint's Stopwatch field as a key. This lets you attach your own classes to the footprint while letting the stopwatch be collected by the GC.

This is a good idea, I'll give it a try Thank you.

hatulaile avatar Oct 29 '25 18:10 hatulaile

@hatulaile You can also track footprints with a normal dictionary, as GetHashCode() returns its serial.

Axwabo avatar Nov 25 '25 17:11 Axwabo

你也可以用普通字典追踪足迹,因为它会返回序列号。GetHashCode()

It's indeed possible, but at the end of the game, you still need to clean up the regular dictionary

hatulaile avatar Nov 25 '25 18:11 hatulaile