File size: 479 Bytes
970fc3e
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
function clearEntityTargets(objects, id) {
  return objects.map((object) => {
    if (object.aimTargetId !== id && object.track?.targetId !== id) return object;
    const next = { ...object };
    if (next.aimTargetId === id) delete next.aimTargetId;
    if (next.track?.targetId === id) next.track = { ...next.track, targetId: null, orientation: next.track.orientation === "target" ? "fixed" : next.track.orientation };
    return next;
  });
}
export {
  clearEntityTargets
};