diff --git a/code/ATMOSPHERICS/components/unary/cold_sink.dm b/code/ATMOSPHERICS/components/unary/cold_sink.dm index 11777e51d2..faefa64883 100644 --- a/code/ATMOSPHERICS/components/unary/cold_sink.dm +++ b/code/ATMOSPHERICS/components/unary/cold_sink.dm @@ -24,7 +24,6 @@ /obj/machinery/atmospherics/unary/freezer/New() ..() initialize_directions = dir - circuit = new circuit(src) component_parts = list() component_parts += new /obj/item/weapon/stock_parts/matter_bin(src) component_parts += new /obj/item/weapon/stock_parts/capacitor(src) diff --git a/code/ATMOSPHERICS/components/unary/heat_source.dm b/code/ATMOSPHERICS/components/unary/heat_source.dm index 8ee9600606..c2daa2b6d1 100644 --- a/code/ATMOSPHERICS/components/unary/heat_source.dm +++ b/code/ATMOSPHERICS/components/unary/heat_source.dm @@ -24,7 +24,6 @@ /obj/machinery/atmospherics/unary/heater/New() ..() initialize_directions = dir - circuit = new circuit(src) component_parts = list() component_parts += new /obj/item/weapon/stock_parts/matter_bin(src) component_parts += new /obj/item/weapon/stock_parts/capacitor(src) diff --git a/code/datums/wires/alarm.dm b/code/datums/wires/alarm.dm index ace1ba9ec3..a665fd75a5 100644 --- a/code/datums/wires/alarm.dm +++ b/code/datums/wires/alarm.dm @@ -11,7 +11,7 @@ var/const/AALARM_WIRE_AALARM = 16 /datum/wires/alarm/CanUse(var/mob/living/L) var/obj/machinery/alarm/A = holder - if(A.wiresexposed) + if(A.panel_open) return 1 return 0 diff --git a/code/game/machinery/Beacon.dm b/code/game/machinery/Beacon.dm index ac736ddfe2..c59c67c300 100644 --- a/code/game/machinery/Beacon.dm +++ b/code/game/machinery/Beacon.dm @@ -1,5 +1,4 @@ /obj/machinery/bluespace_beacon - icon = 'icons/obj/objects.dmi' icon_state = "floor_beaconf" name = "Bluespace Gigabeacon" @@ -11,45 +10,42 @@ idle_power_usage = 0 var/obj/item/device/radio/beacon/Beacon - New() - ..() - var/turf/T = loc +/obj/machinery/bluespace_beacon/New() + ..() + var/turf/T = src.loc + Beacon = new /obj/item/device/radio/beacon + Beacon.invisibility = INVISIBILITY_MAXIMUM + Beacon.loc = T + + hide(!T.is_plating()) + +/obj/machinery/bluespace_beacon/Destroy() + if(Beacon) + qdel(Beacon) + ..() + +// update the invisibility and icon +/obj/machinery/bluespace_beacon/hide(var/intact) + invisibility = intact ? 101 : 0 + updateicon() + +// update the icon_state +/obj/machinery/bluespace_beacon/proc/updateicon() + var/state="floor_beacon" + + if(invisibility) + icon_state = "[state]f" + else + icon_state = "[state]" + +/obj/machinery/bluespace_beacon/process() + if(!Beacon) + var/turf/T = src.loc Beacon = new /obj/item/device/radio/beacon Beacon.invisibility = INVISIBILITY_MAXIMUM Beacon.loc = T + if(Beacon) + if(Beacon.loc != src.loc) + Beacon.loc = src.loc - hide(!T.is_plating()) - - Destroy() - if(Beacon) - qdel(Beacon) - ..() - - // update the invisibility and icon - hide(var/intact) - invisibility = intact ? 101 : 0 - updateicon() - - // update the icon_state - proc/updateicon() - var/state="floor_beacon" - - if(invisibility) - icon_state = "[state]f" - - else - icon_state = "[state]" - - process() - if(!Beacon) - var/turf/T = loc - Beacon = new /obj/item/device/radio/beacon - Beacon.invisibility = INVISIBILITY_MAXIMUM - Beacon.loc = T - if(Beacon) - if(Beacon.loc != loc) - Beacon.loc = loc - - updateicon() - - + updateicon() \ No newline at end of file diff --git a/code/game/machinery/CableLayer.dm b/code/game/machinery/CableLayer.dm index 277742a22b..a5625e9253 100644 --- a/code/game/machinery/CableLayer.dm +++ b/code/game/machinery/CableLayer.dm @@ -1,6 +1,5 @@ /obj/machinery/cablelayer name = "automatic cable layer" - icon = 'icons/obj/stationobjs.dmi' icon_state = "pipe_d" density = 1 @@ -42,7 +41,7 @@ m = min(m, cable.amount) m = min(m, 30) if(m) - playsound(loc, 'sound/items/Wirecutter.ogg', 50, 1) + playsound(src.loc, 'sound/items/Wirecutter.ogg', 50, 1) use_cable(m) var/obj/item/stack/cable_coil/CC = new (get_turf(src)) CC.amount = m diff --git a/code/game/machinery/OpTable.dm b/code/game/machinery/OpTable.dm index 8f0a0535b1..ba083031e7 100644 --- a/code/game/machinery/OpTable.dm +++ b/code/game/machinery/OpTable.dm @@ -10,41 +10,39 @@ active_power_usage = 5 var/mob/living/carbon/human/victim = null var/strapped = 0.0 - var/obj/machinery/computer/operating/computer = null /obj/machinery/optable/New() ..() for(dir in list(NORTH,EAST,SOUTH,WEST)) computer = locate(/obj/machinery/computer/operating, get_step(src, dir)) - if (computer) + if(computer) computer.table = src break // spawn(100) //Wont the MC just call this process() before and at the 10 second mark anyway? // process() /obj/machinery/optable/ex_act(severity) - switch(severity) if(1.0) //SN src = null qdel(src) return if(2.0) - if (prob(50)) + if(prob(50)) //SN src = null qdel(src) return if(3.0) - if (prob(25)) - src.density = 0 + if(prob(25)) + density = 0 else return /obj/machinery/optable/attack_hand(mob/user as mob) - if (HULK in usr.mutations) + if(HULK in usr.mutations) visible_message("\The [usr] destroys \the [src]!") - src.density = 0 + density = 0 qdel(src) return @@ -56,13 +54,12 @@ else return 0 - /obj/machinery/optable/MouseDrop_T(obj/O as obj, mob/user as mob) - if ((!( istype(O, /obj/item/weapon) ) || user.get_active_hand() != O)) + if((!(istype(O, /obj/item/weapon)) || user.get_active_hand() != O)) return user.drop_item() - if (O.loc != src.loc) + if(O.loc != src.loc) step(O, get_dir(O, src)) return @@ -70,10 +67,10 @@ if(locate(/mob/living/carbon/human, src.loc)) var/mob/living/carbon/human/M = locate(/mob/living/carbon/human, src.loc) if(M.lying) - src.victim = M + victim = M icon_state = M.pulse ? "table2-active" : "table2-idle" return 1 - src.victim = null + victim = null icon_state = "table2-idle" return 0 @@ -81,21 +78,21 @@ check_victim() /obj/machinery/optable/proc/take_victim(mob/living/carbon/C, mob/living/carbon/user as mob) - if (C == user) + if(C == user) user.visible_message("[user] climbs on \the [src].","You climb on \the [src].") else visible_message("\The [C] has been laid on \the [src] by [user].", 3) - if (C.client) + if(C.client) C.client.perspective = EYE_PERSPECTIVE C.client.eye = src C.resting = 1 C.loc = src.loc for(var/obj/O in src) O.loc = src.loc - src.add_fingerprint(user) + add_fingerprint(user) if(ishuman(C)) var/mob/living/carbon/human/H = C - src.victim = H + victim = H icon_state = H.pulse ? "table2-active" : "table2-idle" else icon_state = "table2-idle" @@ -121,7 +118,7 @@ take_victim(usr,usr) /obj/machinery/optable/attackby(obj/item/weapon/W as obj, mob/living/carbon/user as mob) - if (istype(W, /obj/item/weapon/grab)) + if(istype(W, /obj/item/weapon/grab)) var/obj/item/weapon/grab/G = W if(iscarbon(G.affecting) && check_table(G.affecting)) take_victim(G.affecting,usr) @@ -130,10 +127,10 @@ /obj/machinery/optable/proc/check_table(mob/living/carbon/patient as mob) check_victim() - if(src.victim && get_turf(victim) == get_turf(src) && victim.lying) + if(victim && get_turf(victim) == get_turf(src) && victim.lying) usr << "\The [src] is already occupied!" return 0 if(patient.buckled) usr << "Unbuckle \the [patient] first!" return 0 - return 1 + return 1 \ No newline at end of file diff --git a/code/game/machinery/Sleeper.dm b/code/game/machinery/Sleeper.dm index c0ef428f99..7193a7907b 100644 --- a/code/game/machinery/Sleeper.dm +++ b/code/game/machinery/Sleeper.dm @@ -2,7 +2,7 @@ name = "Sleeper Console" icon = 'icons/obj/Cryogenic2.dmi' icon_state = "sleeperconsole" - var/obj/machinery/sleeper/connected = null + var/obj/machinery/sleeper/sleeper anchored = 1 //About time someone fixed this. density = 0 dir = 8 @@ -11,21 +11,19 @@ interact_offline = 1 circuit = /obj/item/weapon/circuitboard/sleeper_console -//obj/machinery/sleep_console/New() - //..() - //spawn( 5 ) - //src.connected = locate(/obj/machinery/sleeper, get_step(src, WEST)) //We assume dir = 8 so sleeper is WEST. Other sprites do exist. - //return - //return - /obj/machinery/sleep_console/New() ..() - spawn(5) - //src.machine = locate(/obj/machinery/mineral/processing_unit, get_step(src, machinedir)) - src.connected = locate(/obj/machinery/sleeper) in range(2,src) - return - return + findsleeper() +/obj/machinery/sleep_console/proc/findsleeper() + spawn(5) + var/obj/machinery/sleeper/sleepernew = null + for(dir in list(NORTH, EAST, SOUTH, WEST)) // Loop through every direction + sleepernew = locate(/obj/machinery/sleeper, get_step(src, dir)) // Try to find a scanner in that direction + if(sleepernew) + sleeper = sleepernew + sleepernew.console = src + return /obj/machinery/sleep_console/attack_ai(var/mob/user) return attack_hand(user) @@ -33,39 +31,25 @@ /obj/machinery/sleep_console/attack_hand(var/mob/user) if(..()) return 1 - if(connected) - connected.ui_interact(user) + + if(sleeper.panel_open) + user << "Close the maintenance panel first." + return + + if(!sleeper) + findsleeper() + if(sleeper) + return sleeper.ui_interact(user) + else if(sleeper) + return sleeper.ui_interact(user) + else + user << "Sleeper not found!" /obj/machinery/sleep_console/attackby(var/obj/item/I, var/mob/user) - if(istype(I, /obj/item/weapon/screwdriver) && circuit) - user << "You start disconnecting the monitor." - playsound(src.loc, 'sound/items/Screwdriver.ogg', 50, 1) - if(do_after(user, 20)) - var/obj/structure/frame/A = new /obj/structure/frame( src.loc ) - var/obj/item/weapon/circuitboard/M = new circuit( A ) - A.circuit = M - A.anchored = 1 - A.density = 1 - A.frame_type = M.board_type - for (var/obj/C in src) - C.forceMove(loc) - if (src.stat & BROKEN) - user << "The broken glass falls out." - new /obj/item/weapon/material/shard( src.loc ) - A.state = 3 - A.icon_state = "[A.frame_type]_3" - else - user << "You disconnect the monitor." - A.state = 4 - A.icon_state = "[A.frame_type]_4" - A.pixel_x = pixel_x - A.pixel_y = pixel_y - A.dir = dir - M.deconstruct(src) - qdel(src) + if(computer_deconstruction_screwdriver(user, I)) + return else - src.attack_hand(user) - return + return attack_hand(user) /obj/machinery/sleep_console/power_change() ..() @@ -86,6 +70,7 @@ var/list/available_chemicals = list("inaprovaline" = "Inaprovaline", "stoxin" = "Soporific", "paracetamol" = "Paracetamol", "anti_toxin" = "Dylovene", "dexalin" = "Dexalin") var/obj/item/weapon/reagent_containers/glass/beaker = null var/filtering = 0 + var/obj/machinery/sleep_console/console use_power = 1 idle_power_usage = 15 @@ -94,7 +79,6 @@ /obj/machinery/sleeper/New() ..() beaker = new /obj/item/weapon/reagent_containers/glass/beaker/large(src) - circuit = new circuit(src) component_parts = list() component_parts += new /obj/item/weapon/stock_parts/scanning_module(src) component_parts += new /obj/item/weapon/reagent_containers/glass/beaker(src) @@ -105,13 +89,6 @@ component_parts += new /obj/item/weapon/reagent_containers/syringe(src) component_parts += new /obj/item/stack/material/glass/reinforced(src, 2) - spawn(5) - //src.machine = locate(/obj/machinery/mineral/processing_unit, get_step(src, machinedir)) - var/obj/machinery/sleep_console/C = locate(/obj/machinery/sleep_console) in range(2,src) - if(C) - C.connected = src - return - RefreshParts() /obj/machinery/sleeper/initialize() @@ -208,12 +185,12 @@ return 1 /obj/machinery/sleeper/attackby(var/obj/item/I, var/mob/user) + add_fingerprint(user) if(default_deconstruction_screwdriver(user, I)) return - if(default_deconstruction_crowbar(user, I)) + else if(default_deconstruction_crowbar(user, I)) return - add_fingerprint(user) - if(istype(I, /obj/item/weapon/reagent_containers/glass)) + else if(istype(I, /obj/item/weapon/reagent_containers/glass)) if(!beaker) beaker = I user.drop_item() @@ -283,21 +260,21 @@ if(occupant.client) occupant.client.eye = occupant.client.mob occupant.client.perspective = MOB_PERSPECTIVE - occupant.loc = loc + occupant.loc = src.loc occupant = null for(var/atom/movable/A in src) // In case an object was dropped inside or something if(A == beaker || A == circuit) continue if(A in component_parts) continue - A.loc = loc + A.loc = src.loc update_use_power(1) update_icon() toggle_filter() /obj/machinery/sleeper/proc/remove_beaker() if(beaker) - beaker.loc = loc + beaker.loc = src.loc beaker = null toggle_filter() diff --git a/code/game/machinery/adv_med.dm b/code/game/machinery/adv_med.dm index 43ca9d2fc3..1777151261 100644 --- a/code/game/machinery/adv_med.dm +++ b/code/game/machinery/adv_med.dm @@ -1,6 +1,5 @@ // Pretty much everything here is stolen from the dna scanner FYI - /obj/machinery/bodyscanner var/mob/living/carbon/occupant var/locked @@ -9,25 +8,15 @@ icon_state = "body_scanner_0" density = 1 anchored = 1 - circuit = /obj/item/weapon/circuitboard/body_scanner - use_power = 1 idle_power_usage = 60 active_power_usage = 10000 //10 kW. It's a big all-body scanner. - light_color = "#00FF00" + var/obj/machinery/body_scanconsole/console /obj/machinery/bodyscanner/New() ..() - spawn( 5 ) - var/obj/machinery/body_scanconsole/C = locate(/obj/machinery/body_scanconsole) in range(2,src) - if(C) - C.connected = src - -/obj/machinery/bodyscanner/map/New() - ..() - circuit = new circuit(src) component_parts = list() component_parts += new /obj/item/weapon/stock_parts/scanning_module(src) component_parts += new /obj/item/weapon/stock_parts/scanning_module(src) @@ -45,10 +34,9 @@ /obj/machinery/bodyscanner/attackby(var/obj/item/G, user as mob) if(default_deconstruction_screwdriver(user, G)) return - if(default_deconstruction_crowbar(user, G)) + else if(default_deconstruction_crowbar(user, G)) return - - if(istype(G, /obj/item/weapon/grab)) + else if(istype(G, /obj/item/weapon/grab)) var/obj/item/weapon/grab/H = G if(panel_open) user << "Close the maintenance panel first." @@ -126,14 +114,14 @@ add_fingerprint(usr) /obj/machinery/bodyscanner/proc/go_out() - if ((!( src.occupant ) || src.locked)) + if ((!(occupant) || src.locked)) return - if (src.occupant.client) - src.occupant.client.eye = src.occupant.client.mob - src.occupant.client.perspective = MOB_PERSPECTIVE - src.occupant.loc = src.loc - src.occupant = null - src.icon_state = "body_scanner_0" + if (occupant.client) + occupant.client.eye = occupant.client.mob + occupant.client.perspective = MOB_PERSPECTIVE + occupant.loc = src.loc + occupant = null + icon_state = "body_scanner_0" return /obj/machinery/bodyscanner/ex_act(severity) @@ -169,7 +157,7 @@ //Body Scan Console /obj/machinery/body_scanconsole - var/obj/machinery/bodyscanner/connected + var/obj/machinery/bodyscanner/scanner var/known_implants = list(/obj/item/weapon/implant/chem, /obj/item/weapon/implant/death_alarm, /obj/item/weapon/implant/loyalty, /obj/item/weapon/implant/tracking) var/delete var/temphtml @@ -188,35 +176,22 @@ findscanner() /obj/machinery/body_scanconsole/attackby(var/obj/item/I, var/mob/user) - if(istype(I, /obj/item/weapon/screwdriver) && circuit) - user << "You start disconnecting the monitor." - playsound(src.loc, 'sound/items/Screwdriver.ogg', 50, 1) - if(do_after(user, 20)) - var/obj/structure/frame/A = new /obj/structure/frame( src.loc ) - var/obj/item/weapon/circuitboard/M = new circuit( A ) - A.circuit = M - A.anchored = 1 - A.density = 1 - A.frame_type = M.board_type - for (var/obj/C in src) - C.forceMove(loc) - if (src.stat & BROKEN) - user << "The broken glass falls out." - new /obj/item/weapon/material/shard( src.loc ) - A.state = 3 - A.icon_state = "[A.frame_type]_3" - else - user << "You disconnect the monitor." - A.state = 4 - A.icon_state = "[A.frame_type]_4" - A.pixel_x = pixel_x - A.pixel_y = pixel_y - A.dir = dir - M.deconstruct(src) - qdel(src) + if(computer_deconstruction_screwdriver(user, I)) + return + else if(istype(I, /obj/item/device/multitool)) //Did you want to link it? + var/obj/item/device/multitool/P = I + if(P.connectable) + if(istype(P.connectable, /obj/machinery/bodyscanner)) + var/obj/machinery/bodyscanner/C = P.connectable + scanner = C + C.console = src + user << " You link the [src] to the [P.connectable]!" + else + user << " You store the [src] in the [P]'s buffer!" + P.connectable = src + return else - src.attack_hand(user) - return + return attack_hand(user) /obj/machinery/body_scanconsole/power_change() if(stat & BROKEN) @@ -226,7 +201,7 @@ stat &= ~NOPOWER else spawn(rand(0, 15)) - src.icon_state = "body_scannerconsole-p" + icon_state = "body_scannerconsole-p" stat |= NOPOWER /obj/machinery/body_scanconsole/ex_act(severity) @@ -244,13 +219,14 @@ return /obj/machinery/body_scanconsole/proc/findscanner() - spawn( 5 ) + spawn(5) var/obj/machinery/bodyscanner/bodyscannernew = null // Loop through every direction - for(dir in list(NORTH,EAST,SOUTH,WEST)) - // Try to find a scanner in that direction - bodyscannernew = locate(/obj/machinery/bodyscanner, get_step(src, dir)) - src.connected = bodyscannernew + for(dir in list(NORTH, EAST, SOUTH, WEST)) // Loop through every direction + bodyscannernew = locate(/obj/machinery/bodyscanner, get_step(src, dir)) // Try to find a scanner in that direction + if(bodyscannernew) + scanner = bodyscannernew + bodyscannernew.console = src return /obj/machinery/body_scanconsole/attack_ai(user as mob) @@ -263,26 +239,30 @@ if(stat & (NOPOWER|BROKEN)) return - if (panel_open) + if (scanner.panel_open) user << "Close the maintenance panel first." return - if(!src.connected) + if(!scanner) findscanner() - - ui_interact(user) + if(scanner) + return ui_interact(user) + else if(scanner) + return ui_interact(user) + else + user << "Scanner not found!" /obj/machinery/body_scanconsole/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1) var/data[0] - data["connected"] = connected ? 1 : 0 + data["connected"] = scanner ? 1 : 0 - if(connected) - data["occupied"] = connected.occupant ? 1 : 0 + if(scanner) + data["occupied"] = scanner.occupant ? 1 : 0 var/occupantData[0] - if(connected.occupant && ishuman(connected.occupant)) - var/mob/living/carbon/human/H = connected.occupant + if(scanner.occupant && ishuman(scanner.occupant)) + var/mob/living/carbon/human/H = scanner.occupant occupantData["name"] = H.name occupantData["stat"] = H.stat occupantData["health"] = H.health @@ -420,8 +400,8 @@ /obj/machinery/body_scanconsole/proc/generate_printing_text() var/dat = "" - if(connected) - var/mob/living/carbon/human/occupant = connected.occupant + if(scanner) + var/mob/living/carbon/human/occupant = scanner.occupant dat = "Occupant Statistics:
" //Blah obvious if(istype(occupant)) //is there REALLY someone in there? var/t1 diff --git a/code/game/machinery/ai_slipper.dm b/code/game/machinery/ai_slipper.dm index 9d45b14414..0ea5527df2 100644 --- a/code/game/machinery/ai_slipper.dm +++ b/code/game/machinery/ai_slipper.dm @@ -15,7 +15,6 @@ var/cooldown_on = 0 req_access = list(access_ai_upload) - /obj/machinery/ai_slipper/New() ..() update_icon() @@ -25,32 +24,32 @@ update_icon() /obj/machinery/ai_slipper/update_icon() - if (stat & NOPOWER || stat & BROKEN) + if(stat & NOPOWER || stat & BROKEN) icon_state = "motion0" else icon_state = disabled ? "motion0" : "motion3" /obj/machinery/ai_slipper/proc/setState(var/enabled, var/uses) - src.disabled = disabled - src.uses = uses - src.power_change() + disabled = disabled + uses = uses + power_change() /obj/machinery/ai_slipper/attackby(obj/item/weapon/W, mob/user) if(stat & (NOPOWER|BROKEN)) return - if (istype(user, /mob/living/silicon)) - return src.attack_hand(user) + if(istype(user, /mob/living/silicon)) + return attack_hand(user) else // trying to unlock the interface - if (src.allowed(usr)) + if(allowed(usr)) locked = !locked user << "You [ locked ? "lock" : "unlock"] the device." - if (locked) - if (user.machine==src) + if(locked) + if(user.machine==src) user.unset_machine() user << browse(null, "window=ai_slipper") else - if (user.machine==src) - src.attack_hand(usr) + if(user.machine==src) + attack_hand(usr) else user << "Access denied." return @@ -62,8 +61,8 @@ /obj/machinery/ai_slipper/attack_hand(mob/user as mob) if(stat & (NOPOWER|BROKEN)) return - if ( (get_dist(src, user) > 1 )) - if (!istype(user, /mob/living/silicon)) + if((get_dist(src, user) > 1)) + if(!istype(user, /mob/living/silicon)) user << text("Too far away.") user.unset_machine() user << browse(null, "window=ai_slipper") @@ -71,18 +70,18 @@ user.set_machine(src) var/loc = src.loc - if (istype(loc, /turf)) + if(istype(loc, /turf)) loc = loc:loc - if (!istype(loc, /area)) + if(!istype(loc, /area)) user << text("Turret badly positioned - loc.loc is [].", loc) return var/area/area = loc var/t = "AI Liquid Dispenser ([area.name])
" - if(src.locked && (!istype(user, /mob/living/silicon))) + if(locked && (!istype(user, /mob/living/silicon))) t += "(Swipe ID card to unlock control panel.)
" else - t += text("Dispenser [] - []?
\n", src.disabled?"deactivated":"activated", src, src.disabled?"Enable":"Disable") + t += text("Dispenser [] - []?
\n", disabled?"deactivated":"activated", src, disabled?"Enable":"Disable") t += text("Uses Left: [uses]. Activate the dispenser?
\n") user << browse(t, "window=computer;size=575x450") @@ -91,25 +90,25 @@ /obj/machinery/ai_slipper/Topic(href, href_list) ..() - if (src.locked) - if (!istype(usr, /mob/living/silicon)) + if(locked) + if(!istype(usr, /mob/living/silicon)) usr << "Control panel is locked!" return - if (href_list["toggleOn"]) - src.disabled = !src.disabled + if(href_list["toggleOn"]) + disabled = !disabled update_icon() - if (href_list["toggleUse"]) + if(href_list["toggleUse"]) if(cooldown_on || disabled) return else new /obj/effect/effect/foam(src.loc) - src.uses-- + uses-- cooldown_on = 1 cooldown_time = world.timeofday + 100 slip_process() return - src.attack_hand(usr) + attack_hand(usr) return /obj/machinery/ai_slipper/proc/slip_process() @@ -122,9 +121,9 @@ cooldown_timeleft = (ticksleft / 10) sleep(5) - if (uses <= 0) + if(uses <= 0) return - if (uses >= 0) + if(uses >= 0) cooldown_on = 0 - src.power_change() - return + power_change() + return \ No newline at end of file diff --git a/code/game/machinery/alarm.dm b/code/game/machinery/alarm.dm index 699898fde0..398bac9c54 100644 --- a/code/game/machinery/alarm.dm +++ b/code/game/machinery/alarm.dm @@ -51,10 +51,10 @@ var/rcon_setting = 2 var/rcon_time = 0 var/locked = 1 - var/wiresexposed = 0 // If it's been screwdrivered open. + panel_open = 0 // If it's been screwdrivered open. var/aidisabled = 0 var/shorted = 0 - circuit = /obj/item/weapon/circuitboard/airalarm + circuit = /obj/item/weapon/circuitboard/airalarm var/datum/wires/alarm/wires @@ -112,7 +112,7 @@ /obj/machinery/alarm/proc/first_run() alarm_area = get_area(src) area_uid = alarm_area.uid - if (name == "alarm") + if(name == "alarm") name = "[alarm_area.name] Air Alarm" if(!wires) @@ -123,20 +123,20 @@ TLV["carbon dioxide"] = list(-1.0, -1.0, 5, 10) // Partial pressure, kpa TLV["phoron"] = list(-1.0, -1.0, 0.2, 0.5) // Partial pressure, kpa TLV["other"] = list(-1.0, -1.0, 0.5, 1.0) // Partial pressure, kpa - TLV["pressure"] = list(ONE_ATMOSPHERE*0.80,ONE_ATMOSPHERE*0.90,ONE_ATMOSPHERE*1.10,ONE_ATMOSPHERE*1.20) /* kpa */ - TLV["temperature"] = list(T0C-26, T0C, T0C+40, T0C+66) // K + TLV["pressure"] = list(ONE_ATMOSPHERE * 0.80, ONE_ATMOSPHERE * 0.90, ONE_ATMOSPHERE * 1.10, ONE_ATMOSPHERE * 1.20) /* kpa */ + TLV["temperature"] = list(T0C - 26, T0C, T0C + 40, T0C + 66) // K /obj/machinery/alarm/initialize() set_frequency(frequency) - if (!master_is_operating()) + if(!master_is_operating()) elect_master() /obj/machinery/alarm/process() if((stat & (NOPOWER|BROKEN)) || shorted) return - var/turf/simulated/location = loc + var/turf/simulated/location = src.loc if(!istype(location)) return//returns if loc is not simulated var/datum/gas_mixture/environment = location.return_air() @@ -148,16 +148,16 @@ var/old_pressurelevel = pressure_dangerlevel danger_level = overall_danger_level(environment) - if (old_level != danger_level) + if(old_level != danger_level) apply_danger_level(danger_level) - if (old_pressurelevel != pressure_dangerlevel) - if (breach_detected()) + if(old_pressurelevel != pressure_dangerlevel) + if(breach_detected()) mode = AALARM_MODE_OFF apply_mode() - if (mode==AALARM_MODE_CYCLE && environment.return_pressure() 2.0) update_use_power(2) @@ -184,13 +184,13 @@ "You hear a click and a faint electronic hum.") else //check for when we should stop adjusting temperature - if (get_danger_level(target_temperature, TLV["temperature"]) || abs(environment.temperature - target_temperature) <= 0.5) + if(get_danger_level(target_temperature, TLV["temperature"]) || abs(environment.temperature - target_temperature) <= 0.5) update_use_power(1) regulating_temperature = 0 visible_message("\The [src] clicks quietly as it stops [environment.temperature > target_temperature ? "cooling" : "heating"] the room.",\ "You hear a click as a faint electronic humming stops.") - if (regulating_temperature) + if(regulating_temperature) if(target_temperature > T0C + MAX_TEMPERATURE) target_temperature = T0C + MAX_TEMPERATURE @@ -198,11 +198,11 @@ target_temperature = T0C + MIN_TEMPERATURE var/datum/gas_mixture/gas - gas = environment.remove(0.25*environment.total_moles) + gas = environment.remove(0.25 * environment.total_moles) if(gas) - if (gas.temperature <= target_temperature) //gas heating - var/energy_used = min( gas.get_thermal_energy_change(target_temperature) , active_power_usage) + if(gas.temperature <= target_temperature) //gas heating + var/energy_used = min(gas.get_thermal_energy_change(target_temperature) , active_power_usage) gas.add_thermal_energy(energy_used) //use_power(energy_used, ENVIRON) //handle by update_use_power instead @@ -212,7 +212,7 @@ //Assume the heat is being pumped into the hull which is fixed at 20 C //none of this is really proper thermodynamics but whatever - var/cop = gas.temperature/T20C //coefficient of performance -> power used = heat_transfer/cop + var/cop = gas.temperature / T20C //coefficient of performance -> power used = heat_transfer/cop heat_transfer = min(heat_transfer, cop * active_power_usage) //this ensures that we don't use more than active_power_usage amount of power @@ -223,7 +223,7 @@ environment.merge(gas) /obj/machinery/alarm/proc/overall_danger_level(var/datum/gas_mixture/environment) - var/partial_pressure = R_IDEAL_GAS_EQUATION*environment.temperature/environment.volume + var/partial_pressure = R_IDEAL_GAS_EQUATION * environment.temperature/environment.volume var/environment_pressure = environment.return_pressure() var/other_moles = 0 @@ -248,7 +248,7 @@ // Returns whether this air alarm thinks there is a breach, given the sensors that are available to it. /obj/machinery/alarm/proc/breach_detected() - var/turf/simulated/location = loc + var/turf/simulated/location = src.loc if(!istype(location)) return 0 @@ -260,20 +260,18 @@ var/environment_pressure = environment.return_pressure() var/pressure_levels = TLV["pressure"] - if (environment_pressure <= pressure_levels[1]) //low pressures - if (!(mode == AALARM_MODE_PANIC || mode == AALARM_MODE_CYCLE)) + if(environment_pressure <= pressure_levels[1]) //low pressures + if(!(mode == AALARM_MODE_PANIC || mode == AALARM_MODE_CYCLE)) return 1 return 0 - /obj/machinery/alarm/proc/master_is_operating() - return alarm_area.master_air_alarm && !(alarm_area.master_air_alarm.stat & (NOPOWER|BROKEN)) - + return alarm_area.master_air_alarm && !(alarm_area.master_air_alarm.stat & (NOPOWER | BROKEN)) /obj/machinery/alarm/proc/elect_master() - for (var/obj/machinery/alarm/AA in alarm_area) - if (!(AA.stat & (NOPOWER|BROKEN))) + for(var/obj/machinery/alarm/AA in alarm_area) + if(!(AA.stat & (NOPOWER|BROKEN))) alarm_area.master_air_alarm = AA return 1 return 0 @@ -286,7 +284,7 @@ return 0 /obj/machinery/alarm/update_icon() - if(wiresexposed) + if(panel_open) icon_state = "alarmx" set_light(0) return @@ -296,18 +294,18 @@ return var/icon_level = danger_level - if (alarm_area.atmosalm) + if(alarm_area.atmosalm) icon_level = max(icon_level, 1) //if there's an atmos alarm but everything is okay locally, no need to go past yellow var/new_color = null switch(icon_level) - if (0) + if(0) icon_state = "alarm0" new_color = "#03A728" - if (1) + if(1) icon_state = "alarm2" //yes, alarm2 is yellow alarm new_color = "#EC8B2F" - if (2) + if(2) icon_state = "alarm1" new_color = "#DA0205" @@ -316,20 +314,20 @@ /obj/machinery/alarm/receive_signal(datum/signal/signal) if(stat & (NOPOWER|BROKEN)) return - if (alarm_area.master_air_alarm != src) - if (master_is_operating()) + if(alarm_area.master_air_alarm != src) + if(master_is_operating()) return elect_master() - if (alarm_area.master_air_alarm != src) + if(alarm_area.master_air_alarm != src) return if(!signal || signal.encryption) return var/id_tag = signal.data["tag"] - if (!id_tag) + if(!id_tag) return - if (signal.data["area"] != area_uid) + if(signal.data["area"] != area_uid) return - if (signal.data["sigtype"] != "status") + if(signal.data["sigtype"] != "status") return var/dev_type = signal.data["device"] @@ -342,28 +340,28 @@ /obj/machinery/alarm/proc/register_env_machine(var/m_id, var/device_type) var/new_name - if (device_type=="AVP") + if(device_type == "AVP") new_name = "[alarm_area.name] Vent Pump #[alarm_area.air_vent_names.len+1]" alarm_area.air_vent_names[m_id] = new_name - else if (device_type=="AScr") + else if(device_type == "AScr") new_name = "[alarm_area.name] Air Scrubber #[alarm_area.air_scrub_names.len+1]" alarm_area.air_scrub_names[m_id] = new_name else return - spawn (10) - send_signal(m_id, list("init" = new_name) ) + spawn(10) + send_signal(m_id, list("init" = new_name)) /obj/machinery/alarm/proc/refresh_all() for(var/id_tag in alarm_area.air_vent_names) var/list/I = alarm_area.air_vent_info[id_tag] - if (I && I["timestamp"]+AALARM_REPORT_TIMEOUT/2 > world.time) + if(I && I["timestamp"] + AALARM_REPORT_TIMEOUT / 2 > world.time) continue - send_signal(id_tag, list("status") ) + send_signal(id_tag, list("status")) for(var/id_tag in alarm_area.air_scrub_names) var/list/I = alarm_area.air_scrub_info[id_tag] - if (I && I["timestamp"]+AALARM_REPORT_TIMEOUT/2 > world.time) + if(I && I["timestamp"] + AALARM_REPORT_TIMEOUT / 2 > world.time) continue - send_signal(id_tag, list("status") ) + send_signal(id_tag, list("status")) /obj/machinery/alarm/proc/set_frequency(new_frequency) radio_controller.remove_object(src, frequency) @@ -390,42 +388,42 @@ /obj/machinery/alarm/proc/apply_mode() //propagate mode to other air alarms in the area //TODO: make it so that players can choose between applying the new mode to the room they are in (related area) vs the entire alarm area - for (var/obj/machinery/alarm/AA in alarm_area) + for(var/obj/machinery/alarm/AA in alarm_area) AA.mode = mode switch(mode) if(AALARM_MODE_SCRUBBING) for(var/device_id in alarm_area.air_scrub_names) - send_signal(device_id, list("power"= 1, "co2_scrub"= 1, "scrubbing"= 1, "panic_siphon"= 0) ) + send_signal(device_id, list("power"= 1, "co2_scrub"= 1, "scrubbing"= 1, "panic_siphon"= 0)) for(var/device_id in alarm_area.air_vent_names) - send_signal(device_id, list("power"= 1, "checks"= "default", "set_external_pressure"= "default") ) + send_signal(device_id, list("power"= 1, "checks"= "default", "set_external_pressure"= "default")) if(AALARM_MODE_PANIC, AALARM_MODE_CYCLE) for(var/device_id in alarm_area.air_scrub_names) - send_signal(device_id, list("power"= 1, "panic_siphon"= 1) ) + send_signal(device_id, list("power"= 1, "panic_siphon"= 1)) for(var/device_id in alarm_area.air_vent_names) - send_signal(device_id, list("power"= 0) ) + send_signal(device_id, list("power"= 0)) if(AALARM_MODE_REPLACEMENT) for(var/device_id in alarm_area.air_scrub_names) - send_signal(device_id, list("power"= 1, "panic_siphon"= 1) ) + send_signal(device_id, list("power"= 1, "panic_siphon"= 1)) for(var/device_id in alarm_area.air_vent_names) - send_signal(device_id, list("power"= 1, "checks"= "default", "set_external_pressure"= "default") ) + send_signal(device_id, list("power"= 1, "checks"= "default", "set_external_pressure"= "default")) if(AALARM_MODE_FILL) for(var/device_id in alarm_area.air_scrub_names) - send_signal(device_id, list("power"= 0) ) + send_signal(device_id, list("power"= 0)) for(var/device_id in alarm_area.air_vent_names) - send_signal(device_id, list("power"= 1, "checks"= "default", "set_external_pressure"= "default") ) + send_signal(device_id, list("power"= 1, "checks"= "default", "set_external_pressure"= "default")) if(AALARM_MODE_OFF) for(var/device_id in alarm_area.air_scrub_names) - send_signal(device_id, list("power"= 0) ) + send_signal(device_id, list("power"= 0)) for(var/device_id in alarm_area.air_vent_names) - send_signal(device_id, list("power"= 0) ) + send_signal(device_id, list("power"= 0)) /obj/machinery/alarm/proc/apply_danger_level(var/new_danger_level) - if (report_danger_level && alarm_area.atmosalert(new_danger_level, src)) + if(report_danger_level && alarm_area.atmosalert(new_danger_level, src)) post_alert(new_danger_level) update_icon() @@ -443,9 +441,9 @@ if(alert_level==2) alert_signal.data["alert"] = "severe" - else if (alert_level==1) + else if(alert_level==1) alert_signal.data["alert"] = "minor" - else if (alert_level==0) + else if(alert_level==0) alert_signal.data["alert"] = "clear" frequency.post_signal(src, alert_signal) @@ -455,7 +453,7 @@ /obj/machinery/alarm/attack_hand(mob/user) . = ..() - if (.) + if(.) return return interact(user) @@ -485,7 +483,7 @@ ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open) if(!ui) - ui = new(user, src, ui_key, "air_alarm.tmpl", src.name, 325, 625, master_ui = master_ui, state = state) + ui = new(user, src, ui_key, "air_alarm.tmpl", name, 325, 625, master_ui = master_ui, state = state) ui.set_initial_data(data) ui.open() ui.set_auto_update(1) @@ -570,7 +568,7 @@ "carbon dioxide" = "CO2", "phoron" = "Toxin", "other" = "Other") - for (var/g in gas_names) + for(var/g in gas_names) thresholds[++thresholds.len] = list("name" = gas_names[g], "settings" = list()) selected = TLV[g] for(var/i = 1, i <= 4, i++) @@ -586,7 +584,6 @@ for(var/i = 1, i <= 4, i++) thresholds[thresholds.len]["settings"] += list(list("env" = "temperature", "val" = i, "selected" = selected[i])) - data["thresholds"] = thresholds /obj/machinery/alarm/CanUseTopic(var/mob/user, var/datum/topic_state/state, var/href_list = list()) @@ -660,7 +657,7 @@ "panic_siphon", "scrubbing") - send_signal(device_id, list(href_list["command"] = text2num(href_list["val"]) ) ) + send_signal(device_id, list(href_list["command"] = text2num(href_list["val"]))) return 1 if("set_threshold") @@ -668,16 +665,16 @@ var/threshold = text2num(href_list["var"]) var/list/selected = TLV[env] var/list/thresholds = list("lower bound", "low warning", "high warning", "upper bound") - var/newval = input("Enter [thresholds[threshold]] for [env]", "Alarm triggers", selected[threshold]) as null|num - if (isnull(newval)) + var/newval = input("Enter [thresholds[threshold]] for [env]", "Alarm triggers", selected[threshold]) as null | num + if(isnull(newval)) return 1 - if (newval<0) + if(newval<0) selected[threshold] = -1.0 - else if (env=="temperature" && newval>5000) + else if(env=="temperature" && newval>5000) selected[threshold] = 5000 - else if (env=="pressure" && newval>50*ONE_ATMOSPHERE) + else if(env=="pressure" && newval>50*ONE_ATMOSPHERE) selected[threshold] = 50*ONE_ATMOSPHERE - else if (env!="temperature" && env!="pressure" && newval>200) + else if(env!="temperature" && env!="pressure" && newval>200) selected[threshold] = 200 else newval = round(newval,0.01) @@ -727,13 +724,13 @@ return 1 if(href_list["atmos_alarm"]) - if (alarm_area.atmosalert(2, src)) + if(alarm_area.atmosalert(2, src)) apply_danger_level(2) update_icon() return 1 if(href_list["atmos_reset"]) - if (alarm_area.atmosalert(0, src)) + if(alarm_area.atmosalert(0, src)) apply_danger_level(0) update_icon() return 1 @@ -744,35 +741,13 @@ return 1 /obj/machinery/alarm/attackby(obj/item/W as obj, mob/user as mob) - src.add_fingerprint(user) - if(istype(W, /obj/item/weapon/screwdriver)) // Opening that Air Alarm up. - //user << "You pop the Air Alarm's maintence panel open." - wiresexposed = !wiresexposed - user << "The wires have been [wiresexposed ? "exposed" : "unexposed"]" - update_icon() + add_fingerprint(user) + if(alarm_deconstruction_screwdriver(user, W)) + return + if(alarm_deconstruction_wirecutters(user, W)) return - if (wiresexposed && istype(W, /obj/item/weapon/wirecutters)) - user.visible_message("[user] has cut the wires inside \the [src]!", "You have cut the wires inside \the [src].") - playsound(src.loc, 'sound/items/Wirecutter.ogg', 50, 1) - new/obj/item/stack/cable_coil(get_turf(src), 5) - var/obj/structure/frame/A = new /obj/structure/frame( src.loc ) - var/obj/item/weapon/circuitboard/M = new circuit( A ) - A.frame_type = "airalarm" - A.pixel_x = pixel_x - A.pixel_y = pixel_y - A.set_dir(dir) - A.circuit = M - A.anchored = 1 - for (var/obj/C in src) - C.forceMove(loc) - A.state = 2 - A.icon_state = "airalarm_2" - M.deconstruct(src) - qdel(src) - return - - if (istype(W, /obj/item/weapon/card/id) || istype(W, /obj/item/device/pda))// trying to unlock the interface with an ID card + if(istype(W, /obj/item/weapon/card/id) || istype(W, /obj/item/device/pda))// trying to unlock the interface with an ID card if(stat & (NOPOWER|BROKEN)) user << "It does nothing" return @@ -822,14 +797,14 @@ FIRE ALARM active_power_usage = 6 power_channel = ENVIRON var/last_process = 0 - var/wiresexposed = 0 + panel_open = 0 var/seclevel - circuit = /obj/item/weapon/circuitboard/firealarm + circuit = /obj/item/weapon/circuitboard/firealarm /obj/machinery/firealarm/update_icon() overlays.Cut() - if(wiresexposed) + if(panel_open) set_light(0) return @@ -840,7 +815,7 @@ FIRE ALARM icon_state = "firep" set_light(0) else - if(!src.detecting) + if(!detecting) icon_state = "fire1" set_light(l_range = 4, l_power = 2, l_color = "#ff0000") else @@ -851,79 +826,56 @@ FIRE ALARM if("red") set_light(l_range = 4, l_power = 2, l_color = "#ff0000") if("delta") set_light(l_range = 4, l_power = 2, l_color = "#FF6633") - src.overlays += image('icons/obj/monitors.dmi', "overlay_[seclevel]") + overlays += image('icons/obj/monitors.dmi', "overlay_[seclevel]") /obj/machinery/firealarm/fire_act(datum/gas_mixture/air, temperature, volume) - if(src.detecting) - if(temperature > T0C+200) - src.alarm() // added check of detector status here + if(detecting) + if(temperature > T0C + 200) + alarm() // added check of detector status here return /obj/machinery/firealarm/attack_ai(mob/user as mob) - return src.attack_hand(user) + return attack_hand(user) /obj/machinery/firealarm/bullet_act() - return src.alarm() + return alarm() /obj/machinery/firealarm/emp_act(severity) - if(prob(50/severity)) - alarm(rand(30/severity, 60/severity)) + if(prob(50 / severity)) + alarm(rand(30 / severity, 60 / severity)) ..() /obj/machinery/firealarm/attackby(obj/item/W as obj, mob/user as mob) - src.add_fingerprint(user) + add_fingerprint(user) - if (istype(W, /obj/item/weapon/screwdriver)) - wiresexposed = !wiresexposed - update_icon() - return - - if(wiresexposed) - if (istype(W, /obj/item/device/multitool)) - src.detecting = !( src.detecting ) - if (src.detecting) + if(panel_open) + if(istype(W, /obj/item/device/multitool)) + detecting = !(detecting) + if(detecting) user.visible_message("\The [user] has reconnected [src]'s detecting unit!", "You have reconnected [src]'s detecting unit.") else user.visible_message("\The [user] has disconnected [src]'s detecting unit!", "You have disconnected [src]'s detecting unit.") - else if (istype(W, /obj/item/weapon/wirecutters)) - user.visible_message("\The [user] has cut the wires inside \the [src]!", "You have cut the wires inside \the [src].") - new/obj/item/stack/cable_coil(get_turf(src), 5) - playsound(src.loc, 'sound/items/Wirecutter.ogg', 50, 1) - var/obj/structure/frame/A = new /obj/structure/frame( src.loc ) - var/obj/item/weapon/circuitboard/M = new circuit( A ) - A.frame_type = "firealarm" - A.pixel_x = pixel_x - A.pixel_y = pixel_y - A.set_dir(dir) - A.circuit = M - A.anchored = 1 - for (var/obj/C in src) - C.forceMove(loc) - A.state = 2 - A.icon_state = "firealarm_2" - M.deconstruct(src) - qdel(src) return - src.alarm() + alarm() return /obj/machinery/firealarm/process()//Note: this processing was mostly phased out due to other code, and only runs when needed if(stat & (NOPOWER|BROKEN)) return - if(src.timing) - if(src.time > 0) - src.time = src.time - ((world.timeofday - last_process)/10) + if(timing) + if(time > 0) + time = time - ((world.timeofday - last_process) / 10) else - src.alarm() - src.time = 0 - src.timing = 0 + alarm() + time = 0 + timing = 0 processing_objects.Remove(src) - src.updateDialog() + updateDialog() last_process = world.timeofday - if(locate(/obj/fire) in loc) + if(locate(/obj/fire) in src.loc) alarm() return @@ -934,41 +886,41 @@ FIRE ALARM update_icon() /obj/machinery/firealarm/attack_hand(mob/user as mob) - if(user.stat || stat & (NOPOWER|BROKEN)) + if(user.stat || stat & (NOPOWER | BROKEN)) return user.set_machine(src) var/area/A = src.loc var/d1 var/d2 - if (istype(user, /mob/living/carbon/human) || istype(user, /mob/living/silicon)) + if(istype(user, /mob/living/carbon/human) || istype(user, /mob/living/silicon)) A = A.loc - if (A.fire) + if(A.fire) d1 = text("Reset - Lockdown", src) else d1 = text("Alarm - Lockdown", src) - if (src.timing) + if(timing) d2 = text("Stop Time Lock", src) else d2 = text("Initiate Time Lock", src) - var/second = round(src.time) % 60 - var/minute = (round(src.time) - second) / 60 + var/second = round(time) % 60 + var/minute = (round(time) - second) / 60 var/dat = "Fire alarm [d1]\n
The current alert level is: [get_security_level()]

