Engineering got a new machine that spawns/feeds the singularity.

Redid the power use code, should be working better now.

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@999 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
mport2004@gmail.com
2011-02-09 06:07:32 +00:00
parent 86a47cbc4e
commit 50f282f8b2
42 changed files with 4483 additions and 3574 deletions

View File

@@ -0,0 +1,71 @@
/obj/accelerated_particle
name = "Accelerated Particles"
desc = "Small things moving very fast."
icon = 'particle_accelerator.dmi'
icon_state = "particle"//Need a new icon for this
anchored = 0
density = 1
var
movement_range = 10
energy = 5
weak
movement_range = 8
energy = 10
strong
movement_range = 15
energy = 15
New(loc, dir = 2)
src.loc = loc
src.dir = dir
if(movement_range > 20)
movement_range = 20
spawn(0)
move(1)
return
Bump(atom/A)
if (A)
if(ismob(A))
toxmob(A)
if((istype(A,/obj/machinery/the_singularitygen))||(istype(A,/obj/machinery/singularity/)))
A:energy += energy
return
Bumped(atom/A)
if(ismob(A))
Bump(A)
return
ex_act(severity)
del(src)
return
proc
toxmob(var/mob/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)
M.radiation += radiation
M.updatehealth()
//M << "\red You feel odd."
return
move(var/lag)
if(!step(src,dir))
src.loc = get_step(src,dir)
movement_range--
if(movement_range <= 0)
del(src)
else
sleep(lag)
move(lag)

View File

