TMDU: Mass Driver Overhaul

This commit overhauls mass drivers.
Every component of mass drivers are now buildable.
This means:
 - Mass Drivers
 - Mass Driver Control Computers
 - Mass Driver Buttons
Mass driver control computers now support multiple mass drivers.
You can link mass-drivers to buttons via multitool.
Buttons have a range of 7 for their mass driver link.
Computers have infinite range.
This commit is contained in:
Tigercat2000
2015-05-19 20:28:48 -07:00
parent a155e9e049
commit e470eee477
26 changed files with 988 additions and 587 deletions
@@ -99,6 +99,9 @@
/obj/item/weapon/circuitboard/pod
name = "Circuit board (Massdriver Control)"
build_path = "/obj/machinery/computer/pod"
/obj/item/weapon/circuitboard/pod/deathsquad
name = "Circuit board (Deathsquad Massdriver control)"
build_path = "/obj/machinery/computer/pod/deathsquad"
/obj/item/weapon/circuitboard/robotics
name = "Circuit board (Robotics Control Console)"
build_path = "/obj/machinery/computer/robotics"
+288 -128
View File
@@ -1,114 +1,122 @@
//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:31
/obj/machinery/computer/pod
name = "Pod Launch Control"
name = "Mass Drivers and Pod Doors Control"
desc = "A controll for launching pods. Some people prefer firing Mechas."
icon_state = "computer_generic"
light_color = LIGHT_COLOR_GREEN
icon_state = "mass_drivers"
light_color = "#555555"
circuit = /obj/item/weapon/circuitboard/pod
var/id = 1.0
var/obj/machinery/mass_driver/connected = null
var/timing = 0.0
var/time = 30.0
var/title = "Mass Driver Controls"
var/list/id_tags = list()
var/list/door_only_tags = list()
var/list/synced = list()
var/list/timings = list()
var/list/times = list()
var/list/maxtimes = list()
var/list/powers = list()
var/list/loopings = list()
/obj/machinery/computer/pod/New()
..()
spawn( 5 )
for(var/obj/machinery/mass_driver/M in world)
if(M.id == id)
connected = M
else
return
spawn(5)
driver_sync()
machines += src
return
/obj/machinery/computer/pod/proc/alarm()
/obj/machinery/computer/pod/proc/driver_sync()
timings = list()
times = list()
synced = list()
for(var/obj/machinery/mass_driver/M in world)
if(M.z != src.z) continue
for(var/ident_tag in id_tags)
if((M.id_tag == ident_tag) && !(ident_tag in synced))
synced += ident_tag
timings += ident_tag
timings[ident_tag] = 0.0
times += ident_tag
times[ident_tag] = 30.0
maxtimes += ident_tag
maxtimes[ident_tag] = 30.0
powers += ident_tag
powers[ident_tag] = 1.0
loopings += ident_tag
loopings[ident_tag] = 0
break
for(var/obj/machinery/door/poddoor/M in world)
if(M.z != src.z) continue
for(var/ident_tag in id_tags)
if((M.id_tag == ident_tag) && !(ident_tag in synced) && !(ident_tag in door_only_tags))
door_only_tags += ident_tag
break
return
/obj/machinery/computer/pod/proc/solo_sync(var/ident_tag)
for(var/obj/machinery/mass_driver/M in world)
if(M.z != src.z) continue
if((M.id_tag == ident_tag) && !(ident_tag in synced))
synced += ident_tag
timings += ident_tag
timings[ident_tag] = 0.0
times += ident_tag
times[ident_tag] = 30.0
maxtimes += ident_tag
maxtimes[ident_tag] = 30.0
powers += ident_tag
powers[ident_tag] = 1.0
loopings += ident_tag
loopings[ident_tag] = 0
break
if(!(ident_tag in synced))
for(var/obj/machinery/door/poddoor/M in world)
if(M.z != src.z) continue
if((M.id_tag == ident_tag) && !(ident_tag in synced) && !(ident_tag in door_only_tags))
door_only_tags += ident_tag
break
return
/obj/machinery/computer/pod/proc/launch_sequence(var/ident_tag)
if(stat & (NOPOWER|BROKEN))
return
if(!( connected ))
viewers(null, null) << "Cannot locate mass driver connector. Cancelling firing sequence!"
var/anydriver = 0
for(var/obj/machinery/mass_driver/M in world)
if(M.z != src.z) continue
if(M.id_tag == ident_tag)
anydriver = 1
if(!anydriver)
visible_message("Cannot locate any mass driver of that ID. Cancelling firing sequence!")
return
if(icon_state != "old")
flick("mass_drivers_timing", src)
for(var/obj/machinery/door/poddoor/M in world)
if(M.id == id)
M.open()
return
if(M.z != src.z) continue
if(M.id_tag == ident_tag)
spawn()
M.open()
sleep(20)
for(var/obj/machinery/mass_driver/M in world)
if(M.id == id)
M.power = connected.power
if(M.z != src.z) continue
if(M.id_tag == ident_tag)
M.drive()
sleep(50)
for(var/obj/machinery/door/poddoor/M in world)
if(M.id == id)
M.close()
return
if(M.z != src.z) continue
if(M.id_tag == ident_tag)
spawn()
M.close()
return
/*
/obj/machinery/computer/pod/attackby(I as obj, user as mob, params)
if(istype(I, /obj/item/weapon/screwdriver))
playsound(loc, 'sound/items/Screwdriver.ogg', 50, 1)
if(do_after(user, 20))
if(stat & BROKEN)
user << "\blue The broken glass falls out."
var/obj/structure/computerframe/A = new /obj/structure/computerframe( loc )
getFromPool(/obj/item/weapon/shard, loc)
//generate appropriate circuitboard. Accounts for /pod/old computer types
var/obj/item/weapon/circuitboard/pod/M = null
if(istype(src, /obj/machinery/computer/pod/old))
M = new /obj/item/weapon/circuitboard/olddoor( A )
if(istype(src, /obj/machinery/computer/pod/old/syndicate))
M = new /obj/item/weapon/circuitboard/syndicatedoor( A )
if(istype(src, /obj/machinery/computer/pod/old/swf))
M = new /obj/item/weapon/circuitboard/swfdoor( A )
else //it's not an old computer. Generate standard pod circuitboard.
M = new /obj/item/weapon/circuitboard/pod( A )
for (var/obj/C in src)
C.loc = loc
M.id = id
A.circuit = M
A.state = 3
A.icon_state = "3"
A.anchored = 1
del(src)
else
user << "\blue You disconnect the monitor."
var/obj/structure/computerframe/A = new /obj/structure/computerframe( loc )
//generate appropriate circuitboard. Accounts for /pod/old computer types
var/obj/item/weapon/circuitboard/pod/M = null
if(istype(src, /obj/machinery/computer/pod/old))
M = new /obj/item/weapon/circuitboard/olddoor( A )
if(istype(src, /obj/machinery/computer/pod/old/syndicate))
M = new /obj/item/weapon/circuitboard/syndicatedoor( A )
if(istype(src, /obj/machinery/computer/pod/old/swf))
M = new /obj/item/weapon/circuitboard/swfdoor( A )
else //it's not an old computer. Generate standard pod circuitboard.
M = new /obj/item/weapon/circuitboard/pod( A )
for (var/obj/C in src)
C.loc = loc
M.id = id
A.circuit = M
A.state = 4
A.icon_state = "4"
A.anchored = 1
del(src)
else
attack_hand(user)
return
*/
/obj/machinery/computer/pod/attack_ai(var/mob/user as mob)
src.add_hiddenprint(user)
return attack_hand(user)
@@ -120,73 +128,146 @@
if(..())
return
var/dat = "<HTML><BODY><TT><B>[title]</B>"
var/dat = "<HTML><BODY><TT><B>[name]</B>(<A href='?src=\ref[src];rename=1'>rename</A>)"
user.set_machine(src)
if(connected)
var/d2
if(timing) //door controls do not need timers.
d2 = "<A href='?src=\ref[src];time=0'>Stop Time Launch</A>"
else
d2 = "<A href='?src=\ref[src];time=1'>Initiate Time Launch</A>"
var/second = time % 60
var/minute = (time - second) / 60
dat += "<HR>\nTimer System: [d2]\nTime Left: [minute ? "[minute]:" : null][second] <A href='?src=\ref[src];tp=-30'>-</A> <A href='?src=\ref[src];tp=-1'>-</A> <A href='?src=\ref[src];tp=1'>+</A> <A href='?src=\ref[src];tp=30'>+</A>"
var/temp = ""
var/list/L = list( 0.25, 0.5, 1, 2, 4, 8, 16 )
for(var/t in L)
if(t == connected.power)
temp += "[t] "
dat += "<BR><A href = '?src=\ref[src];sync=1'>Reset Connections</A><BR>"
if(synced.len)
dat += "<BR><A href = '?src=\ref[src];massfire=1'><B>Fire All Connected Drivers</B></A><BR>"
if(istype(src,/obj/machinery/computer/pod/deathsquad))
dat += "<BR><A href = '?src=\ref[src];dstele=1'><B>Set Teleporter Destination Z-Level</B></A><BR>"
for(var/ident_tag in id_tags)
if(!(ident_tag in door_only_tags))
dat += "<BR><BR><B>[ident_tag]</B> <A href='?src=\ref[src];remove=1;driver=[ident_tag]'>remove</A>"
if(ident_tag in synced)
var/d2 = ""
if(timings[ident_tag]) //door controls do not need timers.
d2 = "<A href='?src=\ref[src];time=0;driver=[ident_tag]'>Stop Time Launch</A>"
else
temp += "<A href = '?src=\ref[src];power=[t]'>[t]</A> "
dat += "<HR>\nPower Level: [temp]<BR>\n<A href = '?src=\ref[src];alarm=1'>Firing Sequence</A><BR>\n<A href = '?src=\ref[src];drive=1'>Test Fire Driver</A><BR>\n<A href = '?src=\ref[src];door=1'>Toggle Outer Door</A><BR>"
else
dat += "<BR>\n<A href = '?src=\ref[src];door=1'>Toggle Outer Door</A><BR>"
d2 = "<A href='?src=\ref[src];time=1;driver=[ident_tag]'>Initiate Time Launch</A>"
var/second = times[ident_tag] % 60
var/minute = (times[ident_tag] - second) / 60
var/maxsecond = maxtimes[ident_tag] % 60
var/maxminute = (maxtimes[ident_tag] - maxsecond) / 60
dat += "<HR>\nTimer System: [d2]\nTime Left: [minute ? "[minute]:" : null][second]/[maxminute ? "[maxminute]:" : null][maxsecond] <A href='?src=\ref[src];tp=-30;driver=[ident_tag]'>-</A> <A href='?src=\ref[src];tp=-1;driver=[ident_tag]'>-</A> <A href='?src=\ref[src];tp=1;driver=[ident_tag]'>+</A> <A href='?src=\ref[src];tp=30;driver=[ident_tag]'>+</A>"
dat += "<BR>Set timer to loop: [loopings[ident_tag] ? "<A href = '?src=\ref[src];loop=0;driver=[ident_tag]'>Yes</A>" : "<A href = '?src=\ref[src];loop=1;driver=[ident_tag]'>No</A>"]"
var/temp = ""
var/list/L = list( 0.25, 0.5, 1, 2, 4, 8, 16 )
for(var/t in L)
if( powers[ident_tag] == t)
temp += "<B><A href = '?src=\ref[src];power=[t];driver=[ident_tag]'>[t]</A></B> "
else
temp += "<A href = '?src=\ref[src];power=[t];driver=[ident_tag]'>[t]</A> "
dat += "<HR>\nPower Level: [temp]<BR>\n<A href = '?src=\ref[src];launch=1;driver=[ident_tag]'><B>Fire Drive!</B></A><BR>\n<A href = '?src=\ref[src];door=1;driver=[ident_tag]'>Toggle Pod Doors</A><BR>"
for(var/ident_tag in door_only_tags)
dat += "<BR><BR><B>[ident_tag]</B> <A href='?src=\ref[src];remove=1;driver=[ident_tag]'>remove</A>"
dat += "<BR>\n<A href = '?src=\ref[src];door=1;driver=[ident_tag]'>Toggle Pod Doors</A><BR>"
dat += "<BR><A href='?src=\ref[src];add=1'>add another id_tag</A>"
dat += "<BR><BR><A href='?src=\ref[user];mach_close=computer'>Close</A></TT></BODY></HTML>"
user << browse(dat, "window=computer;size=400x500")
add_fingerprint(usr)
onclose(user, "computer")
return
/obj/machinery/computer/pod/process()
if(!..())
return
if(timing)
if(time > 0)
time = round(time) - 1
var/timing = 0
for(var/ident_tag in id_tags)
if(timings[ident_tag])
if(times[ident_tag] > 0)
times[ident_tag] = round(times[ident_tag]) - 1
timing = 1
else
spawn()
launch_sequence(ident_tag)
if(loopings[ident_tag])
times[ident_tag] = maxtimes[ident_tag]
else
times[ident_tag] = 0
timings[ident_tag] = 0
else
alarm()
time = 0
timing = 0
times[ident_tag] = maxtimes[ident_tag]
updateDialog()
if(icon_state != "old")
if(timing)
icon_state = "mass_drivers_timing"
else
icon_state = "mass_drivers"
return
/obj/machinery/computer/pod/Topic(href, href_list)
if(..())
return 1
if((usr.contents.Find(src) || (in_range(src, usr) && istype(loc, /turf))) || (istype(usr, /mob/living/silicon)))
else
usr.set_machine(src)
if(href_list["add"])
var/new_id_tag = input("Enter a new id_tag", "Mass Driver Controls", "id_tag")
if(!(new_id_tag in id_tags))
id_tags += new_id_tag
solo_sync(new_id_tag)
if(href_list["remove"])
var/ident_tag = href_list["driver"]
if(ident_tag in synced)
synced -= ident_tag
if(ident_tag in door_only_tags)
door_only_tags -= ident_tag
timings -= ident_tag
times -= ident_tag
powers -= ident_tag
loopings -= ident_tag
id_tags -= ident_tag
if(href_list["dstele"])
var/choices = list(0)
choices += accessable_z_levels
var/obj/machinery/computer/pod/deathsquad/D = src
var/input = input("Enter the destination Z-Level. The mechs will arrive from the East. Leave 0 if you don't want to set a specific ZLevel", "Mass Driver Controls", 0) in choices
D.teleporter_dest = input
if(href_list["massfire"])
for(var/ident_tag in synced)
spawn()
launch_sequence(ident_tag)
if(href_list["power"])
var/ident_tag = href_list["driver"]
var/t = text2num(href_list["power"])
t = min(max(0.25, t), 16)
if(connected)
connected.power = t
if(href_list["alarm"])
alarm()
for(var/obj/machinery/mass_driver/M in world)
if(M.id_tag == ident_tag)
M.power = t
powers[ident_tag] = t
if(href_list["launch"])
launch_sequence(href_list["driver"])
if(href_list["time"])
timing = text2num(href_list["time"])
var/ident_tag = href_list["driver"]
timings[ident_tag] = text2num(href_list["time"])
if(href_list["loop"])
var/ident_tag = href_list["driver"]
loopings[ident_tag] = text2num(href_list["loop"])
if(href_list["sync"])
driver_sync()
if(href_list["tp"])
var/ident_tag = href_list["driver"]
var/tp = text2num(href_list["tp"])
time += tp
time = min(max(round(time), 0), 120)
maxtimes[ident_tag] += tp
maxtimes[ident_tag] = min(max(round(maxtimes[ident_tag]), 0), 120)
if(href_list["door"])
var/ident_tag = href_list["driver"]
for(var/obj/machinery/door/poddoor/M in world)
if(M.id == id)
if(M.density)
M.open()
else
M.close()
if(M.z != src.z) continue
if(M.id_tag == ident_tag)
spawn()
if(M.density)
M.open()
else
M.close()
if(href_list["rename"])
var/new_title = input("Enter a new title", "[name]", "[name]")
if(new_title)
name = new_title
updateUsrDialog()
return
@@ -195,19 +276,19 @@
/obj/machinery/computer/pod/old
icon_state = "old"
name = "DoorMex Control Computer"
title = "Door Controls"
circuit = /obj/item/weapon/circuitboard/olddoor
/obj/machinery/computer/pod/old/syndicate
name = "ProComp Executive IIc"
name = "External Airlock Controls"
desc = "The Syndicate operate on a tight budget. Operates external airlocks."
title = "External Airlock Controls"
req_access = list(access_syndicate)
circuit = /obj/item/weapon/circuitboard/syndicatedoor
light_color = "#00FFFF"
/obj/machinery/computer/pod/old/syndicate/attack_hand(var/mob/user as mob)
if(!allowed(user))
user << "\red Access Denied"
user << "<span class='warning'>Access Denied</span>"
return
else
..()
@@ -215,3 +296,82 @@
/obj/machinery/computer/pod/old/swf
name = "Magix System IV"
desc = "An arcane artifact that holds much magic. Running E-Knock 2.2: Sorceror's Edition"
circuit = /obj/item/weapon/circuitboard/swfdoor
/obj/machinery/computer/pod/deathsquad
id_tags = list("ASSAULT0","ASSAULT1","ASSAULT2","ASSAULT3")
var/teleporter_dest = 0
circuit = /obj/item/weapon/circuitboard/pod/deathsquad
/obj/machinery/computer/pod/deathsquad/launch_sequence(var/ident_tag)
if(stat & (NOPOWER|BROKEN))
return
var/anydriver = 0
for(var/obj/machinery/mass_driver/M in world)
if(M.z != src.z) continue
if(M.id_tag == ident_tag)
anydriver = 1
if(!anydriver)
visible_message("Cannot locate any mass driver of that ID. Cancelling firing sequence!")
return
if(icon_state != "old")
flick("mass_drivers_timing", src)
if(teleporter_dest)
for(var/obj/structure/deathsquad_tele/D in world)
if(D.z != src.z) continue
if(D.id_tag == ident_tag)
D.icon_state = "tele1"
D.ztarget = teleporter_dest
D.density = 1
for(var/obj/machinery/door/poddoor/M in world)
if(M.z != src.z) continue
if(M.id_tag == ident_tag)
spawn()
M.open()
sleep(20)
for(var/obj/machinery/mass_driver/M in world)
if(M.z != src.z) continue
if(M.id_tag == ident_tag)
M.drive()
sleep(50)
for(var/obj/machinery/door/poddoor/M in world)
if(M.z != src.z) continue
if(M.id_tag == ident_tag)
spawn()
M.close()
for(var/obj/structure/deathsquad_tele/D in world)
if(D.z != src.z) continue
if(D.id_tag == ident_tag)
D.icon_state = "tele0"
D.density = 0
return
/obj/structure/deathsquad_tele
name = "Mech Teleporter"
density = 0
anchored = 1
icon = 'icons/obj/stationobjs.dmi'
icon_state = "tele0"
var/ztarget = 0
var/id_tag = ""
/obj/structure/deathsquad_tele/Bumped(var/atom/movable/AM)
if(!ztarget) return ..()
var/y = AM.y
spawn()
AM.z = ztarget
AM.y = y
AM.x = world.maxx - TRANSITIONEDGE - 2
AM.dir = 8
var/atom/target = get_edge_target_turf(AM, AM.dir)
AM.throw_at(target, 50, 1)
return
@@ -142,7 +142,7 @@ var/specops_shuttle_timeleft = 0
//Begin Marauder launchpad.
spawn(0)//So it parallel processes it.
for(var/obj/machinery/door/poddoor/M in special_ops)
switch(M.id)
switch(M.id_tag)
if("ASSAULT0")
spawn(10)//1 second delay between each.
M.open()
@@ -173,7 +173,7 @@ var/specops_shuttle_timeleft = 0
sleep(10)
for(var/obj/machinery/mass_driver/M in special_ops)
switch(M.id)
switch(M.id_tag)
if("ASSAULT0")
spawn(10)
M.drive()
@@ -190,7 +190,7 @@ var/specops_shuttle_timeleft = 0
sleep(50)//Doors remain open for 5 seconds.
for(var/obj/machinery/door/poddoor/M in special_ops)
switch(M.id)//Doors close at the same time.
switch(M.id_tag)//Doors close at the same time.
if("ASSAULT0")
spawn(0)
M.close()