trackable
- comment
Trackables can register both click and hover events by players. But they don't provide a way to get the triggering player. In fact the only (as of writing) functions that have the trackable type in their signature are:
CreateTrackableTriggerRegisterTrackableHitEventTriggerRegisterTrackableTrackEventGetTriggeringTrackableSaveTrackableHandleLoadTrackableHandle
To create a trackable which can distinguish the triggering player we simply create a trackable for each player but with a locally different path:
function CreateTrackableForPlayer takes player p, string path, real x, real y, real facing returns trackable if GetLocalPlayer() != p then set path = "" endif return CreateTrackable(path, x, y, facing) endfunctionNow using something like
hashtables or lua tables we can attach the correct player to the trackable handle and retrieve it by accessingGetTriggeringTrackable. You can use the same technique to attach other information like the trackables position, facing, etc.- note
See
CreateTrackablefor a way to create a trackable with a non-zero z-coordinate.- patch
1.00
- Source
- common.j (suggest an edit or discuss on Github)
- Source code
type trackable extends agent