mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-14 11:42:27 +00:00
* Circuit health analyzer/state components now work on targets inside lockers (#85649) <!-- Write **BELOW** The Headers and **ABOVE** The comments else it may not be viewable. --> <!-- You can view Contributing.MD for a detailed description of the pull request process. --> ## About The Pull Request Makes circuit health analyzer/scanner components check distance to target turf instead of target itself similarly to (most) other components. (There are exceptions, presumably due to balancing? concerns, but this feels like it should not have been one) This doesn't feel intentional so I marked it as a fix, given that BCIs stopping being able to scan their occupant is rather nonsensical ## Why It's Good For The Game Currently BCIs with health analyzer components stop working if the owner goes into a locker which is pretty stupid. Most components also only check for turf distance, and while this could theoretically be used to pinpoint someone's hiding spot there are far better ways to do so with circuits ## Changelog <!-- If your PR modifies aspects of the game that can be concretely observed by players or admins you should add a changelog. If your change does NOT meet this description, remove this section. Be sure to properly mark your PRs to prevent unnecessary GBP loss. You can read up on GBP and its effects on PRs in the tgstation guides for contributors. Please note that maintainers freely reserve the right to remove and add tags should they deem it appropriate. You can attempt to finagle the system all you want, but it's best to shoot for clear communication right off the bat. --> 🆑 fix: Circuit health analyzer/state components now work on targets inside lockers /🆑 <!-- Both 🆑's are required for the changelog to work! You can put your name to the right of the first 🆑 if you want to overwrite your GitHub username as author ingame. --> <!-- You can use multiple of the same prefix (they're only used for the icon ingame) and delete the unneeded ones. Despite some of the tags, changelogs should generally represent how a player might be affected by the changes rather than a summary of the PR's contents. --> * Circuit health analyzer/state components now work on targets inside lockers --------- Co-authored-by: SmArtKar <44720187+SmArtKar@users.noreply.github.com>
61 lines
1.7 KiB
Plaintext
61 lines
1.7 KiB
Plaintext
/**
|
|
* # Get Health Component
|
|
*
|
|
* Return the health of a mob
|
|
*/
|
|
/obj/item/circuit_component/health
|
|
display_name = "Get Health"
|
|
desc = "A component that returns the health of an organism."
|
|
category = "Entity"
|
|
|
|
/// The input port
|
|
var/datum/port/input/input_port
|
|
|
|
/// Brute damage
|
|
var/datum/port/output/brute
|
|
/// Burn damage
|
|
var/datum/port/output/burn
|
|
/// Toxin damage
|
|
var/datum/port/output/toxin
|
|
/// Oxyloss damage
|
|
var/datum/port/output/oxy
|
|
/// Health
|
|
var/datum/port/output/health
|
|
|
|
circuit_flags = CIRCUIT_FLAG_INPUT_SIGNAL|CIRCUIT_FLAG_OUTPUT_SIGNAL
|
|
|
|
var/max_range = 5
|
|
|
|
/obj/item/circuit_component/health/get_ui_notices()
|
|
. = ..()
|
|
. += create_ui_notice("Maximum Range: [max_range] tiles", "orange", "info")
|
|
|
|
/obj/item/circuit_component/health/populate_ports()
|
|
input_port = add_input_port("Organism", PORT_TYPE_ATOM)
|
|
|
|
brute = add_output_port("Brute Damage", PORT_TYPE_NUMBER)
|
|
burn = add_output_port("Burn Damage", PORT_TYPE_NUMBER)
|
|
toxin = add_output_port("Toxin Damage", PORT_TYPE_NUMBER)
|
|
oxy = add_output_port("Suffocation Damage", PORT_TYPE_NUMBER)
|
|
health = add_output_port("Health", PORT_TYPE_NUMBER)
|
|
|
|
/obj/item/circuit_component/health/input_received(datum/port/input/port)
|
|
|
|
var/mob/living/organism = input_port.value
|
|
var/turf/current_turf = get_location()
|
|
var/turf/target_location = get_turf(organism)
|
|
if(!istype(organism) || get_dist(current_turf, target_location) > max_range || current_turf.z != target_location.z)
|
|
brute.set_output(null)
|
|
burn.set_output(null)
|
|
toxin.set_output(null)
|
|
oxy.set_output(null)
|
|
health.set_output(null)
|
|
return
|
|
|
|
brute.set_output(organism.getBruteLoss())
|
|
burn.set_output(organism.getFireLoss())
|
|
toxin.set_output(organism.getToxLoss())
|
|
oxy.set_output(organism.getOxyLoss())
|
|
health.set_output(organism.health)
|
|
|