Skip to content

Adding an Interact hotkey. - #5364

Open
MistakeNot4892 wants to merge 1 commit into
NebulaSS13:devfrom
MistakeNot4892:tweak/interact_key
Open

Adding an Interact hotkey.#5364
MistakeNot4892 wants to merge 1 commit into
NebulaSS13:devfrom
MistakeNot4892:tweak/interact_key

Conversation

@MistakeNot4892

@MistakeNot4892 MistakeNot4892 commented May 13, 2026

Copy link
Copy Markdown
Contributor
  • Adds an Interact hotkey that attempts to click on the turf you are facing.
  • Adds interaction_priority to mark atoms that we are most interested in interacting with (so that lights above airlocks do not block interacting with the airlock).

@MistakeNot4892 MistakeNot4892 added the ready for review This PR is ready for review and merge. label May 13, 2026
@MistakeNot4892
MistakeNot4892 force-pushed the tweak/interact_key branch 2 times, most recently from e53a9e4 to b425a19 Compare May 22, 2026 03:28

@out-of-phaze out-of-phaze left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems good except for some nitpicks

Comment thread code/modules/keybindings/binds/mob.dm Outdated
Comment on lines +205 to +211
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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread code/modules/keybindings/binds/mob.dm Outdated

// Try to click something.
for(var/atom/clickable as anything in atoms)
if(!clickable.simulated)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simplified the block a fair bit.

@out-of-phaze out-of-phaze added awaiting author This PR is awaiting action from the author before it can be merged. and removed ready for review This PR is ready for review and merge. labels Jul 9, 2026
@MistakeNot4892 MistakeNot4892 added ready for review This PR is ready for review and merge. and removed awaiting author This PR is awaiting action from the author before it can be merged. labels Aug 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready for review This PR is ready for review and merge.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants