diff --git a/code/WorkInProgress/Electronics.dm b/code/WorkInProgress/Electronics.dm index e4bf656d..6af4cb3d 100644 --- a/code/WorkInProgress/Electronics.dm +++ b/code/WorkInProgress/Electronics.dm @@ -134,6 +134,80 @@ var/list/needed_parts = new/list() module_research = list("electronics" = 3, "engineering" = 1) + + /** + This deploys an assembly as an attachment to a turf, much like how a user can attach light frames to walls. + The attached object is not actually *ON* the wall turf itself but instead is at the location of the user + and its pixels are appropriately displaced depending on which direction the user is facing when they + deploy it. + */ + proc/deploy_turf(atom/target as mob|obj|turf|area, mob/user as mob) + var/turf/T = get_turf(src) + // I'd like to use the progress bar delay proc right here like the normal deploy() does but uuuhhhh... yeah, could a coder put it in here please? + var/obj/O = new store_type(T) + O.dir = user.dir + + switch (O.dir) + if (1) + O.pixel_x = 1 + O.pixel_y = 18 + if (2) + O.pixel_x = -1 + O.pixel_y = -18 + if (4) + O.pixel_x = 18 + O.pixel_y = 1 + if (8) + O.pixel_x = -18 + O.pixel_y = -1 + + O.mats = "Built" + user.visible_message("[user] assembles a [O.name]!") + qdel(src) + + + + + //If the assembly contains a wall mounted recharger and the user is holding a solder, + //attach it to a wall in the same way the charger placer does + afterattack(atom/target as mob|obj|turf|area, mob/user as mob) + if(src.secured == 2) + + if (user.find_in_hand(src)) + + if(istype(user, /mob/living/carbon/human) && user.bioHolder) + + if (user.find_in_hands(/obj/item/electronics/soldering)) + + if (src.store_type == /obj/machinery/recharger/wall) + + if(isturf(target) && target.density) + user.drop_item() + src.loc = user.loc + deploy_turf(target, user) + return + else + boutput(user, "You can only deploy wall-mounted rechargers this way!") + return + + else + boutput(user, "You must be holding a soldering iron in another hand to assemble this!") + return + + else + boutput(user, "The assembly can only be deployed by humanoids.") + return + + else + boutput(user, "The assembly needs to be in one of your hands. How did you even do that?") + return + + else + boutput (user, "The assembly should be secured first!") + return + + + /obj/item/electronics/frame/verb/rotate() set src in view(1) if (!istype(usr, /mob/living)) diff --git a/code/obj/machinery/recharger.dm b/code/obj/machinery/recharger.dm index 59ebb032..8f1aea70 100644 --- a/code/obj/machinery/recharger.dm +++ b/code/obj/machinery/recharger.dm @@ -7,6 +7,12 @@ obj/machinery/recharger desc = "An anchored minature recharging device, used to recharge small, hand-held objects that don't require much electrical charge." power_usage = 50 + // So we can have rechargers with different sprites, let's use their icon states as variables! + // This way we won't have to make a new proc altogether just so we can have different sprites + var/sprite_empty = "recharger0" + var/sprite_charging = "recharger1" + var/sprite_complete = "recharger2" + var obj/item/gun/energy/charging = null obj/item/baton/charging2 = null @@ -82,39 +88,86 @@ obj/machinery/recharger power_usage = 50 ..() if(stat & NOPOWER) - src.icon_state = "recharger0" + src.icon_state = sprite_empty return if((src.charging) && ! (stat & NOPOWER) ) if (src.charging.cell) if(src.charging.cell.charge(20)) - src.icon_state = "recharger1" + src.icon_state = sprite_charging use_power(600) else - src.icon_state = "recharger2" + src.icon_state = sprite_complete else if ((src.charging2) && ! (stat & NOPOWER) ) if (src.charging2.cell) if(src.charging2.cell.charge(15)) - src.icon_state = "recharger1" + src.icon_state = sprite_charging use_power(500) else - src.icon_state = "recharger2" + src.icon_state = sprite_complete else if ((src.charging3) && ! (stat & NOPOWER) ) if (src.charging3.charges < src.charging3.maximum_charges) src.charging3.charges++ - src.icon_state = "recharger1" + src.icon_state = sprite_charging use_power(250) else - src.icon_state = "recharger2" + src.icon_state = sprite_complete else if ((src.charging4) && ! (stat & NOPOWER) ) if(src.charging4.charge(15)) - src.icon_state = "recharger1" + src.icon_state = sprite_charging use_power(500) else - src.icon_state = "recharger2" + src.icon_state = sprite_complete else if (!(src.charging || src.charging2 || src.charging3 || src.charging4)) - src.icon_state = "recharger0" + src.icon_state = sprite_empty + + +obj/machinery/recharger/wall + icon_state = "wall_recharger0" + name = "wall mounted recharger" + desc = "A recharger, refitted to be mounted onto a wall. Handy!" + sprite_empty = "wall_recharger0" + sprite_charging = "wall_recharger1" + sprite_complete = "wall_recharger2" + +/** +This is a handy dandy little placer for the wall rechargers, so you don't have to move the things pixel by pixel +every time you want to place a charger on a wall somewhere. + +Just place this in a map, point it in a direction, and it will automagically create a wall recharger that +appropriately attaches to the wall! Wow! +*/ +obj/recharger_placer + name = "wall mounted recharger placer" + desc = "You are not supposed to be seeing this! The secrets of creation have been unravelled to you, oh god OH FUCK IMCODER" + icon = 'icons/obj/stationobjs.dmi' + icon_state = "wall_recharger_placer" + + New() + ..() + var/obj/machinery/recharger/wall/C = new/obj/machinery/recharger/wall + + C.loc = src.loc + C.dir = src.dir + + switch(dir) + if(1) + C.pixel_x = 1 + C.pixel_y = 18 + if(2) + C.pixel_x = -1 + C.pixel_y = -18 + if(4) + C.pixel_x = 18 + C.pixel_y = 1 + if(8) + C.pixel_x = -18 + C.pixel_y = -1 + + qdel(src) + + \ No newline at end of file diff --git a/icons/obj/stationobjs.dmi b/icons/obj/stationobjs.dmi index 1c15e8b8..5a6b8e2b 100644 Binary files a/icons/obj/stationobjs.dmi and b/icons/obj/stationobjs.dmi differ