Files
Bubberstation/code/modules/paperwork/carbonpaper.dm
T
JeremiahandGitHub 8e3f635b98 Alt click refactor (#82656)
## About The Pull Request
Rewrites how alt click works. 
Based heavily on #82625. What a cool concept, it flows nicely with
#82533.

Fixes #81242 
(tm bugs fixed)
Fixes #82668

<details><summary>More info for devs</summary>

Handy regex used for alt click s&r:
`AltClick\((.*).*\)(\n\t.*\.\.\(\))?`
`click_alt($1)` (yes I am aware this only copies the first arg. there
are no other args!)

### Obj reskins
No reason for obj reskin to check on every single alt click for every
object. It applies to only a few items.
- Moved to obj/item
- Made into signal
- Added screentips

### Ventcrawling
Every single atmospherics machine checked for ventcrawling capability on
alt click despite only 3 objects needing that functionality. This has
been moved down to those individual items.
</details>

## Why It's Good For The Game
For players: 
- Alt clicking should work more logically, not causing double actions
like eject disk and open item window
- Added context menus for reskinnable items
- Removed adjacency restriction on loot panel

For devs:
- Makes alt click interactions easier to work with, no more click chain
nonsense and redundant guard clauses.
- OOP hell reduced
- Pascal Case reduced
- Glorious snake case

## Changelog
🆑
add: The lootpanel now works at range.
add: Screentips for reskinnable items.
fix: Alt click interactions have been refactored, which may lead to
unintentional changes to gameplay. Report any issues, please.
/🆑
2024-04-16 17:48:03 -06:00

52 lines
1.4 KiB
Plaintext

/obj/item/paper/carbon
name = "sheet of carbon"
icon_state = "paper_stack"
inhand_icon_state = "paper"
show_written_words = FALSE
var/copied = FALSE
/obj/item/paper/carbon/update_icon_state()
if(copied)
icon_state = "paper"
else
icon_state = "paper_stack"
if(get_total_length())
icon_state = "[icon_state]_words"
return ..()
/obj/item/paper/carbon/examine()
. = ..()
if(copied)
return
. += span_notice("Right-click to tear off the carbon-copy (you must use both hands).")
/obj/item/paper/carbon/click_alt(mob/living/user)
if(!copied)
to_chat(user, span_notice("Take off the carbon copy first."))
return CLICK_ACTION_BLOCKING
return CLICK_ACTION_SUCCESS
/obj/item/paper/carbon/proc/removecopy(mob/living/user)
if(copied)
to_chat(user, span_notice("There are no more carbon copies attached to this paper!"))
return
var/obj/item/paper/carbon/copy = copy(/obj/item/paper/carbon_copy, loc.drop_location(), FALSE)
copy.name = "\improper Copy - [name]"
to_chat(user, span_notice("You tear off the carbon-copy!"))
copied = TRUE
update_icon_state()
user.put_in_hands(copy)
/obj/item/paper/carbon/attack_hand_secondary(mob/user, list/modifiers)
. = ..()
if(. == SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN)
return
if(loc == user && user.is_holding(src))
removecopy(user)
return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN
/obj/item/paper/carbon_copy
icon_state = "cpaper"