diff --git a/code/game/objects/items/devices/magnetic_lock.dm b/code/game/objects/items/devices/magnetic_lock.dm index 005c644cb85..6b521840435 100644 --- a/code/game/objects/items/devices/magnetic_lock.dm +++ b/code/game/objects/items/devices/magnetic_lock.dm @@ -28,7 +28,6 @@ var/obj/machinery/door/airlock/target_node2 = null var/obj/machinery/door/airlock/target = null var/obj/item/cell/powercell - var/obj/item/cell/internal_cell /obj/item/device/magnetic_lock/security department = "Security" @@ -55,7 +54,6 @@ . = ..() powercell = new /obj/item/cell/high() - internal_cell = new /obj/item/cell/device() if (istext(department)) desc += " It is painted with [department] colors." @@ -88,8 +86,7 @@ var/power = round(powercell.charge / powercell.maxcharge * 100) to_chat(user, "The powercell is at [power]% charge.") else - var/int_power = round(internal_cell.charge / internal_cell.maxcharge * 100) - to_chat(user, "It has no powercell to power it! Internal cell is at [int_power]% charge.") + to_chat(user, "It has no powercell to power it!") /obj/item/device/magnetic_lock/attack_hand(var/mob/user) add_fingerprint(user) @@ -241,34 +238,18 @@ /obj/item/device/magnetic_lock/process() if(!processpower) return - var/obj/item/cell/C = powercell // both of these are for viewing ease - var/obj/item/cell/BU = internal_cell + var/obj/item/cell/C = powercell var/delta_sec = (world.time - last_process_time) / 10 var/drainamount = drain_per_second * delta_sec if (C) if (C.charge > drainamount) C.charge -= drainamount - var/int_diff = min(drainamount, BU.maxcharge - BU.charge) - if (C.charge > int_diff && BU.charge != BU.maxcharge) - if (int_diff < drainamount) - BU.charge = BU.maxcharge - C.charge -= int_diff - else - BU.charge += drainamount - C.charge -= drainamount - else if (BU.charge > (drainamount - C.charge)) - var/diff = drainamount - C.charge - C.charge = 0 - BU.charge -= diff else - BU.charge = 0 + C.charge = 0 visible_message(SPAN_DANGER("[src] beeps loudly and falls off \the [target]; its powercell having run out of power.")) detach(0) - else if (BU.charge > drainamount) - BU.charge -= drainamount - else - BU.charge = 0 - visible_message(SPAN_DANGER("[src] beeps loudly and falls off \the [target]; its powercell having run out of power.")) + if (!C) + visible_message(SPAN_DANGER("[src] gives two shrill beeps and falls off \the [target]. No cell appears to be installed.")) detach(0) last_process_time = world.time @@ -304,9 +285,10 @@ if (!check_target(newtarget, user)) return - if(!internal_cell.charge) - to_chat(user, "\The [src] looks dead and out of power.") - return + if(powercell) + if(!powercell.charge) + to_chat(user, "\The [src] is clearly out of power.") + return var/direction = get_dir(user, newtarget) if ((direction in alldirs) && !(direction in cardinal)) diff --git a/html/changelogs/crunchypretzels-maglocks.yml b/html/changelogs/crunchypretzels-maglocks.yml new file mode 100644 index 00000000000..626e4beb4a9 --- /dev/null +++ b/html/changelogs/crunchypretzels-maglocks.yml @@ -0,0 +1,41 @@ +################################ +# Example Changelog File +# +# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb. +# +# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.) +# When it is, any changes listed below will disappear. +# +# Valid Prefixes: +# bugfix +# wip (For works in progress) +# tweak +# soundadd +# sounddel +# rscadd (general adding of nice things) +# rscdel (general deleting of nice things) +# imageadd +# imagedel +# maptweak +# spellcheck (typo fixes) +# experiment +# balance +# admin +# backend +# security +# refactor +################################# + +# Your name. +author: crunchypretzels + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries. +# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog. +changes: + - bugfix: "Magnetic locks can now have their cells recharged."