Skip to content

Commit

Permalink
Ports Bubbers Synth QOL for their internal computer and charge change (
Browse files Browse the repository at this point in the history
…#331)

QOL
  • Loading branch information
Zergspower authored and FFMirrorBot committed Jan 6, 2024
1 parent bd0f3ed commit 0a29621
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

max_idle_programs = 3

max_capacity = 32
max_capacity = 64

/obj/item/modular_computer/pda/synth/Initialize(mapload)
. = ..()
Expand Down Expand Up @@ -114,3 +114,25 @@ Attacking a synth with an id loads it into its slot.. pain and probably shitcode
robotbrain.internal_computer.interact(user)
return
return ..()

/obj/item/modular_computer/pda/synth/get_header_data()
var/list/data = ..()
var/obj/item/organ/internal/brain/synth/brain_loc = loc
// Battery level is now according to the synth charge
if(istype(brain_loc))
var/charge_level = (brain_loc.owner.nutrition / NUTRITION_LEVEL_ALMOST_FULL) * 100
switch(charge_level)
if(80 to 110)
data["PC_batteryicon"] = "batt_100.gif"
if(60 to 80)
data["PC_batteryicon"] = "batt_80.gif"
if(40 to 60)
data["PC_batteryicon"] = "batt_60.gif"
if(20 to 40)
data["PC_batteryicon"] = "batt_40.gif"
if(5 to 20)
data["PC_batteryicon"] = "batt_20.gif"
else
data["PC_batteryicon"] = "batt_5.gif"
data["PC_batterypercent"] = "[round(charge_level)]%"
return data
4 changes: 2 additions & 2 deletions modular_nova/modules/synths/code/bodyparts/power_cord.dm
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
to_chat(user, span_warning("There is no charge to draw from that APC."))
return

if(ipc.nutrition >= NUTRITION_LEVEL_WELL_FED)
if(ipc.nutrition >= NUTRITION_LEVEL_ALMOST_FULL)
to_chat(user, span_warning("You are already fully charged!"))
return

Expand All @@ -62,7 +62,7 @@
user.visible_message(span_notice("[user] inserts a power connector into the [target_apc]."), span_notice("You begin to draw power from the [target_apc]."))

while(TRUE)
var/power_needed = NUTRITION_LEVEL_WELL_FED - user.nutrition // How much charge do we need in total?
var/power_needed = NUTRITION_LEVEL_ALMOST_FULL - user.nutrition // How much charge do we need in total?
// Do we even need anything?
if(power_needed <= SYNTH_CHARGE_MIN * 2) // Times two to make sure minimum draw is always lower than this margin to prevent potential needless loops.
to_chat(user, span_notice("You are fully charged."))
Expand Down

0 comments on commit 0a29621

Please sign in to comment.