From 3a44b3097f0af5923a9b49d10ee06dac7acbb638 Mon Sep 17 00:00:00 2001 From: Fox-McCloud Date: Mon, 6 Jul 2015 01:07:08 -0400 Subject: [PATCH 1/3] Singulo Equipment Cleanup --- .../power/singularity/field_generator.dm | 4 +- code/modules/power/singularity/generator.dm | 2 +- .../particle_accelerator/particle.dm | 55 +++-------------- .../particle_accelerator.dm | 59 ++++++++++++------- .../particle_accelerator/particle_control.dm | 19 ++++-- .../particle_accelerator/particle_emitter.dm | 2 + 6 files changed, 66 insertions(+), 75 deletions(-) diff --git a/code/modules/power/singularity/field_generator.dm b/code/modules/power/singularity/field_generator.dm index 826f75c140e..762235d30a0 100644 --- a/code/modules/power/singularity/field_generator.dm +++ b/code/modules/power/singularity/field_generator.dm @@ -344,10 +344,10 @@ field_generator power level display //I want to avoid using global variables. spawn(1) var/temp = 1 //stops spam - for(var/obj/singularity/O in machines) + for(var/obj/singularity/O in world) if(O.last_warning && temp) if((world.time - O.last_warning) > 50) //to stop message-spam temp = 0 msg_admin_attack("A singulo exists and a containment field has failed.",1) investigate_log("has failed whilst a singulo exists.","singulo") - O.last_warning = world.time + O.last_warning = world.time \ No newline at end of file diff --git a/code/modules/power/singularity/generator.dm b/code/modules/power/singularity/generator.dm index ef3fb514b52..0a27b24e45e 100644 --- a/code/modules/power/singularity/generator.dm +++ b/code/modules/power/singularity/generator.dm @@ -27,7 +27,7 @@ investigate_log("[admin_message] at [x],[y],[z]","singulo") new /obj/singularity/(T, 50) - if(src) del(src) + if(src) qdel(src) /obj/machinery/the_singularitygen/attackby(obj/item/W, mob/user, params) if(istype(W, /obj/item/weapon/wrench)) diff --git a/code/modules/power/singularity/particle_accelerator/particle.dm b/code/modules/power/singularity/particle_accelerator/particle.dm index 540aee0b692..5f858d92448 100644 --- a/code/modules/power/singularity/particle_accelerator/particle.dm +++ b/code/modules/power/singularity/particle_accelerator/particle.dm @@ -8,15 +8,7 @@ anchored = 1 density = 1 var/movement_range = 10 - var/energy = 10 //energy in eV - var/mega_energy = 0 //energy in MeV - var/frequency = 1 - var/ionizing = 0 - var/particle_type - var/additional_particles = 0 - var/turf/target - var/turf/source - var/movetotarget = 1 + var/energy = 10 /obj/effect/accelerated_particle/weak movement_range = 8 @@ -26,10 +18,15 @@ movement_range = 15 energy = 15 +/obj/effect/accelerated_particle/powerful + movement_range = 20 + energy = 50 + /obj/effect/accelerated_particle/New(loc, dir = 2) src.loc = loc src.dir = dir + if(movement_range > 20) movement_range = 20 spawn(0) @@ -43,22 +40,6 @@ toxmob(A) if((istype(A,/obj/machinery/the_singularitygen))||(istype(A,/obj/singularity/))) A:energy += energy -/* - else if( istype(A,/obj/effect/rust_particle_catcher) ) - var/obj/effect/rust_particle_catcher/collided_catcher = A - if(particle_type && particle_type != "neutron") - if(collided_catcher.AddParticles(particle_type, 1 + additional_particles)) - collided_catcher.parent.AddEnergy(energy,mega_energy) - del (src) - else if( istype(A,/obj/machinery/power/rust_core) ) - var/obj/machinery/power/rust_core/collided_core = A - if(particle_type && particle_type != "neutron") - if(collided_core.AddParticles(particle_type, 1 + additional_particles)) - var/energy_loss_ratio = abs(collided_core.owned_field.frequency - frequency) / 1e9 - collided_core.owned_field.mega_energy += mega_energy - mega_energy * energy_loss_ratio - collided_core.owned_field.energy += energy - energy * energy_loss_ratio - del (src) -*/ return @@ -75,35 +56,17 @@ /obj/effect/accelerated_particle/proc/toxmob(var/mob/living/M) - /*var/radiation = (energy*2) - if(istype(M,/mob/living/carbon/human)) - if(M:wear_suit) //TODO: check for radiation protection - radiation = round(radiation/2,1) - if(istype(M,/mob/living/carbon/monkey)) - if(M:wear_suit) //TODO: check for radiation protection - radiation = round(radiation/2,1)*/ M.apply_effect((energy*6),IRRADIATE,0) M.updatehealth() - //M << "\red You feel odd." return /obj/effect/accelerated_particle/proc/move(var/lag) - if(target) - if(movetotarget) - if(!step_towards(src,target)) - src.loc = get_step(src, get_dir(src,target)) - if(get_dist(src,target) < 1) - movetotarget = 0 - else - if(!step(src, get_step_away(src,source))) - src.loc = get_step(src, get_step_away(src,source)) - else - if(!step(src,dir)) - src.loc = get_step(src,dir) + if(!step(src,dir)) + src.loc = get_step(src,dir) movement_range-- if(movement_range <= 0) - del(src) + 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 0163786e65e..4c0a4d195db 100644 --- a/code/modules/power/singularity/particle_accelerator/particle_accelerator.dm +++ b/code/modules/power/singularity/particle_accelerator/particle_accelerator.dm @@ -71,6 +71,12 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin var/strength = null var/desc_holder = null +/obj/structure/particle_accelerator/Destroy() + construction_state = 0 + if(master) + master.part_scan() + return ..() + /obj/structure/particle_accelerator/end_cap name = "Alpha Particle Generation Array" desc_holder = "This is where Alpha particles are generated from \[REDACTED\]" @@ -87,7 +93,9 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin set category = "Object" set src in oview(1) - if (src.anchored || usr:stat) + 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) @@ -98,7 +106,9 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin set category = "Object" set src in oview(1) - if (src.anchored || usr:stat) + 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) @@ -119,7 +129,6 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin ..() return - /obj/structure/particle_accelerator/attackby(obj/item/W, mob/user, params) if(istool(W)) if(src.process_tool_hit(W,user)) @@ -134,6 +143,7 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin master.toggle_power() investigate_log("was moved whilst active; it powered down.","singulo") + /obj/structure/particle_accelerator/ex_act(severity) switch(severity) if(1.0) @@ -153,7 +163,7 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin /obj/structure/particle_accelerator/blob_act() if(prob(50)) - del(src) + qdel(src) return @@ -206,35 +216,39 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin 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(iswrench(O)) + 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(iswrench(O)) + 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(iscoil(O)) - if(O:use(1,user)) + 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(iswirecutter(O))//TODO:Shock user if its on? + 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(isscrewdriver(O)) + 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(isscrewdriver(O)) + 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-- @@ -273,7 +287,9 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin set category = "Object" set src in oview(1) - if (src.anchored || usr:stat) + 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) @@ -284,7 +300,9 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin set category = "Object" set src in oview(1) - if (src.anchored || usr:stat) + 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) @@ -308,7 +326,6 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin ..() return - /obj/machinery/particle_accelerator/attackby(obj/item/W, mob/user, params) if(istool(W)) if(src.process_tool_hit(W,user)) @@ -335,7 +352,7 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin /obj/machinery/particle_accelerator/blob_act() if(prob(50)) - del(src) + qdel(src) return @@ -351,35 +368,35 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin 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(iswrench(O)) + 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(iswrench(O)) + 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(iscoil(O)) + 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(iswirecutter(O))//TODO:Shock user if its on? + 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(isscrewdriver(O)) + 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(isscrewdriver(O)) + 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-- diff --git a/code/modules/power/singularity/particle_accelerator/particle_control.dm b/code/modules/power/singularity/particle_accelerator/particle_control.dm index 5501b56010f..51c3f2ab769 100644 --- a/code/modules/power/singularity/particle_accelerator/particle_control.dm +++ b/code/modules/power/singularity/particle_accelerator/particle_control.dm @@ -1,7 +1,7 @@ //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 Computer" + name = "Particle Accelerator Control Console" desc = "This controls the density of the particles." icon = 'icons/obj/machines/particle_accelerator.dmi' icon_state = "control_box" @@ -26,6 +26,10 @@ connected_parts = list() ..() +/obj/machinery/particle_accelerator/control_box/Destroy() + if(active) + toggle_power() + return ..() /obj/machinery/particle_accelerator/control_box/attack_hand(mob/user as mob) if(construction_state >= 3) @@ -87,8 +91,10 @@ if(href_list["togglep"]) if(!wires.IsIndexCut(PARTICLE_TOGGLE_WIRE)) src.toggle_power() + else if(href_list["scan"]) src.part_scan() + else if(href_list["strengthup"]) if(!wires.IsIndexCut(PARTICLE_STRENGTH_WIRE)) add_strength() @@ -233,9 +239,8 @@ user.set_machine(src) var/dat = "" - dat += "Particle Accelerator Control Panel
" dat += "Close

