diff --git a/code/game/gamemodes/malfunction/Malf_Modules.dm b/code/game/gamemodes/malfunction/Malf_Modules.dm index d27cb3d4162..12760904359 100644 --- a/code/game/gamemodes/malfunction/Malf_Modules.dm +++ b/code/game/gamemodes/malfunction/Malf_Modules.dm @@ -234,63 +234,71 @@ rcd light flash thingy on matter drain mod_pick_name = "cyborgtransformer" description = "Build a machine anywhere, using expensive nanomachines, that can convert a living human into a loyal cyborg slave when placed inside." cost = 100 - power_type = /mob/living/silicon/ai/proc/place_transformer + var/list/turfOverlays = list() + +/datum/AI_Module/large/place_cyborg_transformer/New() + for(var/i=0;i<3;i++) + var/image/I = image("icon"='icons/turf/overlays.dmi') + turfOverlays += I + ..() /mob/living/silicon/ai/proc/place_transformer() set name = "Place Robotic Factory" set category = "Malfunction" - - if(!eyeobj) + if(!canPlaceTransformer()) return - - if(!isturf(src.loc)) // AI must be in it's core. - return - - var/datum/AI_Module/large/place_cyborg_transformer/PCT = locate() in src.current_modules - if(!PCT) - return - - if(PCT.uses < 1) - src << "Out of uses." - return - - var/sure = alert(src, "Make sure the room it is in is big enough, there is camera vision and that there is a 1x3 area for the machine. Are you sure you want to place the machine here?", "Are you sure?", "Yes", "No") - if(sure != "Yes") - return - - // Make sure there is enough room. - var/turf/middle = get_turf(eyeobj.loc) - var/list/turfs = list(middle, locate(middle.x - 1, middle.y, middle.z), locate(middle.x + 1, middle.y, middle.z)) - - var/alert_msg = "There isn't enough room. Make sure you are placing the machine in a clear area and on a floor." - -/* - var/datum/camerachunk/C = cameranet.getCameraChunk(middle.x, middle.y, middle.z) - if(!C.visibleTurfs[middle]) - alert(src, "We cannot get camera vision of this location.") - return -*/ - for(var/T in turfs) - - // Make sure the turfs are clear and the correct type. - if(!istype(T, /turf/simulated/floor)) - alert(src, alert_msg) + var/sure = alert(src, "Are you sure you want to place the machine here?", "Are you sure?", "Yes", "No") + if(sure == "Yes") + if(!canPlaceTransformer()) return + var/turf/T = get_turf(eyeobj) + new /obj/machinery/transformer/conveyor(T) + playsound(T, 'sound/effects/phasein.ogg', 100, 1) + var/datum/AI_Module/large/place_cyborg_transformer/PCT = locate() in current_modules + PCT.uses -- + can_shunt = 0 + src << "You cannot shunt anymore." - var/turf/simulated/floor/F = T - for(var/atom/movable/AM in F.contents) - if(AM.density) - alert(src, alert_msg) - return - - // All clear, place the transformer - new /obj/machinery/transformer/conveyor(middle) - playsound(middle, 'sound/effects/phasein.ogg', 100, 1) - src.can_shunt = 0 - PCT.uses -= 1 - src << "You cannot shunt anymore." - +/mob/living/silicon/ai/proc/canPlaceTransformer() + if(!eyeobj || !isturf(src.loc)) + return + var/datum/AI_Module/large/place_cyborg_transformer/PCT = locate() in current_modules + if(!PCT || PCT.uses < 1) + alert(src, "Out of uses.") + return + var/turf/middle = get_turf(eyeobj) + var/list/turfs = list(middle, locate(middle.x - 1, middle.y, middle.z), locate(middle.x + 1, middle.y, middle.z)) + var/alert_msg = "There isn't enough room. Make sure you are placing the machine in a clear area and on a floor." + var/success = 1 + if(turfs.len == 3) + for(var/n=1;n<4,n++) + var/fail + var/turf/T = turfs[n] + if(!istype(T, /turf/simulated/floor)) + fail = 1 + var/datum/camerachunk/C = cameranet.getCameraChunk(T.x, T.y, T.z) + if(!C.visibleTurfs[T]) + alert_msg = "We cannot get camera vision of this location." + fail = 1 + for(var/atom/movable/AM in T.contents) + if(AM.density) + fail = 1 + var/image/I = PCT.turfOverlays[n] + I.loc = T + client.images += I + if(fail) + success = 0 + I.icon_state = "redOverlay" + else + I.icon_state = "greenOverlay" + spawn(30) + if(client && (I.loc == T)) + client.images -= I + if(success) + return 1 + alert(src, alert_msg) + return /datum/AI_Module/small/blackout module_name = "Blackout" diff --git a/icons/turf/overlays.dmi b/icons/turf/overlays.dmi index 4a489751273..34819bdca92 100644 Binary files a/icons/turf/overlays.dmi and b/icons/turf/overlays.dmi differ