Added a 'controller' for shuttles (really just a data container), fixed up the admin shuttle verbs into one general verb, changed shuttles to use controller instead of populating lists at spawn.

This commit is contained in:
Zuhayr
2014-06-03 18:06:05 +09:30
parent 405055eda8
commit c01b124ac7
8 changed files with 86 additions and 148 deletions
+1 -7
View File
@@ -2,10 +2,4 @@
name = "engineering shuttle console"
shuttle_tag = "Engineering"
req_access = list(access_engine)
circuit = "/obj/item/weapon/circuitboard/engineering_shuttle"
location = 1 //Starts offstation.
/obj/machinery/computer/shuttle_control/engineering/New()
offsite = locate(/area/shuttle/constructionsite/site)
station = locate(/area/shuttle/constructionsite/station)
..()
circuit = "/obj/item/weapon/circuitboard/engineering_shuttle"
+1 -6
View File
@@ -2,9 +2,4 @@
name = "mining shuttle console"
shuttle_tag = "Mining"
req_access = list(access_mining)
circuit = "/obj/item/weapon/circuitboard/mining_shuttle"
/obj/machinery/computer/shuttle_control/mining/New()
offsite = locate(/area/shuttle/mining/outpost)
station = locate(/area/shuttle/mining/station)
..()
circuit = "/obj/item/weapon/circuitboard/mining_shuttle"
+1 -6
View File
@@ -2,9 +2,4 @@
name = "research shuttle console"
shuttle_tag = "Research"
req_access = list(access_research)
circuit = "/obj/item/weapon/circuitboard/research_shuttle"
/obj/machinery/computer/shuttle_control/research/New()
offsite = locate(/area/shuttle/research/outpost)
station = locate(/area/shuttle/research/station)
..()
circuit = "/obj/item/weapon/circuitboard/research_shuttle"
+65 -33
View File
@@ -1,8 +1,56 @@
//These lists are populated in /obj/machinery/computer/shuttle_control/New()
//TODO: Integrate these into a shuttle controller.
var/list/global/shuttle_locations = list()
var/list/global/shuttle_delays = list()
var/list/global/shuttle_moving = list()
//Shuttle controller is instantiated in master_controller.dm.
var/global/datum/shuttle_controller/shuttles
/datum/shuttle_controller //This isn't really a controller...
var/list/locations = list()
var/list/delays = list()
var/list/moving = list()
var/list/areas_offsite = list()
var/list/areas_station = list()
/datum/shuttle_controller/New()
..()
// Admin shuttles.
locations["Centcom"] = 1
delays["Centcom"] = 0
moving["Centcom"] = 0
areas_offsite["Centcom"] = locate(/area/shuttle/transport1/centcom)
areas_station["Centcom"] = locate(/area/shuttle/transport1/station)
locations["Administration"] = 1
delays["Administration"] = 0
moving["Administration"] = 0
areas_offsite["Administration"] = locate(/area/shuttle/administration/centcom)
areas_station["Administration"] = locate(/area/shuttle/administration/station)
locations["Alien"] = 0
delays["Alien"] = 0
moving["Alien"] = 0
areas_offsite["Alien"] = locate(/area/shuttle/alien/base)
areas_station["Alien"] = locate(/area/shuttle/alien/mine)
// Public shuttles.
locations["Engineering"] = 1
delays["Engineering"] = 10
moving["Engineering"] = 0
areas_offsite["Engineering"] = locate(/area/shuttle/constructionsite/site)
areas_station["Engineering"] = locate(/area/shuttle/constructionsite/station)
locations["Mining"] = 0
delays["Mining"] = 10
moving["Mining"] = 0
areas_offsite["Mining"] = locate(/area/shuttle/mining/outpost)
areas_station["Mining"] = locate(/area/shuttle/mining/station)
locations["Research"] = 0
delays["Research"] = 10
moving["Research"] = 0
areas_offsite["Research"] = locate(/area/shuttle/research/outpost)
areas_station["Research"] = locate(/area/shuttle/research/station)
/obj/machinery/computer/shuttle_control
name = "shuttle console"
@@ -11,27 +59,11 @@ var/list/global/shuttle_moving = list()
req_access = list(access_engine)
circuit = "/obj/item/weapon/circuitboard/engineering_shuttle"
var/shuttle_tag // Used to coordinate data in global lists.
var/area/offsite // Off-station destination.
var/area/station // Station destination.
var/shuttle_tag // Used to coordinate data in shuttle controller.
var/hacked = 0 // Has been emagged, no access restrictions.
var/location = 0 // The location that the shuttle begins the game at.
var/delay = 10 // The number of seconds of delay on each shuttle movement.
/obj/machinery/computer/shuttle_control/New()
..()
if(!shuttle_tag)
del(src)
return
if(isnull(shuttle_locations[shuttle_tag])) shuttle_locations[shuttle_tag] = location
if(isnull(shuttle_delays[shuttle_tag])) shuttle_delays[shuttle_tag] = delay
if(isnull(shuttle_moving[shuttle_tag])) shuttle_moving[shuttle_tag] = 0
/obj/machinery/computer/shuttle_control/attack_hand(user as mob)
if(..(user))
return
src.add_fingerprint(user)
@@ -39,10 +71,10 @@ var/list/global/shuttle_moving = list()
dat = "<center>[shuttle_tag] Shuttle Control<hr>"
if(shuttle_moving[shuttle_tag])
if(shuttles.moving[shuttle_tag])
dat += "Location: <font color='red'>Moving</font> <br>"
else
dat += "Location: [shuttle_locations[shuttle_tag] ? "Offsite" : "Station"] <br>"
dat += "Location: [shuttles.locations[shuttle_tag] ? "Offsite" : "Station"] <br>"
dat += "<b><A href='?src=\ref[src];move=[1]'>Send</A></b></center>"
@@ -55,9 +87,9 @@ var/list/global/shuttle_moving = list()
usr.set_machine(src)
src.add_fingerprint(usr)
if(href_list["move"])
if (!shuttle_moving[shuttle_tag])
if (!shuttles.moving[shuttle_tag])
usr << "\blue [shuttle_tag] Shuttle recieved message and will be sent shortly."
move_shuttle(shuttle_tag,offsite,station)
move_shuttle(shuttle_tag)
else
usr << "\blue [shuttle_tag] Shuttle is already moving."
@@ -74,19 +106,19 @@ var/list/global/shuttle_moving = list()
proc/move_shuttle(var/shuttle_tag,var/area/offsite,var/area/station)
if(!shuttle_tag || isnull(shuttle_locations[shuttle_tag]))
if(!shuttle_tag || isnull(shuttles.locations[shuttle_tag]))
return
if(shuttle_moving[shuttle_tag] == 1) return
shuttle_moving[shuttle_tag] = 1
if(shuttles.moving[shuttle_tag] == 1) return
shuttles.moving[shuttle_tag] = 1
spawn(shuttle_delays[shuttle_tag]*10)
spawn(shuttles.delays[shuttle_tag]*10)
var/list/dstturfs = list()
var/throwy = world.maxy
var/area/area_going_to = (shuttle_locations[shuttle_tag] == 1 ? station : offsite)
var/area/area_coming_from = (shuttle_locations[shuttle_tag] == 1 ? offsite : station)
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
@@ -108,7 +140,7 @@ proc/move_shuttle(var/shuttle_tag,var/area/offsite,var/area/station)
area_coming_from.move_contents_to(area_going_to)
shuttle_locations[shuttle_tag] = !shuttle_locations[shuttle_tag]
shuttles.locations[shuttle_tag] = !shuttles.locations[shuttle_tag]
for(var/mob/M in area_going_to)
if(M.client)
@@ -121,6 +153,6 @@ proc/move_shuttle(var/shuttle_tag,var/area/offsite,var/area/station)
if(!M.buckled)
M.Weaken(3)
shuttle_moving[shuttle_tag] = 0
shuttles.moving[shuttle_tag] = 0
return