Adding an Interact hotkey. - #5364
Conversation
e53a9e4 to
b425a19
Compare
out-of-phaze
left a comment
There was a problem hiding this comment.
seems good except for some nitpicks
| var/list/atoms = sortTim(facing.contents.Copy(), /proc/cmp_planelayer) | ||
|
|
||
| // Move non-prioritised atoms to the end of the list (to avoid burning our hands on lights when trying to open a closet) | ||
| for(var/atom/clickable as anything in atoms) | ||
| if(!clickable.interaction_priority) | ||
| atoms -= clickable | ||
| atoms += clickable |
There was a problem hiding this comment.
wonder if it might be faster to create a custom comparator that's cmp_planelayer but anything with interaction_priority is sorted lower. that'd lower the number of times we need to loop over the contents list at least. not blocking but i'd at least like to consider it
There was a problem hiding this comment.
Something like this? Not completely confident it will sort as expected.
/proc/cmp_planelayer_interact_priority(atom/A, atom/B)
if(A.interaction_priority != B.interaction_priority)
return (B.interaction_priority - A.interaction_priority)
return (B.plane - A.plane) || (B.layer - A.layer)
There was a problem hiding this comment.
i think so? because that means anything with a higher interaction priority will be sorted later, and within the interaction priorities theyll be sorted by plane and layer.
|
|
||
| // Try to click something. | ||
| for(var/atom/clickable as anything in atoms) | ||
| if(!clickable.simulated) |
There was a problem hiding this comment.
if we use facing.get_contained_external_atoms() instead of just facing.contents we can skip the simulated check and probably some other things we want to avoid here too
There was a problem hiding this comment.
Simplified the block a fair bit.
b425a19 to
8dcb485
Compare
8dcb485 to
23ddf52
Compare
interaction_priorityto mark atoms that we are most interested in interacting with (so that lights above airlocks do not block interacting with the airlock).