Skip to content

Clicking Documentation

BurgerLUA edited this page Aug 14, 2020 · 2 revisions

Want to figure out how interaction works?

Variables

  • var/interaction_flags (atom) (default FLAG_INTERACTION_LIVING) flag that controls what can interact with the object, which is handled in an atom proc called can_caller_interact_with(var/mob/caller,var/enable_message = TRUE). Possible values:
    • FLAG_INTERACTION_NONE (Cannot interact.)
    • FLAG_INTERACTION_LIVING (Living can interact. Without this flag means that living cannot interact.)
    • FLAG_INTERACTION_DEAD (Dead people can interact. Without this flag means that dead people cannot interact with it.)
    • FLAG_INTERACTION_NO_HORIZONTAL (Add this flag to prevent horizontal people from interacting.)
    • FLAG_INTERACTION_NO_DISTANCE (Add this flag to disable distance checks. Good if you do your own distance checks.) Flags are bits that can be combined into one bit.

Arguments

  • usr should be avoided at all costs. Do not use this variable.
  • caller always a mob, it's the mob that called this proc.
  • object always another atom, the one that's being interacted on or with.
  • location the turf, stat panel, grid cell, etc. in which the object was clicked.
  • params other parameters including mouse/keyboard flags, icon offsets. This was already converted into a list from params2list so don't convert twice!

Proc - Core

/atom/proc/click_on_object(var/mob/caller as mob,var/atom/object,location,control,params)

What this atom (src) should do when it clicks on another atom (object) by a mob (caller). Return TRUE on success, FALSE on failure.

/atom/proc/clicked_on_by_object(var/mob/caller as mob,var/atom/object,location,control,params)

What this atom (src) should do when it's clicked on by another atom (object) by a mob(caller). Return TRUE on success, FALSE on failure.

/atom/proc/click_self(var/mob/caller as mob,location,control,params)

What this atom (src) should do when it's activated in hands by a mob (caller). Return TRUE on success, FALSE on failure.

Proc - Helpers

/atom/proc/defer_click_on_object(location,control,params)

Returns the object it SHOULD click on when the src is clicked on, such as the top inventory object in an inventory. Should be used inside defer_click_on_object or click_on_object.

/client/proc/get_click_flags(aug,var/check_swap = FALSE)

Converts the client's params click into clickflags, which are altered by player preference. Returns one or more bitflags of CLICK_RIGHT, CLICK_LEFT, and CLICK_MIDDLE.

Defines

INTERACT_CHECK

Performs a check to see if the object can actually be clicked on by the caller. Args do not need to be passed as it is done automatically.