@@ -0,0 +1,225 @@
/*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
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
*/
/obj/particle_accelerator
name = "Particle Accelerator"
desc = "Part of a Particle Accelerator."
icon = 'particle_accelerator.dmi'
icon_state = "none"
anchored = 0
density = 1
var
obj/machinery/particle_accelerator/control_box/master = null
construction_state = 0
end_cap
icon_state = "end_cap"
attackby(obj/item/W, mob/user)
if(istool(W))
if(src.process_tool_hit(W,user))
return
..()
return
proc
update_state()
if(master)
master.update_state()
return 0
report_ready(var/obj/O)
if(O && (O == master))
if(construction_state >= 3)
return 1
return 0
report_master()
if(master)
return master
return 0
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
process_tool_hit(var/obj/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(iswrench(O))
playsound(src.loc, '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))
playsound(src.loc, '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))
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?
user.visible_message("[user.name] removes some wires from the [src.name].", \
"You remove some wires.")
temp_state--
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(isscrewdriver(O))
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
if(src.construction_state >= 3)//Was taken apart, update state
update_state()
src.construction_state = temp_state
update_icon()
return 1
return 0
/obj/machinery/particle_accelerator/
name = "Particle Accelerator"
desc = "Part of a Particle Accelerator."
icon = '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
active = 0
attackby(obj/item/W, mob/user)
if(istool(W))
if(src.process_tool_hit(W,user))
return
..()
return
proc
update_state()
return 0
process_tool_hit(var/obj/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(iswrench(O))
playsound(src.loc, '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))
playsound(src.loc, '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.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?
user.visible_message("[user.name] removes some wires from the [src.name].", \
"You remove some wires.")
temp_state--
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(isscrewdriver(O))
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
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

View File

@@ -0,0 +1,5 @@
/obj/particle_accelerator/fuel_chamber
name = "Particle Accelerator Emitter"
desc = "Part of a Particle Accelerator, might not want to stand near this end."
icon = 'particle_accelerator.dmi'
icon_state = "fuel_chamber"

View File

@@ -0,0 +1,176 @@
/obj/machinery/particle_accelerator/control_box
name = "Particle Accelerator Control Box"
desc = "Part of a Particle Accelerator."
icon = 'particle_accelerator.dmi'
icon_state = "control_box"
anchored = 0
density = 1
use_power = 0
idle_power_usage = 500
active_power_usage = 10000
construction_state = 0
active = 0
var
list/obj/particle_accelerator/connected_parts
assembled = 0
strength = 0
New()
connected_parts = list()
..()
attack_hand(mob/user as mob)
if(construction_state >= 3)
interact(user)
update_state()
if(construction_state < 3)
use_power = 0
assembled = 0
active = 0
connected_parts = list()
return
if(!part_scan())
assembled = 0
return
Topic(href, href_list)
..()
if( href_list["close"] )
usr << browse(null, "window=pacontrol")
usr.machine = null
return
if(href_list["togglep"])
src.toggle_power()
if(href_list["scan"])
src.part_scan()
if(href_list["strengthup"])
src.strength++
if(src.strength > 2)
src.strength = 2
if(href_list["strengthdown"])
src.strength--
if(src.strength < 0)
src.strength = 0
src.updateDialog()
process()
if(src.active)
for(var/obj/particle_accelerator/particle_emitter/PE in connected_parts)
if(PE)
PE.emit_particle(src.strength)
// for(var/obj/particle_accelerator/fuel_chamber/PF in connected_parts)
// PF.doshit()
// for(var/obj/particle_accelerator/power_box/PB in connected_parts)
// PB.doshit()
//finish up putting the fuel run and power use things in here
return
proc
part_scan()
connected_parts = list()
var/tally = 0
var/ldir = 0
var/rdir = 0
var/odir = 0
switch(src.dir)
if(1)
ldir = 4
rdir = 8
odir = 2
if(2)
ldir = 8
rdir = 4
odir = 1
if(4)
ldir = 1
rdir = 2
odir = 8
if(8)
ldir = 2
rdir = 1
odir = 4
var/turf/T = src.loc
T = get_step(T,rdir)
if(check_part(T,/obj/particle_accelerator/fuel_chamber))
tally++
T = get_step(T,odir)
if(check_part(T,/obj/particle_accelerator/end_cap))
tally++
T = get_step(T,dir)
T = get_step(T,dir)
if(check_part(T,/obj/particle_accelerator/power_box))
tally++
T = get_step(T,dir)
if(check_part(T,/obj/particle_accelerator/particle_emitter/center))
tally++
T = get_step(T,ldir)
if(check_part(T,/obj/particle_accelerator/particle_emitter/left))
tally++
T = get_step(T,rdir)
T = get_step(T,rdir)
if(check_part(T,/obj/particle_accelerator/particle_emitter/right))
tally++
if(tally >= 6)
assembled = 1
return 1
else
assembled = 0
return 0
check_part(var/turf/T, var/type)
if(!(T)||!(type))
return 0
var/obj/particle_accelerator/PA = locate(/obj/particle_accelerator) in T
if(istype(PA, type))
if(PA.connect_master(src))
if(PA.report_ready(src))
src.connected_parts.Add(PA)
return 1
return 0
toggle_power()
src.active = !src.active
if(src.active)
src.use_power = 2
else
src.use_power = 1
return 1
interact(mob/user)
if ( (get_dist(src, user) > 1 ) || (stat & (BROKEN|NOPOWER)) )
if (!istype(user, /mob/living/silicon))
user.machine = null
user << browse(null, "window=pacontrol")
return
user.machine = src
var/dat = ""
dat += "Particle Accelerator Control Panel<BR>"
dat += "<A href='?src=\ref[src];close=1'>Close</A><BR><BR>"
dat += "Status:<BR>"
if(!assembled)
dat += "Unable to detect all parts!<BR>"
dat += "<A href='?src=\ref[src];scan=1'>Run Scan</A><BR><BR>"
else
dat += "All parts in place.<BR><BR>"
dat += "Power:"
if(active)
dat += "On<BR>"
else
dat += "Off <BR>"
dat += "<A href='?src=\ref[src];togglep=1'>Toggle Power</A><BR><BR>"
dat += "Particle Strength: [src.strength]"
dat += "<A href='?src=\ref[src];strengthdown=1'>--</A>|<A href='?src=\ref[src];strengthup=1'>++</A><BR><BR>"
user << browse(dat, "window=pacontrol;size=420x500")
onclose(user, "pacontrol")

View File

@@ -0,0 +1,47 @@
/obj/particle_accelerator/particle_emitter
name = "Particle Accelerator Emitter"
desc = "Part of a Particle Accelerator, might not want to stand near this end."
icon = 'particle_accelerator.dmi'
icon_state = "none"
var
fire_delay = 50
last_shot = 0
center
icon_state = "emitter_center"
left
icon_state = "emitter_left"
right
icon_state = "emitter_right"
update_icon()
return//Add overlays here
proc
set_delay(var/delay)
if(delay && delay >= 0)
src.fire_delay = delay
return 1
return 0
emit_particle(var/strength = 0)
if((src.last_shot + src.fire_delay) <= world.time)
src.last_shot = world.time
var/obj/accelerated_particle/A = null
var/turf/T = get_step(src,dir)
switch(strength)
if(0)
A = new/obj/accelerated_particle/weak(T, dir)
if(1)
A = new/obj/accelerated_particle(T, dir)
if(2)
A = new/obj/accelerated_particle/strong(T, dir)
if(A)
A.dir = src.dir
return 1
return 0

View File

@@ -0,0 +1,7 @@
/obj/particle_accelerator/power_box
name = "Particle Accelerator"
desc = "Part of a Particle Accelerator, this part seems to have a maintenance panel on it."
icon = 'particle_accelerator.dmi'
icon_state = "power_box"
anchored = 0
density = 1