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

View File

@@ -65,6 +65,8 @@ datum/controller/game_controller/proc/setup()
if(!ticker)
ticker = new /datum/controller/gameticker()
if(!shuttles) shuttles = new /datum/shuttle_controller()
setup_objects()
setupgenetics()
setupfactions()
@@ -280,7 +282,7 @@ datum/controller/game_controller/proc/process_machines_power()
if(M)
if(M.use_power)
M.auto_use_power()
if(A.apc.len && A.master == A)
i++
continue
@@ -295,7 +297,7 @@ datum/controller/game_controller/proc/process_machines_rebuild()
A.powerupdate += 1
active_areas |= A
rebuild_active_areas = 0
datum/controller/game_controller/proc/process_objects()
var/i = 1

View File

@@ -109,7 +109,6 @@ var/list/bombers = list( )
var/list/admin_log = list ( )
var/list/lastsignalers = list( ) //keeps last 100 signals here in format: "[src] used \ref[src] @ location [src.loc]: [freq]/[code]"
var/list/lawchanges = list( ) //Stores who uploaded laws to which silicon-based lifeform, and what the law was
var/list/shuttles = list( )
var/list/reg_dna = list( )
// list/traitobj = list( )

View File

@@ -637,10 +637,7 @@ var/global/floorIsLava = 0
<A href='?src=\ref[src];secretsfun=fakeguns'>Make all items look like guns</A><BR>
<A href='?src=\ref[src];secretsfun=schoolgirl'>Japanese Animes Mode</A><BR>
<A href='?src=\ref[src];secretsfun=eagles'>Egalitarian Station Mode</A><BR>
<A href='?src=\ref[src];secretsfun=moveadminshuttle'>Move Administration Shuttle</A><BR>
<A href='?src=\ref[src];secretsfun=moveferry'>Move Ferry</A><BR>
<A href='?src=\ref[src];secretsfun=movealienship'>Move Alien Dinghy</A><BR>
<A href='?src=\ref[src];secretsfun=moveminingshuttle'>Move Mining Shuttle</A><BR>
<A href='?src=\ref[src];secretsfun=moveshuttle'>Move a shuttle</A><BR>
<A href='?src=\ref[src];secretsfun=blackout'>Break all lights</A><BR>
<A href='?src=\ref[src];secretsfun=whiteout'>Fix all lights</A><BR>
<A href='?src=\ref[src];secretsfun=friendai'>Best Friend AI</A><BR>
@@ -1127,67 +1124,4 @@ proc/get_options_bar(whom, detail = 2, name = 0, link = 1)
//
//ALL DONE
//*********************************************************************************************************
//TO-DO:
//
//
/**********************Administration Shuttle**************************/
var/admin_shuttle_location = 0 // 0 = centcom 13, 1 = station
proc/move_admin_shuttle()
var/area/fromArea
var/area/toArea
if (admin_shuttle_location == 1)
fromArea = locate(/area/shuttle/administration/station)
toArea = locate(/area/shuttle/administration/centcom)
else
fromArea = locate(/area/shuttle/administration/centcom)
toArea = locate(/area/shuttle/administration/station)
fromArea.move_contents_to(toArea)
if (admin_shuttle_location)
admin_shuttle_location = 0
else
admin_shuttle_location = 1
return
/**********************Centcom Ferry**************************/
var/ferry_location = 0 // 0 = centcom , 1 = station
proc/move_ferry()
var/area/fromArea
var/area/toArea
if (ferry_location == 1)
fromArea = locate(/area/shuttle/transport1/station)
toArea = locate(/area/shuttle/transport1/centcom)
else
fromArea = locate(/area/shuttle/transport1/centcom)
toArea = locate(/area/shuttle/transport1/station)
fromArea.move_contents_to(toArea)
if (ferry_location)
ferry_location = 0
else
ferry_location = 1
return
/**********************Alien ship**************************/
var/alien_ship_location = 1 // 0 = base , 1 = mine
proc/move_alien_ship()
var/area/fromArea
var/area/toArea
if (alien_ship_location == 1)
fromArea = locate(/area/shuttle/alien/mine)
toArea = locate(/area/shuttle/alien/base)
else
fromArea = locate(/area/shuttle/alien/base)
toArea = locate(/area/shuttle/alien/mine)
fromArea.move_contents_to(toArea)
if (alien_ship_location)
alien_ship_location = 0
else
alien_ship_location = 1
return
//

View File

@@ -1921,33 +1921,20 @@
message_admins("\blue [key_name_admin(usr)] used everyone is a traitor secret. Objective is [objective]", 1)
log_admin("[key_name(usr)] used everyone is a traitor secret. Objective is [objective]")
//TODO: Generalize admin shuttles, make 'Move Shuttle' adminverb.
if("moveminingshuttle")
if(shuttle_moving["Mining"] || isnull(shuttle_moving["Mining"]))
return
feedback_inc("admin_secrets_fun_used",1)
feedback_add_details("admin_secrets_fun_used","ShM")
move_shuttle("Mining",locate(/area/shuttle/mining/outpost),locate(/area/shuttle/mining/station))
message_admins("\blue [key_name_admin(usr)] moved mining shuttle", 1)
log_admin("[key_name(usr)] moved the mining shuttle")
if("moveadminshuttle")
if("moveshuttle")
if(!shuttles) return // Something is very wrong, the shuttle controller has not been created.
feedback_inc("admin_secrets_fun_used",1)
feedback_add_details("admin_secrets_fun_used","ShA")
move_admin_shuttle()
message_admins("\blue [key_name_admin(usr)] moved the centcom administration shuttle", 1)
log_admin("[key_name(usr)] moved the centcom administration shuttle")
if("moveferry")
feedback_inc("admin_secrets_fun_used",1)
feedback_add_details("admin_secrets_fun_used","ShF")
move_ferry()
message_admins("\blue [key_name_admin(usr)] moved the centcom ferry", 1)
log_admin("[key_name(usr)] moved the centcom ferry")
if("movealienship")
feedback_inc("admin_secrets_fun_used",1)
feedback_add_details("admin_secrets_fun_used","ShX")
move_alien_ship()
message_admins("\blue [key_name_admin(usr)] moved the alien dinghy", 1)
log_admin("[key_name(usr)] moved the alien dinghy")
var/shuttle_tag = input("Which shuttle do you want to call?") as null|anything in shuttles.locations
if(shuttle_tag && !shuttles.moving[shuttle_tag])
move_shuttle(shuttle_tag)
message_admins("\blue [key_name_admin(usr)] moved the [shuttle_tag] shuttle", 1)
log_admin("[key_name(usr)] moved the [shuttle_tag] shuttle")
if("togglebombcap")
feedback_inc("admin_secrets_fun_used",1)
feedback_add_details("admin_secrets_fun_used","BC")

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"

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"

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"

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