Moved the Vox skipjack console over to a multi-destination shuttle datum setup.

This commit is contained in:
Zuhayr
2014-06-03 23:21:10 +09:30
parent 02e5f97b95
commit 54b08ff55a
11 changed files with 295 additions and 219 deletions
+9
View File
@@ -0,0 +1,9 @@
/obj/machinery/computer/shuttle_control/multi/vox
name = "skipjack control console"
req_access = list(access_syndicate)
shuttle_tag = "Vox Skipjack"
/obj/machinery/computer/shuttle_control/multi/syndicate
name = "Syndicate control console"
req_access = list(access_syndicate)
shuttle_tag = "Syndicate"
+17
View File
@@ -0,0 +1,17 @@
/obj/machinery/computer/shuttle_control/mining
name = "mining shuttle console"
shuttle_tag = "Mining"
req_access = list(access_mining)
circuit = "/obj/item/weapon/circuitboard/mining_shuttle"
/obj/machinery/computer/shuttle_control/engineering
name = "engineering shuttle console"
shuttle_tag = "Engineering"
req_access = list(access_engine)
circuit = "/obj/item/weapon/circuitboard/engineering_shuttle"
/obj/machinery/computer/shuttle_control/research
name = "research shuttle console"
shuttle_tag = "Research"
req_access = list(access_research)
circuit = "/obj/item/weapon/circuitboard/research_shuttle"
-5
View File
@@ -1,5 +0,0 @@
/obj/machinery/computer/shuttle_control/engineering
name = "engineering shuttle console"
shuttle_tag = "Engineering"
req_access = list(access_engine)
circuit = "/obj/item/weapon/circuitboard/engineering_shuttle"
-5
View File
@@ -1,5 +0,0 @@
/obj/machinery/computer/shuttle_control/mining
name = "mining shuttle console"
shuttle_tag = "Mining"
req_access = list(access_mining)
circuit = "/obj/item/weapon/circuitboard/mining_shuttle"
-5
View File
@@ -1,5 +0,0 @@
/obj/machinery/computer/shuttle_control/research
name = "research shuttle console"
shuttle_tag = "Research"
req_access = list(access_research)
circuit = "/obj/item/weapon/circuitboard/research_shuttle"
+138 -56
View File
@@ -10,6 +10,9 @@ var/global/datum/shuttle_controller/shuttles
var/list/areas_offsite = list()
var/list/areas_station = list()
//Shuttles with multiple destinations don't quite behave in the same way as ferries.
var/list/multi_shuttles = list()
/datum/shuttle_controller/New()
..()
@@ -52,6 +55,138 @@ var/global/datum/shuttle_controller/shuttles
areas_offsite["Research"] = locate(/area/shuttle/research/outpost)
areas_station["Research"] = locate(/area/shuttle/research/station)
//Vox Shuttle.
var/datum/multi_shuttle/VS = new
VS.origin = /area/shuttle/vox/station
VS.destinations = list(
"Fore Starboard Solars" = /area/vox_station/northeast_solars,
"Fore Port Solars" = /area/vox_station/northwest_solars,
"Aft Starboard Solars" = /area/vox_station/southeast_solars,
"Aft Port Solars" = /area/vox_station/southwest_solars,
"Mining asteroid" = /area/vox_station/mining
)
VS.announcer = "NSV Icarus"
VS.arrival_message = "Attention, Exodus, we just tracked a small target bypassing our defensive perimeter. Can't fire on it without hitting the station - you've got incoming visitors, like it or not."
VS.departure_message = "Your guests are pulling away, Exodus - moving too fast for us to draw a bead on them. Looks like they're heading out of the system at a rapid clip."
VS.interim = /area/vox_station/transit
multi_shuttles["Vox Skipjack"] = VS
locations["Vox Skipjack"] = 1
delays["Vox Skipjack"] = 10
moving["Vox Skipjack"] = 0
//Nuke Ops shuttle.
var/datum/multi_shuttle/MS = new
MS.origin = /area/syndicate_station/start
MS.destinations = list(
"NW" = /area/syndicate_station/northwest,
"N" = /area/syndicate_station/north,
"NE" = /area/syndicate_station/northeast,
"SW" = /area/syndicate_station/southwest,
"S" = /area/syndicate_station/south,
"SE" = /area/syndicate_station/southeast,
"Telecomms" = /area/syndicate_station/commssat,
"Mining" = /area/syndicate_station/mining
)
multi_shuttles["Syndicate"] = MS
locations["Syndicate"] = 1
delays["Syndicate"] = 10
moving["Syndicate"] = 0
/datum/shuttle_controller/proc/move_shuttle(var/shuttle_tag,var/area/origin,var/area/destination)
world << "move_shuttle() called for [shuttle_tag] leaving [origin] en route to [destination]."
if(!shuttle_tag || isnull(locations[shuttle_tag]))
return
if(moving[shuttle_tag] == 1) return
moving[shuttle_tag] = 1
spawn(delays[shuttle_tag]*10)
var/area/area_going_to
if(destination)
world << "Using supplied destination [destination]."
area_going_to = destination
else
world << "Using controller value [(locations[shuttle_tag] == 1 ? areas_station[shuttle_tag] : areas_offsite[shuttle_tag])]."
area_going_to = (locations[shuttle_tag] == 1 ? areas_station[shuttle_tag] : areas_offsite[shuttle_tag])
var/area/area_coming_from
if(origin)
world << "Using supplied origin [origin]."
area_coming_from = origin
else
world << "Using controller value [(locations[shuttle_tag] == 1 ? areas_offsite[shuttle_tag] : areas_station[shuttle_tag])]."
area_coming_from = (locations[shuttle_tag] == 1 ? areas_offsite[shuttle_tag] : areas_station[shuttle_tag])
world << "area_coming_from: [area_coming_from]"
world << "area_going_to: [area_going_to]"
if(area_coming_from == area_going_to)
world << "cancelling move, shuttle will overlap."
moving[shuttle_tag] = 0
return
var/list/dstturfs = list()
var/throwy = world.maxy
for(var/turf/T in area_going_to)
dstturfs += T
if(T.y < throwy)
throwy = T.y
for(var/turf/T in dstturfs)
var/turf/D = locate(T.x, throwy - 1, 1)
for(var/atom/movable/AM as mob|obj in T)
AM.Move(D)
if(istype(T, /turf/simulated))
del(T)
for(var/mob/living/carbon/bug in area_going_to)
bug.gib()
for(var/mob/living/simple_animal/pest in area_going_to)
pest.gib()
area_coming_from.move_contents_to(area_going_to)
locations[shuttle_tag] = !locations[shuttle_tag]
for(var/mob/M in area_going_to)
if(M.client)
M << "\red The ship lurches beneath you!"
spawn(0)
if(M.buckled)
shake_camera(M, 3, 1)
else
shake_camera(M, 10, 1)
if(istype(M, /mob/living/carbon))
if(!M.buckled)
M.Weaken(3)
moving[shuttle_tag] = 0
return
//This is for shuttles with a timer before arrival such as the vox skipjack and the escape shuttle.
/datum/shuttle_controller/proc/move_shuttle_long(var/shuttle_tag,var/area/departing,var/area/destination,var/area/interim,var/delay)
move_shuttle(shuttle_tag,locate(departing),locate(interim))
spawn(1)
moving[shuttle_tag] = 1 //So they can't jump out by messing with the console.
sleep(delay)
moving[shuttle_tag] = 0
move_shuttle(shuttle_tag,locate(interim),locate(destination))
return
/obj/machinery/computer/shuttle_control
name = "shuttle console"
icon = 'icons/obj/computer.dmi'
@@ -86,14 +221,14 @@ var/global/datum/shuttle_controller/shuttles
return
usr.set_machine(src)
src.add_fingerprint(usr)
if(href_list["move"])
if (!shuttles.moving[shuttle_tag])
usr << "\blue [shuttle_tag] Shuttle recieved message and will be sent shortly."
move_shuttle(shuttle_tag)
shuttles.move_shuttle(shuttle_tag)
else
usr << "\blue [shuttle_tag] Shuttle is already moving."
updateUsrDialog()
/obj/machinery/computer/shuttle_control/attackby(obj/item/weapon/W as obj, mob/user as mob)
@@ -102,57 +237,4 @@ var/global/datum/shuttle_controller/shuttles
hacked = 1
usr << "You short out the console's ID checking system. It's now available to everyone!"
else
..()
proc/move_shuttle(var/shuttle_tag,var/area/offsite,var/area/station)
if(!shuttle_tag || isnull(shuttles.locations[shuttle_tag]))
return
if(shuttles.moving[shuttle_tag] == 1) return
shuttles.moving[shuttle_tag] = 1
spawn(shuttles.delays[shuttle_tag]*10)
var/list/dstturfs = list()
var/throwy = world.maxy
var/area/area_going_to = (shuttles.locations[shuttle_tag] == 1 ? shuttles.areas_station[shuttle_tag] : shuttles.areas_offsite[shuttle_tag])
var/area/area_coming_from = (shuttles.locations[shuttle_tag] == 1 ? shuttles.areas_offsite[shuttle_tag] : shuttles.areas_station[shuttle_tag])
for(var/turf/T in area_going_to)
dstturfs += T
if(T.y < throwy)
throwy = T.y
for(var/turf/T in dstturfs)
var/turf/D = locate(T.x, throwy - 1, 1)
for(var/atom/movable/AM as mob|obj in T)
AM.Move(D)
if(istype(T, /turf/simulated))
del(T)
for(var/mob/living/carbon/bug in area_going_to)
bug.gib()
for(var/mob/living/simple_animal/pest in area_going_to)
pest.gib()
area_coming_from.move_contents_to(area_going_to)
shuttles.locations[shuttle_tag] = !shuttles.locations[shuttle_tag]
for(var/mob/M in area_going_to)
if(M.client)
spawn(0)
if(M.buckled)
shake_camera(M, 3, 1)
else
shake_camera(M, 10, 1)
if(istype(M, /mob/living/carbon))
if(!M.buckled)
M.Weaken(3)
shuttles.moving[shuttle_tag] = 0
return
..()
+124
View File
@@ -0,0 +1,124 @@
//This is a holder for things like the Vox and Nuke shuttle.
/datum/multi_shuttle
var/cloaked = 1
var/at_origin = 1
var/move_time = 240
var/cooldown = 200
var/announcer
var/arrival_message
var/departure_message
var/area/interim
var/area/last_departed
var/list/destinations
var/area/origin
var/return_warning = 0
/datum/multi_shuttle/New()
..()
if(origin) last_departed = origin
/datum/multi_shuttle/proc/announce_departure()
if(cloaked || isnull(departure_message))
return
command_alert(departure_message,(announcer ? announcer : "Central Command"))
/datum/multi_shuttle/proc/announce_arrival()
if(cloaked || isnull(arrival_message))
return
command_alert(arrival_message,(announcer ? announcer : "Central Command"))
/obj/machinery/computer/shuttle_control/multi
icon_state = "syndishuttle"
/obj/machinery/computer/shuttle_control/multi/attack_hand(user as mob)
if(..(user))
return
src.add_fingerprint(user)
var/dat
dat = "<center>[shuttle_tag] Ship Control<hr>"
if(shuttles.moving[shuttle_tag])
dat += "Location: <font color='red'>Moving</font> <br>"
else
var/area/areacheck = get_area(src)
dat += "Location: [areacheck.name]<br>"
dat += "<b><A href='?src=\ref[src];toggle_cloak=[1]'>Toggle cloaking field</A></b><br>"
dat += "<b><A href='?src=\ref[src];move_multi=[1]'>Move ship</A></b><br>"
dat += "<b><A href='?src=\ref[src];start=[1]'>Return to base</A></b></center>"
user << browse("[dat]", "window=[shuttle_tag]shuttlecontrol;size=220x220")
/obj/machinery/computer/shuttle_control/multi/Topic(href, href_list)
if(..())
return
usr.set_machine(src)
src.add_fingerprint(usr)
var/datum/multi_shuttle/MS = shuttles.multi_shuttles[shuttle_tag]
if(!istype(MS)) return
if (shuttles.moving[shuttle_tag])
usr << "\blue [shuttle_tag] vessel is moving."
return
if(href_list["start"])
if(MS.at_origin)
usr << "\red You are already at your home base."
return
if(!MS.return_warning)
usr << "\red Returning to your home base will end your mission. If you are sure, press the button again."
//TODO: Actually end the mission.
MS.return_warning = 1
return
shuttles.move_shuttle_long(shuttle_tag,MS.last_departed,MS.origin,MS.interim,MS.move_time)
MS.last_departed = MS.origin
MS.at_origin = 1
if(href_list["toggle_cloak"])
if(!shuttles.multi_shuttles) return
MS.cloaked = !MS.cloaked
usr << "\red Ship stealth systems have been [(MS.cloaked ? "activated. The station will not" : "deactivated. The station will")] be warned of our arrival."
if(href_list["move_multi"])
if(!shuttles.multi_shuttles) return
var/choice = input("Select a destination.") as null|anything in MS.destinations
if(!choice) return
usr << "\blue [shuttle_tag] main computer recieved message."
if(MS.at_origin)
MS.announce_arrival()
MS.last_departed = MS.origin
MS.at_origin = 0
shuttles.move_shuttle_long(shuttle_tag,MS.last_departed,MS.destinations[choice],MS.interim,MS.move_time)
MS.last_departed = MS.destinations[choice]
return
else if(choice == MS.origin)
MS.announce_departure()
shuttles.move_shuttle(shuttle_tag,locate(MS.last_departed),locate(MS.destinations[choice]))
MS.last_departed = MS.destinations[choice]
updateUsrDialog()