From 9744bc614ddf7ad827b3f0576821f5d1629799d0 Mon Sep 17 00:00:00 2001 From: Metis <100518708+sheepishgoat@users.noreply.github.com> Date: Sun, 26 May 2024 18:52:31 -0400 Subject: [PATCH] circuit --- GainStation13/code/obj/items/circuits.dm | 30 +++++++++++++++++++++++ GainStation13/code/obj/structure/scale.dm | 5 +++- code/__DEFINES/misc.dm | 2 ++ tgstation.dme | 1 + 4 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 GainStation13/code/obj/items/circuits.dm diff --git a/GainStation13/code/obj/items/circuits.dm b/GainStation13/code/obj/items/circuits.dm new file mode 100644 index 00000000..19d48918 --- /dev/null +++ b/GainStation13/code/obj/items/circuits.dm @@ -0,0 +1,30 @@ +/obj/item/integrated_circuit/input/fat_scanner + name = "integrated body fat analyser" + desc = "A very small version of the common medical analyser adjusted to scan a target's weight." + icon_state = "medscan" + complexity = 4 + inputs = list("target" = IC_PINTYPE_REF) + outputs = list( + "weight (pounds)" = IC_PINTYPE_NUMBER, + "weight (BFI)" = IC_PINTYPE_NUMBER + ) + activators = list("scan" = IC_PINTYPE_PULSE_IN, "on scanned" = IC_PINTYPE_PULSE_OUT) + spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH + power_draw_per_use = 40 + +/obj/item/integrated_circuit/input/fat_scanner/do_work() + var/mob/living/carbon/fatty = get_pin_data_as_type(IC_INPUT, 1, /mob/living) + if(!istype(fatty)) //Invalid input + return + if(!fatty.Adjacent(get_turf(src))) // Like normal analysers, it can't be used at range. + return + + var/weight_in_pounds = fatty.calculate_weight_in_pounds() + var/weight_in_fatness = fatty.fatness + + set_pin_data(IC_OUTPUT, 1, weight_in_pounds) + set_pin_data(IC_OUTPUT, 2, weight_in_fatness) + + push_data() + activate_pin(2) + diff --git a/GainStation13/code/obj/structure/scale.dm b/GainStation13/code/obj/structure/scale.dm index 87913fd8..488d9eda 100644 --- a/GainStation13/code/obj/structure/scale.dm +++ b/GainStation13/code/obj/structure/scale.dm @@ -71,8 +71,11 @@ weighperson(HM) /obj/structure/scale/proc/weighperson(mob/living/carbon/human/fatty) - src.lastreading = round((140 + (fatty.fatness*src.fatnessToWeight))*(fatty.size_multiplier**2)*((fatty.dna.features["taur"] != "None") ? 2.5: 1)) + src.lastreading = fatty.calculate_weight_in_pounds() weighEffect(fatty) visible_message("[fatty] weighs themselves.") visible_message("The numbers on the screen settle on: [src.lastreading]Lbs.") visible_message("The numbers on the screen read out: [fatty] has a BFI of [fatty.fatness].") + +/mob/living/carbon/proc/calculate_weight_in_pounds() + return round((140 + (fatness*FATNESS_TO_WEIGHT_RATIO))*(size_multiplier**2)*((dna.features["taur"] != "None") ? 2.5: 1)) diff --git a/code/__DEFINES/misc.dm b/code/__DEFINES/misc.dm index 8f9ad059..d51813ec 100644 --- a/code/__DEFINES/misc.dm +++ b/code/__DEFINES/misc.dm @@ -528,3 +528,5 @@ GLOBAL_LIST_INIT(lighter_reskins, list(ZIPPO_SKIN_PLAIN = "plain", ZIPPO_SKIN_DA #define FATTENING_TYPE_MAGIC "magic" #define FATTENING_TYPE_VIRUS "virus" #define FATTENING_TYPE_WEIGHT_LOSS "weight_loss" + +#define FATNESS_TO_WEIGHT_RATIO 0.25 diff --git a/tgstation.dme b/tgstation.dme index 857ac0ea..68d48fea 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -3126,6 +3126,7 @@ #include "GainStation13\code\modules\vending\gatocola.dm" #include "GainStation13\code\modules\vending\mealdor.dm" #include "GainStation13\code\obj\items\bluespace_belt.dm" +#include "GainStation13\code\obj\items\circuits.dm" #include "GainStation13\code\obj\items\holy.dm" #include "GainStation13\code\obj\items\minor_items.dm" #include "GainStation13\code\obj\items\sensors\weight_infared.dm"