From 09e1c36b4ce3c8b4432ef7cdedaa0b9758d8d60c Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Tue, 17 Dec 2024 16:11:28 -0600 Subject: [PATCH 1/3] two fixes --- code/modules/power/apc.dm | 2 +- code/modules/surgery/organs/lungs.dm | 43 ---------------------------- 2 files changed, 1 insertion(+), 44 deletions(-) diff --git a/code/modules/power/apc.dm b/code/modules/power/apc.dm index 48651a3146c4..b046f7200c69 100644 --- a/code/modules/power/apc.dm +++ b/code/modules/power/apc.dm @@ -286,7 +286,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/power/apc/auto_name, 25) has_electronics = APC_ELECTRONICS_SECURED // is starting with a power cell installed, create it and set its charge level if(cell_type) - cell = new cell_type + cell = new cell_type(src) cell.charge = start_charge * cell.maxcharge / 100 // (convert percentage to actual value) var/area/A = loc.loc diff --git a/code/modules/surgery/organs/lungs.dm b/code/modules/surgery/organs/lungs.dm index 14fd951e0e9a..5a0d20e23ca3 100644 --- a/code/modules/surgery/organs/lungs.dm +++ b/code/modules/surgery/organs/lungs.dm @@ -461,22 +461,17 @@ if(!HAS_TRAIT(breather, TRAIT_RESISTCOLD)) // COLD DAMAGE var/cold_modifier = breather.dna.species.coldmod var/breath_effect_prob = 0 - var/part_count = 0 if(breath_temperature < cold_level_3_threshold) breather.apply_damage(cold_level_3_damage * cold_modifier, cold_damage_type, spread_damage = TRUE) breath_effect_prob = 100 - part_count = 8 if(breath_temperature > cold_level_3_threshold && breath_temperature < cold_level_2_threshold) breather.apply_damage(cold_level_2_damage * cold_modifier, cold_damage_type, spread_damage = TRUE) breath_effect_prob = 75 - part_count = 5 if(breath_temperature > cold_level_2_threshold && breath_temperature < cold_level_1_threshold) breather.apply_damage(cold_level_1_damage * cold_modifier, cold_damage_type, spread_damage = TRUE) breath_effect_prob = 50 - part_count = 3 if(breath_temperature > cold_level_1_threshold) breath_effect_prob = 25 - part_count = 2 if(breath_temperature < cold_level_1_threshold) if(prob(sqrt(breath_effect_prob) * 6)) @@ -484,7 +479,6 @@ else if(breath_temperature < chlly_threshold) if(!breath_effect_prob) breath_effect_prob = 20 - part_count = 1 if(prob(sqrt(breath_effect_prob) * 6)) to_chat(breather, "You feel [chilly_message] in your [name].") if(breath_temperature < chlly_threshold) @@ -525,43 +519,6 @@ // The air you breathe out should match your body temperature breath.set_temperature(breather.bodytemperature) -/// Creates a particle effect off the mouth of the passed mob. -/obj/item/organ/lungs/proc/emit_breath_particle(mob/living/carbon/human/breather, particle_type, part_count) - ASSERT(ispath(particle_type, /particles)) - - var/obj/effect/abstract/particle_holder/holder = new(breather, particle_type) - var/particles/breath_particle = holder.particles - var/breath_dir = breather.dir - - var/list/particle_grav = list(0, 0.1, 0) - var/list/particle_pos = list(0, 10, 0) - if(breath_dir & NORTH) - particle_grav[2] = 0.2 - breath_particle.rotation = pick(-45, 45) - // Layer it behind the mob since we're facing away from the camera - holder.pixel_w -= 4 - holder.pixel_y += 4 - if(breath_dir & WEST) - particle_grav[1] = -0.2 - particle_pos[1] = -5 - breath_particle.rotation = -45 - if(breath_dir & EAST) - particle_grav[1] = 0.2 - particle_pos[1] = 5 - breath_particle.rotation = 45 - if(breath_dir & SOUTH) - particle_grav[2] = 0.2 - breath_particle.rotation = pick(-45, 45) - // Shouldn't be necessary but just for parity - holder.pixel_w += 4 - holder.pixel_y -= 4 - - breath_particle.gravity = particle_grav - breath_particle.position = particle_pos - breath_particle.count = part_count - - QDEL_IN(holder, breath_particle.lifespan) - /obj/item/organ/lungs/on_life() . = ..() if(failed && !(organ_flags & ORGAN_FAILING)) From b3cdcf0021e72399408ca70d93e1f2c79338dd48 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Tue, 17 Dec 2024 13:15:28 -0600 Subject: [PATCH 2/3] phase 1 --- code/modules/power/apc.dm | 37 ++++++++++++++++---------- code/modules/recycling/disposal/bin.dm | 2 +- 2 files changed, 24 insertions(+), 15 deletions(-) diff --git a/code/modules/power/apc.dm b/code/modules/power/apc.dm index b046f7200c69..73205dfc8ab5 100644 --- a/code/modules/power/apc.dm +++ b/code/modules/power/apc.dm @@ -1345,23 +1345,33 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/power/apc/auto_name, 25) lighting = autoset(lighting, AUTOSET_FORCE_OFF) environ = autoset(environ, AUTOSET_FORCE_OFF) area.poweralert(0, src) - else if(cell.percent() < 15 && longtermpower < 0) // <15%, turn off lighting & equipment - equipment = autoset(equipment, AUTOSET_OFF) - lighting = autoset(lighting, AUTOSET_OFF) - environ = autoset(environ, AUTOSET_ON) - area.poweralert(0, src) - else if(cell.percent() < 30 && longtermpower < 0) // <30%, turn off equipment + else if(longtermpower < 0) + switch(cell.percent()) + if(0 to 15) + equipment = autoset(equipment, AUTOSET_OFF) + lighting = autoset(lighting, AUTOSET_OFF) + environ = autoset(environ, AUTOSET_ON) + area.poweralert(0, src) + if(15 to 30) + equipment = autoset(equipment, AUTOSET_OFF) + lighting = autoset(lighting, AUTOSET_ON) + environ = autoset(environ, AUTOSET_ON) + area.poweralert(0, src) + if(30 to 75) + equipment = autoset(equipment, AUTOSET_ON) + lighting = autoset(lighting, AUTOSET_ON) + environ = autoset(environ, AUTOSET_ON) + area.poweralert(0, src) + if(75 to 100) + equipment = autoset(equipment, AUTOSET_ON) + lighting = autoset(lighting, AUTOSET_ON) + environ = autoset(environ, AUTOSET_ON) + area.poweralert(1, src) + else equipment = autoset(equipment, AUTOSET_ON) lighting = autoset(lighting, AUTOSET_ON) environ = autoset(environ, AUTOSET_ON) - area.poweralert(0, src) - else // otherwise all can be on - equipment = autoset(equipment, 1) - lighting = autoset(lighting, 1) - environ = autoset(environ, 1) area.poweralert(1, src) - if(cell.percent() > 75) - area.poweralert(1, src) // now trickle-charge the cell if(chargemode && charging == APC_CHARGING && operating) @@ -1397,7 +1407,6 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/power/apc/auto_name, 25) chargecount = 0 else // no cell, switch everything off - charging = APC_NOT_CHARGING chargecount = 0 equipment = autoset(equipment, AUTOSET_FORCE_OFF) diff --git a/code/modules/recycling/disposal/bin.dm b/code/modules/recycling/disposal/bin.dm index 111428528242..793edb4a84da 100644 --- a/code/modules/recycling/disposal/bin.dm +++ b/code/modules/recycling/disposal/bin.dm @@ -432,7 +432,7 @@ if(air_contents.return_pressure() >= SEND_PRESSURE) full_pressure = TRUE pressure_charging = FALSE - update_appearance() + update_appearance(UPDATE_OVERLAYS) return /obj/machinery/disposal/bin/get_remote_view_fullscreens(mob/user) From cc2a39f881d8b0e7642f3fdf0ddd8d666851baf5 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Tue, 17 Dec 2024 16:26:46 -0600 Subject: [PATCH 3/3] better way of doing it --- code/modules/mob/living/silicon/robot/life.dm | 2 +- .../modular_computers/computers/item/computer_power.dm | 4 ++-- code/modules/power/apc.dm | 2 +- code/modules/power/cell.dm | 4 ++-- code/modules/power/lighting.dm | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/code/modules/mob/living/silicon/robot/life.dm b/code/modules/mob/living/silicon/robot/life.dm index 123726ce3c01..987b8b6c2a32 100644 --- a/code/modules/mob/living/silicon/robot/life.dm +++ b/code/modules/mob/living/silicon/robot/life.dm @@ -21,7 +21,7 @@ if(cell.charge <= 100) uneq_all() var/amt = clamp((lamp_enabled * lamp_intensity),1,cell.charge) //Lamp will use a max of 5 charge, depending on brightness of lamp. If lamp is off, borg systems consume 1 point of charge, or the rest of the cell if it's lower than that. - cell.use(amt) //Usage table: 1/tick if off/lowest setting, 4 = 4/tick, 6 = 8/tick, 8 = 12/tick, 10 = 16/tick + cell.use(amt, FALSE) //Usage table: 1/tick if off/lowest setting, 4 = 4/tick, 6 = 8/tick, 8 = 12/tick, 10 = 16/tick else uneq_all() low_power_mode = TRUE diff --git a/code/modules/modular_computers/computers/item/computer_power.dm b/code/modules/modular_computers/computers/item/computer_power.dm index d3c65f86ec35..8e5a8e2d0a21 100644 --- a/code/modules/modular_computers/computers/item/computer_power.dm +++ b/code/modules/modular_computers/computers/item/computer_power.dm @@ -13,10 +13,10 @@ if(battery_module && battery_module.battery && battery_module.battery.charge) var/obj/item/stock_parts/cell/cell = battery_module.battery - if(cell.use(amount * GLOB.CELLRATE)) + if(cell.use(amount * GLOB.CELLRATE, FALSE)) return TRUE else // Discharge the cell anyway. - cell.use(min(amount*GLOB.CELLRATE, cell.charge)) + cell.use(min(amount*GLOB.CELLRATE, cell.charge), FALSE) return FALSE return FALSE diff --git a/code/modules/power/apc.dm b/code/modules/power/apc.dm index 73205dfc8ab5..a3cedcd401ea 100644 --- a/code/modules/power/apc.dm +++ b/code/modules/power/apc.dm @@ -1310,7 +1310,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/power/apc/auto_name, 25) if(cell && !shorted) // draw power from cell as before to power the area var/cellused = min(cell.charge, GLOB.CELLRATE * lastused_total) // clamp deduction to a max, amount left in cell - cell.use(cellused) + cell.use(cellused, FALSE) if(excess > lastused_total) // if power excess recharge the cell // by the same amount just used diff --git a/code/modules/power/cell.dm b/code/modules/power/cell.dm index 0e29e53da52e..d4a17523255d 100644 --- a/code/modules/power/cell.dm +++ b/code/modules/power/cell.dm @@ -76,14 +76,14 @@ return 100*charge/maxcharge // use power from a cell -/obj/item/stock_parts/cell/use(amount) +/obj/item/stock_parts/cell/use(amount, log = TRUE) if(rigged && amount > 0) explode() return 0 if(charge < amount) return 0 charge = (charge - amount) - if(!istype(loc, /obj/machinery/power/apc)) + if(log) SSblackbox.record_feedback("tally", "cell_used", 1, type) return 1 diff --git a/code/modules/power/lighting.dm b/code/modules/power/lighting.dm index 662bdbecc572..8b7ab2fa3b53 100644 --- a/code/modules/power/lighting.dm +++ b/code/modules/power/lighting.dm @@ -634,7 +634,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/light/small/built, 28) visible_message("[src] short-circuits from too powerful of a power cell!") burn_out() return FALSE - cell.use(pwr) + cell.use(pwr, FALSE) set_light(brightness * bulb_emergency_brightness_mul, max(bulb_emergency_pow_min, bulb_emergency_pow_mul * (cell.charge / cell.maxcharge)), bulb_emergency_colour) return TRUE