mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-29 08:08:49 +01:00
## About The Pull Request You no longer have to manually target each limb when trying to repair synthetic people just like with organic people ## Why It's Good For The Game Targeting each body zone is annoying, just think about the people without number pad that have to click every body part in bottom right ## Proof Of Testing <details> <summary>Screenshots/Videos</summary> https://github.com/user-attachments/assets/977c1831-69ea-42f4-9adf-fe8be2152527 </details> ## Changelog 🆑 qol: welding tool and cable coil will now automatically switch to damaged synthetic limbs just like sutures and regen meshes /🆑 --------- Co-authored-by: Alexis <catmc8565@gmail.com>
57 lines
2.8 KiB
Plaintext
57 lines
2.8 KiB
Plaintext
/obj/item/weldingtool/interact_with_atom(atom/interacting_with, mob/living/user, list/modifiers)
|
|
if(!status && interacting_with.is_refillable())
|
|
reagents.trans_to(interacting_with, reagents.total_volume, transferred_by = user)
|
|
to_chat(user, span_notice("You empty [src]'s fuel tank into [interacting_with]."))
|
|
update_appearance()
|
|
return ITEM_INTERACT_SUCCESS
|
|
if(!ishuman(interacting_with))
|
|
return NONE
|
|
if(user.combat_mode)
|
|
return NONE
|
|
|
|
return try_heal(interacting_with, user)
|
|
|
|
/obj/item/weldingtool/proc/try_heal(atom/interacting_with, mob/living/user)
|
|
var/mob/living/carbon/carbon_patient = interacting_with
|
|
var/obj/item/bodypart/preferred_limb = carbon_patient.get_bodypart(check_zone(user.zone_selected))
|
|
if(isnull(preferred_limb) || !IS_ROBOTIC_LIMB(preferred_limb))
|
|
return NONE
|
|
if(!(preferred_limb.brute_dam > 0))
|
|
balloon_alert(user, "limb not damaged")
|
|
return ITEM_INTERACT_BLOCKING
|
|
var/list/damaged_limbs = list()
|
|
for(var/obj/item/bodypart/limb as anything in carbon_patient.bodyparts)
|
|
if(isnull(limb) || !IS_ROBOTIC_LIMB(limb) || !(limb.brute_dam > 0))
|
|
continue
|
|
damaged_limbs += limb
|
|
return try_auto_heal(interacting_with, user, damaged_limbs, preferred_limb)
|
|
|
|
/obj/item/weldingtool/proc/try_auto_heal(atom/interacting_with, mob/living/user, list/damaged_limbs, preferred_limb)
|
|
var/mob/living/carbon/human/attacked_humanoid = interacting_with
|
|
var/obj/item/bodypart/repaired = (preferred_limb in damaged_limbs) ? preferred_limb : damaged_limbs[1]
|
|
if(!(repaired.brute_dam > 0))
|
|
var/list/updated_damaged_limbs = damaged_limbs
|
|
updated_damaged_limbs.Remove(repaired)
|
|
if(!length(damaged_limbs))
|
|
user.balloon_alert(user, "fully repaired")
|
|
return ITEM_INTERACT_SUCCESS
|
|
user.balloon_alert(user, "repairing [updated_damaged_limbs[1]]")
|
|
INVOKE_ASYNC(src, PROC_REF(try_auto_heal), interacting_with, user, updated_damaged_limbs, preferred_limb)
|
|
return
|
|
|
|
user.visible_message(span_notice("[user] starts to fix some of the dents on [attacked_humanoid == user ? user.p_their() : "[attacked_humanoid]'s"] [repaired.name]."),
|
|
span_notice("You start fixing some of the dents on [attacked_humanoid == user ? "your" : "[attacked_humanoid]'s"] [repaired.name]."))
|
|
var/use_delay = 1 SECONDS
|
|
if(user == attacked_humanoid)
|
|
use_delay = 5 SECONDS
|
|
|
|
if(!use_tool(attacked_humanoid, user, use_delay, volume=50, amount=1))
|
|
return ITEM_INTERACT_BLOCKING
|
|
|
|
repaired.heal_damage(brute = 15, burn = 0, required_bodytype = BODYTYPE_ROBOTIC)
|
|
user.visible_message(span_notice("[user] fixes some of the dents on [attacked_humanoid]'s [repaired.name]."), \
|
|
span_notice("You fix some of the dents on [attacked_humanoid == user ? "your" : "[attacked_humanoid]'s"] [repaired.name]."))
|
|
|
|
INVOKE_ASYNC(src, PROC_REF(try_auto_heal), interacting_with, user, damaged_limbs, preferred_limb)
|
|
return ITEM_INTERACT_SUCCESS
|