mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 18:22:39 +00:00
Moar whitespace normalization [MDB IGNORE] (#7750)
Co-authored-by: Raeschen <rycoop29@gmail.com>
This commit is contained in:
@@ -1,103 +1,103 @@
|
||||
//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_accelerator2.dmi'
|
||||
icon_state = "particle1"//Need a new icon for this
|
||||
anchored = TRUE
|
||||
density = TRUE
|
||||
movement_type = UNSTOPPABLE // for bumps to trigger
|
||||
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
|
||||
|
||||
/obj/effect/accelerated_particle/weak
|
||||
icon_state = "particle0"
|
||||
movement_range = 8
|
||||
energy = 5
|
||||
|
||||
/obj/effect/accelerated_particle/strong
|
||||
icon_state = "particle2"
|
||||
movement_range = 15
|
||||
energy = 15
|
||||
|
||||
/obj/effect/accelerated_particle/powerful
|
||||
icon_state = "particle3"
|
||||
movement_range = 25
|
||||
energy = 50
|
||||
|
||||
/obj/effect/accelerated_particle/New(loc, dir = 2)
|
||||
src.loc = loc
|
||||
src.set_dir(dir)
|
||||
spawn(0)
|
||||
move(1)
|
||||
|
||||
|
||||
/obj/effect/accelerated_particle/Bump(atom/A)
|
||||
if (A)
|
||||
if(ismob(A))
|
||||
toxmob(A)
|
||||
if((istype(A,/obj/machinery/the_singularitygen))||(istype(A,/obj/singularity/))||(istype(A, /obj/machinery/particle_smasher)))
|
||||
A:energy += energy
|
||||
//R-UST port
|
||||
else if(istype(A,/obj/machinery/power/fusion_core))
|
||||
var/obj/machinery/power/fusion_core/collided_core = A
|
||||
if(particle_type && particle_type != "neutron")
|
||||
if(collided_core.AddParticles(particle_type, 1 + additional_particles))
|
||||
collided_core.owned_field.plasma_temperature += mega_energy
|
||||
collided_core.owned_field.energy += energy
|
||||
loc = null
|
||||
else if(istype(A, /obj/effect/fusion_particle_catcher))
|
||||
var/obj/effect/fusion_particle_catcher/PC = A
|
||||
if(particle_type && particle_type != "neutron")
|
||||
if(PC.parent.owned_core.AddParticles(particle_type, 1 + additional_particles))
|
||||
PC.parent.plasma_temperature += mega_energy
|
||||
PC.parent.energy += energy
|
||||
loc = null
|
||||
|
||||
|
||||
/obj/effect/accelerated_particle/Bumped(atom/A)
|
||||
if(ismob(A))
|
||||
Bump(A)
|
||||
|
||||
|
||||
/obj/effect/accelerated_particle/ex_act(severity)
|
||||
qdel(src)
|
||||
|
||||
/obj/effect/accelerated_particle/singularity_act()
|
||||
return
|
||||
|
||||
/obj/effect/accelerated_particle/proc/toxmob(var/mob/living/M)
|
||||
var/radiation = (energy*2)
|
||||
M.apply_effect((radiation*3),IRRADIATE,0)
|
||||
M.updatehealth()
|
||||
//to_chat(M, "<font color='red'>You feel odd.</font>")
|
||||
|
||||
|
||||
/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)
|
||||
movement_range--
|
||||
if(movement_range <= 0)
|
||||
qdel(src)
|
||||
else
|
||||
sleep(lag)
|
||||
move(lag)
|
||||
//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_accelerator2.dmi'
|
||||
icon_state = "particle1"//Need a new icon for this
|
||||
anchored = TRUE
|
||||
density = TRUE
|
||||
movement_type = UNSTOPPABLE // for bumps to trigger
|
||||
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
|
||||
|
||||
/obj/effect/accelerated_particle/weak
|
||||
icon_state = "particle0"
|
||||
movement_range = 8
|
||||
energy = 5
|
||||
|
||||
/obj/effect/accelerated_particle/strong
|
||||
icon_state = "particle2"
|
||||
movement_range = 15
|
||||
energy = 15
|
||||
|
||||
/obj/effect/accelerated_particle/powerful
|
||||
icon_state = "particle3"
|
||||
movement_range = 25
|
||||
energy = 50
|
||||
|
||||
/obj/effect/accelerated_particle/New(loc, dir = 2)
|
||||
src.loc = loc
|
||||
src.set_dir(dir)
|
||||
spawn(0)
|
||||
move(1)
|
||||
|
||||
|
||||
/obj/effect/accelerated_particle/Bump(atom/A)
|
||||
if (A)
|
||||
if(ismob(A))
|
||||
toxmob(A)
|
||||
if((istype(A,/obj/machinery/the_singularitygen))||(istype(A,/obj/singularity/))||(istype(A, /obj/machinery/particle_smasher)))
|
||||
A:energy += energy
|
||||
//R-UST port
|
||||
else if(istype(A,/obj/machinery/power/fusion_core))
|
||||
var/obj/machinery/power/fusion_core/collided_core = A
|
||||
if(particle_type && particle_type != "neutron")
|
||||
if(collided_core.AddParticles(particle_type, 1 + additional_particles))
|
||||
collided_core.owned_field.plasma_temperature += mega_energy
|
||||
collided_core.owned_field.energy += energy
|
||||
loc = null
|
||||
else if(istype(A, /obj/effect/fusion_particle_catcher))
|
||||
var/obj/effect/fusion_particle_catcher/PC = A
|
||||
if(particle_type && particle_type != "neutron")
|
||||
if(PC.parent.owned_core.AddParticles(particle_type, 1 + additional_particles))
|
||||
PC.parent.plasma_temperature += mega_energy
|
||||
PC.parent.energy += energy
|
||||
loc = null
|
||||
|
||||
|
||||
/obj/effect/accelerated_particle/Bumped(atom/A)
|
||||
if(ismob(A))
|
||||
Bump(A)
|
||||
|
||||
|
||||
/obj/effect/accelerated_particle/ex_act(severity)
|
||||
qdel(src)
|
||||
|
||||
/obj/effect/accelerated_particle/singularity_act()
|
||||
return
|
||||
|
||||
/obj/effect/accelerated_particle/proc/toxmob(var/mob/living/M)
|
||||
var/radiation = (energy*2)
|
||||
M.apply_effect((radiation*3),IRRADIATE,0)
|
||||
M.updatehealth()
|
||||
//to_chat(M, "<font color='red'>You feel odd.</font>")
|
||||
|
||||
|
||||
/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)
|
||||
movement_range--
|
||||
if(movement_range <= 0)
|
||||
qdel(src)
|
||||
else
|
||||
sleep(lag)
|
||||
move(lag)
|
||||
|
||||
@@ -1,385 +1,385 @@
|
||||
//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:33
|
||||
|
||||
/*Composed of 7 parts
|
||||
3 Particle emitters
|
||||
proc
|
||||
emit_particle()
|
||||
|
||||
1 power box
|
||||
the only part of this thing that uses power, can hack to mess with the pa/make it better.
|
||||
Lies, only the control computer draws power.
|
||||
|
||||
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
|
||||
|
||||
*/
|
||||
|
||||
/obj/structure/particle_accelerator
|
||||
name = "Particle Accelerator"
|
||||
desc = "Part of a Particle Accelerator."
|
||||
icon = 'icons/obj/machines/particle_accelerator2.dmi'
|
||||
icon_state = "none"
|
||||
anchored = FALSE
|
||||
density = TRUE
|
||||
var/obj/machinery/particle_accelerator/control_box/master = null
|
||||
var/construction_state = 0
|
||||
var/reference = null
|
||||
var/powered = 0
|
||||
var/strength = null
|
||||
var/desc_holder = null
|
||||
|
||||
/obj/structure/particle_accelerator/Destroy()
|
||||
construction_state = 0
|
||||
if(master)
|
||||
master.part_scan()
|
||||
..()
|
||||
|
||||
/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_clockwise()
|
||||
set name = "Rotate Clockwise"
|
||||
set category = "Object"
|
||||
set src in oview(1)
|
||||
|
||||
if (src.anchored || usr:stat)
|
||||
to_chat(usr, "It is fastened to the floor!")
|
||||
return 0
|
||||
src.set_dir(turn(src.dir, 270))
|
||||
return 1
|
||||
|
||||
/obj/structure/particle_accelerator/verb/rotate_counterclockwise()
|
||||
set name = "Rotate Counter Clockwise"
|
||||
set category = "Object"
|
||||
set src in oview(1)
|
||||
|
||||
if (src.anchored || usr:stat)
|
||||
to_chat(usr, "It is fastened to the floor!")
|
||||
return 0
|
||||
src.set_dir(turn(src.dir, 90))
|
||||
return 1
|
||||
|
||||
/obj/structure/particle_accelerator/examine(mob/user)
|
||||
. = ..()
|
||||
|
||||
switch(construction_state)
|
||||
if(0)
|
||||
. += "Looks like it's not attached to the flooring."
|
||||
if(1)
|
||||
. += "It is missing some cables."
|
||||
if(2)
|
||||
. += "The panel is open."
|
||||
if(3)
|
||||
. += "It is assembled."
|
||||
|
||||
/obj/structure/particle_accelerator/attackby(obj/item/W, mob/user)
|
||||
if(istool(W))
|
||||
if(src.process_tool_hit(W,user))
|
||||
return
|
||||
..()
|
||||
return
|
||||
|
||||
|
||||
/obj/structure/particle_accelerator/Moved(atom/old_loc, direction, forced = FALSE)
|
||||
. = ..()
|
||||
if(master?.active)
|
||||
master.toggle_power()
|
||||
log_game("PACCEL([x],[y],[z]) Was moved while active and turned off.")
|
||||
investigate_log("was moved whilst active; it <font color='red'>powered down</font>.","singulo")
|
||||
|
||||
/obj/structure/particle_accelerator/ex_act(severity)
|
||||
switch(severity)
|
||||
if(1.0)
|
||||
qdel(src)
|
||||
return
|
||||
if(2.0)
|
||||
if (prob(50))
|
||||
qdel(src)
|
||||
return
|
||||
if(3.0)
|
||||
if (prob(25))
|
||||
qdel(src)
|
||||
return
|
||||
else
|
||||
return
|
||||
|
||||
/obj/structure/particle_accelerator/update_icon()
|
||||
switch(construction_state)
|
||||
if(0,1)
|
||||
icon_state="[reference]"
|
||||
if(2)
|
||||
icon_state="[reference]w"
|
||||
if(3)
|
||||
if(powered)
|
||||
icon_state="[reference]p[strength]"
|
||||
else
|
||||
icon_state="[reference]c"
|
||||
return
|
||||
|
||||
/obj/structure/particle_accelerator/proc/update_state()
|
||||
if(master)
|
||||
master.update_state()
|
||||
return 0
|
||||
|
||||
|
||||
/obj/structure/particle_accelerator/proc/report_ready(var/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(var/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(var/obj/item/O, var/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(O.has_tool_quality(TOOL_WRENCH))
|
||||
playsound(src, O.usesound, 75, 1)
|
||||
src.anchored = TRUE
|
||||
user.visible_message("[user.name] secures the [src.name] to the floor.", \
|
||||
"You secure the external bolts.")
|
||||
temp_state++
|
||||
if(1)
|
||||
if(O.has_tool_quality(TOOL_WRENCH))
|
||||
playsound(src, O.usesound, 75, 1)
|
||||
src.anchored = FALSE
|
||||
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))
|
||||
user.visible_message("[user.name] adds wires to the [src.name].", \
|
||||
"You add some wires.")
|
||||
temp_state++
|
||||
if(2)
|
||||
if(O.has_tool_quality(TOOL_WIRECUTTER))//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(O.has_tool_quality(TOOL_SCREWDRIVER))
|
||||
user.visible_message("[user.name] closes the [src.name]'s access panel.", \
|
||||
"You close the access panel.")
|
||||
temp_state++
|
||||
if(3)
|
||||
if(O.has_tool_quality(TOOL_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()
|
||||
return 1
|
||||
|
||||
|
||||
|
||||
/obj/machinery/particle_accelerator
|
||||
name = "Particle Accelerator"
|
||||
desc = "Part of a Particle Accelerator."
|
||||
icon = 'icons/obj/machines/particle_accelerator2.dmi'
|
||||
icon_state = "none"
|
||||
anchored = FALSE
|
||||
density = TRUE
|
||||
use_power = USE_POWER_OFF
|
||||
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
|
||||
|
||||
|
||||
/obj/machinery/particle_accelerator/verb/rotate_clockwise()
|
||||
set name = "Rotate Clockwise"
|
||||
set category = "Object"
|
||||
set src in oview(1)
|
||||
|
||||
if (src.anchored || usr:stat)
|
||||
to_chat(usr, "It is fastened to the floor!")
|
||||
return 0
|
||||
src.set_dir(turn(src.dir, 270))
|
||||
return 1
|
||||
|
||||
/obj/machinery/particle_accelerator/verb/rotate_counterclockwise()
|
||||
set name = "Rotate Counter-Clockwise"
|
||||
set category = "Object"
|
||||
set src in oview(1)
|
||||
|
||||
if (src.anchored || usr:stat)
|
||||
to_chat(usr, "It is fastened to the floor!")
|
||||
return 0
|
||||
src.set_dir(turn(src.dir, 90))
|
||||
return 1
|
||||
|
||||
/obj/machinery/particle_accelerator/update_icon()
|
||||
return
|
||||
|
||||
/obj/machinery/particle_accelerator/examine(mob/user)
|
||||
. = ..()
|
||||
|
||||
switch(construction_state)
|
||||
if(0)
|
||||
. += "Looks like it's not attached to the flooring."
|
||||
if(1)
|
||||
. += "It is missing some cables."
|
||||
if(2)
|
||||
. += "The panel is open."
|
||||
if(3)
|
||||
. += "It is assembled."
|
||||
|
||||
|
||||
/obj/machinery/particle_accelerator/attackby(obj/item/W, mob/user)
|
||||
if(istool(W))
|
||||
if(src.process_tool_hit(W,user))
|
||||
return
|
||||
..()
|
||||
return
|
||||
|
||||
/obj/machinery/particle_accelerator/ex_act(severity)
|
||||
switch(severity)
|
||||
if(1.0)
|
||||
qdel(src)
|
||||
return
|
||||
if(2.0)
|
||||
if (prob(50))
|
||||
qdel(src)
|
||||
return
|
||||
if(3.0)
|
||||
if (prob(25))
|
||||
qdel(src)
|
||||
return
|
||||
else
|
||||
return
|
||||
|
||||
/obj/machinery/particle_accelerator/proc/update_state()
|
||||
return 0
|
||||
|
||||
/obj/machinery/particle_accelerator/proc/process_tool_hit(var/obj/item/O, var/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(O.has_tool_quality(TOOL_WRENCH))
|
||||
playsound(src, O.usesound, 75, 1)
|
||||
src.anchored = TRUE
|
||||
user.visible_message("[user.name] secures the [src.name] to the floor.", \
|
||||
"You secure the external bolts.")
|
||||
temp_state++
|
||||
if(1)
|
||||
if(O.has_tool_quality(TOOL_WRENCH))
|
||||
playsound(src, O.usesound, 75, 1)
|
||||
src.anchored = FALSE
|
||||
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(O.has_tool_quality(TOOL_WIRECUTTER))//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(O.has_tool_quality(TOOL_SCREWDRIVER))
|
||||
user.visible_message("[user.name] closes the [src.name]'s access panel.", \
|
||||
"You close the access panel.")
|
||||
temp_state++
|
||||
if(3)
|
||||
if(O.has_tool_quality(TOOL_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)
|
||||
update_use_power(USE_POWER_OFF)
|
||||
src.construction_state = temp_state
|
||||
if(src.construction_state >= 3)
|
||||
update_use_power(USE_POWER_IDLE)
|
||||
update_icon()
|
||||
return 1
|
||||
//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:33
|
||||
|
||||
/*Composed of 7 parts
|
||||
3 Particle emitters
|
||||
proc
|
||||
emit_particle()
|
||||
|
||||
1 power box
|
||||
the only part of this thing that uses power, can hack to mess with the pa/make it better.
|
||||
Lies, only the control computer draws power.
|
||||
|
||||
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
|
||||
|
||||
*/
|
||||
|
||||
/obj/structure/particle_accelerator
|
||||
name = "Particle Accelerator"
|
||||
desc = "Part of a Particle Accelerator."
|
||||
icon = 'icons/obj/machines/particle_accelerator2.dmi'
|
||||
icon_state = "none"
|
||||
anchored = FALSE
|
||||
density = TRUE
|
||||
var/obj/machinery/particle_accelerator/control_box/master = null
|
||||
var/construction_state = 0
|
||||
var/reference = null
|
||||
var/powered = 0
|
||||
var/strength = null
|
||||
var/desc_holder = null
|
||||
|
||||
/obj/structure/particle_accelerator/Destroy()
|
||||
construction_state = 0
|
||||
if(master)
|
||||
master.part_scan()
|
||||
..()
|
||||
|
||||
/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_clockwise()
|
||||
set name = "Rotate Clockwise"
|
||||
set category = "Object"
|
||||
set src in oview(1)
|
||||
|
||||
if (src.anchored || usr:stat)
|
||||
to_chat(usr, "It is fastened to the floor!")
|
||||
return 0
|
||||
src.set_dir(turn(src.dir, 270))
|
||||
return 1
|
||||
|
||||
/obj/structure/particle_accelerator/verb/rotate_counterclockwise()
|
||||
set name = "Rotate Counter Clockwise"
|
||||
set category = "Object"
|
||||
set src in oview(1)
|
||||
|
||||
if (src.anchored || usr:stat)
|
||||
to_chat(usr, "It is fastened to the floor!")
|
||||
return 0
|
||||
src.set_dir(turn(src.dir, 90))
|
||||
return 1
|
||||
|
||||
/obj/structure/particle_accelerator/examine(mob/user)
|
||||
. = ..()
|
||||
|
||||
switch(construction_state)
|
||||
if(0)
|
||||
. += "Looks like it's not attached to the flooring."
|
||||
if(1)
|
||||
. += "It is missing some cables."
|
||||
if(2)
|
||||
. += "The panel is open."
|
||||
if(3)
|
||||
. += "It is assembled."
|
||||
|
||||
/obj/structure/particle_accelerator/attackby(obj/item/W, mob/user)
|
||||
if(istool(W))
|
||||
if(src.process_tool_hit(W,user))
|
||||
return
|
||||
..()
|
||||
return
|
||||
|
||||
|
||||
/obj/structure/particle_accelerator/Moved(atom/old_loc, direction, forced = FALSE)
|
||||
. = ..()
|
||||
if(master?.active)
|
||||
master.toggle_power()
|
||||
log_game("PACCEL([x],[y],[z]) Was moved while active and turned off.")
|
||||
investigate_log("was moved whilst active; it <font color='red'>powered down</font>.","singulo")
|
||||
|
||||
/obj/structure/particle_accelerator/ex_act(severity)
|
||||
switch(severity)
|
||||
if(1.0)
|
||||
qdel(src)
|
||||
return
|
||||
if(2.0)
|
||||
if (prob(50))
|
||||
qdel(src)
|
||||
return
|
||||
if(3.0)
|
||||
if (prob(25))
|
||||
qdel(src)
|
||||
return
|
||||
else
|
||||
return
|
||||
|
||||
/obj/structure/particle_accelerator/update_icon()
|
||||
switch(construction_state)
|
||||
if(0,1)
|
||||
icon_state="[reference]"
|
||||
if(2)
|
||||
icon_state="[reference]w"
|
||||
if(3)
|
||||
if(powered)
|
||||
icon_state="[reference]p[strength]"
|
||||
else
|
||||
icon_state="[reference]c"
|
||||
return
|
||||
|
||||
/obj/structure/particle_accelerator/proc/update_state()
|
||||
if(master)
|
||||
master.update_state()
|
||||
return 0
|
||||
|
||||
|
||||
/obj/structure/particle_accelerator/proc/report_ready(var/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(var/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(var/obj/item/O, var/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(O.has_tool_quality(TOOL_WRENCH))
|
||||
playsound(src, O.usesound, 75, 1)
|
||||
src.anchored = TRUE
|
||||
user.visible_message("[user.name] secures the [src.name] to the floor.", \
|
||||
"You secure the external bolts.")
|
||||
temp_state++
|
||||
if(1)
|
||||
if(O.has_tool_quality(TOOL_WRENCH))
|
||||
playsound(src, O.usesound, 75, 1)
|
||||
src.anchored = FALSE
|
||||
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))
|
||||
user.visible_message("[user.name] adds wires to the [src.name].", \
|
||||
"You add some wires.")
|
||||
temp_state++
|
||||
if(2)
|
||||
if(O.has_tool_quality(TOOL_WIRECUTTER))//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(O.has_tool_quality(TOOL_SCREWDRIVER))
|
||||
user.visible_message("[user.name] closes the [src.name]'s access panel.", \
|
||||
"You close the access panel.")
|
||||
temp_state++
|
||||
if(3)
|
||||
if(O.has_tool_quality(TOOL_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()
|
||||
return 1
|
||||
|
||||
|
||||
|
||||
/obj/machinery/particle_accelerator
|
||||
name = "Particle Accelerator"
|
||||
desc = "Part of a Particle Accelerator."
|
||||
icon = 'icons/obj/machines/particle_accelerator2.dmi'
|
||||
icon_state = "none"
|
||||
anchored = FALSE
|
||||
density = TRUE
|
||||
use_power = USE_POWER_OFF
|
||||
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
|
||||
|
||||
|
||||
/obj/machinery/particle_accelerator/verb/rotate_clockwise()
|
||||
set name = "Rotate Clockwise"
|
||||
set category = "Object"
|
||||
set src in oview(1)
|
||||
|
||||
if (src.anchored || usr:stat)
|
||||
to_chat(usr, "It is fastened to the floor!")
|
||||
return 0
|
||||
src.set_dir(turn(src.dir, 270))
|
||||
return 1
|
||||
|
||||
/obj/machinery/particle_accelerator/verb/rotate_counterclockwise()
|
||||
set name = "Rotate Counter-Clockwise"
|
||||
set category = "Object"
|
||||
set src in oview(1)
|
||||
|
||||
if (src.anchored || usr:stat)
|
||||
to_chat(usr, "It is fastened to the floor!")
|
||||
return 0
|
||||
src.set_dir(turn(src.dir, 90))
|
||||
return 1
|
||||
|
||||
/obj/machinery/particle_accelerator/update_icon()
|
||||
return
|
||||
|
||||
/obj/machinery/particle_accelerator/examine(mob/user)
|
||||
. = ..()
|
||||
|
||||
switch(construction_state)
|
||||
if(0)
|
||||
. += "Looks like it's not attached to the flooring."
|
||||
if(1)
|
||||
. += "It is missing some cables."
|
||||
if(2)
|
||||
. += "The panel is open."
|
||||
if(3)
|
||||
. += "It is assembled."
|
||||
|
||||
|
||||
/obj/machinery/particle_accelerator/attackby(obj/item/W, mob/user)
|
||||
if(istool(W))
|
||||
if(src.process_tool_hit(W,user))
|
||||
return
|
||||
..()
|
||||
return
|
||||
|
||||
/obj/machinery/particle_accelerator/ex_act(severity)
|
||||
switch(severity)
|
||||
if(1.0)
|
||||
qdel(src)
|
||||
return
|
||||
if(2.0)
|
||||
if (prob(50))
|
||||
qdel(src)
|
||||
return
|
||||
if(3.0)
|
||||
if (prob(25))
|
||||
qdel(src)
|
||||
return
|
||||
else
|
||||
return
|
||||
|
||||
/obj/machinery/particle_accelerator/proc/update_state()
|
||||
return 0
|
||||
|
||||
/obj/machinery/particle_accelerator/proc/process_tool_hit(var/obj/item/O, var/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(O.has_tool_quality(TOOL_WRENCH))
|
||||
playsound(src, O.usesound, 75, 1)
|
||||
src.anchored = TRUE
|
||||
user.visible_message("[user.name] secures the [src.name] to the floor.", \
|
||||
"You secure the external bolts.")
|
||||
temp_state++
|
||||
if(1)
|
||||
if(O.has_tool_quality(TOOL_WRENCH))
|
||||
playsound(src, O.usesound, 75, 1)
|
||||
src.anchored = FALSE
|
||||
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(O.has_tool_quality(TOOL_WIRECUTTER))//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(O.has_tool_quality(TOOL_SCREWDRIVER))
|
||||
user.visible_message("[user.name] closes the [src.name]'s access panel.", \
|
||||
"You close the access panel.")
|
||||
temp_state++
|
||||
if(3)
|
||||
if(O.has_tool_quality(TOOL_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)
|
||||
update_use_power(USE_POWER_OFF)
|
||||
src.construction_state = temp_state
|
||||
if(src.construction_state >= 3)
|
||||
update_use_power(USE_POWER_IDLE)
|
||||
update_icon()
|
||||
return 1
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/obj/structure/particle_accelerator/fuel_chamber
|
||||
name = "EM Acceleration Chamber"
|
||||
desc_holder = "This is where the Alpha particles are accelerated to <b><i>radical speeds</i></b>."
|
||||
icon = 'icons/obj/machines/particle_accelerator2.dmi'
|
||||
icon_state = "fuel_chamber"
|
||||
/obj/structure/particle_accelerator/fuel_chamber
|
||||
name = "EM Acceleration Chamber"
|
||||
desc_holder = "This is where the Alpha particles are accelerated to <b><i>radical speeds</i></b>."
|
||||
icon = 'icons/obj/machines/particle_accelerator2.dmi'
|
||||
icon_state = "fuel_chamber"
|
||||
reference = "fuel_chamber"
|
||||
@@ -1,253 +1,253 @@
|
||||
//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"
|
||||
desc = "This controls the density of the particles."
|
||||
icon = 'icons/obj/machines/particle_accelerator_vr.dmi' //VOREStation Edit
|
||||
icon_state = "control_box"
|
||||
reference = "control_box"
|
||||
anchored = FALSE
|
||||
density = TRUE
|
||||
use_power = USE_POWER_OFF
|
||||
idle_power_usage = 500
|
||||
active_power_usage = 70000 //70 kW per unit of strength
|
||||
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/datum/wires/particle_acc/control_box/wires = null
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/New()
|
||||
wires = new(src)
|
||||
connected_parts = list()
|
||||
update_active_power_usage(initial(active_power_usage) * (strength + 1))
|
||||
..()
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/Destroy()
|
||||
if(active)
|
||||
toggle_power()
|
||||
qdel(wires)
|
||||
wires = null
|
||||
return ..()
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/attack_hand(mob/user as mob)
|
||||
if(construction_state >= 3)
|
||||
tgui_interact(user)
|
||||
else if(construction_state == 2) // Wires exposed
|
||||
wires.Interact(user)
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/update_state()
|
||||
if(construction_state < 3)
|
||||
update_use_power(USE_POWER_OFF)
|
||||
assembled = 0
|
||||
active = 0
|
||||
for(var/obj/structure/particle_accelerator/part in connected_parts)
|
||||
part.strength = null
|
||||
part.powered = 0
|
||||
part.update_icon()
|
||||
connected_parts = list()
|
||||
return
|
||||
if(!part_scan())
|
||||
update_use_power(USE_POWER_IDLE)
|
||||
active = 0
|
||||
connected_parts = list()
|
||||
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/update_icon()
|
||||
if(active)
|
||||
icon_state = "[reference]p[strength]"
|
||||
else
|
||||
if(use_power)
|
||||
if(assembled)
|
||||
icon_state = "[reference]p"
|
||||
else
|
||||
icon_state = "u[reference]p"
|
||||
else
|
||||
switch(construction_state)
|
||||
if(0)
|
||||
icon_state = "[reference]"
|
||||
if(1)
|
||||
icon_state = "[reference]"
|
||||
if(2)
|
||||
icon_state = "[reference]w"
|
||||
else
|
||||
icon_state = "[reference]c"
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/proc/strength_change()
|
||||
for(var/obj/structure/particle_accelerator/part in connected_parts)
|
||||
part.strength = strength
|
||||
part.update_icon()
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/proc/add_strength(var/s)
|
||||
if(assembled)
|
||||
strength++
|
||||
if(strength > strength_upper_limit)
|
||||
strength = strength_upper_limit
|
||||
else
|
||||
message_admins("PA Control Computer increased to [strength] by [key_name(usr, usr.client)][ADMIN_QUE(usr)] in [ADMIN_COORDJMP(src)]",0,1)
|
||||
log_game("PACCEL([x],[y],[z]) [key_name(usr)] increased to [strength]")
|
||||
investigate_log("increased to <font color='red'>[strength]</font> by [usr.key]","singulo")
|
||||
strength_change()
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/proc/remove_strength(var/s)
|
||||
if(assembled)
|
||||
strength--
|
||||
if(strength < 0)
|
||||
strength = 0
|
||||
else
|
||||
message_admins("PA Control Computer decreased to [strength] by [key_name(usr, usr.client)][ADMIN_QUE(usr)] in [ADMIN_COORDJMP(src)]",0,1)
|
||||
log_game("PACCEL([x],[y],[z]) [key_name(usr)] decreased to [strength]")
|
||||
investigate_log("decreased to <font color='green'>[strength]</font> by [usr.key]","singulo")
|
||||
strength_change()
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/power_change()
|
||||
..()
|
||||
if(stat & NOPOWER)
|
||||
active = 0
|
||||
update_use_power(USE_POWER_OFF)
|
||||
else if(!stat && construction_state == 3)
|
||||
update_use_power(USE_POWER_IDLE)
|
||||
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/process()
|
||||
if(src.active)
|
||||
//a part is missing!
|
||||
if( length(connected_parts) < 6 )
|
||||
log_game("PACCEL([x],[y],[z]) Failed due to missing parts.")
|
||||
investigate_log("lost a connected part; It <font color='red'>powered down</font>.","singulo")
|
||||
toggle_power()
|
||||
return
|
||||
//emit some particles
|
||||
for(var/obj/structure/particle_accelerator/particle_emitter/PE in connected_parts)
|
||||
if(PE)
|
||||
PE.emit_particle(src.strength)
|
||||
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/proc/part_scan()
|
||||
for(var/obj/structure/particle_accelerator/fuel_chamber/F in orange(1,src))
|
||||
src.set_dir(F.dir)
|
||||
break
|
||||
|
||||
connected_parts = list()
|
||||
assembled = 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,ldir)
|
||||
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(var/turf/T, var/type)
|
||||
if(!(T)||!(type))
|
||||
return 0
|
||||
|
||||
var/obj/structure/particle_accelerator/PA = locate(/obj/structure/particle_accelerator) in T
|
||||
if(istype(PA, type) && PA.connect_master(src) && PA.report_ready(src))
|
||||
src.connected_parts.Add(PA)
|
||||
return 1
|
||||
return 0
|
||||
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/proc/toggle_power()
|
||||
active = !active
|
||||
investigate_log("turned [active?"<font color='red'>ON</font>":"<font color='green'>OFF</font>"] by [usr ? usr.key : "outside forces"]","singulo")
|
||||
message_admins("PA Control Computer turned [active ?"ON":"OFF"] by [usr ? key_name(usr, usr.client) : "outside forces"][ADMIN_QUE(usr)] in [ADMIN_COORDJMP(src)]",0,1)
|
||||
log_game("PACCEL([x],[y],[z]) [usr ? key_name(usr, usr.client) : "outside forces"] turned [active?"ON":"OFF"].")
|
||||
if(active)
|
||||
update_use_power(USE_POWER_ACTIVE)
|
||||
for(var/obj/structure/particle_accelerator/part in connected_parts)
|
||||
part.strength = src.strength
|
||||
part.powered = 1
|
||||
part.update_icon()
|
||||
else
|
||||
update_use_power(USE_POWER_IDLE)
|
||||
for(var/obj/structure/particle_accelerator/part in connected_parts)
|
||||
part.strength = null
|
||||
part.powered = 0
|
||||
part.update_icon()
|
||||
return 1
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/proc/is_interactive(mob/user)
|
||||
if(!interface_control)
|
||||
to_chat(user, "<span class='alert'>ERROR: Request timed out. Check wire contacts.</span>")
|
||||
return FALSE
|
||||
if(construction_state != 3)
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/tgui_status(mob/user)
|
||||
if(is_interactive(user))
|
||||
return ..()
|
||||
return STATUS_CLOSE
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/tgui_interact(mob/user, datum/tgui/ui)
|
||||
ui = SStgui.try_update_ui(user, src, ui)
|
||||
if(!ui)
|
||||
ui = new(user, src, "ParticleAccelerator", name)
|
||||
ui.open()
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/tgui_data(mob/user)
|
||||
var/list/data = list()
|
||||
data["assembled"] = assembled
|
||||
data["power"] = active
|
||||
data["strength"] = strength
|
||||
return data
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/tgui_act(action, params)
|
||||
if(..())
|
||||
return
|
||||
|
||||
switch(action)
|
||||
if("power")
|
||||
if(wires.is_cut(WIRE_POWER))
|
||||
return
|
||||
toggle_power()
|
||||
. = TRUE
|
||||
if("scan")
|
||||
part_scan()
|
||||
. = TRUE
|
||||
if("add_strength")
|
||||
if(wires.is_cut(WIRE_PARTICLE_STRENGTH))
|
||||
return
|
||||
add_strength()
|
||||
. = TRUE
|
||||
if("remove_strength")
|
||||
if(wires.is_cut(WIRE_PARTICLE_STRENGTH))
|
||||
return
|
||||
remove_strength()
|
||||
. = TRUE
|
||||
|
||||
update_icon()
|
||||
//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"
|
||||
desc = "This controls the density of the particles."
|
||||
icon = 'icons/obj/machines/particle_accelerator_vr.dmi' //VOREStation Edit
|
||||
icon_state = "control_box"
|
||||
reference = "control_box"
|
||||
anchored = FALSE
|
||||
density = TRUE
|
||||
use_power = USE_POWER_OFF
|
||||
idle_power_usage = 500
|
||||
active_power_usage = 70000 //70 kW per unit of strength
|
||||
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/datum/wires/particle_acc/control_box/wires = null
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/New()
|
||||
wires = new(src)
|
||||
connected_parts = list()
|
||||
update_active_power_usage(initial(active_power_usage) * (strength + 1))
|
||||
..()
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/Destroy()
|
||||
if(active)
|
||||
toggle_power()
|
||||
qdel(wires)
|
||||
wires = null
|
||||
return ..()
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/attack_hand(mob/user as mob)
|
||||
if(construction_state >= 3)
|
||||
tgui_interact(user)
|
||||
else if(construction_state == 2) // Wires exposed
|
||||
wires.Interact(user)
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/update_state()
|
||||
if(construction_state < 3)
|
||||
update_use_power(USE_POWER_OFF)
|
||||
assembled = 0
|
||||
active = 0
|
||||
for(var/obj/structure/particle_accelerator/part in connected_parts)
|
||||
part.strength = null
|
||||
part.powered = 0
|
||||
part.update_icon()
|
||||
connected_parts = list()
|
||||
return
|
||||
if(!part_scan())
|
||||
update_use_power(USE_POWER_IDLE)
|
||||
active = 0
|
||||
connected_parts = list()
|
||||
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/update_icon()
|
||||
if(active)
|
||||
icon_state = "[reference]p[strength]"
|
||||
else
|
||||
if(use_power)
|
||||
if(assembled)
|
||||
icon_state = "[reference]p"
|
||||
else
|
||||
icon_state = "u[reference]p"
|
||||
else
|
||||
switch(construction_state)
|
||||
if(0)
|
||||
icon_state = "[reference]"
|
||||
if(1)
|
||||
icon_state = "[reference]"
|
||||
if(2)
|
||||
icon_state = "[reference]w"
|
||||
else
|
||||
icon_state = "[reference]c"
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/proc/strength_change()
|
||||
for(var/obj/structure/particle_accelerator/part in connected_parts)
|
||||
part.strength = strength
|
||||
part.update_icon()
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/proc/add_strength(var/s)
|
||||
if(assembled)
|
||||
strength++
|
||||
if(strength > strength_upper_limit)
|
||||
strength = strength_upper_limit
|
||||
else
|
||||
message_admins("PA Control Computer increased to [strength] by [key_name(usr, usr.client)][ADMIN_QUE(usr)] in [ADMIN_COORDJMP(src)]",0,1)
|
||||
log_game("PACCEL([x],[y],[z]) [key_name(usr)] increased to [strength]")
|
||||
investigate_log("increased to <font color='red'>[strength]</font> by [usr.key]","singulo")
|
||||
strength_change()
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/proc/remove_strength(var/s)
|
||||
if(assembled)
|
||||
strength--
|
||||
if(strength < 0)
|
||||
strength = 0
|
||||
else
|
||||
message_admins("PA Control Computer decreased to [strength] by [key_name(usr, usr.client)][ADMIN_QUE(usr)] in [ADMIN_COORDJMP(src)]",0,1)
|
||||
log_game("PACCEL([x],[y],[z]) [key_name(usr)] decreased to [strength]")
|
||||
investigate_log("decreased to <font color='green'>[strength]</font> by [usr.key]","singulo")
|
||||
strength_change()
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/power_change()
|
||||
..()
|
||||
if(stat & NOPOWER)
|
||||
active = 0
|
||||
update_use_power(USE_POWER_OFF)
|
||||
else if(!stat && construction_state == 3)
|
||||
update_use_power(USE_POWER_IDLE)
|
||||
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/process()
|
||||
if(src.active)
|
||||
//a part is missing!
|
||||
if( length(connected_parts) < 6 )
|
||||
log_game("PACCEL([x],[y],[z]) Failed due to missing parts.")
|
||||
investigate_log("lost a connected part; It <font color='red'>powered down</font>.","singulo")
|
||||
toggle_power()
|
||||
return
|
||||
//emit some particles
|
||||
for(var/obj/structure/particle_accelerator/particle_emitter/PE in connected_parts)
|
||||
if(PE)
|
||||
PE.emit_particle(src.strength)
|
||||
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/proc/part_scan()
|
||||
for(var/obj/structure/particle_accelerator/fuel_chamber/F in orange(1,src))
|
||||
src.set_dir(F.dir)
|
||||
break
|
||||
|
||||
connected_parts = list()
|
||||
assembled = 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,ldir)
|
||||
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(var/turf/T, var/type)
|
||||
if(!(T)||!(type))
|
||||
return 0
|
||||
|
||||
var/obj/structure/particle_accelerator/PA = locate(/obj/structure/particle_accelerator) in T
|
||||
if(istype(PA, type) && PA.connect_master(src) && PA.report_ready(src))
|
||||
src.connected_parts.Add(PA)
|
||||
return 1
|
||||
return 0
|
||||
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/proc/toggle_power()
|
||||
active = !active
|
||||
investigate_log("turned [active?"<font color='red'>ON</font>":"<font color='green'>OFF</font>"] by [usr ? usr.key : "outside forces"]","singulo")
|
||||
message_admins("PA Control Computer turned [active ?"ON":"OFF"] by [usr ? key_name(usr, usr.client) : "outside forces"][ADMIN_QUE(usr)] in [ADMIN_COORDJMP(src)]",0,1)
|
||||
log_game("PACCEL([x],[y],[z]) [usr ? key_name(usr, usr.client) : "outside forces"] turned [active?"ON":"OFF"].")
|
||||
if(active)
|
||||
update_use_power(USE_POWER_ACTIVE)
|
||||
for(var/obj/structure/particle_accelerator/part in connected_parts)
|
||||
part.strength = src.strength
|
||||
part.powered = 1
|
||||
part.update_icon()
|
||||
else
|
||||
update_use_power(USE_POWER_IDLE)
|
||||
for(var/obj/structure/particle_accelerator/part in connected_parts)
|
||||
part.strength = null
|
||||
part.powered = 0
|
||||
part.update_icon()
|
||||
return 1
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/proc/is_interactive(mob/user)
|
||||
if(!interface_control)
|
||||
to_chat(user, "<span class='alert'>ERROR: Request timed out. Check wire contacts.</span>")
|
||||
return FALSE
|
||||
if(construction_state != 3)
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/tgui_status(mob/user)
|
||||
if(is_interactive(user))
|
||||
return ..()
|
||||
return STATUS_CLOSE
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/tgui_interact(mob/user, datum/tgui/ui)
|
||||
ui = SStgui.try_update_ui(user, src, ui)
|
||||
if(!ui)
|
||||
ui = new(user, src, "ParticleAccelerator", name)
|
||||
ui.open()
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/tgui_data(mob/user)
|
||||
var/list/data = list()
|
||||
data["assembled"] = assembled
|
||||
data["power"] = active
|
||||
data["strength"] = strength
|
||||
return data
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/tgui_act(action, params)
|
||||
if(..())
|
||||
return
|
||||
|
||||
switch(action)
|
||||
if("power")
|
||||
if(wires.is_cut(WIRE_POWER))
|
||||
return
|
||||
toggle_power()
|
||||
. = TRUE
|
||||
if("scan")
|
||||
part_scan()
|
||||
. = TRUE
|
||||
if("add_strength")
|
||||
if(wires.is_cut(WIRE_PARTICLE_STRENGTH))
|
||||
return
|
||||
add_strength()
|
||||
. = TRUE
|
||||
if("remove_strength")
|
||||
if(wires.is_cut(WIRE_PARTICLE_STRENGTH))
|
||||
return
|
||||
remove_strength()
|
||||
. = TRUE
|
||||
|
||||
update_icon()
|
||||
|
||||
@@ -1,47 +1,47 @@
|
||||
//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."
|
||||
icon = 'icons/obj/machines/particle_accelerator2.dmi'
|
||||
icon_state = "none"
|
||||
var/fire_delay = 50
|
||||
var/last_shot = 0
|
||||
|
||||
/obj/structure/particle_accelerator/particle_emitter/center
|
||||
icon_state = "emitter_center"
|
||||
reference = "emitter_center"
|
||||
|
||||
/obj/structure/particle_accelerator/particle_emitter/right // It's looking for these in opposite directions.
|
||||
icon_state = "emitter_left"
|
||||
reference = "emitter_left"
|
||||
|
||||
/obj/structure/particle_accelerator/particle_emitter/left
|
||||
icon_state = "emitter_right"
|
||||
reference = "emitter_right"
|
||||
|
||||
|
||||
/obj/structure/particle_accelerator/particle_emitter/proc/set_delay(var/delay)
|
||||
if(delay && delay >= 0)
|
||||
fire_delay = delay
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/obj/structure/particle_accelerator/particle_emitter/proc/emit_particle(var/strength = 0)
|
||||
if((last_shot + fire_delay) <= world.time)
|
||||
last_shot = world.time
|
||||
var/obj/effect/accelerated_particle/A = null
|
||||
var/turf/T = src.loc // if it doesn't spawn here, it won't bump stuff directly infront of the PA
|
||||
switch(strength)
|
||||
if(0)
|
||||
A = new/obj/effect/accelerated_particle/weak(T, dir)
|
||||
if(1)
|
||||
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.set_dir(src.dir)
|
||||
return 1
|
||||
return 0
|
||||
//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."
|
||||
icon = 'icons/obj/machines/particle_accelerator2.dmi'
|
||||
icon_state = "none"
|
||||
var/fire_delay = 50
|
||||
var/last_shot = 0
|
||||
|
||||
/obj/structure/particle_accelerator/particle_emitter/center
|
||||
icon_state = "emitter_center"
|
||||
reference = "emitter_center"
|
||||
|
||||
/obj/structure/particle_accelerator/particle_emitter/right // It's looking for these in opposite directions.
|
||||
icon_state = "emitter_left"
|
||||
reference = "emitter_left"
|
||||
|
||||
/obj/structure/particle_accelerator/particle_emitter/left
|
||||
icon_state = "emitter_right"
|
||||
reference = "emitter_right"
|
||||
|
||||
|
||||
/obj/structure/particle_accelerator/particle_emitter/proc/set_delay(var/delay)
|
||||
if(delay && delay >= 0)
|
||||
fire_delay = delay
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/obj/structure/particle_accelerator/particle_emitter/proc/emit_particle(var/strength = 0)
|
||||
if((last_shot + fire_delay) <= world.time)
|
||||
last_shot = world.time
|
||||
var/obj/effect/accelerated_particle/A = null
|
||||
var/turf/T = src.loc // if it doesn't spawn here, it won't bump stuff directly infront of the PA
|
||||
switch(strength)
|
||||
if(0)
|
||||
A = new/obj/effect/accelerated_particle/weak(T, dir)
|
||||
if(1)
|
||||
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.set_dir(src.dir)
|
||||
return 1
|
||||
return 0
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/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_accelerator2.dmi'
|
||||
icon_state = "power_box"
|
||||
/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_accelerator2.dmi'
|
||||
icon_state = "power_box"
|
||||
reference = "power_box"
|
||||
Reference in New Issue
Block a user