\nTimer System: [d2]
\nTime Left: [(minute ? "[minute]:" : null)][second] - - + +\n
" user << browse(dat, "window=firealarm") onclose(user, "firealarm") else A = A.loc - if (A.fire) + if(A.fire) d1 = text("[]", src, stars("Reset - Lockdown")) else d1 = text("[]", src, stars("Alarm - Lockdown")) - if (src.timing) + if(timing) d2 = text("[]", src, stars("Stop Time Lock")) else d2 = text("[]", src, stars("Initiate Time Lock")) - var/second = round(src.time) % 60 - var/minute = (round(src.time) - second) / 60 + var/second = round(time) % 60 + var/minute = (round(time) - second) / 60 var/dat = "[stars("Fire alarm")] [d1]\n
The current alert level is: [stars(get_security_level())]

\nTimer System: [d2]
\nTime Left: [(minute ? text("[]:", minute) : null)][second] - - + +\n
" user << browse(dat, "window=firealarm") onclose(user, "firealarm") @@ -976,43 +928,43 @@ FIRE ALARM /obj/machinery/firealarm/Topic(href, href_list) ..() - if (usr.stat || stat & (BROKEN|NOPOWER)) + if(usr.stat || stat & (BROKEN | NOPOWER)) return - if ((usr.contents.Find(src) || ((get_dist(src, usr) <= 1) && istype(src.loc, /turf))) || (istype(usr, /mob/living/silicon))) + if((usr.contents.Find(src) || ((get_dist(src, usr) <= 1) && istype(src.loc, /turf))) || (istype(usr, /mob/living/silicon))) usr.set_machine(src) - if (href_list["reset"]) - src.reset() - else if (href_list["alarm"]) - src.alarm() - else if (href_list["time"]) - src.timing = text2num(href_list["time"]) + if(href_list["reset"]) + reset() + else if(href_list["alarm"]) + alarm() + else if(href_list["time"]) + timing = text2num(href_list["time"]) last_process = world.timeofday processing_objects.Add(src) - else if (href_list["tp"]) + else if(href_list["tp"]) var/tp = text2num(href_list["tp"]) - src.time += tp - src.time = min(max(round(src.time), 0), 120) + time += tp + time = min(max(round(time), 0), 120) - src.updateUsrDialog() + updateUsrDialog() - src.add_fingerprint(usr) + add_fingerprint(usr) else usr << browse(null, "window=firealarm") return return /obj/machinery/firealarm/proc/reset() - if (!( src.working )) + if(!(working)) return var/area/area = get_area(src) for(var/obj/machinery/firealarm/FA in area) - fire_alarm.clearAlarm(loc, FA) + fire_alarm.clearAlarm(src.loc, FA) update_icon() return /obj/machinery/firealarm/proc/alarm(var/duration = 0) - if (!( src.working)) + if(!(working)) return var/area/area = get_area(src) for(var/obj/machinery/firealarm/FA in area) @@ -1066,13 +1018,13 @@ Just a object used in constructing fire alarms ASSERT(isarea(A)) var/d1 var/d2 - if (istype(user, /mob/living/carbon/human) || istype(user, /mob/living/silicon/ai)) + if(istype(user, /mob/living/carbon/human) || istype(user, /mob/living/silicon/ai)) - if (A.party) + if(A.party) d1 = text("No Party :(", src) else d1 = text("PARTY!!!", src) - if (timing) + if(timing) d2 = text("Stop Time Lock", src) else d2 = text("Initiate Time Lock", src) @@ -1082,11 +1034,11 @@ Just a object used in constructing fire alarms user << browse(dat, "window=partyalarm") onclose(user, "partyalarm") else - if (A.fire) + if(A.fire) d1 = text("[]", src, stars("No Party :(")) else d1 = text("[]", src, stars("PARTY!!!")) - if (timing) + if(timing) d2 = text("[]", src, stars("Stop Time Lock")) else d2 = text("[]", src, stars("Initiate Time Lock")) @@ -1098,7 +1050,7 @@ Just a object used in constructing fire alarms return /obj/machinery/partyalarm/proc/reset() - if (!( working )) + if(!(working)) return var/area/A = get_area(src) ASSERT(isarea(A)) @@ -1106,7 +1058,7 @@ Just a object used in constructing fire alarms return /obj/machinery/partyalarm/proc/alarm() - if (!( working )) + if(!(working)) return var/area/A = get_area(src) ASSERT(isarea(A)) @@ -1115,23 +1067,20 @@ Just a object used in constructing fire alarms /obj/machinery/partyalarm/Topic(href, href_list) ..() - if (usr.stat || stat & (BROKEN|NOPOWER)) + if(usr.stat || stat & (BROKEN|NOPOWER)) return - if ((usr.contents.Find(src) || ((get_dist(src, usr) <= 1) && istype(loc, /turf))) || (istype(usr, /mob/living/silicon/ai))) + if((usr.contents.Find(src) || ((get_dist(src, usr) <= 1) && istype(loc, /turf))) || (istype(usr, /mob/living/silicon/ai))) usr.machine = src - if (href_list["reset"]) + if(href_list["reset"]) reset() - else - if (href_list["alarm"]) - alarm() - else - if (href_list["time"]) - timing = text2num(href_list["time"]) - else - if (href_list["tp"]) - var/tp = text2num(href_list["tp"]) - time += tp - time = min(max(round(time), 0), 120) + else if(href_list["alarm"]) + alarm() + else if(href_list["time"]) + timing = text2num(href_list["time"]) + else if(href_list["tp"]) + var/tp = text2num(href_list["tp"]) + time += tp + time = min(max(round(time), 0), 120) updateUsrDialog() add_fingerprint(usr) diff --git a/code/game/machinery/atmo_control.dm b/code/game/machinery/atmo_control.dm index 19d1ee1253..83c6f81e30 100644 --- a/code/game/machinery/atmo_control.dm +++ b/code/game/machinery/atmo_control.dm @@ -58,7 +58,6 @@ signal.data["sigtype"]="status" radio_connection.post_signal(src, signal, filter = RADIO_ATMOSIA) - /obj/machinery/air_sensor/proc/set_frequency(new_frequency) radio_controller.remove_object(src, frequency) frequency = new_frequency @@ -76,12 +75,9 @@ obj/machinery/air_sensor/Destroy() icon = 'icons/obj/computer.dmi' icon_keyboard = "atmos_key" icon_screen = "tank" - name = "Computer" - var/frequency = 1439 var/list/sensors = list() - var/list/sensor_information = list() var/datum/radio_frequency/radio_connection circuit = /obj/item/weapon/circuitboard/air_management @@ -121,8 +117,8 @@ obj/machinery/computer/general_air_control/Destroy() data["sensors"] = sensors_ui ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open) - if (!ui) - ui = new(user, src, ui_key, "atmo_control.tmpl", src.name, 525, 600) + if(!ui) + ui = new(user, src, ui_key, "atmo_control.tmpl", name, 525, 600) ui.set_initial_data(data) ui.open() ui.set_auto_update(5) @@ -137,14 +133,11 @@ obj/machinery/computer/general_air_control/Destroy() /obj/machinery/computer/general_air_control/large_tank_control icon = 'icons/obj/computer.dmi' - frequency = 1441 var/input_tag var/output_tag - var/list/input_info var/list/output_info - var/input_flow_setting = 200 var/pressure_setting = ONE_ATMOSPHERE * 45 circuit = /obj/item/weapon/circuitboard/air_management/tank_control @@ -179,8 +172,8 @@ obj/machinery/computer/general_air_control/Destroy() data["pressure_setting"] = pressure_setting ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open) - if (!ui) - ui = new(user, src, ui_key, "atmo_control.tmpl", src.name, 660, 500) + if(!ui) + ui = new(user, src, ui_key, "atmo_control.tmpl", name, 660, 500) ui.set_initial_data(data) ui.open() ui.set_auto_update(5) @@ -251,14 +244,11 @@ obj/machinery/computer/general_air_control/Destroy() /obj/machinery/computer/general_air_control/supermatter_core icon = 'icons/obj/computer.dmi' - frequency = 1438 var/input_tag var/output_tag - var/list/input_info var/list/output_info - var/input_flow_setting = 700 var/pressure_setting = 100 circuit = /obj/item/weapon/circuitboard/air_management/supermatter_core @@ -292,8 +282,8 @@ obj/machinery/computer/general_air_control/Destroy() data["pressure_setting"] = pressure_setting ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open) - if (!ui) - ui = new(user, src, ui_key, "atmo_control.tmpl", src.name, 650, 500) + if(!ui) + ui = new(user, src, ui_key, "atmo_control.tmpl", name, 650, 500) ui.set_initial_data(data) ui.open() ui.set_auto_update(5) @@ -365,12 +355,9 @@ obj/machinery/computer/general_air_control/Destroy() /obj/machinery/computer/general_air_control/fuel_injection icon = 'icons/obj/computer.dmi' icon_screen = "alert:0" - var/device_tag var/list/device_info - var/automation = 0 - var/cutoff_temperature = 2000 var/on_temperature = 1200 circuit = /obj/item/weapon/circuitboard/air_management/injector_control @@ -427,8 +414,8 @@ obj/machinery/computer/general_air_control/Destroy() data["device_info"] = null ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open) - if (!ui) - ui = new(user, src, ui_key, "atmo_control.tmpl", src.name, 650, 500) + if(!ui) + ui = new(user, src, ui_key, "atmo_control.tmpl", name, 650, 500) ui.set_initial_data(data) ui.open() ui.set_auto_update(5) @@ -494,8 +481,4 @@ obj/machinery/computer/general_air_control/Destroy() "sigtype"="command" ) - radio_connection.post_signal(src, signal, filter = RADIO_ATMOSIA) - - - - + radio_connection.post_signal(src, signal, filter = RADIO_ATMOSIA) \ No newline at end of file diff --git a/code/game/machinery/autolathe.dm b/code/game/machinery/autolathe.dm index 236079f8e3..e9c7df22b2 100644 --- a/code/game/machinery/autolathe.dm +++ b/code/game/machinery/autolathe.dm @@ -26,7 +26,6 @@ /obj/machinery/autolathe/New() ..() wires = new(src) - circuit = new circuit(src) component_parts = list() component_parts += new /obj/item/weapon/stock_parts/matter_bin(src) component_parts += new /obj/item/weapon/stock_parts/matter_bin(src) @@ -48,7 +47,6 @@ current_category = machine_recipes.categories[1] /obj/machinery/autolathe/interact(mob/user as mob) - update_recipe_list() if(..() || (disabled && !panel_open)) @@ -119,7 +117,6 @@ onclose(user, "autolathe") /obj/machinery/autolathe/attackby(var/obj/item/O as obj, var/mob/user as mob) - if(busy) user << "\The [src] is busy. Please wait for completion of previous operation." return @@ -223,7 +220,6 @@ interact(user) /obj/machinery/autolathe/Topic(href, href_list) - if(..()) return @@ -277,7 +273,7 @@ if(!making || !src) return //Create the desired item. - var/obj/item/I = new making.path(loc) + var/obj/item/I = new making.path(src.loc) if(multiplier > 1 && istype(I, /obj/item/stack)) var/obj/item/stack/S = I S.amount = multiplier @@ -303,7 +299,6 @@ mat_efficiency = 1.1 - man_rating * 0.1// Normally, price is 1.25 the amount of material, so this shouldn't go higher than 0.8. Maximum rating of parts is 3 /obj/machinery/autolathe/dismantle() - for(var/mat in stored_material) var/material/M = get_material_by_name(mat) if(!istype(M)) diff --git a/code/game/machinery/biogenerator.dm b/code/game/machinery/biogenerator.dm index 986d20e3b9..07f0b8f9bd 100644 --- a/code/game/machinery/biogenerator.dm +++ b/code/game/machinery/biogenerator.dm @@ -15,7 +15,6 @@ var/build_eff = 1 var/eat_eff = 1 - /obj/machinery/biogenerator/New() ..() var/datum/reagents/R = new/datum/reagents(1000) @@ -23,11 +22,9 @@ R.my_atom = src beaker = new /obj/item/weapon/reagent_containers/glass/bottle(src) - circuit = new circuit(src) component_parts = list() component_parts += new /obj/item/weapon/stock_parts/matter_bin(src) component_parts += new /obj/item/weapon/stock_parts/manipulator(src) - RefreshParts() /obj/machinery/biogenerator/on_reagent_change() //When the reagents change, change the icon as well. @@ -96,13 +93,13 @@ return user.set_machine(src) var/dat = "BiogeneratorBiogenerator:
" - if (processing) + if(processing) dat += "Biogenerator is processing! Please wait..." else dat += "Biomass: [points] points.
" switch(menustat) if("menu") - if (beaker) + if(beaker) dat += "Activate Biogenerator!
" dat += "Detach Container

" dat += "Food
" @@ -139,9 +136,9 @@ interact(user) /obj/machinery/biogenerator/proc/activate() - if (usr.stat) + if(usr.stat) return - if (stat) //NOPOWER etc + if(stat) //NOPOWER etc return if(processing) usr << "The biogenerator is in the process of working." @@ -255,4 +252,4 @@ man_rating += P.rating build_eff = man_rating - eat_eff = bin_rating + eat_eff = bin_rating \ No newline at end of file diff --git a/code/game/machinery/buttons.dm b/code/game/machinery/buttons.dm index 70557a2e18..b072a7e488 100644 --- a/code/game/machinery/buttons.dm +++ b/code/game/machinery/buttons.dm @@ -10,9 +10,8 @@ idle_power_usage = 2 active_power_usage = 4 - /obj/machinery/button/attack_ai(mob/user as mob) - return src.attack_hand(user) + return attack_hand(user) /obj/machinery/button/attackby(obj/item/weapon/W, mob/user as mob) - return src.attack_hand(user) \ No newline at end of file + return attack_hand(user) \ No newline at end of file diff --git a/code/game/machinery/cell_charger.dm b/code/game/machinery/cell_charger.dm index 9ff0b2f894..1e5c6ec73b 100644 --- a/code/game/machinery/cell_charger.dm +++ b/code/game/machinery/cell_charger.dm @@ -14,7 +14,7 @@ /obj/machinery/cell_charger/update_icon() icon_state = "ccharger[charging ? 1 : 0]" - if(charging && !(stat & (BROKEN|NOPOWER)) ) + if(charging && !(stat & (BROKEN|NOPOWER))) var/newlevel = round(charging.percent() * 4.0 / 99) //world << "nl: [newlevel]" @@ -73,14 +73,14 @@ charging.add_fingerprint(user) charging.update_icon() - src.charging = null + charging = null user.visible_message("[user] removes the cell from the charger.", "You remove the cell from the charger.") chargelevel = -1 update_icon() /obj/machinery/cell_charger/attack_ai(mob/user) if(istype(user, /mob/living/silicon/robot) && Adjacent(user)) // Borgs can remove the cell if they are near enough - if(!src.charging) + if(!charging) return charging.loc = src.loc @@ -104,7 +104,7 @@ update_use_power(0) return - if (charging && !charging.fully_charged()) + if(charging && !charging.fully_charged()) charging.give(active_power_usage*CELLRATE) update_use_power(2) diff --git a/code/game/machinery/cloning.dm b/code/game/machinery/cloning.dm index 19d187ade4..88bafe5cd3 100644 --- a/code/game/machinery/cloning.dm +++ b/code/game/machinery/cloning.dm @@ -47,7 +47,6 @@ /obj/machinery/clonepod/New() ..() - circuit = new circuit(src) component_parts = list() component_parts += new /obj/item/weapon/stock_parts/manipulator(src) component_parts += new /obj/item/weapon/stock_parts/manipulator(src) @@ -184,7 +183,7 @@ else if((occupant.health >= heal_level) && (!eject_wait)) playsound(src.loc, 'sound/machines/ding.ogg', 50, 1) - src.audible_message("\The [src] signals that the cloning process is complete.") + audible_message("\The [src] signals that the cloning process is complete.") connected_message("Cloning Process Complete.") locked = 0 go_out() @@ -235,7 +234,7 @@ connected = null else anchored = 1 - playsound(loc, 'sound/items/Ratchet.ogg', 100, 1) + playsound(src.loc, 'sound/items/Ratchet.ogg', 100, 1) if(anchored) user.visible_message("[user] secures [src] to the floor.", "You secure [src] to the floor.") else @@ -298,7 +297,7 @@ if(mess) //Clean that mess and dump those gibs! mess = 0 - gibs(loc) + gibs(src.loc) update_icon() return @@ -308,7 +307,7 @@ if(occupant.client) occupant.client.eye = occupant.client.mob occupant.client.perspective = MOB_PERSPECTIVE - occupant.loc = loc + occupant.loc = src.loc eject_wait = 0 //If it's still set somehow. domutcheck(occupant) //Waiting until they're out before possible transforming. occupant = null @@ -342,21 +341,21 @@ switch(severity) if(1.0) for(var/atom/movable/A as mob|obj in src) - A.loc = loc + A.loc = src.loc ex_act(severity) qdel(src) return if(2.0) if(prob(50)) for(var/atom/movable/A as mob|obj in src) - A.loc = loc + A.loc = src.loc ex_act(severity) qdel(src) return if(3.0) if(prob(25)) for(var/atom/movable/A as mob|obj in src) - A.loc = loc + A.loc = src.loc ex_act(severity) qdel(src) return @@ -366,9 +365,9 @@ /obj/machinery/clonepod/update_icon() ..() icon_state = "pod_0" - if (occupant && !(stat & NOPOWER)) + if(occupant && !(stat & NOPOWER)) icon_state = "pod_1" - else if (mess) + else if(mess) icon_state = "pod_g" //Health Tracker Implant diff --git a/code/game/machinery/computer/computer.dm b/code/game/machinery/computer/computer.dm index 6f380739cc..5cdbdeab9c 100644 --- a/code/game/machinery/computer/computer.dm +++ b/code/game/machinery/computer/computer.dm @@ -7,7 +7,6 @@ use_power = 1 idle_power_usage = 300 active_power_usage = 300 - frame_type = "computer" var/processing = 0 var/icon_keyboard = "generic_key" @@ -97,37 +96,8 @@ return text /obj/machinery/computer/attackby(I as obj, user as mob) - if(istype(I, /obj/item/weapon/screwdriver) && circuit) - user << "You start disconnecting the monitor." - playsound(src.loc, 'sound/items/Screwdriver.ogg', 50, 1) - if(do_after(user, 20)) - var/obj/structure/frame/A = new /obj/structure/frame( src.loc ) - var/obj/item/weapon/circuitboard/M = new circuit( A ) - A.circuit = M - A.anchored = 1 - A.density = 1 - A.frame_type = M.board_type - for (var/obj/C in src) - C.forceMove(loc) - if (src.stat & BROKEN) - user << "The broken glass falls out." - new /obj/item/weapon/material/shard( src.loc ) - A.state = 3 - A.icon_state = "[A.frame_type]_3" - else - user << "You disconnect the monitor." - A.state = 4 - A.icon_state = "[A.frame_type]_4" - A.pixel_x = pixel_x - A.pixel_y = pixel_y - M.deconstruct(src) - qdel(src) + if(computer_deconstruction_screwdriver(user, I)) + return else - src.attack_hand(user) - return - - - - - - + attack_hand(user) + return \ No newline at end of file diff --git a/code/game/machinery/computer/guestpass.dm b/code/game/machinery/computer/guestpass.dm index b3f9765746..333c12cd44 100644 --- a/code/game/machinery/computer/guestpass.dm +++ b/code/game/machinery/computer/guestpass.dm @@ -65,25 +65,6 @@ /obj/machinery/computer/guestpass/attackby(obj/I, mob/user) - if(istype(I, /obj/item/weapon/screwdriver) && circuit) - user << "You start disconnecting the monitor." - playsound(src.loc, 'sound/items/Screwdriver.ogg', 50, 1) - if(do_after(user, 20)) - var/obj/structure/frame/A = new /obj/structure/frame( src.loc ) - var/obj/item/weapon/circuitboard/M = new circuit( A ) - A.frame_type = "guestpass" - A.pixel_x = pixel_x - A.pixel_y = pixel_y - A.circuit = M - A.anchored = 1 - for (var/obj/C in src) - C.forceMove(loc) - user << "You disconnect the monitor." - A.state = 4 - A.icon_state = "guestpass_4" - M.deconstruct(src) - qdel(src) - return if(istype(I, /obj/item/weapon/card/id)) if(!giver && user.unEquip(I)) I.forceMove(src) diff --git a/code/game/machinery/constructable_frame.dm b/code/game/machinery/constructable_frame.dm index 665f74d926..1236ae0e5b 100644 --- a/code/game/machinery/constructable_frame.dm +++ b/code/game/machinery/constructable_frame.dm @@ -1,5 +1,4 @@ //This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:31 - //Circuit boards are in /code/game/objects/items/weapons/circuitboards/machinery/ /obj/machinery/constructable_frame //Made into a seperate type to make future revisions easier. diff --git a/code/game/machinery/cryo.dm b/code/game/machinery/cryo.dm index 6c4c6160cd..7a1b12509c 100644 --- a/code/game/machinery/cryo.dm +++ b/code/game/machinery/cryo.dm @@ -27,10 +27,10 @@ initialize_directions = dir /obj/machinery/atmospherics/unary/cryo_cell/Destroy() - var/turf/T = loc + var/turf/T = src.loc T.contents += contents if(beaker) - beaker.loc = get_step(loc, SOUTH) //Beaker is carefully ejected from the wreckage of the cryotube + beaker.loc = get_step(src.loc, SOUTH) //Beaker is carefully ejected from the wreckage of the cryotube ..() /obj/machinery/atmospherics/unary/cryo_cell/initialize() @@ -64,7 +64,7 @@ /obj/machinery/atmospherics/unary/cryo_cell/relaymove(mob/user as mob) // note that relaymove will also be called for mobs outside the cell with UI open - if(src.occupant == user && !user.stat) + if(occupant == user && !user.stat) go_out() /obj/machinery/atmospherics/unary/cryo_cell/attack_hand(mob/user) @@ -92,7 +92,7 @@ data["hasOccupant"] = occupant ? 1 : 0 var/occupantData[0] - if (occupant) + if(occupant) occupantData["name"] = occupant.name occupantData["stat"] = occupant.stat occupantData["health"] = occupant.health @@ -124,13 +124,13 @@ data["beakerVolume"] = 0 if(beaker) data["beakerLabel"] = beaker.label_text ? beaker.label_text : null - if (beaker.reagents && beaker.reagents.reagent_list.len) + if(beaker.reagents && beaker.reagents.reagent_list.len) for(var/datum/reagent/R in beaker.reagents.reagent_list) data["beakerVolume"] += R.volume // update the ui if it exists, returns null if no ui is passed/found ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open) - if (!ui) + if(!ui) // the ui does not exist, so we'll create a new() one // for a list of parameters and their descriptions see the code docs in \code\modules\nano\nanoui.dm ui = new(user, src, ui_key, "cryo.tmpl", "Cryo Cell Control System", 520, 410) @@ -158,7 +158,7 @@ if(href_list["ejectBeaker"]) if(beaker) - beaker.loc = get_step(loc, SOUTH) + beaker.loc = get_step(src.loc, SOUTH) beaker = null if(href_list["ejectOccupant"]) @@ -235,7 +235,7 @@ occupant.adjustOxyLoss(-1) //severe damage should heal waaay slower without proper chemicals if(occupant.bodytemperature < 225) - if (occupant.getToxLoss()) + if(occupant.getToxLoss()) occupant.adjustToxLoss(max(-1, -20/occupant.getToxLoss())) var/heal_brute = occupant.getBruteLoss() ? min(1, 20/occupant.getBruteLoss()) : 0 var/heal_fire = occupant.getFireLoss() ? min(1, 20/occupant.getFireLoss()) : 0 @@ -267,15 +267,15 @@ //loc.assume_air(expel_gas) /obj/machinery/atmospherics/unary/cryo_cell/proc/go_out() - if(!( occupant )) + if(!(occupant)) return //for(var/obj/O in src) - // O.loc = loc - if (occupant.client) + // O.loc = src.loc + if(occupant.client) occupant.client.eye = occupant.client.mob occupant.client.perspective = MOB_PERSPECTIVE - occupant.loc = get_step(loc, SOUTH) //this doesn't account for walls or anything, but i don't forsee that being a problem. - if (occupant.bodytemperature < 261 && occupant.bodytemperature >= 70) //Patch by Aranclanos to stop people from taking burn damage after being ejected + occupant.loc = get_step(src.loc, SOUTH) //this doesn't account for walls or anything, but i don't forsee that being a problem. + if(occupant.bodytemperature < 261 && occupant.bodytemperature >= 70) //Patch by Aranclanos to stop people from taking burn damage after being ejected occupant.bodytemperature = 261 // Changed to 70 from 140 by Zuhayr due to reoccurance of bug. // occupant.metabslow = 0 occupant = null @@ -284,22 +284,22 @@ update_icon() return /obj/machinery/atmospherics/unary/cryo_cell/proc/put_mob(mob/living/carbon/M as mob) - if (stat & (NOPOWER|BROKEN)) + if(stat & (NOPOWER|BROKEN)) usr << "The cryo cell is not functioning." return - if (!istype(M)) + if(!istype(M)) usr << "The cryo cell cannot handle such a lifeform!" return - if (occupant) + if(occupant) usr << "The cryo cell is already occupied!" return - if (M.abiotic()) + if(M.abiotic()) usr << "Subject may not have abiotic items on." return if(!node) usr << "The cell is not correctly connected to its pipe network!" return - if (M.client) + if(M.client) M.client.perspective = EYE_PERSPECTIVE M.client.eye = src M.stop_pulling() @@ -320,7 +320,7 @@ set category = "Object" set src in oview(1) if(usr == occupant)//If the user is inside the tube... - if (usr.stat == 2)//and he's not dead.... + if(usr.stat == 2)//and he's not dead.... return usr << "Release sequence activated. This will take two minutes." sleep(1200) @@ -328,7 +328,7 @@ return go_out()//and release him from the eternal prison. else - if (usr.stat != 0) + if(usr.stat != 0) return go_out() add_fingerprint(usr) @@ -342,7 +342,7 @@ if(M.Victim == usr) usr << "You're too busy getting your life sucked out of you." return - if (usr.stat != 0) + if(usr.stat != 0) return put_mob(usr) return @@ -353,7 +353,7 @@ /obj/machinery/atmospherics/unary/cryo_cell/return_air_for_internal_lifeform() //assume that the cryo cell has some kind of breath mask or something that //draws from the cryo tube's environment, instead of the cold internal air. - if(loc) + if(src.loc) return loc.return_air() else return null diff --git a/code/game/machinery/cryopod.dm b/code/game/machinery/cryopod.dm index e1c65243d9..9c3a8f26bb 100644 --- a/code/game/machinery/cryopod.dm +++ b/code/game/machinery/cryopod.dm @@ -6,7 +6,6 @@ * ~ Zuhayr */ - //Main cryopod console. /obj/machinery/computer/cryopod @@ -73,18 +72,18 @@ allow_items = 1 /obj/machinery/computer/cryopod/attack_ai() - src.attack_hand() + attack_hand() /obj/machinery/computer/cryopod/attack_hand(mob/user = usr) if(stat & (NOPOWER|BROKEN)) return user.set_machine(src) - src.add_fingerprint(usr) + add_fingerprint(usr) var/dat - if (!( ticker )) + if(!(ticker)) return dat += "

[storage_name]
" @@ -105,7 +104,7 @@ var/mob/user = usr - src.add_fingerprint(user) + add_fingerprint(user) if(href_list["log"]) @@ -159,7 +158,7 @@ I.forceMove(get_turf(src)) frozen_items -= I - src.updateUsrDialog() + updateUsrDialog() return /obj/item/weapon/circuitboard/cryopodcontrol @@ -395,7 +394,7 @@ O.forceMove(src) //Delete all items not on the preservation list. - var/list/items = src.contents.Copy() + var/list/items = contents.Copy() items -= occupant // Don't delete the occupant items -= announce // or the autosay radio. @@ -451,13 +450,13 @@ if(PDA_Manifest.len) PDA_Manifest.Cut() for(var/datum/data/record/R in data_core.medical) - if ((R.fields["name"] == occupant.real_name)) + if((R.fields["name"] == occupant.real_name)) qdel(R) for(var/datum/data/record/T in data_core.security) - if ((T.fields["name"] == occupant.real_name)) + if((T.fields["name"] == occupant.real_name)) qdel(T) for(var/datum/data/record/G in data_core.general) - if ((G.fields["name"] == occupant.real_name)) + if((G.fields["name"] == occupant.real_name)) qdel(G) icon_state = base_icon_state @@ -536,7 +535,7 @@ message_admins("[key_name_admin(M)] has entered a stasis pod.") //Despawning occurs when process() is called with an occupant without a client. - src.add_fingerprint(M) + add_fingerprint(M) /obj/machinery/cryopod/verb/eject() set name = "Eject Pod" @@ -548,14 +547,14 @@ icon_state = base_icon_state //Eject any items that aren't meant to be in the pod. - var/list/items = src.contents + var/list/items = contents if(occupant) items -= occupant if(announce) items -= announce for(var/obj/item/W in items) W.forceMove(get_turf(src)) - src.go_out() + go_out() add_fingerprint(usr) name = initial(name) @@ -569,7 +568,7 @@ if(usr.stat != 0 || !check_occupant_allowed(usr)) return - if(src.occupant) + if(occupant) usr << "\The [src] is in use." return @@ -585,7 +584,7 @@ if(!usr || !usr.client) return - if(src.occupant) + if(occupant) usr << "\The [src] is in use." return @@ -605,7 +604,7 @@ time_entered = world.time - src.add_fingerprint(usr) + add_fingerprint(usr) return @@ -626,7 +625,7 @@ return if(occupant.client) - occupant.client.eye = src.occupant.client.mob + occupant.client.eye = occupant.client.mob occupant.client.perspective = MOB_PERSPECTIVE occupant.forceMove(get_turf(src)) @@ -640,7 +639,7 @@ return /obj/machinery/cryopod/proc/set_occupant(var/occupant) - src.occupant = occupant + occupant = occupant name = initial(name) if(occupant) name = "[name] ([occupant])" diff --git a/code/game/machinery/deployable.dm b/code/game/machinery/deployable.dm index 0140a33fe3..fa4b601e91 100644 --- a/code/game/machinery/deployable.dm +++ b/code/game/machinery/deployable.dm @@ -1,11 +1,9 @@ /* CONTAINS: - Deployable items Barricades for reference: - access_security = 1 access_brig = 2 access_armory = 3 @@ -50,7 +48,6 @@ for reference: access_court = 42 access_clown = 43 access_mime = 44 - */ //Barricades! @@ -83,17 +80,17 @@ for reference: return material /obj/structure/barricade/attackby(obj/item/W as obj, mob/user as mob) - if (istype(W, /obj/item/stack)) + if(istype(W, /obj/item/stack)) var/obj/item/stack/D = W if(D.get_material_name() != material.name) return //hitting things with the wrong type of stack usually doesn't produce messages, and probably doesn't need to. - if (health < maxhealth) - if (D.get_amount() < 1) + if(health < maxhealth) + if(D.get_amount() < 1) user << "You need one sheet of [material.display_name] to repair \the [src]." return visible_message("[user] begins to repair \the [src].") if(do_after(user,20) && health < maxhealth) - if (D.use(1)) + if(D.use(1)) health = maxhealth visible_message("[user] repairs \the [src].") return @@ -102,11 +99,11 @@ for reference: user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN) switch(W.damtype) if("fire") - src.health -= W.force * 1 + health -= W.force * 1 if("brute") - src.health -= W.force * 0.75 + health -= W.force * 0.75 else - if (src.health <= 0) + if(health <= 0) visible_message("The barricade is smashed apart!") dismantle() qdel(src) @@ -125,8 +122,8 @@ for reference: qdel(src) return if(2.0) - src.health -= 25 - if (src.health <= 0) + health -= 25 + if(health <= 0) visible_message("\The [src] is blown apart!") dismantle() return @@ -158,114 +155,114 @@ for reference: var/locked = 0.0 // req_access = list(access_maint_tunnels) - New() +/obj/machinery/deployable/barrier/New() + ..() + + icon_state = "barrier[locked]" + +/obj/machinery/deployable/barrier/attackby(obj/item/weapon/W as obj, mob/user as mob) + if(istype(W, /obj/item/weapon/card/id/)) + if(allowed(user)) + if (emagged < 2.0) + locked = !locked + anchored = !anchored + icon_state = "barrier[locked]" + if((locked == 1.0) && (emagged < 2.0)) + user << "Barrier lock toggled on." + return + else if((locked == 0.0) && (emagged < 2.0)) + user << "Barrier lock toggled off." + return + else + var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread + s.set_up(2, 1, src) + s.start() + visible_message("BZZzZZzZZzZT") + return + return + else if(istype(W, /obj/item/weapon/wrench)) + if(health < maxhealth) + health = maxhealth + emagged = 0 + req_access = list(access_security) + visible_message("[user] repairs \the [src]!") + return + else if(emagged > 0) + emagged = 0 + req_access = list(access_security) + visible_message("[user] repairs \the [src]!") + return + return + else + switch(W.damtype) + if("fire") + health -= W.force * 0.75 + if("brute") + health -= W.force * 0.5 + else + if(health <= 0) + explode() ..() - src.icon_state = "barrier[src.locked]" - - attackby(obj/item/weapon/W as obj, mob/user as mob) - if (istype(W, /obj/item/weapon/card/id/)) - if (src.allowed(user)) - if (src.emagged < 2.0) - src.locked = !src.locked - src.anchored = !src.anchored - src.icon_state = "barrier[src.locked]" - if ((src.locked == 1.0) && (src.emagged < 2.0)) - user << "Barrier lock toggled on." - return - else if ((src.locked == 0.0) && (src.emagged < 2.0)) - user << "Barrier lock toggled off." - return - else - var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread - s.set_up(2, 1, src) - s.start() - visible_message("BZZzZZzZZzZT") - return +/obj/machinery/deployable/barrier/ex_act(severity) + switch(severity) + if(1.0) + explode() return - else if (istype(W, /obj/item/weapon/wrench)) - if (src.health < src.maxhealth) - src.health = src.maxhealth - src.emagged = 0 - src.req_access = list(access_security) - visible_message("[user] repairs \the [src]!") - return - else if (src.emagged > 0) - src.emagged = 0 - src.req_access = list(access_security) - visible_message("[user] repairs \the [src]!") - return + if(2.0) + health -= 25 + if(health <= 0) + explode() return - else - switch(W.damtype) - if("fire") - src.health -= W.force * 0.75 - if("brute") - src.health -= W.force * 0.5 - else - if (src.health <= 0) - src.explode() - ..() + +/obj/machinery/deployable/barrier/emp_act(severity) + if(stat & (BROKEN|NOPOWER)) + return + if(prob(50/severity)) + locked = !locked + anchored = !anchored + icon_state = "barrier[locked]" - ex_act(severity) - switch(severity) - if(1.0) - src.explode() - return - if(2.0) - src.health -= 25 - if (src.health <= 0) - src.explode() - return - emp_act(severity) - if(stat & (BROKEN|NOPOWER)) - return - if(prob(50/severity)) - locked = !locked - anchored = !anchored - icon_state = "barrier[src.locked]" +/obj/machinery/deployable/barrier/CanPass(atom/movable/mover, turf/target, height=0, air_group=0)//So bullets will fly over and stuff. + if(air_group || (height==0)) + return 1 + if(istype(mover) && mover.checkpass(PASSTABLE)) + return 1 + else + return 0 - CanPass(atom/movable/mover, turf/target, height=0, air_group=0)//So bullets will fly over and stuff. - if(air_group || (height==0)) - return 1 - if(istype(mover) && mover.checkpass(PASSTABLE)) - return 1 - else - return 0 +/obj/machinery/deployable/barrier/proc/explode() - proc/explode() + visible_message("[src] blows apart!") + var/turf/Tsec = get_turf(src) - visible_message("[src] blows apart!") - var/turf/Tsec = get_turf(src) +/* var/obj/item/stack/rods/ =*/ + PoolOrNew(/obj/item/stack/rods, Tsec) - /* var/obj/item/stack/rods/ =*/ - PoolOrNew(/obj/item/stack/rods, Tsec) + var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread + s.set_up(3, 1, src) + s.start() - var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread - s.set_up(3, 1, src) - s.start() + explosion(src.loc,-1,-1,0) + if(src) + qdel(src) - explosion(src.loc,-1,-1,0) - if(src) - qdel(src) - - /obj/machinery/deployable/barrier/emag_act(var/remaining_charges, var/mob/user) - if (src.emagged == 0) - src.emagged = 1 - src.req_access.Cut() - src.req_one_access.Cut() + if(emagged == 0) + emagged = 1 + req_access.Cut() + req_one_access.Cut() user << "You break the ID authentication lock on \the [src]." var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread s.set_up(2, 1, src) s.start() visible_message("BZZzZZzZZzZT") return 1 - else if (src.emagged == 1) - src.emagged = 2 + else if(emagged == 1) + emagged = 2 user << "You short out the anchoring mechanism on \the [src]." var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread s.set_up(2, 1, src) s.start() visible_message("BZZzZZzZZzZT") - return 1 + return 1 \ No newline at end of file diff --git a/code/game/machinery/door_control.dm b/code/game/machinery/door_control.dm index b51d72ccd8..7f7ce32e03 100644 --- a/code/game/machinery/door_control.dm +++ b/code/game/machinery/door_control.dm @@ -19,12 +19,12 @@ /obj/machinery/button/remote/attack_ai(mob/user as mob) if(wires & 2) - return src.attack_hand(user) + return attack_hand(user) else user << "Error, no route to host." /obj/machinery/button/remote/attackby(obj/item/weapon/W, mob/user as mob) - return src.attack_hand(user) + return attack_hand(user) /obj/machinery/button/remote/emag_act(var/remaining_charges, var/mob/user) if(req_access.len || req_one_access.len) @@ -37,7 +37,7 @@ if(..()) return - src.add_fingerprint(user) + add_fingerprint(user) if(stat & (NOPOWER|BROKEN)) return @@ -92,9 +92,9 @@ /obj/machinery/button/remote/airlock/trigger() for(var/obj/machinery/door/airlock/D in world) - if(D.id_tag == src.id) + if(D.id_tag == id) if(specialfunctions & OPEN) - if (D.density) + if(D.density) spawn(0) D.open() return @@ -136,7 +136,7 @@ /obj/machinery/button/remote/blast_door/trigger() for(var/obj/machinery/door/blast/M in world) - if(M.id == src.id) + if(M.id == id) if(M.density) spawn(0) M.open() @@ -155,7 +155,7 @@ /obj/machinery/button/remote/emitter/trigger(mob/user as mob) for(var/obj/machinery/power/emitter/E in world) - if(E.id == src.id) + if(E.id == id) spawn(0) E.activate(user) return @@ -174,21 +174,21 @@ update_icon() for(var/obj/machinery/door/blast/M in machines) - if (M.id == src.id) - spawn( 0 ) + if(M.id == id) + spawn(0) M.open() return sleep(20) for(var/obj/machinery/mass_driver/M in machines) - if(M.id == src.id) + if(M.id == id) M.drive() sleep(50) for(var/obj/machinery/door/blast/M in machines) - if (M.id == src.id) + if(M.id == id) spawn(0) M.close() return @@ -202,4 +202,4 @@ if(!active || (stat & NOPOWER)) icon_state = "launcherbtt" else - icon_state = "launcheract" + icon_state = "launcheract" \ No newline at end of file diff --git a/code/game/machinery/doppler_array.dm b/code/game/machinery/doppler_array.dm index 6661468f59..7a4087e2c4 100644 --- a/code/game/machinery/doppler_array.dm +++ b/code/game/machinery/doppler_array.dm @@ -4,7 +4,6 @@ var/list/doppler_arrays = list() name = "tachyon-doppler array" desc = "A highly precise directional sensor array which measures the release of quants from decaying tachyons. The doppler shifting of the mirror-image formed by these quants can reveal the size, location and temporal affects of energetic disturbances within a large radius ahead of the array." - /obj/machinery/doppler_array/New() ..() doppler_arrays += src @@ -39,13 +38,12 @@ var/list/doppler_arrays = list() for(var/mob/O in hearers(src, null)) O.show_message("[src] states coldly, \"[message]\"",2) - /obj/machinery/doppler_array/power_change() ..() if(stat & BROKEN) icon_state = "[initial(icon_state)]-broken" else - if( !(stat & NOPOWER) ) + if(!(stat & NOPOWER)) icon_state = initial(icon_state) else icon_state = "[initial(icon_state)]-off" \ No newline at end of file diff --git a/code/game/machinery/flasher.dm b/code/game/machinery/flasher.dm index 7532cb1407..18844dcd73 100644 --- a/code/game/machinery/flasher.dm +++ b/code/game/machinery/flasher.dm @@ -1,5 +1,4 @@ // It is a gizmo that flashes a small area - /obj/machinery/flasher name = "Mounted flash" desc = "A wall-mounted flashbulb device." @@ -27,48 +26,48 @@ /obj/machinery/flasher/power_change() ..() - if ( !(stat & NOPOWER) ) + if(!(stat & NOPOWER)) icon_state = "[base_state]1" -// src.sd_SetLuminosity(2) +// sd_SetLuminosity(2) else icon_state = "[base_state]1-p" -// src.sd_SetLuminosity(0) +// sd_SetLuminosity(0) //Don't want to render prison breaks impossible /obj/machinery/flasher/attackby(obj/item/weapon/W as obj, mob/user as mob) - if (istype(W, /obj/item/weapon/wirecutters)) + if(istype(W, /obj/item/weapon/wirecutters)) add_fingerprint(user) - src.disable = !src.disable - if (src.disable) + disable = !disable + if(disable) user.visible_message("[user] has disconnected the [src]'s flashbulb!", "You disconnect the [src]'s flashbulb!") - if (!src.disable) + if(!disable) user.visible_message("[user] has connected the [src]'s flashbulb!", "You connect the [src]'s flashbulb!") //Let the AI trigger them directly. /obj/machinery/flasher/attack_ai() - if (src.anchored) - return src.flash() + if(anchored) + return flash() else return /obj/machinery/flasher/proc/flash() - if (!(powered())) + if(!(powered())) return - if ((src.disable) || (src.last_flash && world.time < src.last_flash + 150)) + if((disable) || (last_flash && world.time < last_flash + 150)) return playsound(src.loc, 'sound/weapons/flash.ogg', 100, 1) flick("[base_state]_flash", src) - src.last_flash = world.time + last_flash = world.time use_power(1500) for (var/mob/O in viewers(src, null)) - if (get_dist(src, O) > src.range) + if(get_dist(src, O) > range) continue var/flash_time = strength - if (istype(O, /mob/living/carbon/human)) + if(istype(O, /mob/living/carbon/human)) var/mob/living/carbon/human/H = O if(!H.eyecheck() <= 0) continue @@ -94,26 +93,26 @@ ..(severity) /obj/machinery/flasher/portable/HasProximity(atom/movable/AM as mob|obj) - if ((src.disable) || (src.last_flash && world.time < src.last_flash + 150)) + if((disable) || (last_flash && world.time < last_flash + 150)) return if(istype(AM, /mob/living/carbon)) var/mob/living/carbon/M = AM - if ((M.m_intent != "walk") && (src.anchored)) - src.flash() + if((M.m_intent != "walk") && (anchored)) + flash() /obj/machinery/flasher/portable/attackby(obj/item/weapon/W as obj, mob/user as mob) - if (istype(W, /obj/item/weapon/wrench)) + if(istype(W, /obj/item/weapon/wrench)) add_fingerprint(user) - src.anchored = !src.anchored + anchored = !anchored - if (!src.anchored) + if(!anchored) user.show_message(text("[src] can now be moved.")) - src.overlays.Cut() + overlays.Cut() - else if (src.anchored) + else if(anchored) user.show_message(text("[src] is now secured.")) - src.overlays += "[base_state]-s" + overlays += "[base_state]-s" /obj/machinery/button/flasher name = "flasher button" @@ -130,7 +129,7 @@ icon_state = "launcheract" for(var/obj/machinery/flasher/M in machines) - if(M.id == src.id) + if(M.id == id) spawn() M.flash() @@ -139,4 +138,4 @@ icon_state = "launcherbtt" active = 0 - return + return \ No newline at end of file diff --git a/code/game/machinery/floodlight.dm b/code/game/machinery/floodlight.dm index e31a19b265..9f594e4178 100644 --- a/code/game/machinery/floodlight.dm +++ b/code/game/machinery/floodlight.dm @@ -1,5 +1,3 @@ -//these are probably broken - /obj/machinery/floodlight name = "Emergency Floodlight" icon = 'icons/obj/machines/floodlight.dmi' @@ -13,7 +11,7 @@ var/brightness_on = 8 //can't remember what the maxed out value is /obj/machinery/floodlight/New() - src.cell = new(src) + cell = new(src) cell.maxcharge = 1000 cell.charge = 1000 // 41minutes @ 200W ..() @@ -71,7 +69,6 @@ if(!turn_on(1)) user << "You try to turn on \the [src] but it does not work." - /obj/machinery/floodlight/attack_hand(mob/user as mob) if(open && cell) if(ishuman(user)) @@ -79,12 +76,12 @@ user.put_in_hands(cell) cell.loc = user.loc else - cell.loc = loc + cell.loc = src.loc cell.add_fingerprint(user) cell.update_icon() - src.cell = null + cell = null on = 0 set_light(0) user << "You remove the power cell" @@ -99,10 +96,9 @@ update_icon() - /obj/machinery/floodlight/attackby(obj/item/weapon/W as obj, mob/user as mob) - if (istype(W, /obj/item/weapon/screwdriver)) - if (!open) + if(istype(W, /obj/item/weapon/screwdriver)) + if(!open) if(unlocked) unlocked = 0 user << "You screw the battery panel in place." @@ -110,7 +106,7 @@ unlocked = 1 user << "You unscrew the battery panel." - if (istype(W, /obj/item/weapon/crowbar)) + if(istype(W, /obj/item/weapon/crowbar)) if(unlocked) if(open) open = 0 @@ -121,7 +117,7 @@ open = 1 user << "You remove the battery panel." - if (istype(W, /obj/item/weapon/cell)) + if(istype(W, /obj/item/weapon/cell)) if(open) if(cell) user << "There is a power cell already installed." diff --git a/code/game/machinery/floor_light.dm b/code/game/machinery/floor_light.dm index 7298b62abf..a134e68e3f 100644 --- a/code/game/machinery/floor_light.dm +++ b/code/game/machinery/floor_light.dm @@ -132,7 +132,7 @@ var/list/floor_light_cache = list() if(1) qdel(src) if(2) - if (prob(50)) + if(prob(50)) qdel(src) else if(prob(20)) stat |= BROKEN @@ -140,7 +140,7 @@ var/list/floor_light_cache = list() if(isnull(damaged)) damaged = 0 if(3) - if (prob(5)) + if(prob(5)) qdel(src) else if(isnull(damaged)) damaged = 0 diff --git a/code/game/machinery/floorlayer.dm b/code/game/machinery/floorlayer.dm index c682a2b228..1cbccc195c 100644 --- a/code/game/machinery/floorlayer.dm +++ b/code/game/machinery/floorlayer.dm @@ -1,5 +1,4 @@ /obj/machinery/floorlayer - name = "automatic floor layer" icon = 'icons/obj/stationobjs.dmi' icon_state = "pipe_d" @@ -35,8 +34,7 @@ return /obj/machinery/floorlayer/attackby(var/obj/item/W as obj, var/mob/user as mob) - - if (istype(W, /obj/item/weapon/wrench)) + if(istype(W, /obj/item/weapon/wrench)) var/m = input("Choose work mode", "Mode") as null|anything in mode mode[m] = !mode[m] var/O = mode[m] @@ -109,4 +107,4 @@ /obj/machinery/floorlayer/proc/CollectTiles(var/turf/w_turf) for(var/obj/item/stack/tile/tile in w_turf) - TakeTile(tile) + TakeTile(tile) \ No newline at end of file diff --git a/code/game/machinery/frame.dm b/code/game/machinery/frame.dm index 1dddcedea0..3005996f0b 100644 --- a/code/game/machinery/frame.dm +++ b/code/game/machinery/frame.dm @@ -1,3 +1,177 @@ +/var/global/list/construction_frame_wall +/var/global/list/construction_frame_floor + +/proc/populate_frame_types() + //Create global frame type list if it hasn't been made already. + construction_frame_wall = list() + construction_frame_floor = list() + for(var/R in typesof(/datum/frame/frame_types) - /datum/frame/frame_types) + var/datum/frame/frame_types/type = new R + if(type.frame_style == "wall") + construction_frame_wall += type + else + construction_frame_floor += type + + var/datum/frame/frame_types/cancel/cancel = new /datum/frame/frame_types/cancel + construction_frame_wall += cancel + construction_frame_floor += cancel + +/datum/frame/frame_types + var/name + var/frame_size = 5 + var/frame_class + var/circuit + var/frame_style = "floor" + var/x_offset + var/y_offset + +/datum/frame/frame_types/computer + name = "Computer" + frame_class = "computer" + +/datum/frame/frame_types/machine + name = "Machine" + frame_class = "machine" + +/datum/frame/frame_types/conveyor + name = "Conveyor" + frame_class = "machine" + circuit = /obj/item/weapon/circuitboard/conveyor + +/datum/frame/frame_types/photocopier + name = "Photocopier" + frame_class = "machine" + +/datum/frame/frame_types/washing_machine + name = "Washing Machine" + frame_class = "machine" + +/datum/frame/frame_types/medical_console + name = "Medical Console" + frame_class = "computer" + +/datum/frame/frame_types/medical_pod + name = "Medical Pod" + frame_class = "machine" + +/datum/frame/frame_types/dna_analyzer + name = "DNA Analyzer" + frame_class = "machine" + +/datum/frame/frame_types/mass_driver + name = "Mass Driver" + frame_class = "machine" + circuit = /obj/item/weapon/circuitboard/mass_driver + +/datum/frame/frame_types/holopad + name = "Holopad" + frame_class = "computer" + frame_size = 4 + +/datum/frame/frame_types/microwave + name = "Microwave" + frame_class = "machine" + frame_size = 4 + +/datum/frame/frame_types/fax + name = "Fax" + frame_class = "machine" + frame_size = 3 + +/datum/frame/frame_types/recharger + name = "Recharger" + frame_class = "machine" + circuit = /obj/item/weapon/circuitboard/recharger + frame_size = 3 + +/datum/frame/frame_types/grinder + name = "Grinder" + frame_class = "machine" + circuit = /obj/item/weapon/circuitboard/grinder + frame_size = 3 + +/datum/frame/frame_types/display + name = "Display" + frame_class = "display" + frame_style = "wall" + x_offset = 32 + y_offset = 32 + +/datum/frame/frame_types/supply_request_console + name = "Supply Request Console" + frame_class = "display" + frame_style = "wall" + x_offset = 32 + y_offset = 32 + +/datum/frame/frame_types/atm + name = "ATM" + frame_class = "display" + frame_size = 3 + frame_style = "wall" + x_offset = 32 + y_offset = 32 + +/datum/frame/frame_types/newscaster + name = "Newscaster" + frame_class = "display" + frame_size = 3 + frame_style = "wall" + x_offset = 28 + y_offset = 30 + +/datum/frame/frame_types/wall_charger + name = "Wall Charger" + frame_class = "machine" + circuit = /obj/item/weapon/circuitboard/recharger/wrecharger + frame_size = 3 + frame_style = "wall" + x_offset = 32 + y_offset = 32 + +/datum/frame/frame_types/fire_alarm + name = "Fire Alarm" + frame_class = "alarm" + frame_size = 2 + frame_style = "wall" + x_offset = 24 + y_offset = 24 + +/datum/frame/frame_types/air_alarm + name = "Air Alarm" + frame_class = "alarm" + frame_size = 2 + frame_style = "wall" + x_offset = 24 + y_offset = 24 + +/datum/frame/frame_types/guest_pass_console + name = "Guest Pass Console" + frame_class = "display" + frame_size = 2 + frame_style = "wall" + x_offset = 30 + y_offset = 30 + +/datum/frame/frame_types/intercom + name = "Intercom" + frame_class = "alarm" + frame_size = 2 + frame_style = "wall" + x_offset = 28 + y_offset = 28 + +/datum/frame/frame_types/keycard_authenticator + name = "Keycard Authenticator" + frame_class = "alarm" + frame_size = 1 + frame_style = "wall" + x_offset = 24 + y_offset = 24 + +/datum/frame/frame_types/cancel //used to get out of input dialogue + name = "Cancel" + /obj/structure/frame anchored = 0 name = "frame" @@ -6,20 +180,16 @@ var/state = 0 var/obj/item/weapon/circuitboard/circuit = null var/need_circuit = 1 - var/frame_type = "machine" + var/datum/frame/frame_types/frame_type = new /datum/frame/frame_types/machine var/list/components = null var/list/req_components = null var/list/req_component_names = null - var/list/alarms = list("firealarm", "airalarm", "intercom", "keycard") - var/list/machines = list( - "machine", "photocopier", "fax", "microwave", "conveyor", "recharger", "wrecharger", - "washing", "grinder", "teleporter_hub", "teleporter_station", "medpod", "dna_analyzer", - "massdriver") - var/list/computers = list("computer", "holopad", "console") - var/list/displays = list("display", "guestpass", "newscaster", "atm", "request") - var/list/no_circuit = list("wrecharger", "recharger", "grinder", "conveyor", "massdriver") +/obj/structure/frame/computer //used for maps + frame_type = new /datum/frame/frame_types/computer + anchored = 1 + density = 1 /obj/structure/frame/proc/update_desc() var/D @@ -31,6 +201,12 @@ D = "Requires [english_list(component_list)]." desc = D +/obj/structure/frame/update_icon() + ..() + var/type = lowertext(frame_type.name) + type = replacetext(type, " ", "_") + icon_state = "[type]_[state]" + /obj/structure/frame/proc/check_components(mob/user as mob) components = list() req_components = circuit.req_components.Copy() @@ -41,175 +217,110 @@ var/obj/ct = A req_component_names[A] = initial(ct.name) -/obj/structure/frame/New(var/loc, var/dir, var/building = 0, var/obj/item/frame/frame_type, mob/user as mob) +/obj/structure/frame/New(var/loc, var/dir, var/building = 0, var/datum/frame/frame_types/type, mob/user as mob) ..() if(building) - src.frame_type = frame_type - icon_state = "[frame_type]_0" + frame_type = type + state = 0 + if(dir) - src.set_dir(dir) + set_dir(dir) - if(frame_type in alarms) - if(loc) - src.loc = loc + if(loc) + src.loc = loc - state = 0 - if(frame_type == "airalarm" || frame_type == "firealarm" || frame_type == "keycard") - if(dir) - src.set_dir(dir) - pixel_x = (dir & 3)? 0 : (dir == 4 ? -24 : 24) - pixel_y = (dir & 3)? (dir == 1 ? -24 : 24) : 0 + if(frame_type.x_offset) + pixel_x = (dir & 3)? 0 : (dir == 4 ? -frame_type.x_offset : frame_type.x_offset) - if(frame_type == "intercom") - if(dir) - src.set_dir(dir) - pixel_x = (dir & 3)? 0 : (dir == 4 ? -28 : 28) - pixel_y = (dir & 3)? (dir == 1 ? -28 : 28) : 0 + if(frame_type.y_offset) + pixel_y = (dir & 3)? (dir == 1 ? -frame_type.y_offset : frame_type.y_offset) : 0 - update_icon() - return - - if(frame_type in displays) - if(loc) - src.loc = loc - - if(frame_type == "display" || frame_type == "atm" || frame_type == "request") - pixel_x = (dir & 3)? 0 : (dir == 4 ? -32 : 32) - pixel_y = (dir & 3)? (dir == 1 ? -32 : 32) : 0 - - if(frame_type == "newscaster") - pixel_x = (dir & 3)? 0 : (dir == 4 ? -28 : 28) - pixel_y = (dir & 3)? (dir == 1 ? -30 : 30) : 0 - - if(frame_type == "guestpass") - pixel_x = (dir & 3)? 0 : (dir == 4 ? -30 : 30) - pixel_y = (dir & 3)? (dir == 1 ? -30 : 30) : 0 - - update_icon() - return - - if(frame_type in no_circuit) + if(frame_type.circuit) need_circuit = 0 - if(frame_type == "wrecharger") - circuit = new /obj/item/weapon/circuitboard/recharger/wrecharger(src) - if(loc) - src.loc = loc + circuit = new frame_type.circuit(src) - state = 0 - - pixel_x = (dir & 3)? 0 : (dir == 4 ? -26 : 32) - pixel_y = (dir & 3)? (dir == 1 ? -32 : 32) : 0 - - update_icon() - return - if(frame_type == "recharger") - circuit = new /obj/item/weapon/circuitboard/recharger(src) - if(frame_type == "grinder") - circuit = new /obj/item/weapon/circuitboard/grinder(src) - if(frame_type == "conveyor") - circuit = new /obj/item/weapon/circuitboard/conveyor(src) - if(frame_type == "massdriver") - circuit = new /obj/item/weapon/circuitboard/mass_driver(src) - - if(frame_type == "computer") + if(frame_type.name == "Computer") density = 1 - if(frame_type in machines) + + if(frame_type.frame_class == "machine") density = 1 - return + + update_icon() /obj/structure/frame/attackby(obj/item/P as obj, mob/user as mob) if(istype(P, /obj/item/weapon/wrench)) - if(state == 0) + if(state == 0 && !anchored) user << "You start to wrench the frame into place." playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1) if(do_after(user, 20)) - src.anchored = 1 + anchored = 1 if(!need_circuit && circuit) - src.state = 2 + state = 2 check_components() update_desc() - src.icon_state = "[frame_type]_2" user << "You wrench the frame into place and set the outer cover." else - src.state = 1 user << "You wrench the frame into place." - return - if(state == 1) + else if(state == 0 && anchored) playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1) if(do_after(user, 20)) user << "You unfasten the frame." - src.anchored = 0 - src.state = 0 - return + anchored = 0 - if(istype(P, /obj/item/weapon/weldingtool)) + else if(istype(P, /obj/item/weapon/weldingtool)) if(state == 0) var/obj/item/weapon/weldingtool/WT = P - if(!WT.remove_fuel(0, user)) + if(WT.remove_fuel(0, user)) + playsound(src.loc, 'sound/items/Welder.ogg', 50, 1) + if(do_after(user, 20)) + if(src && WT.isOn()) + user << "You deconstruct the frame." + new /obj/item/stack/material/steel(src.loc, frame_type.frame_size) + qdel(src) + return + else if(!WT.remove_fuel(0, user)) user << "The welding tool must be on to complete this task." return - playsound(src.loc, 'sound/items/Welder.ogg', 50, 1) - if(do_after(user, 20)) - if(!src || !WT.isOn()) return - user << "You deconstruct the frame." - if(frame_type == "holopad" || frame_type == "microwave") - new /obj/item/stack/material/steel( src.loc, 4 ) - else if(frame_type == "fax" || frame_type == "newscaster" || frame_type == "recharger" || frame_type == "wrecharger" || frame_type == "grinder") - new /obj/item/stack/material/steel( src.loc, 3 ) - else if(frame_type == "firealarm" || frame_type == "airalarm" || frame_type == "intercom" || frame_type == "guestpass") - new /obj/item/stack/material/steel( src.loc, 2 ) - else if(frame_type == "keycard") - new /obj/item/stack/material/steel( src.loc, 1 ) - else - new /obj/item/stack/material/steel( src.loc, 5 ) - qdel(src) - return - if(istype(P, /obj/item/weapon/circuitboard) && need_circuit && !circuit) - if(state == 1) + else if(istype(P, /obj/item/weapon/circuitboard) && need_circuit && !circuit) + if(state == 0 && anchored) var/obj/item/weapon/circuitboard/B = P - if(B.board_type == frame_type) + var/datum/frame/frame_types/board_type = B.board_type + if(board_type.name == frame_type.name) playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1) user << "You place the circuit board inside the frame." - src.icon_state = "[frame_type]_1" - src.circuit = P + circuit = P user.drop_item() P.loc = src - if(frame_type in machines) //because machines are assholes + state = 1 + if(frame_type.frame_class == "machine") check_components() update_desc() - return else user << "This frame does not accept circuit boards of this type!" - return + return - if(istype(P, /obj/item/weapon/screwdriver)) + else if(istype(P, /obj/item/weapon/screwdriver)) if(state == 1) if(need_circuit && circuit) playsound(src.loc, 'sound/items/Screwdriver.ogg', 50, 1) user << "You screw the circuit board into place." - src.state = 2 - src.icon_state = "[frame_type]_2" - return + state = 2 - if(state == 2) + else if(state == 2) if(need_circuit && circuit) playsound(src.loc, 'sound/items/Screwdriver.ogg', 50, 1) user << "You unfasten the circuit board." - src.state = 1 - src.icon_state = "[frame_type]_1" - return + state = 1 - if(!need_circuit && circuit) + else if(!need_circuit && circuit) playsound(src.loc, 'sound/items/Screwdriver.ogg', 50, 1) user << "You unfasten the outer cover." - src.state = 1 - src.icon_state = "[frame_type]_0" - return + state = 0 - if(state == 3) - if(frame_type in machines) + else if(state == 3) + if(frame_type.frame_class == "machine") var/component_check = 1 for(var/R in req_components) if(req_components[R] > 0) @@ -217,7 +328,7 @@ break if(component_check) playsound(src.loc, 'sound/items/Screwdriver.ogg', 50, 1) - var/obj/machinery/new_machine = new src.circuit.build_path(src.loc, src.dir) + var/obj/machinery/new_machine = new circuit.build_path(src.loc, dir) // Handle machines that have allocated default parts in thier constructor. if(new_machine.component_parts) for(var/CP in new_machine.component_parts) @@ -226,9 +337,9 @@ else new_machine.component_parts = list() - src.circuit.construct(new_machine) + circuit.construct(new_machine) - for(var/obj/O in src.components) + for(var/obj/O in components) if(circuit.contain_parts) O.loc = new_machine else @@ -240,173 +351,158 @@ new_machine.RefreshParts() - new_machine.pixel_x = src.pixel_x - new_machine.pixel_y = src.pixel_y + new_machine.pixel_x = pixel_x + new_machine.pixel_y = pixel_y qdel(src) - return + return - if(frame_type in alarms) + else if(frame_type.frame_class == "alarm") playsound(src.loc, 'sound/items/Screwdriver.ogg', 50, 1) user << "You fasten the cover." - var/obj/machinery/B = new src.circuit.build_path ( src.loc ) - B.pixel_x = src.pixel_x - B.pixel_y = src.pixel_y + var/obj/machinery/B = new circuit.build_path(src.loc) + B.pixel_x = pixel_x + B.pixel_y = pixel_y B.set_dir(dir) - src.circuit.construct(B) + circuit.construct(B) + circuit.loc = null + B.circuit = circuit qdel(src) return - if(state == 4) - if(frame_type in computers) + else if(state == 4) + if(frame_type.frame_class == "computer") playsound(src.loc, 'sound/items/Screwdriver.ogg', 50, 1) user << "You connect the monitor." - var/obj/machinery/B = new src.circuit.build_path ( src.loc ) - B.pixel_x = src.pixel_x - B.pixel_y = src.pixel_y + var/obj/machinery/B = new circuit.build_path(src.loc) + B.pixel_x = pixel_x + B.pixel_y = pixel_y B.set_dir(dir) - src.circuit.construct(B) + circuit.construct(B) + circuit.loc = null + B.circuit = circuit qdel(src) return - if(frame_type in displays) + else if(frame_type.frame_class == "display") playsound(src.loc, 'sound/items/Screwdriver.ogg', 50, 1) user << "You connect the monitor." - var/obj/machinery/B = new src.circuit.build_path ( src.loc ) - B.pixel_x = src.pixel_x - B.pixel_y = src.pixel_y + var/obj/machinery/B = new circuit.build_path(src.loc) + B.pixel_x = pixel_x + B.pixel_y = pixel_y B.set_dir(dir) - src.circuit.construct(B) + circuit.construct(B) + circuit.loc = null + B.circuit = circuit qdel(src) return - if(istype(P, /obj/item/weapon/crowbar)) + else if(istype(P, /obj/item/weapon/crowbar)) if(state == 1) if(need_circuit && circuit) playsound(src.loc, 'sound/items/Crowbar.ogg', 50, 1) user << "You remove the circuit board." - src.state = 1 - src.icon_state = "[frame_type]_0" - circuit.loc = src.loc - src.circuit = null - if(frame_type in machines) //becuase machines are assholes + state = 0 + circuit.forceMove(src.loc) + circuit = null + if(frame_type.frame_class == "machine") req_components = null - return - if(state == 3) - if(frame_type in machines) + else if(state == 3) + if(frame_type.frame_class == "machine") playsound(src.loc, 'sound/items/Crowbar.ogg', 50, 1) if(components.len == 0) user << "There are no components to remove." else user << "You remove the components." for(var/obj/item/weapon/W in components) - W.forceMove(loc) + W.forceMove(src.loc) check_components() update_desc() user << desc - return - if(state == 4) - if(frame_type in computers) + else if(state == 4) + if(frame_type.frame_class == "computer") playsound(src.loc, 'sound/items/Crowbar.ogg', 50, 1) user << "You remove the glass panel." - src.state = 3 - src.icon_state = "[frame_type]_3" - new /obj/item/stack/material/glass( src.loc, 2 ) - return + state = 3 + new /obj/item/stack/material/glass(src.loc, 2) - if(frame_type in displays) + else if(frame_type.frame_class == "display") playsound(src.loc, 'sound/items/Crowbar.ogg', 50, 1) user << "You remove the glass panel." - src.state = 3 - src.icon_state = "[frame_type]_3" - new /obj/item/stack/material/glass( src.loc, 2 ) - return + state = 3 + new /obj/item/stack/material/glass(src.loc, 2) - if(istype(P, /obj/item/stack/cable_coil)) + else if(istype(P, /obj/item/stack/cable_coil)) if(state == 2) var/obj/item/stack/cable_coil/C = P - if (C.get_amount() < 5) + if(C.get_amount() < 5) user << "You need five coils of wire to add them to the frame." return user << "You start to add cables to the frame." playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1) if(do_after(user, 20) && state == 2) - if (C.use(5)) + if(C.use(5)) user << "You add cables to the frame." state = 3 - icon_state = "[frame_type]_3" - if(frame_type in machines) + if(frame_type.frame_class == "machine") user << desc - return - if(istype(P, /obj/item/weapon/wirecutters)) + else if(istype(P, /obj/item/weapon/wirecutters)) if(state == 3) - if(frame_type in computers) + if(frame_type.frame_class == "computer") playsound(src.loc, 'sound/items/Wirecutter.ogg', 50, 1) user << "You remove the cables." - src.state = 2 - src.icon_state = "[frame_type]_2" - new /obj/item/stack/cable_coil( src.loc, 5 ) - return + state = 2 + new /obj/item/stack/cable_coil(src.loc, 5) - if(frame_type in displays) + else if(frame_type.frame_class == "display") playsound(src.loc, 'sound/items/Wirecutter.ogg', 50, 1) user << "You remove the cables." - src.state = 2 - src.icon_state = "[frame_type]_2" - new /obj/item/stack/cable_coil( src.loc, 5 ) - return + state = 2 + new /obj/item/stack/cable_coil(src.loc, 5) - if(frame_type in alarms) + else if(frame_type.frame_class == "alarm") playsound(src.loc, 'sound/items/Wirecutter.ogg', 50, 1) user << "You remove the cables." - src.state = 2 - src.icon_state = "[frame_type]_2" - new /obj/item/stack/cable_coil( src.loc, 5 ) - return + state = 2 + new /obj/item/stack/cable_coil(src.loc, 5) - if(frame_type in machines) + else if(frame_type.frame_class == "machine") playsound(src.loc, 'sound/items/Wirecutter.ogg', 50, 1) user << "You remove the cables." - src.state = 2 - src.icon_state = "[frame_type]_2" - new /obj/item/stack/cable_coil( src.loc, 5 ) - return + state = 2 + new /obj/item/stack/cable_coil(src.loc, 5) - if(istype(P, /obj/item/stack/material) && P.get_material_name() == "glass") + else if(istype(P, /obj/item/stack/material) && P.get_material_name() == "glass") if(state == 3) - if(frame_type in computers) + if(frame_type.frame_class == "computer") var/obj/item/stack/G = P - if (G.get_amount() < 2) + if(G.get_amount() < 2) user << "You need two sheets of glass to put in the glass panel." return playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1) user << "You start to put in the glass panel." if(do_after(user, 20) && state == 3) - if (G.use(2)) + if(G.use(2)) user << "You put in the glass panel." - src.state = 4 - src.icon_state = "[frame_type]_4" - return + state = 4 - if(frame_type in displays) + else if(frame_type.frame_class == "display") var/obj/item/stack/G = P - if (G.get_amount() < 2) + if(G.get_amount() < 2) user << "You need two sheets of glass to put in the glass panel." return playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1) user << "You start to put in the glass panel." if(do_after(user, 20) && state == 3) - if (G.use(2)) + if(G.use(2)) user << "You put in the glass panel." - src.state = 4 - src.icon_state = "[frame_type]_4" - return + state = 4 - if(istype(P, /obj/item)) + else if(istype(P, /obj/item)) if(state == 3) - if(frame_type in machines) + if(frame_type.frame_class == "machine") for(var/I in req_components) if(istype(P, I) && (req_components[I] > 0)) playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1) @@ -423,10 +519,10 @@ update_desc() break - if(istype(P, /obj/item/stack/material/glass/reinforced)) + else if(istype(P, /obj/item/stack/material/glass/reinforced)) var/obj/item/stack/material/glass/reinforced/CP = P if(CP.get_amount() > 1) - var/camt = min(CP.amount, req_components[I]) // amount of cable to take, idealy amount required, but limited by amount provided + var/camt = min(CP.amount, req_components[I]) // amount of glass to take, idealy amount required, but limited by amount provided var/obj/item/stack/material/glass/reinforced/CC = new /obj/item/stack/material/glass/reinforced(src) CC.amount = camt CC.update_icon() @@ -445,4 +541,6 @@ user << desc if(P && P.loc != src && !istype(P, /obj/item/stack/cable_coil) && !istype(P, /obj/item/stack/material)) user << "You cannot add that component to the machine!" - return \ No newline at end of file + return + + update_icon() \ No newline at end of file diff --git a/code/game/machinery/hologram.dm b/code/game/machinery/hologram.dm index 58c8423a23..158b718e83 100644 --- a/code/game/machinery/hologram.dm +++ b/code/game/machinery/hologram.dm @@ -19,11 +19,9 @@ Possible to do for anyone motivated enough: Itegrate EMP effect to disable the unit. */ - /* * Holopad */ - #define HOLOPAD_PASSIVE_POWER_USAGE 1 #define HOLOGRAM_POWER_USAGE 2 #define RANGE_BASED 4 @@ -37,39 +35,19 @@ var/const/HOLOPAD_MODE = RANGE_BASED icon_state = "holopad0" show_messages = 1 circuit = /obj/item/weapon/circuitboard/holopad - layer = TURF_LAYER+0.1 //Preventing mice and drones from sneaking under them. - var/power_per_hologram = 500 //per usage per hologram idle_power_usage = 5 use_power = 1 - var/list/mob/living/silicon/ai/masters = new() //List of AIs that use the holopad var/last_request = 0 //to prevent request spam. ~Carn var/holo_range = 5 // Change to change how far the AI can move away from the holopad before deactivating. /obj/machinery/hologram/holopad/attackby(obj/item/I as obj, user as mob) - if(istype(I, /obj/item/weapon/screwdriver) && circuit) - user << "You start removing the glass." - playsound(src.loc, 'sound/items/Screwdriver.ogg', 50, 1) - if(do_after(user, 20)) - var/obj/structure/frame/A = new /obj/structure/frame( src.loc ) - var/obj/item/weapon/circuitboard/M = new circuit( A ) - A.circuit = M - A.anchored = 1 - A.density = 1 - A.frame_type = "holopad" - for (var/obj/C in src) - C.forceMove(loc) - user << "You remove the glass." - A.state = 4 - A.icon_state = "holopad_4" - M.deconstruct(src) - for (var/mob/living/silicon/ai/master in masters) - clear_holo(master) - qdel(src) + if(computer_deconstruction_screwdriver(user, I)) + return else - src.attack_hand(user) + attack_hand(user) return /obj/machinery/hologram/holopad/attack_hand(var/mob/living/carbon/human/user) //Carn: Hologram requests. @@ -87,7 +65,7 @@ var/const/HOLOPAD_MODE = RANGE_BASED user << "A request for AI presence was already sent recently." /obj/machinery/hologram/holopad/attack_ai(mob/living/silicon/ai/user) - if (!istype(user)) + if(!istype(user)) return /*There are pretty much only three ways to interact here. I don't need to check for client since they're clicking on an object. @@ -102,11 +80,11 @@ var/const/HOLOPAD_MODE = RANGE_BASED /obj/machinery/hologram/holopad/proc/activate_holo(mob/living/silicon/ai/user) if(!(stat & NOPOWER) && user.eyeobj.loc == src.loc)//If the projector has power and client eye is on it - if (user.holo) + if(user.holo) user << "ERROR: Image feed in progress." return create_holo(user)//Create one. - src.visible_message("A holographic image of [user] flicks to life right before your eyes!") + visible_message("A holographic image of [user] flicks to life right before your eyes!") else user << "ERROR: Unable to project hologram." return @@ -165,7 +143,7 @@ For the other part of the code, check silicon say.dm. Particularly robot talk.*/ user.holo = null qdel(masters[user])//Get rid of user's hologram masters -= user //Discard AI from the list of those who use holopad - if (!masters.len)//If no users left + if(!masters.len)//If no users left set_light(0) //pad lighting (hologram lighting will be handled automatically since its owner was deleted) icon_state = "holopad0" return 1 @@ -214,10 +192,10 @@ For the other part of the code, check silicon say.dm. Particularly robot talk.*/ if(1.0) qdel(src) if(2.0) - if (prob(50)) + if(prob(50)) qdel(src) if(3.0) - if (prob(5)) + if(prob(5)) qdel(src) return diff --git a/code/game/machinery/holosign.dm b/code/game/machinery/holosign.dm index 6319871022..7e465db189 100644 --- a/code/game/machinery/holosign.dm +++ b/code/game/machinery/holosign.dm @@ -14,20 +14,20 @@ var/on_icon = "sign_on" /obj/machinery/holosign/proc/toggle() - if (stat & (BROKEN|NOPOWER)) + if(stat & (BROKEN|NOPOWER)) return lit = !lit use_power = lit ? 2 : 1 update_icon() /obj/machinery/holosign/update_icon() - if (!lit) + if(!lit) icon_state = "sign_off" else icon_state = on_icon /obj/machinery/holosign/power_change() - if (stat & NOPOWER) + if(stat & NOPOWER) lit = 0 use_power = 0 update_icon() @@ -55,8 +55,8 @@ icon_state = "light[active]" for(var/obj/machinery/holosign/M in machines) - if (M.id == src.id) - spawn( 0 ) + if(M.id == id) + spawn(0) M.toggle() return diff --git a/code/game/machinery/igniter.dm b/code/game/machinery/igniter.dm index 5fd791843d..97c430f9d0 100755 --- a/code/game/machinery/igniter.dm +++ b/code/game/machinery/igniter.dm @@ -11,7 +11,7 @@ active_power_usage = 4 /obj/machinery/igniter/attack_ai(mob/user as mob) - return src.attack_hand(user) + return attack_hand(user) /obj/machinery/igniter/attack_hand(mob/user as mob) if(..()) @@ -19,14 +19,14 @@ add_fingerprint(user) use_power(50) - src.on = !( src.on ) - src.icon_state = text("igniter[]", src.on) + on = !(on) + icon_state = text("igniter[]", on) return /obj/machinery/igniter/process() //ugh why is this even in process()? - if (src.on && !(stat & NOPOWER) ) + if(on && !(stat & NOPOWER)) var/turf/location = src.loc - if (isturf(location)) + if(isturf(location)) location.hotspot_expose(1000,500,1) return 1 @@ -36,8 +36,8 @@ /obj/machinery/igniter/power_change() ..() - if(!( stat & NOPOWER) ) - icon_state = "igniter[src.on]" + if(!(stat & NOPOWER)) + icon_state = "igniter[on]" else icon_state = "igniter0" @@ -57,56 +57,54 @@ idle_power_usage = 2 active_power_usage = 4 - /obj/machinery/sparker/New() ..() /obj/machinery/sparker/power_change() ..() - if ( !(stat & NOPOWER) && disable == 0 ) + if(!(stat & NOPOWER) && disable == 0) icon_state = "[base_state]" -// src.sd_SetLuminosity(2) +// sd_SetLuminosity(2) else icon_state = "[base_state]-p" -// src.sd_SetLuminosity(0) +// sd_SetLuminosity(0) /obj/machinery/sparker/attackby(obj/item/weapon/W as obj, mob/user as mob) - if (istype(W, /obj/item/weapon/screwdriver)) + if(istype(W, /obj/item/weapon/screwdriver)) add_fingerprint(user) - src.disable = !src.disable - if (src.disable) + disable = !disable + if(disable) user.visible_message("[user] has disabled the [src]!", "You disable the connection to the [src].") icon_state = "[base_state]-d" - if (!src.disable) + if(!disable) user.visible_message("[user] has reconnected the [src]!", "You fix the connection to the [src].") - if(src.powered()) + if(powered()) icon_state = "[base_state]" else icon_state = "[base_state]-p" /obj/machinery/sparker/attack_ai() - if (src.anchored) - return src.ignite() + if(anchored) + return ignite() else return /obj/machinery/sparker/proc/ignite() - if (!(powered())) + if(!(powered())) return - if ((src.disable) || (src.last_spark && world.time < src.last_spark + 50)) + if((disable) || (last_spark && world.time < last_spark + 50)) return - flick("[base_state]-spark", src) var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread s.set_up(2, 1, src) s.start() - src.last_spark = world.time + last_spark = world.time use_power(1000) var/turf/location = src.loc - if (isturf(location)) + if(isturf(location)) location.hotspot_expose(1000,500,1) return 1 @@ -132,14 +130,14 @@ icon_state = "launcheract" for(var/obj/machinery/sparker/M in machines) - if (M.id == src.id) - spawn( 0 ) + if(M.id == id) + spawn(0) M.ignite() for(var/obj/machinery/igniter/M in machines) - if(M.id == src.id) + if(M.id == id) use_power(50) - M.on = !( M.on ) + M.on = !(M.on) M.icon_state = text("igniter[]", M.on) sleep(50) @@ -147,4 +145,4 @@ icon_state = "launcherbtt" active = 0 - return + return \ No newline at end of file diff --git a/code/game/machinery/iv_drip.dm b/code/game/machinery/iv_drip.dm index 4ae639c039..c0f2a284f4 100644 --- a/code/game/machinery/iv_drip.dm +++ b/code/game/machinery/iv_drip.dm @@ -10,7 +10,7 @@ /obj/machinery/iv_drip/var/obj/item/weapon/reagent_containers/beaker = null /obj/machinery/iv_drip/update_icon() - if(src.attached) + if(attached) icon_state = "hooked" else icon_state = "" @@ -41,28 +41,28 @@ return if(attached) - visible_message("[src.attached] is detached from \the [src]") - src.attached = null - src.update_icon() + visible_message("[attached] is detached from \the [src]") + attached = null + update_icon() return if(in_range(src, usr) && ishuman(over_object) && get_dist(over_object, src) <= 1) visible_message("[usr] attaches \the [src] to \the [over_object].") - src.attached = over_object - src.update_icon() + attached = over_object + update_icon() /obj/machinery/iv_drip/attackby(obj/item/weapon/W as obj, mob/user as mob) - if (istype(W, /obj/item/weapon/reagent_containers)) - if(!isnull(src.beaker)) + if(istype(W, /obj/item/weapon/reagent_containers)) + if(!isnull(beaker)) user << "There is already a reagent container loaded!" return user.drop_item() W.loc = src - src.beaker = W + beaker = W user << "You attach \the [W] to \the [src]." - src.update_icon() + update_icon() return if(istype(W, /obj/item/weapon/screwdriver)) @@ -70,11 +70,11 @@ user << "You start to dismantle the IV drip." if(do_after(user, 15)) user << "You dismantle the IV drip." - var/obj/item/stack/rods/A = new /obj/item/stack/rods( src.loc ) + var/obj/item/stack/rods/A = new /obj/item/stack/rods(src.loc) A.amount = 6 - if(src.beaker) - src.beaker.loc = get_turf(src) - src.beaker = null + if(beaker) + beaker.loc = get_turf(src) + beaker = null qdel(src) return else @@ -84,24 +84,24 @@ /obj/machinery/iv_drip/process() set background = 1 - if(src.attached) + if(attached) - if(!(get_dist(src, src.attached) <= 1 && isturf(src.attached.loc))) - visible_message("The needle is ripped out of [src.attached], doesn't that hurt?") - src.attached:apply_damage(3, BRUTE, pick("r_arm", "l_arm")) - src.attached = null - src.update_icon() + if(!(get_dist(src, attached) <= 1 && isturf(attached.loc))) + visible_message("The needle is ripped out of [attached], doesn't that hurt?") + attached:apply_damage(3, BRUTE, pick("r_arm", "l_arm")) + attached = null + update_icon() return - if(src.attached && src.beaker) + if(attached && beaker) // Give blood if(mode) - if(src.beaker.volume > 0) + if(beaker.volume > 0) var/transfer_amount = REM - if(istype(src.beaker, /obj/item/weapon/reagent_containers/blood)) + if(istype(beaker, /obj/item/weapon/reagent_containers/blood)) // speed up transfer on blood packs transfer_amount = 4 - src.beaker.reagents.trans_to_mob(src.attached, transfer_amount, CHEM_BLOOD) + beaker.reagents.trans_to_mob(attached, transfer_amount, CHEM_BLOOD) update_icon() // Take blood @@ -130,7 +130,7 @@ var/datum/reagent/B = T.take_blood(beaker,amount) - if (B) + if(B) beaker.reagents.reagent_list |= B beaker.reagents.update_total() beaker.on_reagent_change() @@ -138,9 +138,9 @@ update_icon() /obj/machinery/iv_drip/attack_hand(mob/user as mob) - if(src.beaker) - src.beaker.loc = get_turf(src) - src.beaker = null + if(beaker) + beaker.loc = get_turf(src) + beaker = null update_icon() else return ..() @@ -163,7 +163,7 @@ /obj/machinery/iv_drip/examine(mob/user) ..(user) - if (!(user in view(2)) && user!=src.loc) return + if(!(user in view(2)) && user != src.loc) return user << "The IV drip is [mode ? "injecting" : "taking blood"]." @@ -177,7 +177,7 @@ usr << "[attached ? attached : "No one"] is attached." -/obj/machinery/iv_drip/CanPass(atom/movable/mover, turf/target, height=0, air_group=0) +/obj/machinery/iv_drip/CanPass(atom/movable/mover, turf/target, height = 0, air_group = 0) if(height && istype(mover) && mover.checkpass(PASSTABLE)) //allow bullets, beams, thrown objects, mice, drones, and the like through. return 1 return ..() diff --git a/code/game/machinery/jukebox.dm b/code/game/machinery/jukebox.dm index 3cc537be49..57e0e1b55a 100644 --- a/code/game/machinery/jukebox.dm +++ b/code/game/machinery/jukebox.dm @@ -38,7 +38,6 @@ datum/track/New(var/title_name, var/audio) /obj/machinery/media/jukebox/New() ..() - circuit = new circuit(src) component_parts = list() component_parts += new /obj/item/weapon/stock_parts/capacitor(src) component_parts += new /obj/item/weapon/stock_parts/console_screen(src) diff --git a/code/game/machinery/kitchen/microwave.dm b/code/game/machinery/kitchen/microwave.dm index 1be387f35f..a3b0f9fdd4 100644 --- a/code/game/machinery/kitchen/microwave.dm +++ b/code/game/machinery/kitchen/microwave.dm @@ -30,7 +30,6 @@ reagents = new/datum/reagents(100) reagents.my_atom = src - circuit = new circuit(src) component_parts = list() component_parts += new /obj/item/weapon/stock_parts/console_screen(src) component_parts += new /obj/item/weapon/stock_parts/motor(src) diff --git a/code/game/machinery/lightswitch.dm b/code/game/machinery/lightswitch.dm index 7d8e75764c..180471f070 100644 --- a/code/game/machinery/lightswitch.dm +++ b/code/game/machinery/lightswitch.dm @@ -18,19 +18,17 @@ /obj/machinery/light_switch/New() ..() spawn(5) - src.area = get_area(src) + area = get_area(src) if(otherarea) - src.area = locate(text2path("/area/[otherarea]")) + area = locate(text2path("/area/[otherarea]")) if(!name) name = "light switch ([area.name])" - src.on = src.area.lightswitch + on = area.lightswitch updateicon() - - /obj/machinery/light_switch/proc/updateicon() if(!overlay) overlay = image(icon, "light1-overlay", LIGHTING_LAYER+0.1) @@ -77,4 +75,4 @@ ..(severity) return power_change() - ..(severity) + ..(severity) \ No newline at end of file diff --git a/code/game/machinery/machinery.dm b/code/game/machinery/machinery.dm index 30a9b8548b..9b7760a12e 100644 --- a/code/game/machinery/machinery.dm +++ b/code/game/machinery/machinery.dm @@ -113,7 +113,6 @@ Class Procs: var/global/gl_uid = 1 var/interact_offline = 0 // Can the machine be interacted with while de-powered. var/circuit = null - var/frame_type = "machine" /obj/machinery/New(l, d=0) ..(l) @@ -124,6 +123,8 @@ Class Procs: else machines += src machinery_sort_required = 1 + if(circuit) + circuit = new circuit(src) /obj/machinery/Destroy() machines -= src @@ -165,11 +166,11 @@ Class Procs: qdel(src) return if(2.0) - if (prob(50)) + if(prob(50)) qdel(src) return if(3.0) - if (prob(25)) + if(prob(25)) qdel(src) return else @@ -182,20 +183,20 @@ Class Procs: /obj/machinery/proc/auto_use_power() if(!powered(power_channel)) return 0 - if(src.use_power == 1) - use_power(idle_power_usage,power_channel, 1) - else if(src.use_power >= 2) - use_power(active_power_usage,power_channel, 1) + if(use_power == 1) + use_power(idle_power_usage, power_channel, 1) + else if(use_power >= 2) + use_power(active_power_usage, power_channel, 1) return 1 /obj/machinery/proc/operable(var/additional_flags = 0) return !inoperable(additional_flags) /obj/machinery/proc/inoperable(var/additional_flags = 0) - return (stat & (NOPOWER|BROKEN|additional_flags)) + return (stat & (NOPOWER | BROKEN | additional_flags)) /obj/machinery/CanUseTopic(var/mob/user) - if(!interact_offline && (stat & (NOPOWER|BROKEN))) + if(!interact_offline && (stat & (NOPOWER | BROKEN))) return STATUS_CLOSE return ..() @@ -214,20 +215,19 @@ Class Procs: // For some reason attack_robot doesn't work // This is to stop robots from using cameras to remotely control machines. if(user.client && user.client.eye == user) - return src.attack_hand(user) + return attack_hand(user) else - return src.attack_hand(user) + return attack_hand(user) /obj/machinery/attack_hand(mob/user as mob) if(inoperable(MAINT)) return 1 if(user.lying || user.stat) return 1 - if ( ! (istype(usr, /mob/living/carbon/human) || \ - istype(usr, /mob/living/silicon))) + if(!(istype(usr, /mob/living/carbon/human) || istype(usr, /mob/living/silicon))) usr << "You don't have the dexterity to do this!" return 1 - if (ishuman(user)) + if(ishuman(user)) var/mob/living/carbon/human/H = user if(H.getBrainLoss() >= 55) visible_message("[H] stares cluelessly at [src].") @@ -236,7 +236,7 @@ Class Procs: user << "You momentarily forget how to use [src]." return 1 - src.add_fingerprint(user) + add_fingerprint(user) return ..() @@ -252,7 +252,7 @@ Class Procs: O.show_message("\icon[src] [msg]", 2) /obj/machinery/proc/ping(text=null) - if (!text) + if(!text) text = "\The [src] pings." state(text, "blue") @@ -266,7 +266,7 @@ Class Procs: var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread s.set_up(5, 1, src) s.start() - if (electrocute_mob(user, get_area(src), src, 0.7)) + if(electrocute_mob(user, get_area(src), src, 0.7)) var/area/temp_area = get_area(src) if(temp_area) var/obj/machinery/power/apc/temp_apc = temp_area.get_apc() @@ -304,7 +304,7 @@ Class Procs: RefreshParts() else user << "Following parts detected in the machine:" - for(var/var/obj/item/C in component_parts) + for(var/var/obj/item/C in component_parts) //var/var/obj/item/C? user << " [C.name]" return 1 @@ -324,31 +324,77 @@ Class Procs: update_icon() return 1 +/obj/machinery/proc/computer_deconstruction_screwdriver(var/mob/user, var/obj/item/weapon/screwdriver/S) + if(!istype(S)) + return 0 + if(!circuit) + return 0 + user << "You start disconnecting the monitor." + playsound(src.loc, 'sound/items/Screwdriver.ogg', 50, 1) + if(do_after(user, 20)) + if(stat & BROKEN) + user << "The broken glass falls out." + new /obj/item/weapon/material/shard(src.loc) + else + user << "You disconnect the monitor." + . = dismantle() + +/obj/machinery/proc/alarm_deconstruction_screwdriver(var/mob/user, var/obj/item/weapon/screwdriver/S) + if(!istype(S)) + return 0 + playsound(src.loc, 'sound/items/Screwdriver.ogg', 50, 1) + panel_open = !panel_open + user << "The wires have been [panel_open ? "exposed" : "unexposed"]" + update_icon() + return 1 + +/obj/machinery/proc/alarm_deconstruction_wirecutters(var/mob/user, var/obj/item/weapon/wirecutters/W) + if(!istype(W)) + return 0 + if(!panel_open) + return 0 + user.visible_message("[user] has cut the wires inside \the [src]!", "You have cut the wires inside \the [src].") + playsound(src.loc, 'sound/items/Wirecutter.ogg', 50, 1) + new/obj/item/stack/cable_coil(get_turf(src), 5) + . = dismantle() + /obj/machinery/proc/dismantle() - playsound(loc, 'sound/items/Crowbar.ogg', 50, 1) - var/obj/structure/frame/A = new /obj/structure/frame( src.loc ) + playsound(src.loc, 'sound/items/Crowbar.ogg', 50, 1) + var/obj/structure/frame/A = new /obj/structure/frame(src.loc) var/obj/item/weapon/circuitboard/M = circuit A.circuit = M A.anchored = 1 A.density = 1 A.frame_type = M.board_type - if(A.frame_type in A.no_circuit) + if(A.frame_type.circuit) A.need_circuit = 0 - for (var/obj/D in src.component_parts) - D.forceMove(loc) - if(A.components) - A.components.Cut() + + if(A.frame_type.frame_class == "machine") + for(var/obj/D in component_parts) + D.forceMove(src.loc) + if(A.components) + A.components.Cut() + else + A.components = list() + component_parts = list() + A.check_components() + + if(A.frame_type.frame_class == "alarm") + A.state = 2 + else if(A.frame_type.frame_class == "computer" || A.frame_type.frame_class == "display") + if(stat & BROKEN) + A.state = 3 + else + A.state = 4 else - A.components = list() - component_parts = list() - A.icon_state = "[A.frame_type]_3" - A.state = 3 - A.dir = dir + A.state = 3 + + A.set_dir(dir) A.pixel_x = pixel_x A.pixel_y = pixel_y - A.check_components() A.update_desc() + A.update_icon() M.loc = null M.deconstruct(src) qdel(src) - return 1 + return 1 \ No newline at end of file diff --git a/code/game/machinery/magnet.dm b/code/game/machinery/magnet.dm index ca044a5a48..af61e93424 100644 --- a/code/game/machinery/magnet.dm +++ b/code/game/machinery/magnet.dm @@ -5,7 +5,6 @@ // This was created for firing ranges, but I suppose this could have other applications - Doohl /obj/machinery/magnetic_module - icon = 'icons/obj/objects.dmi' icon_state = "floor_magnet-f" name = "Electromagnetic Generator" @@ -29,166 +28,157 @@ var/center_y = 0 var/max_dist = 20 // absolute value of center_x,y cannot exceed this integer - New() - ..() - var/turf/T = loc - hide(!T.is_plating()) - center = T +/obj/machinery/magnetic_module/New() + ..() + var/turf/T = loc + hide(!T.is_plating()) + center = T - spawn(10) // must wait for map loading to finish - if(radio_controller) - radio_controller.add_object(src, freq, RADIO_MAGNETS) + spawn(10) // must wait for map loading to finish + if(radio_controller) + radio_controller.add_object(src, freq, RADIO_MAGNETS) - spawn() - magnetic_process() + spawn() + magnetic_process() - // update the invisibility and icon - hide(var/intact) - invisibility = intact ? 101 : 0 - updateicon() +// update the invisibility and icon +/obj/machinery/magnetic_module/hide(var/intact) + invisibility = intact ? 101 : 0 + updateicon() - // update the icon_state - proc/updateicon() - var/state="floor_magnet" - var/onstate="" - if(!on) - onstate="0" +// update the icon_state +/obj/machinery/magnetic_module/proc/updateicon() + var/state="floor_magnet" + var/onstate="" + if(!on) + onstate="0" - if(invisibility) - icon_state = "[state][onstate]-f" // if invisible, set icon to faded version - // in case of being revealed by T-scanner - else - icon_state = "[state][onstate]" + if(invisibility) + icon_state = "[state][onstate]-f" // if invisible, set icon to faded version + // in case of being revealed by T-scanner + else + icon_state = "[state][onstate]" - receive_signal(datum/signal/signal) +/obj/machinery/magnetic_module/receive_signal(datum/signal/signal) + var/command = signal.data["command"] + var/modifier = signal.data["modifier"] + var/signal_code = signal.data["code"] + if(command && (signal_code == code)) - var/command = signal.data["command"] - var/modifier = signal.data["modifier"] - var/signal_code = signal.data["code"] - if(command && (signal_code == code)) + Cmd(command, modifier) - Cmd(command, modifier) +/obj/machinery/magnetic_module/proc/Cmd(var/command, var/modifier) + if(command) + switch(command) + if("set-electriclevel") + if(modifier) electricity_level = modifier + if("set-magneticfield") + if(modifier) magnetic_field = modifier + if("add-elec") + electricity_level++ + if(electricity_level > 12) + electricity_level = 12 + if("sub-elec") + electricity_level-- + if(electricity_level <= 0) + electricity_level = 1 + if("add-mag") + magnetic_field++ + if(magnetic_field > 4) + magnetic_field = 4 + if("sub-mag") + magnetic_field-- + if(magnetic_field <= 0) + magnetic_field = 1 + if("set-x") + if(modifier) center_x = modifier + if("set-y") + if(modifier) center_y = modifier - proc/Cmd(var/command, var/modifier) + if("N") // NORTH + center_y++ + if("S") // SOUTH + center_y-- + if("E") // EAST + center_x++ + if("W") // WEST + center_x-- + if("C") // CENTER + center_x = 0 + center_y = 0 + if("R") // RANDOM + center_x = rand(-max_dist, max_dist) + center_y = rand(-max_dist, max_dist) - if(command) - switch(command) - if("set-electriclevel") - if(modifier) electricity_level = modifier - if("set-magneticfield") - if(modifier) magnetic_field = modifier + if("set-code") + if(modifier) code = modifier + if("toggle-power") + on = !on - if("add-elec") - electricity_level++ - if(electricity_level > 12) - electricity_level = 12 - if("sub-elec") - electricity_level-- - if(electricity_level <= 0) - electricity_level = 1 - if("add-mag") - magnetic_field++ - if(magnetic_field > 4) - magnetic_field = 4 - if("sub-mag") - magnetic_field-- - if(magnetic_field <= 0) - magnetic_field = 1 + if(on) + spawn() + magnetic_process() - if("set-x") - if(modifier) center_x = modifier - if("set-y") - if(modifier) center_y = modifier +/obj/machinery/magnetic_module/process() + if(stat & NOPOWER) + on = 0 - if("N") // NORTH - center_y++ - if("S") // SOUTH - center_y-- - if("E") // EAST - center_x++ - if("W") // WEST - center_x-- - if("C") // CENTER - center_x = 0 - center_y = 0 - if("R") // RANDOM - center_x = rand(-max_dist, max_dist) - center_y = rand(-max_dist, max_dist) + // Sanity checks: + if(electricity_level <= 0) + electricity_level = 1 + if(magnetic_field <= 0) + magnetic_field = 1 - if("set-code") - if(modifier) code = modifier - if("toggle-power") - on = !on + // Limitations: + if(abs(center_x) > max_dist) + center_x = max_dist + if(abs(center_y) > max_dist) + center_y = max_dist + if(magnetic_field > 4) + magnetic_field = 4 + if(electricity_level > 12) + electricity_level = 12 - if(on) - spawn() - magnetic_process() + // Update power usage: + if(on) + use_power = 2 + active_power_usage = electricity_level*15 + else + use_power = 0 + // Overload conditions: + /* // Eeeehhh kinda stupid + if(on) + if(electricity_level > 11) + if(prob(electricity_level)) + explosion(loc, 0, 1, 2, 3) // ooo dat shit EXPLODES son + spawn(2) + qdel(src) + */ + updateicon() - process() - if(stat & NOPOWER) - on = 0 +/obj/machinery/magnetic_module/proc/magnetic_process() // proc that actually does the pulling + if(pulling) return + while(on) - // Sanity checks: - if(electricity_level <= 0) - electricity_level = 1 - if(magnetic_field <= 0) - magnetic_field = 1 + pulling = 1 + center = locate(x+center_x, y+center_y, z) + if(center) + for(var/obj/M in orange(magnetic_field, center)) + if(!M.anchored && (M.flags & CONDUCT)) + step_towards(M, center) + for(var/mob/living/silicon/S in orange(magnetic_field, center)) + if(istype(S, /mob/living/silicon/ai)) continue + step_towards(S, center) - // Limitations: - if(abs(center_x) > max_dist) - center_x = max_dist - if(abs(center_y) > max_dist) - center_y = max_dist - if(magnetic_field > 4) - magnetic_field = 4 - if(electricity_level > 12) - electricity_level = 12 + use_power(electricity_level * 5) + sleep(13 - electricity_level) - // Update power usage: - if(on) - use_power = 2 - active_power_usage = electricity_level*15 - else - use_power = 0 - - - // Overload conditions: - /* // Eeeehhh kinda stupid - if(on) - if(electricity_level > 11) - if(prob(electricity_level)) - explosion(loc, 0, 1, 2, 3) // ooo dat shit EXPLODES son - spawn(2) - qdel(src) - */ - - updateicon() - - - proc/magnetic_process() // proc that actually does the pulling - if(pulling) return - while(on) - - pulling = 1 - center = locate(x+center_x, y+center_y, z) - if(center) - for(var/obj/M in orange(magnetic_field, center)) - if(!M.anchored && (M.flags & CONDUCT)) - step_towards(M, center) - - for(var/mob/living/silicon/S in orange(magnetic_field, center)) - if(istype(S, /mob/living/silicon/ai)) continue - step_towards(S, center) - - use_power(electricity_level * 5) - sleep(13 - electricity_level) - - pulling = 0 + pulling = 0 /obj/machinery/magnetic_module/Destroy() if(radio_controller) @@ -220,186 +210,186 @@ var/datum/radio_frequency/radio_connection - New() - ..() +/obj/machinery/magnetic_controller/New() + ..() - if(autolink) - for(var/obj/machinery/magnetic_module/M in world) - if(M.freq == frequency && M.code == code) - magnets.Add(M) + if(autolink) + for(var/obj/machinery/magnetic_module/M in world) + if(M.freq == frequency && M.code == code) + magnets.Add(M) - spawn(45) // must wait for map loading to finish - if(radio_controller) - radio_connection = radio_controller.add_object(src, frequency, RADIO_MAGNETS) + spawn(45) // must wait for map loading to finish + if(radio_controller) + radio_connection = radio_controller.add_object(src, frequency, RADIO_MAGNETS) - if(path) // check for default path - filter_path() // renders rpath + if(path) // check for default path + filter_path() // renders rpath - process() - if(magnets.len == 0 && autolink) - for(var/obj/machinery/magnetic_module/M in world) - if(M.freq == frequency && M.code == code) - magnets.Add(M) +/obj/machinery/magnetic_controller/process() + if(magnets.len == 0 && autolink) + for(var/obj/machinery/magnetic_module/M in world) + if(M.freq == frequency && M.code == code) + magnets.Add(M) - attack_ai(mob/user as mob) - return src.attack_hand(user) +/obj/machinery/magnetic_controller/attack_ai(mob/user as mob) + return attack_hand(user) + +/obj/machinery/magnetic_controller/attack_hand(mob/user as mob) + if(stat & (BROKEN|NOPOWER)) + return + user.set_machine(src) + var/dat = "Magnetic Control Console

" + if(!autolink) + dat += {" + Frequency: [frequency]
+ Code: [code]
+ Probe Generators
+ "} + + if(magnets.len >= 1) + + dat += "Magnets confirmed:
" + var/i = 0 + for(var/obj/machinery/magnetic_module/M in magnets) + i++ + dat += "     < \[[i]\] ([M.on ? "On":"Off"]) | Electricity level: - [M.electricity_level] +; Magnetic field: - [M.magnetic_field] +
" + + dat += "
Speed: - [speed] +
" + dat += "Path: {[path]}
" + dat += "Moving: [moving ? "Enabled":"Disabled"]" + + + user << browse(dat, "window=magnet;size=400x500") + onclose(user, "magnet") + +/obj/machinery/magnetic_controller/Topic(href, href_list) + if(stat & (BROKEN|NOPOWER)) + return + usr.set_machine(src) + add_fingerprint(usr) + + if(href_list["radio-op"]) + + // Prepare signal beforehand, because this is a radio operation + var/datum/signal/signal = new + signal.transmission_method = 1 // radio transmission + signal.source = src + signal.frequency = frequency + signal.data["code"] = code + + // Apply any necessary commands + switch(href_list["radio-op"]) + if("togglepower") + signal.data["command"] = "toggle-power" + + if("minuselec") + signal.data["command"] = "sub-elec" + if("pluselec") + signal.data["command"] = "add-elec" + + if("minusmag") + signal.data["command"] = "sub-mag" + if("plusmag") + signal.data["command"] = "add-mag" + + + // Broadcast the signal + + radio_connection.post_signal(src, signal, filter = RADIO_MAGNETS) + + spawn(1) + updateUsrDialog() // pretty sure this increases responsiveness + + if(href_list["operation"]) + switch(href_list["operation"]) + if("plusspeed") + speed ++ + if(speed > 10) + speed = 10 + if("minusspeed") + speed -- + if(speed <= 0) + speed = 1 + if("setpath") + var/newpath = sanitize(input(usr, "Please define a new path!",,path) as text|null) + if(newpath && newpath != "") + moving = 0 // stop moving + path = newpath + pathpos = 1 // reset position + filter_path() // renders rpath + + if("togglemoving") + moving = !moving + if(moving) + spawn() MagnetMove() + + + updateUsrDialog() + +/obj/machinery/magnetic_controller/proc/MagnetMove() + if(looping) return + + while(moving && rpath.len >= 1) - attack_hand(mob/user as mob) if(stat & (BROKEN|NOPOWER)) - return - user.set_machine(src) - var/dat = "Magnetic Control Console

" - if(!autolink) - dat += {" - Frequency: [frequency]
- Code: [code]
- Probe Generators
- "} + break - if(magnets.len >= 1) + looping = 1 - dat += "Magnets confirmed:
" - var/i = 0 - for(var/obj/machinery/magnetic_module/M in magnets) - i++ - dat += "     < \[[i]\] ([M.on ? "On":"Off"]) | Electricity level: - [M.electricity_level] +; Magnetic field: - [M.magnetic_field] +
" + // Prepare the radio signal + var/datum/signal/signal = new + signal.transmission_method = 1 // radio transmission + signal.source = src + signal.frequency = frequency + signal.data["code"] = code - dat += "
Speed: - [speed] +
" - dat += "Path: {[path]}
" - dat += "Moving: [moving ? "Enabled":"Disabled"]" + if(pathpos > rpath.len) // if the position is greater than the length, we just loop through the list! + pathpos = 1 + + var/nextmove = uppertext(rpath[pathpos]) // makes it un-case-sensitive + + if(!(nextmove in list("N","S","E","W","C","R"))) + // N, S, E, W are directional + // C is center + // R is random (in magnetic field's bounds) + qdel(signal) + break // break the loop if the character located is invalid + + signal.data["command"] = nextmove - user << browse(dat, "window=magnet;size=400x500") - onclose(user, "magnet") - - Topic(href, href_list) - if(stat & (BROKEN|NOPOWER)) - return - usr.set_machine(src) - src.add_fingerprint(usr) - - if(href_list["radio-op"]) - - // Prepare signal beforehand, because this is a radio operation - var/datum/signal/signal = new - signal.transmission_method = 1 // radio transmission - signal.source = src - signal.frequency = frequency - signal.data["code"] = code - - // Apply any necessary commands - switch(href_list["radio-op"]) - if("togglepower") - signal.data["command"] = "toggle-power" - - if("minuselec") - signal.data["command"] = "sub-elec" - if("pluselec") - signal.data["command"] = "add-elec" - - if("minusmag") - signal.data["command"] = "sub-mag" - if("plusmag") - signal.data["command"] = "add-mag" - - - // Broadcast the signal + pathpos++ // increase iterator + // Broadcast the signal + spawn() radio_connection.post_signal(src, signal, filter = RADIO_MAGNETS) - spawn(1) - updateUsrDialog() // pretty sure this increases responsiveness + if(speed == 10) + sleep(1) + else + sleep(12-speed) - if(href_list["operation"]) - switch(href_list["operation"]) - if("plusspeed") - speed ++ - if(speed > 10) - speed = 10 - if("minusspeed") - speed -- - if(speed <= 0) - speed = 1 - if("setpath") - var/newpath = sanitize(input(usr, "Please define a new path!",,path) as text|null) - if(newpath && newpath != "") - moving = 0 // stop moving - path = newpath - pathpos = 1 // reset position - filter_path() // renders rpath - - if("togglemoving") - moving = !moving - if(moving) - spawn() MagnetMove() + looping = 0 - updateUsrDialog() +/obj/machinery/magnetic_controller/proc/filter_path() + // Generates the rpath variable using the path string, think of this as "string2list" + // Doesn't use params2list() because of the akward way it stacks entities + rpath = list() // clear rpath + var/maximum_character = min(50, length(path)) // chooses the maximum length of the iterator. 50 max length - proc/MagnetMove() - if(looping) return + for(var/i=1, i<=maximum_character, i++) // iterates through all characters in path - while(moving && rpath.len >= 1) + var/nextchar = copytext(path, i, i+1) // find next character - if(stat & (BROKEN|NOPOWER)) - break + if(!(nextchar in list(";", "&", "*", " "))) // if char is a separator, ignore + rpath += copytext(path, i, i+1) // else, add to list - looping = 1 - - // Prepare the radio signal - var/datum/signal/signal = new - signal.transmission_method = 1 // radio transmission - signal.source = src - signal.frequency = frequency - signal.data["code"] = code - - if(pathpos > rpath.len) // if the position is greater than the length, we just loop through the list! - pathpos = 1 - - var/nextmove = uppertext(rpath[pathpos]) // makes it un-case-sensitive - - if(!(nextmove in list("N","S","E","W","C","R"))) - // N, S, E, W are directional - // C is center - // R is random (in magnetic field's bounds) - qdel(signal) - break // break the loop if the character located is invalid - - signal.data["command"] = nextmove - - - pathpos++ // increase iterator - - // Broadcast the signal - spawn() - radio_connection.post_signal(src, signal, filter = RADIO_MAGNETS) - - if(speed == 10) - sleep(1) - else - sleep(12-speed) - - looping = 0 - - - proc/filter_path() - // Generates the rpath variable using the path string, think of this as "string2list" - // Doesn't use params2list() because of the akward way it stacks entities - rpath = list() // clear rpath - var/maximum_character = min( 50, length(path) ) // chooses the maximum length of the iterator. 50 max length - - for(var/i=1, i<=maximum_character, i++) // iterates through all characters in path - - var/nextchar = copytext(path, i, i+1) // find next character - - if(!(nextchar in list(";", "&", "*", " "))) // if char is a separator, ignore - rpath += copytext(path, i, i+1) // else, add to list - - // there doesn't HAVE to be separators but it makes paths syntatically visible + // there doesn't HAVE to be separators but it makes paths syntatically visible /obj/machinery/magnetic_controller/Destroy() if(radio_controller) diff --git a/code/game/machinery/mass_driver.dm b/code/game/machinery/mass_driver.dm index f563d9ef39..4d1affb3a0 100644 --- a/code/game/machinery/mass_driver.dm +++ b/code/game/machinery/mass_driver.dm @@ -18,7 +18,6 @@ /obj/machinery/mass_driver/New() ..() - circuit = new circuit(src) component_parts = list() component_parts += new /obj/item/weapon/stock_parts/motor(src) component_parts += new /obj/item/weapon/stock_parts/motor(src) @@ -59,7 +58,7 @@ M << "The mass driver lets out a screech, it mustn't be able to handle any more items." break use_power(500) - spawn( 0 ) + spawn(0) O.throw_at(target, drive_range * power, power) flick("mass_driver1", src) return diff --git a/code/game/machinery/navbeacon.dm b/code/game/machinery/navbeacon.dm index 0c14c66990..fe5cac9c44 100644 --- a/code/game/machinery/navbeacon.dm +++ b/code/game/machinery/navbeacon.dm @@ -1,11 +1,9 @@ // Navigation beacon for AI robots // Functions as a transponder: looks for incoming signal matching - var/global/list/navbeacons // no I don't like putting this in, but it will do for now /obj/machinery/navbeacon - icon = 'icons/obj/objects.dmi' icon_state = "navbeacon0-f" name = "navigation beacon" @@ -13,162 +11,160 @@ var/global/list/navbeacons // no I don't like putting this in, but it will do level = 1 // underfloor layer = 2.5 anchored = 1 - var/open = 0 // true if cover is open var/locked = 1 // true if controls are locked var/freq = 1445 // radio frequency var/location = "" // location response text var/list/codes // assoc. list of transponder codes var/codes_txt = "" // codes as set on map: "tag1;tag2" or "tag1=value;tag2=value" - req_access = list(access_engine) - New() - ..() +/obj/machinery/navbeacon/New() + ..() - set_codes() + set_codes() - var/turf/T = loc - hide(!T.is_plating()) + var/turf/T = loc + hide(!T.is_plating()) - // add beacon to MULE bot beacon list - if(freq == 1400) - if(!navbeacons) - navbeacons = new() - navbeacons += src + // add beacon to MULE bot beacon list + if(freq == 1400) + if(!navbeacons) + navbeacons = new() + navbeacons += src - spawn(5) // must wait for map loading to finish - if(radio_controller) - radio_controller.add_object(src, freq, RADIO_NAVBEACONS) + spawn(5) // must wait for map loading to finish + if(radio_controller) + radio_controller.add_object(src, freq, RADIO_NAVBEACONS) - // set the transponder codes assoc list from codes_txt - proc/set_codes() - if(!codes_txt) - return - - codes = new() - - var/list/entries = splittext(codes_txt, ";") // entries are separated by semicolons - - for(var/e in entries) - var/index = findtext(e, "=") // format is "key=value" - if(index) - var/key = copytext(e, 1, index) - var/val = copytext(e, index+1) - codes[key] = val - else - codes[e] = "1" - - - // called when turf state changes - // hide the object if turf is intact - hide(var/intact) - invisibility = intact ? 101 : 0 - updateicon() - - // update the icon_state - proc/updateicon() - var/state="navbeacon[open]" - - if(invisibility) - icon_state = "[state]-f" // if invisible, set icon to faded version - // in case revealed by T-scanner - else - icon_state = "[state]" - - - // look for a signal of the form "findbeacon=X" - // where X is any - // or the location - // or one of the set transponder keys - // if found, return a signal - receive_signal(datum/signal/signal) - - var/request = signal.data["findbeacon"] - if(request && ((request in codes) || request == "any" || request == location)) - spawn(1) - post_signal() - - // return a signal giving location and transponder codes - - proc/post_signal() - - var/datum/radio_frequency/frequency = radio_controller.return_frequency(freq) - - if(!frequency) return - - var/datum/signal/signal = new() - signal.source = src - signal.transmission_method = 1 - signal.data["beacon"] = location - - for(var/key in codes) - signal.data[key] = codes[key] - - frequency.post_signal(src, signal, filter = RADIO_NAVBEACONS) - - - attackby(var/obj/item/I, var/mob/user) - var/turf/T = loc - if(!T.is_plating()) - return // prevent intraction when T-scanner revealed - - if(istype(I, /obj/item/weapon/screwdriver)) - open = !open - - user.visible_message("[user] [open ? "opens" : "closes"] the beacon's cover.", "You [open ? "open" : "close"] the beacon's cover.") - - updateicon() - - else if (istype(I, /obj/item/weapon/card/id)||istype(I, /obj/item/device/pda)) - if(open) - if (src.allowed(user)) - src.locked = !src.locked - user << "Controls are now [src.locked ? "locked." : "unlocked."]" - else - user << "Access denied." - updateDialog() - else - user << "You must open the cover first!" +// set the transponder codes assoc list from codes_txt +/obj/machinery/navbeacon/proc/set_codes() + if(!codes_txt) return - attack_ai(var/mob/user) - interact(user, 1) + codes = new() - attack_hand(var/mob/user) + var/list/entries = splittext(codes_txt, ";") // entries are separated by semicolons - if(!user.IsAdvancedToolUser()) - return 0 - - interact(user, 0) - - interact(var/mob/user, var/ai = 0) - var/turf/T = loc - if(!T.is_plating()) - return // prevent intraction when T-scanner revealed - - if(!open && !ai) // can't alter controls if not open, unless you're an AI - user << "The beacon's control cover is closed." - return + for(var/e in entries) + var/index = findtext(e, "=") // format is "key=value" + if(index) + var/key = copytext(e, 1, index) + var/val = copytext(e, index+1) + codes[key] = val + else + codes[e] = "1" - var/t +// called when turf state changes +// hide the object if turf is intact +/obj/machinery/navbeacon/hide(var/intact) + invisibility = intact ? 101 : 0 + updateicon() - if(locked && !ai) - t = {"Navigation Beacon

+// update the icon_state +/obj/machinery/navbeacon/proc/updateicon() + var/state="navbeacon[open]" + + if(invisibility) + icon_state = "[state]-f" // if invisible, set icon to faded version + // in case revealed by T-scanner + else + icon_state = "[state]" + + +// look for a signal of the form "findbeacon=X" +// where X is any +// or the location +// or one of the set transponder keys +// if found, return a signal +/obj/machinery/navbeacon/receive_signal(datum/signal/signal) + + var/request = signal.data["findbeacon"] + if(request && ((request in codes) || request == "any" || request == location)) + spawn(1) + post_signal() + +// return a signal giving location and transponder codes + +/obj/machinery/navbeacon/proc/post_signal() + + var/datum/radio_frequency/frequency = radio_controller.return_frequency(freq) + + if(!frequency) return + + var/datum/signal/signal = new() + signal.source = src + signal.transmission_method = 1 + signal.data["beacon"] = location + + for(var/key in codes) + signal.data[key] = codes[key] + + frequency.post_signal(src, signal, filter = RADIO_NAVBEACONS) + + +/obj/machinery/navbeacon/attackby(var/obj/item/I, var/mob/user) + var/turf/T = loc + if(!T.is_plating()) + return // prevent intraction when T-scanner revealed + + if(istype(I, /obj/item/weapon/screwdriver)) + open = !open + + user.visible_message("[user] [open ? "opens" : "closes"] the beacon's cover.", "You [open ? "open" : "close"] the beacon's cover.") + + updateicon() + + else if(istype(I, /obj/item/weapon/card/id)||istype(I, /obj/item/device/pda)) + if(open) + if(allowed(user)) + locked = !locked + user << "Controls are now [locked ? "locked." : "unlocked."]" + else + user << "Access denied." + updateDialog() + else + user << "You must open the cover first!" + return + +/obj/machinery/navbeacon/attack_ai(var/mob/user) + interact(user, 1) + +/obj/machinery/navbeacon/attack_hand(var/mob/user) + + if(!user.IsAdvancedToolUser()) + return 0 + + interact(user, 0) + +/obj/machinery/navbeacon/interact(var/mob/user, var/ai = 0) + var/turf/T = loc + if(!T.is_plating()) + return // prevent intraction when T-scanner revealed + + if(!open && !ai) // can't alter controls if not open, unless you're an AI + user << "The beacon's control cover is closed." + return + + + var/t + + if(locked && !ai) + t = {"Navigation Beacon

(swipe card to unlock controls)
Frequency: [format_frequency(freq)]

Location: [location ? location : "(none)"]
Transponder Codes: