diff --git a/code/modules/power/singularity/particle_accelerator/particle.dm b/code/modules/power/singularity/particle_accelerator/particle.dm index 889d9a3189b..8bbc0d6e7bb 100644 --- a/code/modules/power/singularity/particle_accelerator/particle.dm +++ b/code/modules/power/singularity/particle_accelerator/particle.dm @@ -1,10 +1,8 @@ -//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:33 - /obj/effect/accelerated_particle name = "Accelerated Particles" desc = "Small things moving very fast." icon = 'icons/obj/machines/particle_accelerator.dmi' - icon_state = "particle"//Need a new icon for this + icon_state = "particle" anchored = 1 density = 1 var/movement_range = 10 @@ -24,14 +22,10 @@ /obj/effect/accelerated_particle/New(loc, dir = 2) - src.loc = loc src.dir = dir - if(movement_range > 20) - movement_range = 20 spawn(0) move(1) - return /obj/effect/accelerated_particle/Bump(atom/A) @@ -40,35 +34,27 @@ toxmob(A) if((istype(A,/obj/machinery/the_singularitygen))||(istype(A,/obj/singularity/))) A:energy += energy - return /obj/effect/accelerated_particle/Bumped(atom/A) if(ismob(A)) Bump(A) - return /obj/effect/accelerated_particle/ex_act(severity, target) - loc = null - return - - + qdel(src) /obj/effect/accelerated_particle/proc/toxmob(mob/living/M) M.rad_act(energy*6) M.updatehealth() - return /obj/effect/accelerated_particle/proc/move(lag) - if(loc == null) - return if(!step(src,dir)) - src.loc = get_step(src,dir) + loc = get_step(src,dir) movement_range-- - if(movement_range <= 0) - loc = null + if(movement_range == 0) + qdel(src) else sleep(lag) move(lag) diff --git a/code/modules/power/singularity/particle_accelerator/particle_accelerator.dm b/code/modules/power/singularity/particle_accelerator/particle_accelerator.dm index c9f6d832c5e..55190370271 100644 --- a/code/modules/power/singularity/particle_accelerator/particle_accelerator.dm +++ b/code/modules/power/singularity/particle_accelerator/particle_accelerator.dm @@ -1,61 +1,23 @@ -//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:33 +/*Composed of 7 parts : -/*Composed of 7 parts -3 Particle emitters -proc -emit_particle() + 3 Particle Emitters + 1 Power Box + 1 Fuel Chamber + 1 End Cap + 1 Control computer -1 power box -the only part of this thing that uses power, can hack to mess with the pa/make it better + Setup map -1 fuel chamber -contains procs for mixing gas and whatever other fuel it uses -mix_gas() - -1 gas holder WIP -acts like a tank valve on the ground that you wrench gas tanks onto -proc -extract_gas() -return_gas() -attach_tank() -remove_tank() -get_available_mix() - -1 End Cap - -1 Control computer -interface for the pa, acts like a computer with an html menu for diff parts and a status report -all other parts contain only a ref to this -a /machine/, tells the others to do work -contains ref for all parts -proc -process() -check_build() - -Setup map - |EC| -CC|FC| - |PB| -PE|PE|PE - - -Icon Addemdum -Icon system is much more robust, and the icons are all variable based. -Each part has a reference string, powered, strength, and contruction values. -Using this the update_icon() proc is simplified a bit (using for absolutely was problematic with naming), -so the icon_state comes out be: -"[reference][strength]", with a switch controlling construction_states and ensuring that it doesn't -power on while being contructed, and all these variables are set by the computer through it's scan list -Essential order of the icons: -Standard - [reference] -Wrenched - [reference] -Wired - [reference]w -Closed - [reference]c -Powered - [reference]p[strength] -Strength being set by the computer and a null strength (Computer is powered off or inactive) returns a 'null', counting as empty -So, hopefully this is helpful if any more icons are to be added/changed/wondering what the hell is going on here + |EC| + CC|FC| + |PB| + PE|PE|PE */ +#define PA_CONSTRUCTION_UNSECURED 0 +#define PA_CONSTRUCTION_UNWIRED 1 +#define PA_CONSTRUCTION_PANEL_OPEN 2 +#define PA_CONSTRUCTION_COMPLETE 3 /obj/structure/particle_accelerator name = "Particle Accelerator" @@ -65,33 +27,32 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin anchored = 0 density = 1 var/obj/machinery/particle_accelerator/control_box/master = null - var/construction_state = 0 + var/construction_state = PA_CONSTRUCTION_UNSECURED var/reference = null var/powered = 0 var/strength = null - var/desc_holder = null /obj/structure/particle_accelerator/examine(mob/user) ..() + + switch(construction_state) + if(PA_CONSTRUCTION_UNSECURED) + user << "Looks like it's not attached to the flooring" + if(PA_CONSTRUCTION_UNWIRED) + user << "It is missing some cables" + if(PA_CONSTRUCTION_PANEL_OPEN) + user << "The panel is open" + user << "Alt-click to rotate it clockwise." /obj/structure/particle_accelerator/Destroy() - construction_state = 0 + construction_state = PA_CONSTRUCTION_UNSECURED if(master) - master.part_scan() + master.connected_parts -= src + master.assembled = 0 + master = null return ..() -/obj/structure/particle_accelerator/end_cap - name = "Alpha Particle Generation Array" - desc_holder = "This is where Alpha particles are generated from \[REDACTED\]" - icon_state = "end_cap" - reference = "end_cap" - -/obj/structure/particle_accelerator/update_icon() - ..() - return - - /obj/structure/particle_accelerator/verb/rotate() set name = "Rotate Clockwise" set category = "Object" @@ -99,10 +60,10 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin if(usr.stat || !usr.canmove || usr.restrained()) return - if (src.anchored) + if (anchored) usr << "It is fastened to the floor!" return 0 - src.dir = turn(src.dir, 270) + dir = turn(dir, -90) return 1 /obj/structure/particle_accelerator/AltClick(mob/user) @@ -122,32 +83,63 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin if(usr.stat || !usr.canmove || usr.restrained()) return - if (src.anchored) + if (anchored) usr << "It is fastened to the floor!" return 0 - src.dir = turn(src.dir, 90) + dir = turn(dir, 90) return 1 -/obj/structure/particle_accelerator/examine(mob/user) - switch(src.construction_state) - if(0) - src.desc = text("A [name], looks like it's not attached to the flooring") - if(1) - src.desc = text("A [name], it is missing some cables") - if(2) - src.desc = text("A [name], the panel is open") - if(3) - src.desc = text("The [name] is assembled") - if(powered) - src.desc = src.desc_holder - ..() - - /obj/structure/particle_accelerator/attackby(obj/item/W, mob/user, params) - user.changeNext_move(CLICK_CD_MELEE) - if(istool(W)) - if(src.process_tool_hit(W,user)) - return + var/did_something = FALSE + + switch(construction_state) + if(PA_CONSTRUCTION_UNSECURED) + if(istype(W, /obj/item/weapon/wrench) && !isinspace()) + playsound(loc, 'sound/items/Ratchet.ogg', 75, 1) + anchored = 1 + user.visible_message("[user.name] secures the [name] to the floor.", \ + "You secure the external bolts.") + construction_state = PA_CONSTRUCTION_UNWIRED + did_something = TRUE + if(PA_CONSTRUCTION_UNWIRED) + if(istype(W, /obj/item/weapon/wrench)) + playsound(loc, 'sound/items/Ratchet.ogg', 75, 1) + anchored = 0 + user.visible_message("[user.name] detaches the [name] from the floor.", \ + "You remove the external bolts.") + construction_state = PA_CONSTRUCTION_UNSECURED + did_something = TRUE + else if(istype(W, /obj/item/stack/cable_coil)) + var/obj/item/stack/cable_coil/CC = W + if(CC.use(1)) + user.visible_message("[user.name] adds wires to the [name].", \ + "You add some wires.") + construction_state = PA_CONSTRUCTION_PANEL_OPEN + did_something = TRUE + if(PA_CONSTRUCTION_PANEL_OPEN) + if(istype(W, /obj/item/weapon/wirecutters))//TODO:Shock user if its on? + user.visible_message("[user.name] removes some wires from the [name].", \ + "You remove some wires.") + construction_state = PA_CONSTRUCTION_UNWIRED + did_something = TRUE + else if(istype(W, /obj/item/weapon/screwdriver)) + user.visible_message("[user.name] closes the [name]'s access panel.", \ + "You close the access panel.") + construction_state = PA_CONSTRUCTION_COMPLETE + did_something = TRUE + if(PA_CONSTRUCTION_COMPLETE) + if(istype(W, /obj/item/weapon/screwdriver)) + user.visible_message("[user.name] opens the [name]'s access panel.", \ + "You open the access panel.") + construction_state = PA_CONSTRUCTION_PANEL_OPEN + did_something = TRUE + + if(did_something) + user.changeNext_move(CLICK_CD_MELEE) + update_state() + update_icon() + return + ..() @@ -160,16 +152,15 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin /obj/structure/particle_accelerator/blob_act() if(prob(50)) qdel(src) - return /obj/structure/particle_accelerator/update_icon() switch(construction_state) - if(0,1) + if(PA_CONSTRUCTION_UNSECURED,PA_CONSTRUCTION_UNWIRED) icon_state="[reference]" - if(2) + if(PA_CONSTRUCTION_PANEL_OPEN) icon_state="[reference]w" - if(3) + if(PA_CONSTRUCTION_COMPLETE) if(powered) icon_state="[reference]p[strength]" else @@ -179,217 +170,34 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin /obj/structure/particle_accelerator/proc/update_state() if(master) master.update_state() - return 0 - - -/obj/structure/particle_accelerator/proc/report_ready(obj/O) - if(O && (O == master)) - if(construction_state >= 3) - return 1 - return 0 - - -/obj/structure/particle_accelerator/proc/report_master() - if(master) - return master - return 0 - /obj/structure/particle_accelerator/proc/connect_master(obj/O) - if(O && istype(O,/obj/machinery/particle_accelerator/control_box)) - if(O.dir == src.dir) - master = O - return 1 - return 0 - - -/obj/structure/particle_accelerator/proc/process_tool_hit(obj/O, mob/user) - if(!(O) || !(user)) - return 0 - if(!ismob(user) || !isobj(O)) - return 0 - var/temp_state = src.construction_state - - switch(src.construction_state)//TODO:Might be more interesting to have it need several parts rather than a single list of steps - if(0) - if(istype(O, /obj/item/weapon/wrench) && !isinspace()) - playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1) - src.anchored = 1 - user.visible_message("[user.name] secures the [src.name] to the floor.", \ - "You secure the external bolts.") - temp_state++ - if(1) - if(istype(O, /obj/item/weapon/wrench)) - playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1) - src.anchored = 0 - user.visible_message("[user.name] detaches the [src.name] from the floor.", \ - "You remove the external bolts.") - temp_state-- - else if(istype(O, /obj/item/stack/cable_coil)) - var/obj/item/stack/cable_coil/C = O - if(C.use(1)) - user.visible_message("[user.name] adds wires to the [src.name].", \ - "You add some wires.") - temp_state++ - else - user << "You need one length of cable to wire the [src.name]!" - return - if(2) - if(istype(O, /obj/item/weapon/wirecutters))//TODO:Shock user if its on? - user.visible_message("[user.name] removes some wires from the [src.name].", \ - "You remove some wires.") - temp_state-- - else if(istype(O, /obj/item/weapon/screwdriver)) - user.visible_message("[user.name] closes the [src.name]'s access panel.", \ - "You close the access panel.") - temp_state++ - if(3) - if(istype(O, /obj/item/weapon/screwdriver)) - user.visible_message("[user.name] opens the [src.name]'s access panel.", \ - "You open the access panel.") - temp_state-- - if(temp_state == src.construction_state)//Nothing changed - return 0 - else - src.construction_state = temp_state - if(src.construction_state < 3)//Was taken apart, update state - update_state() - update_icon() + if(O.dir == dir) + master = O return 1 return 0 +/////////// +// PARTS // +/////////// -/obj/machinery/particle_accelerator - name = "Particle Accelerator" - desc = "Part of a Particle Accelerator." +/obj/structure/particle_accelerator/end_cap + name = "Alpha Particle Generation Array" + desc = "This is where Alpha particles are generated from \[REDACTED\]" + icon_state = "end_cap" + reference = "end_cap" + +/obj/structure/particle_accelerator/power_box + name = "Particle Focusing EM Lens" + desc = "This uses electromagnetic waves to focus the Alpha-Particles." icon = 'icons/obj/machines/particle_accelerator.dmi' - icon_state = "none" - anchored = 0 - density = 1 - use_power = 0 - idle_power_usage = 0 - active_power_usage = 0 - var/construction_state = 0 - var/active = 0 - var/reference = null - var/powered = null - var/strength = 0 - var/desc_holder = null + icon_state = "power_box" + reference = "power_box" - -/obj/machinery/particle_accelerator/verb/rotate() - set name = "Rotate Clockwise" - set category = "Object" - set src in oview(1) - - if(usr.stat || !usr.canmove || usr.restrained()) - return - if (src.anchored) - usr << "It is fastened to the floor!" - return 0 - src.dir = turn(src.dir, 270) - return 1 - -/obj/machinery/particle_accelerator/verb/rotateccw() - set name = "Rotate Counter-Clockwise" - set category = "Object" - set src in oview(1) - - if(usr.stat || !usr.canmove || usr.restrained()) - return - if (src.anchored) - usr << "It is fastened to the floor!" - return 0 - src.dir = turn(src.dir, 90) - return 1 - -/obj/machinery/particle_accelerator/update_icon() - return - -/obj/machinery/particle_accelerator/examine(mob/user) - switch(src.construction_state) - if(0) - src.desc = text("A [name], looks like it's not attached to the flooring") - if(1) - src.desc = text("A [name], it is missing some cables") - if(2) - src.desc = text("A [name], the panel is open") - if(3) - src.desc = text("The [name] is assembled") - if(powered) - src.desc = src.desc_holder - ..() - - -/obj/machinery/particle_accelerator/attackby(obj/item/W, mob/user, params) - if(istool(W)) - if(src.process_tool_hit(W,user)) - return - ..() - return - -/obj/machinery/particle_accelerator/blob_act() - if(prob(50)) - qdel(src) - return - - -/obj/machinery/particle_accelerator/proc/update_state() - return 0 - - -/obj/machinery/particle_accelerator/proc/process_tool_hit(obj/O, mob/user) - if(!(O) || !(user)) - return 0 - if(!ismob(user) || !isobj(O)) - return 0 - var/temp_state = src.construction_state - switch(src.construction_state)//TODO:Might be more interesting to have it need several parts rather than a single list of steps - if(0) - if(istype(O, /obj/item/weapon/wrench)) - playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1) - src.anchored = 1 - user.visible_message("[user.name] secures the [src.name] to the floor.", \ - "You secure the external bolts.") - temp_state++ - if(1) - if(istype(O, /obj/item/weapon/wrench)) - playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1) - src.anchored = 0 - user.visible_message("[user.name] detaches the [src.name] from the floor.", \ - "You remove the external bolts.") - temp_state-- - else if(istype(O, /obj/item/stack/cable_coil)) - if(O:use(1)) - user.visible_message("[user.name] adds wires to the [src.name].", \ - "You add some wires.") - temp_state++ - if(2) - if(istype(O, /obj/item/weapon/wirecutters))//TODO:Shock user if its on? - user.visible_message("[user.name] removes some wires from the [src.name].", \ - "You remove some wires.") - temp_state-- - else if(istype(O, /obj/item/weapon/screwdriver)) - user.visible_message("[user.name] closes the [src.name]'s access panel.", \ - "You close the access panel.") - temp_state++ - if(3) - if(istype(O, /obj/item/weapon/screwdriver)) - user.visible_message("[user.name] opens the [src.name]'s access panel.", \ - "You open the access panel.") - temp_state-- - active = 0 - if(temp_state == src.construction_state)//Nothing changed - return 0 - else - if(src.construction_state < 3)//Was taken apart, update state - update_state() - if(use_power) - use_power = 0 - src.construction_state = temp_state - if(src.construction_state >= 3) - use_power = 1 - update_icon() - return 1 - return 0 +/obj/structure/particle_accelerator/fuel_chamber + name = "EM Acceleration Chamber" + desc = "This is where the Alpha particles are accelerated to radical speeds." + icon = 'icons/obj/machines/particle_accelerator.dmi' + icon_state = "fuel_chamber" + reference = "fuel_chamber" diff --git a/code/modules/power/singularity/particle_accelerator/particle_chamber.dm b/code/modules/power/singularity/particle_accelerator/particle_chamber.dm deleted file mode 100644 index 8d8e23e9964..00000000000 --- a/code/modules/power/singularity/particle_accelerator/particle_chamber.dm +++ /dev/null @@ -1,10 +0,0 @@ -/obj/structure/particle_accelerator/fuel_chamber - name = "EM Acceleration Chamber" - desc_holder = "This is where the Alpha particles are accelerated to radical speeds." - icon = 'icons/obj/machines/particle_accelerator.dmi' - icon_state = "fuel_chamber" - reference = "fuel_chamber" - -/obj/structure/particle_accelerator/fuel_chamber/update_icon() - ..() - return \ No newline at end of file diff --git a/code/modules/power/singularity/particle_accelerator/particle_control.dm b/code/modules/power/singularity/particle_accelerator/particle_control.dm index 0d70ae0410f..887b816efe6 100644 --- a/code/modules/power/singularity/particle_accelerator/particle_control.dm +++ b/code/modules/power/singularity/particle_accelerator/particle_control.dm @@ -1,24 +1,24 @@ -//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:33 + /obj/machinery/particle_accelerator/control_box name = "Particle Accelerator Control Console" desc = "This controls the density of the particles." icon = 'icons/obj/machines/particle_accelerator.dmi' icon_state = "control_box" - reference = "control_box" anchored = 0 density = 1 use_power = 0 idle_power_usage = 500 active_power_usage = 10000 - construction_state = 0 - active = 0 dir = 1 var/strength_upper_limit = 2 var/interface_control = 1 var/list/obj/structure/particle_accelerator/connected_parts var/assembled = 0 - var/parts = null + var/construction_state = PA_CONSTRUCTION_UNSECURED + var/active = 0 + var/strength = 0 + var/powered = 0 /obj/machinery/particle_accelerator/control_box/New() wires = new /datum/wires/particle_accelerator/control_box(src) @@ -28,54 +28,54 @@ /obj/machinery/particle_accelerator/control_box/Destroy() if(active) toggle_power() + for(var/CP in connected_parts) + var/obj/structure/particle_accelerator/part = CP + part.master = null + connected_parts.Cut() qdel(wires) wires = null return ..() /obj/machinery/particle_accelerator/control_box/attack_hand(mob/user) - if(construction_state >= 3) + if(construction_state == PA_CONSTRUCTION_COMPLETE) interact(user) - else if(construction_state == 2) // Wires exposed + else if(construction_state == PA_CONSTRUCTION_PANEL_OPEN) wires.interact(user) -/obj/machinery/particle_accelerator/control_box/update_state() - if(construction_state < 3) +/obj/machinery/particle_accelerator/control_box/proc/update_state() + if(construction_state < PA_CONSTRUCTION_COMPLETE) use_power = 0 assembled = 0 active = 0 - for(var/obj/structure/particle_accelerator/part in connected_parts) + for(var/CP in connected_parts) + var/obj/structure/particle_accelerator/part = CP part.strength = null part.powered = 0 part.update_icon() - connected_parts = list() + connected_parts.Cut() return if(!part_scan()) use_power = 1 active = 0 - connected_parts = list() - - return + connected_parts.Cut() /obj/machinery/particle_accelerator/control_box/update_icon() if(active) - icon_state = "[reference]p1" + icon_state = "control_boxp1" else if(use_power) if(assembled) - icon_state = "[reference]p" + icon_state = "control_boxp" else - icon_state = "u[reference]p" + icon_state = "ucontrol_boxp" else switch(construction_state) - if(0) - icon_state = "[reference]" - if(1) - icon_state = "[reference]" - if(2) - icon_state = "[reference]w" + if(PA_CONSTRUCTION_UNSECURED, PA_CONSTRUCTION_UNWIRED) + icon_state = "control_box" + if(PA_CONSTRUCTION_PANEL_OPEN) + icon_state = "control_boxw" else - icon_state = "[reference]c" - return + icon_state = "control_boxc" /obj/machinery/particle_accelerator/control_box/Topic(href, href_list) if(..()) @@ -85,16 +85,16 @@ usr << "ERROR: Request timed out. Check wire contacts." return - if( href_list["close"] ) + if(href_list["close"]) usr << browse(null, "window=pacontrol") usr.unset_machine() return if(href_list["togglep"]) if(!wires.is_cut(WIRE_POWER)) - src.toggle_power() + toggle_power() else if(href_list["scan"]) - src.part_scan() + part_scan() else if(href_list["strengthup"]) if(!wires.is_cut(WIRE_STRENGTH)) @@ -104,125 +104,119 @@ if(!wires.is_cut(WIRE_STRENGTH)) remove_strength() - src.updateDialog() - src.update_icon() - return - + updateDialog() + update_icon() /obj/machinery/particle_accelerator/control_box/proc/strength_change() - for(var/obj/structure/particle_accelerator/part in connected_parts) + for(var/CP in connected_parts) + var/obj/structure/particle_accelerator/part = CP part.strength = strength part.update_icon() /obj/machinery/particle_accelerator/control_box/proc/add_strength(s) - if(assembled) + if(assembled && (strength < strength_upper_limit)) strength++ - if(strength > strength_upper_limit) - strength = strength_upper_limit - else - message_admins("PA Control Computer increased to [strength] by [key_name_admin(usr)](?) (FLW) in ([x],[y],[z] - JMP)",0,1) - log_game("PA Control Computer increased to [strength] by [key_name(usr)] in ([x],[y],[z])") - investigate_log("increased to [strength] by [key_name(usr)]","singulo") strength_change() + message_admins("PA Control Computer increased to [strength] by [key_name_admin(usr)](?) (FLW) in ([x],[y],[z] - JMP)",0,1) + log_game("PA Control Computer increased to [strength] by [key_name(usr)] in ([x],[y],[z])") + investigate_log("increased to [strength] by [key_name(usr)]","singulo") + + /obj/machinery/particle_accelerator/control_box/proc/remove_strength(s) - if(assembled) + if(assembled && (strength > 0)) strength-- - if(strength < 0) - strength = 0 - else - message_admins("PA Control Computer decreased to [strength] by [key_name_admin(usr)](?) (FLW) in ([x],[y],[z] - JMP)",0,1) - log_game("PA Control Computer decreased to [strength] by [key_name(usr)] in ([x],[y],[z])") - investigate_log("decreased to [strength] by [key_name(usr)]","singulo") strength_change() + message_admins("PA Control Computer decreased to [strength] by [key_name_admin(usr)](?) (FLW) in ([x],[y],[z] - JMP)",0,1) + log_game("PA Control Computer decreased to [strength] by [key_name(usr)] in ([x],[y],[z])") + investigate_log("decreased to [strength] by [key_name(usr)]","singulo") + + /obj/machinery/particle_accelerator/control_box/power_change() ..() if(stat & NOPOWER) active = 0 use_power = 0 - else if(!stat && construction_state <= 3) + else if(!stat && construction_state == PA_CONSTRUCTION_COMPLETE) use_power = 1 - return - /obj/machinery/particle_accelerator/control_box/process() - if(src.active) + if(active) //a part is missing! - if( length(connected_parts) < 6 ) + if(connected_parts.len < 6) investigate_log("lost a connected part; It powered down.","singulo") - src.toggle_power() + toggle_power() + update_icon() return //emit some particles for(var/obj/structure/particle_accelerator/particle_emitter/PE in connected_parts) - if(PE) - PE.emit_particle(src.strength) - return - + PE.emit_particle(strength) /obj/machinery/particle_accelerator/control_box/proc/part_scan() - for(var/obj/structure/particle_accelerator/fuel_chamber/F in orange(1,src)) - src.dir = F.dir - connected_parts = list() - var/tally = 0 var/ldir = turn(dir,-90) var/rdir = turn(dir,90) var/odir = turn(dir,180) - var/turf/T = src.loc - T = get_step(T,rdir) - if(check_part(T,/obj/structure/particle_accelerator/fuel_chamber)) - tally++ - T = get_step(T,odir) - if(check_part(T,/obj/structure/particle_accelerator/end_cap)) - tally++ - T = get_step(T,dir) - T = get_step(T,dir) - if(check_part(T,/obj/structure/particle_accelerator/power_box)) - tally++ - T = get_step(T,dir) - if(check_part(T,/obj/structure/particle_accelerator/particle_emitter/center)) - tally++ - T = get_step(T,ldir) - if(check_part(T,/obj/structure/particle_accelerator/particle_emitter/left)) - tally++ - T = get_step(T,rdir) - T = get_step(T,rdir) - if(check_part(T,/obj/structure/particle_accelerator/particle_emitter/right)) - tally++ - if(tally >= 6) - assembled = 1 - return 1 - else - assembled = 0 + var/turf/T = loc + + assembled = 0 + + var/obj/structure/particle_accelerator/fuel_chamber/F = locate() in orange(1,src) + if(!F) return 0 + dir = F.dir + connected_parts.Cut() + + T = get_step(T,rdir) + if(!check_part(T,/obj/structure/particle_accelerator/fuel_chamber)) + return 0 + T = get_step(T,odir) + if(!check_part(T,/obj/structure/particle_accelerator/end_cap)) + return 0 + T = get_step(T,dir) + T = get_step(T,dir) + if(!check_part(T,/obj/structure/particle_accelerator/power_box)) + return 0 + T = get_step(T,dir) + if(!check_part(T,/obj/structure/particle_accelerator/particle_emitter/center)) + return 0 + T = get_step(T,ldir) + if(!check_part(T,/obj/structure/particle_accelerator/particle_emitter/left)) + return 0 + T = get_step(T,rdir) + T = get_step(T,rdir) + if(!check_part(T,/obj/structure/particle_accelerator/particle_emitter/right)) + return 0 + + assembled = 1 + return 1 /obj/machinery/particle_accelerator/control_box/proc/check_part(turf/T, type) - if(!(T)||!(type)) - return 0 var/obj/structure/particle_accelerator/PA = locate(/obj/structure/particle_accelerator) in T - if(istype(PA, type)) + if(istype(PA, type) && (PA.construction_state == PA_CONSTRUCTION_COMPLETE)) if(PA.connect_master(src)) - if(PA.report_ready(src)) - src.connected_parts.Add(PA) - return 1 + connected_parts.Add(PA) + return 1 return 0 /obj/machinery/particle_accelerator/control_box/proc/toggle_power() - src.active = !src.active + active = !active investigate_log("turned [active?"ON":"OFF"] by [usr ? key_name(usr) : "outside forces"]","singulo") message_admins("PA Control Computer turned [active ?"ON":"OFF"] by [usr ? key_name_admin(usr) : "outside forces"](?) (FLW) in ([x],[y],[z] - JMP)",0,1) log_game("PA Control Computer turned [active ?"ON":"OFF"] by [usr ? "[key_name(usr)]" : "outside forces"] in ([x],[y],[z])") - if(src.active) - src.use_power = 2 - for(var/obj/structure/particle_accelerator/part in connected_parts) - part.strength = src.strength + if(active) + use_power = 2 + for(var/CP in connected_parts) + var/obj/structure/particle_accelerator/part = CP + part.strength = strength part.powered = 1 part.update_icon() else - src.use_power = 1 - for(var/obj/structure/particle_accelerator/part in connected_parts) + use_power = 1 + for(var/CP in connected_parts) + var/obj/structure/particle_accelerator/part = CP part.strength = null part.powered = 0 part.update_icon() @@ -251,13 +245,85 @@ else dat += "Off
" dat += "Toggle Power

" - dat += "Particle Strength: [src.strength] " + dat += "Particle Strength: [strength] " dat += "--|++

" //user << browse(dat, "window=pacontrol;size=420x500") //onclose(user, "pacontrol") - var/datum/browser/popup = new(user, "pacontrol", name, 420, 500) + var/datum/browser/popup = new(user, "pacontrol", name, 420, 300) popup.set_content(dat) - popup.set_title_image(user.browse_rsc_icon(src.icon, src.icon_state)) + popup.set_title_image(user.browse_rsc_icon(icon, icon_state)) popup.open() - return \ No newline at end of file + +/obj/machinery/particle_accelerator/control_box/examine(mob/user) + ..() + switch(construction_state) + if(PA_CONSTRUCTION_UNSECURED) + user << "Looks like it's not attached to the flooring" + if(PA_CONSTRUCTION_UNWIRED) + user << "It is missing some cables" + if(PA_CONSTRUCTION_PANEL_OPEN) + user << "The panel is open" + + +/obj/machinery/particle_accelerator/control_box/attackby(obj/item/W, mob/user, params) + var/did_something = FALSE + + switch(construction_state) + if(PA_CONSTRUCTION_UNSECURED) + if(istype(W, /obj/item/weapon/wrench) && !isinspace()) + playsound(loc, 'sound/items/Ratchet.ogg', 75, 1) + anchored = 1 + user.visible_message("[user.name] secures the [name] to the floor.", \ + "You secure the external bolts.") + construction_state = PA_CONSTRUCTION_UNWIRED + did_something = TRUE + if(PA_CONSTRUCTION_UNWIRED) + if(istype(W, /obj/item/weapon/wrench)) + playsound(loc, 'sound/items/Ratchet.ogg', 75, 1) + anchored = 0 + user.visible_message("[user.name] detaches the [name] from the floor.", \ + "You remove the external bolts.") + construction_state = PA_CONSTRUCTION_UNSECURED + did_something = TRUE + else if(istype(W, /obj/item/stack/cable_coil)) + var/obj/item/stack/cable_coil/CC = W + if(CC.use(1)) + user.visible_message("[user.name] adds wires to the [name].", \ + "You add some wires.") + construction_state = PA_CONSTRUCTION_PANEL_OPEN + did_something = TRUE + if(PA_CONSTRUCTION_PANEL_OPEN) + if(istype(W, /obj/item/weapon/wirecutters))//TODO:Shock user if its on? + user.visible_message("[user.name] removes some wires from the [name].", \ + "You remove some wires.") + construction_state = PA_CONSTRUCTION_UNWIRED + did_something = TRUE + else if(istype(W, /obj/item/weapon/screwdriver)) + user.visible_message("[user.name] closes the [name]'s access panel.", \ + "You close the access panel.") + construction_state = PA_CONSTRUCTION_COMPLETE + did_something = TRUE + if(PA_CONSTRUCTION_COMPLETE) + if(istype(W, /obj/item/weapon/screwdriver)) + user.visible_message("[user.name] opens the [name]'s access panel.", \ + "You open the access panel.") + construction_state = PA_CONSTRUCTION_PANEL_OPEN + did_something = TRUE + + if(did_something) + user.changeNext_move(CLICK_CD_MELEE) + update_state() + update_icon() + return + + ..() + +/obj/machinery/particle_accelerator/control_box/blob_act() + if(prob(50)) + qdel(src) + +#undef PA_CONSTRUCTION_UNSECURED +#undef PA_CONSTRUCTION_UNWIRED +#undef PA_CONSTRUCTION_PANEL_OPEN +#undef PA_CONSTRUCTION_COMPLETE diff --git a/code/modules/power/singularity/particle_accelerator/particle_emitter.dm b/code/modules/power/singularity/particle_accelerator/particle_emitter.dm index caaae583787..7c6ca75d305 100644 --- a/code/modules/power/singularity/particle_accelerator/particle_emitter.dm +++ b/code/modules/power/singularity/particle_accelerator/particle_emitter.dm @@ -1,8 +1,6 @@ -//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:33 - /obj/structure/particle_accelerator/particle_emitter name = "EM Containment Grid" - desc_holder = "This launchs the Alpha particles, might not want to stand near this end." + desc = "This launchs the Alpha particles, might not want to stand near this end." icon = 'icons/obj/machines/particle_accelerator.dmi' icon_state = "none" var/fire_delay = 50 @@ -20,32 +18,24 @@ icon_state = "emitter_right" reference = "emitter_right" -/obj/structure/particle_accelerator/particle_emitter/update_icon() - ..() - return - /obj/structure/particle_accelerator/particle_emitter/proc/set_delay(delay) - if(delay && delay >= 0) - src.fire_delay = delay + if(delay >= 0) + fire_delay = delay return 1 return 0 - /obj/structure/particle_accelerator/particle_emitter/proc/emit_particle(strength = 0) - if((src.last_shot + src.fire_delay) <= world.time) - src.last_shot = world.time - var/obj/effect/accelerated_particle/A = null + if((last_shot + fire_delay) <= world.time) + last_shot = world.time var/turf/T = get_step(src,dir) switch(strength) if(0) - A = new/obj/effect/accelerated_particle/weak(T, dir) + new/obj/effect/accelerated_particle/weak(T, dir) if(1) - A = new/obj/effect/accelerated_particle(T, dir) + new/obj/effect/accelerated_particle(T, dir) if(2) - A = new/obj/effect/accelerated_particle/strong(T, dir) + new/obj/effect/accelerated_particle/strong(T, dir) if(3) - A = new/obj/effect/accelerated_particle/powerful(T, dir) - if(A) - A.dir = src.dir - return 1 + new/obj/effect/accelerated_particle/powerful(T, dir) + return 1 return 0 diff --git a/code/modules/power/singularity/particle_accelerator/particle_power.dm b/code/modules/power/singularity/particle_accelerator/particle_power.dm deleted file mode 100644 index e6deff37ddf..00000000000 --- a/code/modules/power/singularity/particle_accelerator/particle_power.dm +++ /dev/null @@ -1,10 +0,0 @@ -/obj/structure/particle_accelerator/power_box - name = "Particle Focusing EM Lens" - desc_holder = "This uses electromagnetic waves to focus the Alpha-Particles." - icon = 'icons/obj/machines/particle_accelerator.dmi' - icon_state = "power_box" - reference = "power_box" - -/obj/structure/particle_accelerator/power_box/update_icon() - ..() - return diff --git a/tgstation.dme b/tgstation.dme index 4a0d37630c2..7e9bbff2cfa 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -1415,10 +1415,8 @@ #include "code\modules\power\singularity\singularity.dm" #include "code\modules\power\singularity\particle_accelerator\particle.dm" #include "code\modules\power\singularity\particle_accelerator\particle_accelerator.dm" -#include "code\modules\power\singularity\particle_accelerator\particle_chamber.dm" #include "code\modules\power\singularity\particle_accelerator\particle_control.dm" #include "code\modules\power\singularity\particle_accelerator\particle_emitter.dm" -#include "code\modules\power\singularity\particle_accelerator\particle_power.dm" #include "code\modules\power\supermatter\supermatter.dm" #include "code\modules\power\tesla\coil.dm" #include "code\modules\power\tesla\energy_ball.dm"