diff --git a/code/game/objects/items/devices/lightreplacer.dm b/code/game/objects/items/devices/lightreplacer.dm index d59b7ceaa0a..35f44867758 100644 --- a/code/game/objects/items/devices/lightreplacer.dm +++ b/code/game/objects/items/devices/lightreplacer.dm @@ -15,7 +15,7 @@ // // HOW TO REFILL THE DEVICE // -// It will need to be manually refilled with lights. +// It will need to be manually refilled with lights. This can be done by using it on a boxful of lights // If it's part of a robot module, it will charge when the Robot is inside a Recharge Station. // // EMAGGED FEATURES @@ -43,28 +43,44 @@ name = "light replacer" desc = "A device to automatically replace lights. Refill with working lightbulbs." - icon = 'icons/obj/janitor.dmi' - icon_state = "lightreplacer0" - item_state = "electronic" + icon = 'icons/obj/tools/lightreplacer.dmi' + icon_state = "lightreplacer" + item_state = "lightreplacer" + contained_sprite = 1 flags = CONDUCT slot_flags = SLOT_BELT origin_tech = "magnets=3;materials=2" var/max_uses = 20 - var/uses = 0 + var/uses = 10 var/emagged = 0 var/failmsg = "" var/charge = 0 + var/load_interval = 60 + var/store_broken = 0//If set, this lightreplacer will suck up and store broken bulbs + var/max_stored = 10 + +/obj/item/device/lightreplacer/advanced + store_broken = 1 + load_interval = 10 + max_uses = 30 + uses = 0 //Starts empty + name = "advanced light replacer" + desc = "A specialised light replacer which stores more lights, refills faster from boxes, and sucks up broken bulbs. Empty into a disposal or trashbag when full!" + icon_state = "adv_lightreplacer" + item_state = "adv_lightreplacer" + /obj/item/device/lightreplacer/New() - uses = max_uses / 2 failmsg = "The [name]'s refill light blinks red." ..() /obj/item/device/lightreplacer/examine(mob/user) if(..(user, 2)) user << "It has [uses] lights remaining." + if (store_broken) + user << "It is storing [stored()]/[max_stored] broken lights." /obj/item/device/lightreplacer/attackby(obj/item/W, mob/user) if(istype(W, /obj/item/weapon/card/emag) && emagged == 0) @@ -76,9 +92,11 @@ if(uses >= max_uses) user << "[src.name] is full." return - else if(G.use(1)) - AddUses(5) - user << "You insert a piece of glass into the [src.name]. You have [uses] lights remaining." + else if(G.use(5)) + AddUses(2) + if (prob(50)) + AddUses(1) + user << "You insert five pieces of glass into the [src.name]. You have [uses] lights remaining." return else user << "You need one sheet of glass to replace lights." @@ -97,6 +115,55 @@ return +/obj/item/device/lightreplacer/afterattack(var/atom/target, var/mob/living/user, proximity, params) + if (istype(target, /obj/item/weapon/storage/box)) + if (box_contains_lights(target)) + load_lights_from_box(target, user) + else + user << "This box has no bulbs in it!" + + +/obj/item/device/lightreplacer/proc/box_contains_lights(var/obj/item/weapon/storage/box/box) + for (var/obj/item/weapon/light/L in box.contents) + if (L.status == 0) + return 1 + return 0 + + +/obj/item/device/lightreplacer/proc/load_lights_from_box(var/obj/item/weapon/storage/box/box, var/mob/user) + var/boxstartloc = box.loc + var/ourstartloc = src.loc + user.visible_message("[user] starts loading lights from the [box] into their [src]", "You start loading lights from the [box] into the [src]") + while (uses < max_uses) + var/bulb = null + for (var/obj/item/weapon/light/L in box.contents) + if (L.status == 0) + bulb = L + break + + if (!bulb) + user << "\red There are no more working lights left in the box!" + return + + if (do_after(user, load_interval, needhand = 0) && boxstartloc == box.loc && ourstartloc == src.loc) + uses++ + user << "Light loaded: [uses]/[max_uses]" + playsound(src.loc, 'sound/machines/click.ogg', 20, 1) + box.remove_from_storage(bulb,get_turf(box)) + qdel(bulb) + else + user << "\red You need to keep the [src] close to the box!" + return + + user << "The [src]'s refill light shines a solid green, indicating it's full and ready to go!" + +/obj/item/device/lightreplacer/proc/stored() + var/count = 0 + for (var/obj/item/weapon/light/L in src) + count++ + + return count + /obj/item/device/lightreplacer/attack_self(mob/user) /* // This would probably be a bit OP. If you want it though, uncomment the code. if(isrobot(user)) @@ -108,9 +175,6 @@ */ usr << "It has [uses] lights remaining." -/obj/item/device/lightreplacer/update_icon() - icon_state = "lightreplacer[emagged]" - /obj/item/device/lightreplacer/proc/Use(var/mob/user) @@ -124,7 +188,7 @@ /obj/item/device/lightreplacer/proc/Charge(var/mob/user, var/amount = 1) charge += amount - if(charge > 6) + if(charge > 3) AddUses(1) charge = 0 @@ -150,6 +214,13 @@ target.status = LIGHT_EMPTY target.update() + if (store_broken) + if (stored() < max_stored) + L1.forceMove(src) + U << "\The [src] neatly sucks the broken [target.fitting] into its internal storage. Now storing [stored()]/[max_stored] broken bulbs" + else + U << "\The [src] tries to suck up the broken [target.fitting] but it has no more space. Empty it into the trash!" + var/obj/item/weapon/light/L2 = new target.light_type() target.status = L2.status diff --git a/code/game/objects/items/weapons/storage/bags.dm b/code/game/objects/items/weapons/storage/bags.dm index 62d460fd45e..04ad251fbac 100644 --- a/code/game/objects/items/weapons/storage/bags.dm +++ b/code/game/objects/items/weapons/storage/bags.dm @@ -48,6 +48,26 @@ icon_state = "trashbag2" else icon_state = "trashbag3" +/obj/item/weapon/storage/bag/trash/attackby(var/obj/item/I, var/mob/user) + if (istype (I, /obj/item/device/lightreplacer)) + var/count = 0 + var/obj/item/device/lightreplacer/R = I + var/bagfull = 0 + if (R.store_broken) + for(var/obj/item/weapon/light/L in R.contents) + if(!can_be_inserted(L))//This displays its own error message if the bag is full + bagfull = 1 + break + count++ + handle_item_insertion(L, 1)//value of 1 suppresses confirmation messages from this one + + if (count) + user << "\blue You empty [count] broken bulbs into the trashbag." + else if (!bagfull) + user << "\blue There are no broken bulbs to empty out." + return 1 + ..() + // ----------------------------- // Plastic Bag @@ -254,7 +274,7 @@ max_w_class = 3 w_class = 2 can_hold = list(/obj/item/weapon/coin,/obj/item/weapon/spacecash) - + // ----------------------------- // Book bag // ----------------------------- @@ -268,6 +288,6 @@ storage_slots = 7 max_storage_space = 200 max_w_class = 3 - w_class = 3 - can_hold = list(/obj/item/weapon/book, /obj/item/weapon/spellbook) + w_class = 3 + can_hold = list(/obj/item/weapon/book, /obj/item/weapon/spellbook) diff --git a/code/game/objects/structures/janicart.dm b/code/game/objects/structures/janicart.dm index 8a1b0985aed..75fe5fd3526 100644 --- a/code/game/objects/structures/janicart.dm +++ b/code/game/objects/structures/janicart.dm @@ -18,16 +18,17 @@ var/has_items = 0//This is set true whenever the cart has anything loaded/mounted on it var/dismantled = 0//This is set true after the object has been dismantled to avoid an infintie loop - ///obj/structure/janitorialcart/New() /obj/structure/janitorialcart/examine(mob/user) if(..(user, 1)) if (mybucket) - user << "[src] \icon The bucket contains [mybucket.reagents.total_volume] unit\s of liquid!" + var/contains = mybucket.reagents.total_volume + world << "Contains is [contains]" + user << "\icon[src] The bucket contains [contains] unit\s of liquid!" else - user << "[src] \icon There is no bucket mounted on it!" + user << "\icon[src] There is no bucket mounted on it!" //everything else is visible, so doesn't need to be mentioned @@ -59,6 +60,11 @@ else if(istype(I, /obj/item/weapon/reagent_containers) && mybucket) var/obj/item/weapon/reagent_containers/C = I C.afterattack(mybucket, usr, 1) + else if(istype (I, /obj/item/device/lightreplacer)) + var/obj/item/device/lightreplacer/LR = I + if (LR.store_broken) + return mybag.attackby(I, usr) + /obj/structure/janitorialcart/attackby(obj/item/I, mob/user) if(istype(I, /obj/item/weapon/mop) || istype(I, /obj/item/weapon/reagent_containers/glass/rag) || istype(I, /obj/item/weapon/soap)) @@ -273,7 +279,10 @@ overlays += "cart_spray" has_items = 1 if(myreplacer) - overlays += "cart_replacer" + if (istype(myreplacer, /obj/item/device/lightreplacer/advanced)) + overlays += "cart_adv_lightreplacer" + else + overlays += "cart_replacer" has_items = 1 if(signs) overlays += "cart_sign[signs]" diff --git a/code/modules/mob/living/silicon/robot/robot_modules.dm b/code/modules/mob/living/silicon/robot/robot_modules.dm index 96552b0ead8..b1e6c77ebaf 100644 --- a/code/modules/mob/living/silicon/robot/robot_modules.dm +++ b/code/modules/mob/living/silicon/robot/robot_modules.dm @@ -468,7 +468,7 @@ var/global/list/robot_modules = list( src.modules += new /obj/item/weapon/soap/nanotrasen(src) src.modules += new /obj/item/weapon/storage/bag/trash(src) src.modules += new /obj/item/weapon/mop(src) - src.modules += new /obj/item/device/lightreplacer(src) + src.modules += new /obj/item/device/lightreplacer/advanced(src) src.emag = new /obj/item/weapon/reagent_containers/spray(src) src.emag.reagents.add_reagent("lube", 250) src.emag.name = "Lube spray" diff --git a/code/modules/recycling/disposal.dm b/code/modules/recycling/disposal.dm index 48d7c88b09a..fc51b0eed7f 100644 --- a/code/modules/recycling/disposal.dm +++ b/code/modules/recycling/disposal.dm @@ -105,6 +105,21 @@ update() return + else if (istype (I, /obj/item/device/lightreplacer)) + var/count = 0 + var/obj/item/device/lightreplacer/R = I + if (R.store_broken) + for(var/obj/item/weapon/light/L in R.contents) + count++ + L.forceMove(src) + + if (count) + user << "\blue You empty [count] broken bulbs into the disposal." + else + user << "\blue There are no broken bulbs to empty out." + update() + return + var/obj/item/weapon/grab/G = I if(istype(G)) // handle grabbed mob if(ismob(G.affecting)) diff --git a/code/modules/research/designs.dm b/code/modules/research/designs.dm index 3b3ca539fae..085fff28b7b 100644 --- a/code/modules/research/designs.dm +++ b/code/modules/research/designs.dm @@ -1684,6 +1684,14 @@ datum/design/item/experimental_welder materials = list("$metal" = 500) build_path =/obj/item/weapon/weldingtool/experimental +datum/design/item/advanced_light_replacer + name = "Advanced Light Replacer" + desc = "A specialised light replacer which stores more lights, refills faster from boxes, and sucks up broken bulbs." + id = "advanced_light_replacer" + req_tech = list("materials" = 3, "powerstorage" = 3) + materials = list("$metal" = 500) + build_path =/obj/item/device/lightreplacer/advanced + //////exosuit modules - allow robotics to print some modules, maybe a generic rig, but more things for them to do --Alberyk datum/design/item/rigmodule diff --git a/html/changelogs/Nanako-Lightreplacer.yml b/html/changelogs/Nanako-Lightreplacer.yml new file mode 100644 index 00000000000..b52996af906 --- /dev/null +++ b/html/changelogs/Nanako-Lightreplacer.yml @@ -0,0 +1,39 @@ +################################ +# 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 +################################# + +# Your name. +author: Nanako + +# 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: + - rscadd: "Light Replacers can now be used on a box of lights to automatically refill them." + - rscadd: "Added an Advanced Light Replacer, creatable at science. It sucks up broken bulbs into an internal storage, greatly expediting mass-light-fixing" + - tweak: "Custodial cyborg module now comes with an advanced light replacer." + \ No newline at end of file diff --git a/icons/obj/janitor.dmi b/icons/obj/janitor.dmi index de85d22dd10..aeaeaa10f1b 100644 Binary files a/icons/obj/janitor.dmi and b/icons/obj/janitor.dmi differ diff --git a/icons/obj/tools/lightreplacer.dmi b/icons/obj/tools/lightreplacer.dmi new file mode 100644 index 00000000000..8d55dcda61f Binary files /dev/null and b/icons/obj/tools/lightreplacer.dmi differ