From 8ea0e54c78c4bb623fe7baa17cfe22a179039dac Mon Sep 17 00:00:00 2001 From: Alphas00 <154434082+Alphas00@users.noreply.github.com> Date: Mon, 20 May 2024 22:38:05 +0200 Subject: [PATCH 1/2] Adipoelectric Generator fix HOPEFULLY fixes the null.fatness_real problem with the adipoelectric generator --- .../code/machinery/adipoelectric_generator.dm | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/GainStation13/code/machinery/adipoelectric_generator.dm b/GainStation13/code/machinery/adipoelectric_generator.dm index 609e3d96..0b932263 100644 --- a/GainStation13/code/machinery/adipoelectric_generator.dm +++ b/GainStation13/code/machinery/adipoelectric_generator.dm @@ -16,6 +16,7 @@ var/emp_timer = 0 var/active = FALSE var/datum/looping_sound/generator/soundloop + var/iamcheckingtoseeifthelinesnumberchange = 0 /obj/machinery/power/adipoelectric_generator/Initialize() . = ..() @@ -23,6 +24,7 @@ if(anchored) connect_to_network() update_icon() + occupant = null /obj/machinery/power/adipoelectric_generator/RefreshParts() laser_modifier = 0 @@ -33,10 +35,15 @@ max_fat += C.rating * 2 /obj/machinery/power/adipoelectric_generator/process() - if(occupant:fatness_real > 0 && powernet && anchored && (emp_timer < world.time)) + if(!is_operational()) + return + var/mob/living/carbon/user = occupant + if(!user || !attached) + return PROCESS_KILL + if(user.fatness_real > 0 && powernet && anchored && (emp_timer < world.time)) active = TRUE add_avail(conversion_rate * laser_modifier * max_fat) - occupant:adjust_fatness(-max_fat, FATTENING_TYPE_ITEM) + user.adjust_fatness(-max_fat, FATTENING_TYPE_ITEM) soundloop.start() else active = FALSE @@ -96,11 +103,13 @@ /obj/machinery/power/adipoelectric_generator/open_machine() . = ..() + STOP_PROCESSING(SSobj, src) /obj/machinery/power/adipoelectric_generator/close_machine() . = ..() if(occupant && anchored && !panel_open) add_fingerprint(occupant) + START_PROCESSING(SSobj, src) else open_machine() From 39b0397950982716725bbd60b52ca6cd00eda94e Mon Sep 17 00:00:00 2001 From: Alphas00 <154434082+Alphas00@users.noreply.github.com> Date: Mon, 20 May 2024 23:40:07 +0200 Subject: [PATCH 2/2] Update adipoelectric_generator.dm --- .../code/machinery/adipoelectric_generator.dm | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/GainStation13/code/machinery/adipoelectric_generator.dm b/GainStation13/code/machinery/adipoelectric_generator.dm index 0b932263..a42add21 100644 --- a/GainStation13/code/machinery/adipoelectric_generator.dm +++ b/GainStation13/code/machinery/adipoelectric_generator.dm @@ -16,7 +16,6 @@ var/emp_timer = 0 var/active = FALSE var/datum/looping_sound/generator/soundloop - var/iamcheckingtoseeifthelinesnumberchange = 0 /obj/machinery/power/adipoelectric_generator/Initialize() . = ..() @@ -24,7 +23,6 @@ if(anchored) connect_to_network() update_icon() - occupant = null /obj/machinery/power/adipoelectric_generator/RefreshParts() laser_modifier = 0 @@ -35,15 +33,13 @@ max_fat += C.rating * 2 /obj/machinery/power/adipoelectric_generator/process() - if(!is_operational()) - return - var/mob/living/carbon/user = occupant - if(!user || !attached) + if(!occupant) + playsound(src, 'sound/machines/buzz-two.ogg', 50) return PROCESS_KILL - if(user.fatness_real > 0 && powernet && anchored && (emp_timer < world.time)) + if(occupant:fatness_real > 0 && powernet && anchored && (emp_timer < world.time)) active = TRUE add_avail(conversion_rate * laser_modifier * max_fat) - user.adjust_fatness(-max_fat, FATTENING_TYPE_ITEM) + occupant:adjust_fatness(-max_fat, FATTENING_TYPE_ITEM) soundloop.start() else active = FALSE