mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-20 20:45:28 +01:00
Alt right click refactor (#83736)
This commit is contained in:
+1
-19
@@ -94,7 +94,7 @@
|
||||
return
|
||||
if(LAZYACCESS(modifiers, ALT_CLICK)) // alt and alt-gr (rightalt)
|
||||
if(LAZYACCESS(modifiers, RIGHT_CLICK))
|
||||
alt_click_on_secondary(A)
|
||||
base_click_alt_secondary(A)
|
||||
else
|
||||
base_click_alt(A)
|
||||
return
|
||||
@@ -386,24 +386,6 @@
|
||||
A.CtrlClick(src)
|
||||
return
|
||||
|
||||
|
||||
///The base proc of when something is right clicked on when alt is held - generally use alt_click_secondary instead
|
||||
/atom/proc/alt_click_on_secondary(atom/A)
|
||||
. = SEND_SIGNAL(src, COMSIG_MOB_ALTCLICKON_SECONDARY, A)
|
||||
if(. & COMSIG_MOB_CANCEL_CLICKON)
|
||||
return
|
||||
A.alt_click_secondary(src)
|
||||
|
||||
///The base proc of when something is right clicked on when alt is held
|
||||
/atom/proc/alt_click_secondary(mob/user)
|
||||
if(!user.can_interact_with(src))
|
||||
return FALSE
|
||||
if(SEND_SIGNAL(src, COMSIG_CLICK_ALT_SECONDARY, user) & COMPONENT_CANCEL_CLICK_ALT_SECONDARY)
|
||||
return
|
||||
if(isobserver(user) && user.client && check_rights_for(user.client, R_DEBUG))
|
||||
user.client.toggle_tag_datum(src)
|
||||
return
|
||||
|
||||
/mob/proc/TurfAdjacent(turf/tile)
|
||||
return tile.Adjacent(src)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* ### Base proc for alt click interaction.
|
||||
* ### Base proc for alt click interaction left click.
|
||||
*
|
||||
* If you wish to add custom `click_alt` behavior for a single type, use that proc.
|
||||
*/
|
||||
@@ -53,7 +53,6 @@
|
||||
|
||||
client.loot_panel.open(tile)
|
||||
|
||||
|
||||
/**
|
||||
* ## Custom alt click interaction
|
||||
* Override this to change default alt click behavior. Return `CLICK_ACTION_SUCCESS`, `CLICK_ACTION_BLOCKING` or `NONE`.
|
||||
@@ -86,6 +85,46 @@
|
||||
return NONE
|
||||
|
||||
|
||||
/**
|
||||
* ### Base proc for alt click interaction right click.
|
||||
*
|
||||
* If you wish to add custom `click_alt_secondary` behavior for a single type, use that proc.
|
||||
*/
|
||||
/mob/proc/base_click_alt_secondary(atom/target)
|
||||
SHOULD_NOT_OVERRIDE(TRUE)
|
||||
|
||||
//Hook on the mob to intercept the click
|
||||
if(SEND_SIGNAL(src, COMSIG_MOB_ALTCLICKON_SECONDARY, target) & COMSIG_MOB_CANCEL_CLICKON)
|
||||
return
|
||||
|
||||
var/can_use_click_action = FALSE
|
||||
if(isturf(target))
|
||||
// Turfs are special because they can't be used with can_perform_action
|
||||
can_use_click_action = can_perform_turf_action(target)
|
||||
else
|
||||
can_use_click_action = can_perform_action(target, target.interaction_flags_click | SILENT_ADJACENCY)
|
||||
if(!can_use_click_action)
|
||||
return
|
||||
|
||||
//Hook on the atom to intercept the click
|
||||
if(SEND_SIGNAL(target, COMSIG_CLICK_ALT_SECONDARY, src) & COMPONENT_CANCEL_CLICK_ALT_SECONDARY)
|
||||
return
|
||||
if(isobserver(src) && client && check_rights_for(client, R_DEBUG))
|
||||
client.toggle_tag_datum(src)
|
||||
return
|
||||
target.click_alt_secondary(src)
|
||||
|
||||
/**
|
||||
* ## Custom alt click secondary interaction
|
||||
* Override this to change default alt right click behavior.
|
||||
*
|
||||
* ### Guard clauses
|
||||
* Consider adding `interaction_flags_click` before adding unique guard clauses.
|
||||
**/
|
||||
/atom/proc/click_alt_secondary(mob/user)
|
||||
SHOULD_CALL_PARENT(FALSE)
|
||||
return NONE
|
||||
|
||||
/// Helper proc to validate turfs. Used because can_perform_action does not support turfs.
|
||||
/mob/proc/can_perform_turf_action(turf/target)
|
||||
if(!CanReach(target)) // No error message for parity with SILENT_ADJACENCY
|
||||
|
||||
@@ -56,6 +56,7 @@
|
||||
icon_state = "card_grey"
|
||||
worn_icon_state = "nothing"
|
||||
slot_flags = ITEM_SLOT_ID
|
||||
interaction_flags_click = FORBID_TELEKINESIS_REACH
|
||||
armor_type = /datum/armor/card_id
|
||||
resistance_flags = FIRE_PROOF | ACID_PROOF
|
||||
|
||||
@@ -633,9 +634,6 @@
|
||||
/obj/item/card/id/proc/alt_click_can_use_id(mob/living/user)
|
||||
if(!isliving(user))
|
||||
return FALSE
|
||||
if(!user.can_perform_action(src, FORBID_TELEKINESIS_REACH))
|
||||
return FALSE
|
||||
|
||||
return TRUE
|
||||
|
||||
/// Attempts to set a new bank account on the ID card.
|
||||
@@ -706,13 +704,11 @@
|
||||
registered_account.bank_card_talk(span_warning("ERROR: The linked account requires [difference] more credit\s to perform that withdrawal."), TRUE)
|
||||
return CLICK_ACTION_BLOCKING
|
||||
|
||||
/obj/item/card/id/alt_click_secondary(mob/user)
|
||||
. = ..()
|
||||
/obj/item/card/id/click_alt_secondary(mob/user)
|
||||
if(!alt_click_can_use_id(user))
|
||||
return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN
|
||||
return
|
||||
if(!registered_account || registered_account.replaceable)
|
||||
set_new_account(user)
|
||||
return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN
|
||||
|
||||
/obj/item/card/id/proc/pay_debt(user)
|
||||
var/amount_to_pay = tgui_input_number(user, "How much do you want to pay? (Max: [registered_account.account_balance] cr)", "Debt Payment", max_value = min(registered_account.account_balance, registered_account.account_debt))
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
icon = 'icons/obj/clothing/neck.dmi'
|
||||
body_parts_covered = NECK
|
||||
slot_flags = ITEM_SLOT_NECK
|
||||
interaction_flags_click = NEED_DEXTERITY
|
||||
strip_delay = 40
|
||||
equip_delay_other = 40
|
||||
|
||||
@@ -103,11 +104,8 @@
|
||||
user.update_clothing(ITEM_SLOT_NECK)
|
||||
return CLICK_ACTION_SUCCESS
|
||||
|
||||
/obj/item/clothing/neck/tie/alt_click_secondary(mob/user)
|
||||
. = ..()
|
||||
if(!user.can_perform_action(src, NEED_DEXTERITY))
|
||||
return
|
||||
alternate_worn_layer = alternate_worn_layer == initial(alternate_worn_layer) ? NONE : initial(alternate_worn_layer)
|
||||
/obj/item/clothing/neck/tie/click_alt_secondary(mob/user)
|
||||
alternate_worn_layer = (alternate_worn_layer == initial(alternate_worn_layer) ? NONE : initial(alternate_worn_layer))
|
||||
user.update_clothing(ITEM_SLOT_NECK)
|
||||
balloon_alert(user, "wearing [alternate_worn_layer == initial(alternate_worn_layer) ? "below" : "above"] suits")
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
righthand_file = 'icons/mob/inhands/clothing/suits_righthand.dmi'
|
||||
body_parts_covered = CHEST|GROIN|LEGS|ARMS
|
||||
slot_flags = ITEM_SLOT_ICLOTHING
|
||||
interaction_flags_click = NEED_DEXTERITY
|
||||
armor_type = /datum/armor/clothing_under
|
||||
equip_sound = 'sound/items/equip/jumpsuit_equip.ogg'
|
||||
drop_sound = 'sound/items/handling/cloth_drop.ogg'
|
||||
@@ -378,17 +379,10 @@
|
||||
rolldown()
|
||||
return CLICK_ACTION_SUCCESS
|
||||
|
||||
/obj/item/clothing/under/alt_click_secondary(mob/user)
|
||||
. = ..()
|
||||
if(.)
|
||||
return
|
||||
|
||||
/obj/item/clothing/under/click_alt_secondary(mob/user)
|
||||
if(!LAZYLEN(attached_accessories))
|
||||
balloon_alert(user, "no accessories to remove!")
|
||||
return
|
||||
if(!user.can_perform_action(src, NEED_DEXTERITY))
|
||||
return
|
||||
|
||||
pop_accessory(user)
|
||||
|
||||
/obj/item/clothing/under/verb/jumpsuit_adjust()
|
||||
|
||||
@@ -239,14 +239,13 @@
|
||||
update_appearance()
|
||||
return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN
|
||||
|
||||
/obj/item/gun/ballistic/shotgun/bulldog/alt_click_secondary(mob/user)
|
||||
/obj/item/gun/ballistic/shotgun/bulldog/click_alt_secondary(mob/user)
|
||||
if(secondary_magazine)
|
||||
var/obj/item/ammo_box/magazine/old_mag = secondary_magazine
|
||||
secondary_magazine = null
|
||||
user.put_in_hands(old_mag)
|
||||
update_appearance()
|
||||
playsound(src, load_empty_sound, load_sound_volume, load_sound_vary)
|
||||
return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN
|
||||
|
||||
/obj/item/gun/ballistic/shotgun/bulldog/proc/toggle_magazine()
|
||||
var/primary_magazine = magazine
|
||||
|
||||
@@ -434,13 +434,10 @@
|
||||
replace_beaker(user, TRUE)
|
||||
return CLICK_ACTION_SUCCESS
|
||||
|
||||
/obj/machinery/chem_mass_spec/alt_click_secondary(mob/living/user)
|
||||
. = ..()
|
||||
if(!can_interact(user))
|
||||
return
|
||||
/obj/machinery/chem_mass_spec/click_alt_secondary(mob/living/user)
|
||||
if(processing_reagents)
|
||||
balloon_alert(user, "still processing!")
|
||||
return ..()
|
||||
return
|
||||
replace_beaker(user, FALSE)
|
||||
|
||||
/obj/machinery/chem_mass_spec/process(seconds_per_tick)
|
||||
|
||||
Reference in New Issue
Block a user