" - dat += "Status:
" + dat += "

Status

" if(!assembled) dat += "Unable to detect all parts!
" dat += "Run Scan

" @@ -250,6 +255,10 @@ dat += "Particle Strength: [src.strength] " dat += "--|++

" - user << browse(dat, "window=pacontrol;size=420x500") - onclose(user, "pacontrol") + //user << browse(dat, "window=pacontrol;size=420x500") + //onclose(user, "pacontrol") + var/datum/browser/popup = new(user, "pacontrol", name, 420, 500) + popup.set_content(dat) + popup.set_title_image(user.browse_rsc_icon(src.icon, src.icon_state)) + popup.open() return \ No newline at end of file diff --git a/code/modules/power/singularity/particle_accelerator/particle_emitter.dm b/code/modules/power/singularity/particle_accelerator/particle_emitter.dm index f91b92a55e9..8e260a1115d 100644 --- a/code/modules/power/singularity/particle_accelerator/particle_emitter.dm +++ b/code/modules/power/singularity/particle_accelerator/particle_emitter.dm @@ -43,6 +43,8 @@ A = new/obj/effect/accelerated_particle(T, dir) if(2) A = 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 From b9a492a3a5a317e2ff47a978cb2ca9f9e88156a5 Mon Sep 17 00:00:00 2001 From: Fox-McCloud Date: Mon, 6 Jul 2015 23:25:29 -0400 Subject: [PATCH 2/3] no world --- code/_globalvars/lists/objects.dm | 1 + .../power/singularity/field_generator.dm | 2 +- .../particle_accelerator.dm | 24 +++++++++---------- code/modules/power/singularity/singularity.dm | 2 ++ 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/code/_globalvars/lists/objects.dm b/code/_globalvars/lists/objects.dm index 03b16f38efe..510be54c75c 100644 --- a/code/_globalvars/lists/objects.dm +++ b/code/_globalvars/lists/objects.dm @@ -10,6 +10,7 @@ var/global/list/spacepods_list = list() //list of all space pods. Used by hos var/global/list/joblist = list() //list of all jobstypes, minus borg and AI var/global/list/flag_list = list() //list of flags during Nations gamemode var/global/list/airlocks = list() //list of all airlocks +var/global/list/singularities = list() //list of all singularities var/global/list/aibots = list() // AI controlled bots var/global/list/table_recipes = list() //list of all table craft recipes diff --git a/code/modules/power/singularity/field_generator.dm b/code/modules/power/singularity/field_generator.dm index 762235d30a0..a616a7b3381 100644 --- a/code/modules/power/singularity/field_generator.dm +++ b/code/modules/power/singularity/field_generator.dm @@ -344,7 +344,7 @@ field_generator power level display //I want to avoid using global variables. spawn(1) var/temp = 1 //stops spam - for(var/obj/singularity/O in world) + for(var/obj/singularity/O in singularities) if(O.last_warning && temp) if((world.time - O.last_warning) > 50) //to stop message-spam temp = 0 diff --git a/code/modules/power/singularity/particle_accelerator/particle_accelerator.dm b/code/modules/power/singularity/particle_accelerator/particle_accelerator.dm index 4c0a4d195db..09390df300c 100644 --- a/code/modules/power/singularity/particle_accelerator/particle_accelerator.dm +++ b/code/modules/power/singularity/particle_accelerator/particle_accelerator.dm @@ -216,20 +216,20 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin 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()) + if(iswrench(O) && !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)) + if(iswrench(O)) 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)) + else if(iscoil(O)) var/obj/item/stack/cable_coil/C = O if(C.use(1)) user.visible_message("[user.name] adds wires to the [src.name].", \ @@ -239,16 +239,16 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin 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? + if(iswirecutter(O))//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)) + else if(isscrewdriver(O)) 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)) + if(isscrewdriver(O)) user.visible_message("[user.name] opens the [src.name]'s access panel.", \ "You open the access panel.") temp_state-- @@ -368,35 +368,35 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin 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)) + if(iswrench(O)) 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)) + if(iswrench(O)) 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)) + else if(iscoil(O)) 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? + if(iswirecutter(O))//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)) + else if(isscrewdriver(O)) 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)) + if(isscrewdriver(O)) user.visible_message("[user.name] opens the [src.name]'s access panel.", \ "You open the access panel.") temp_state-- diff --git a/code/modules/power/singularity/singularity.dm b/code/modules/power/singularity/singularity.dm index a1d86e5f6dd..fa8c14fe1b0 100644 --- a/code/modules/power/singularity/singularity.dm +++ b/code/modules/power/singularity/singularity.dm @@ -30,6 +30,7 @@ /obj/singularity/New(loc, var/starting_energy = 50, var/temp = 0) //CARN: admin-alert for chuckle-fuckery. + singularities += src admin_investigate_setup() src.energy = starting_energy @@ -43,6 +44,7 @@ /obj/singularity/Destroy() processing_objects.Remove(src) + singularities -= src return ..() /obj/singularity/Move(atom/newloc, direct) From 8e68d7903cc3ea71ac91627b74a0598b244cb0ae Mon Sep 17 00:00:00 2001 From: Fox-McCloud Date: Mon, 6 Jul 2015 23:55:05 -0400 Subject: [PATCH 3/3] fixes another in world call --- code/game/machinery/syndicatebeacon.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/game/machinery/syndicatebeacon.dm b/code/game/machinery/syndicatebeacon.dm index ab65c5a1e3d..667ebfddde8 100644 --- a/code/game/machinery/syndicatebeacon.dm +++ b/code/game/machinery/syndicatebeacon.dm @@ -127,7 +127,7 @@ if(surplus() < 1500) if(user) user << "The connected wire doesn't have enough current." return - for(var/obj/singularity/singulo in world) + for(var/obj/singularity/singulo in singularities) if(singulo.z == z) singulo.target = src icon_state = "[icontype]1"