mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-21 22:47:19 +00:00
## About The Pull Request Implements half of this (with some minor changes):  The ultimate goal of this is to split our attack chain in two: - One for non-combat item interactions - Health analyzer scanning - using tools on stuff - surgery - Niche other interactions - One for combat attacking - Item hit thing, item deal damage. - Special effects on attack would go here. This PR begins this by broadining tool act into item interact. Item interact is a catch-all proc ran at the beginning of attack chain, before `pre_attack` and such, that handles the first part of the chain. This allows us to easily catch item interaction and cancel the attack part of the chain by using deliberate bitflag return values, rather than `TRUE` / `FALSE`*. *Because right now, `TRUE` = `cancel attack`, no matter what, which is unclear to people. Instead of moving as much as possible to the new proc in this PR, I started by doing some easy, obvious things. More things can be moved in the future, or technically they don't even need to move in a lot of cases. ## Changelog 🆑 Melbert refactor: Refactored some methods of items interacting with other objects or mobs, such as surgery and health analzyers. Report if anything seems wrong /🆑
40 lines
1.4 KiB
Plaintext
40 lines
1.4 KiB
Plaintext
// APC HULL
|
|
/obj/item/wallframe/apc
|
|
name = "\improper APC frame"
|
|
desc = "Used for repairing or building APCs."
|
|
icon_state = "apc"
|
|
result_path = /obj/machinery/power/apc/auto_name
|
|
|
|
/obj/item/wallframe/apc/try_build(turf/on_wall, user)
|
|
if(!..())
|
|
return
|
|
var/turf/T = get_turf(on_wall) //the user is not where it needs to be.
|
|
var/area/A = get_area(user)
|
|
if(A.apc)
|
|
to_chat(user, span_warning("This area already has an APC!"))
|
|
return //only one APC per area
|
|
if(!A.requires_power)
|
|
to_chat(user, span_warning("You cannot place [src] in this area!"))
|
|
return //can't place apcs in areas with no power requirement
|
|
for(var/obj/machinery/power/terminal/E in T)
|
|
if(E.master)
|
|
to_chat(user, span_warning("There is another network terminal here!"))
|
|
return
|
|
else
|
|
new /obj/item/stack/cable_coil(T, 10)
|
|
to_chat(user, span_notice("You cut the cables and disassemble the unused power terminal."))
|
|
qdel(E)
|
|
return TRUE
|
|
|
|
/obj/item/wallframe/apc/screwdriver_act(mob/living/user, obj/item/tool)
|
|
//overriding the wallframe parent screwdriver act with this one which allows applying to existing apc frames.
|
|
|
|
var/turf/T = get_step(get_turf(user), user.dir)
|
|
if(iswallturf(T))
|
|
if(locate(/obj/machinery/power/apc) in get_turf(user))
|
|
var/obj/machinery/power/apc/mounted_apc = locate(/obj/machinery/power/apc) in get_turf(user)
|
|
mounted_apc.attackby(src, user)
|
|
return ITEM_INTERACT_SUCCESS
|
|
T.attackby(src, user)
|
|
return ITEM_INTERACT_SUCCESS
|