From 00c81bb6750f98ba1fdbf30d8bcce2d9ccc199d4 Mon Sep 17 00:00:00 2001 From: Zuhayr Date: Tue, 3 Jun 2014 15:26:34 +0930 Subject: [PATCH] Moved engineering, research and mining shuttles to a generalized system with its own directory structure. --- baystation12.dme | 4 +- .../game/machinery/computer/buildandrepair.dm | 14 +- code/modules/admin/topic.dm | 6 +- code/modules/mining/mine_items.dm | 126 ------------------ code/modules/research/research_shuttle.dm | 108 --------------- code/modules/shuttles/engineering.dm | 109 +-------------- code/modules/shuttles/mining.dm | 12 ++ code/modules/shuttles/research.dm | 12 ++ code/modules/shuttles/shuttle.dm | 126 ++++++++++++++++++ 9 files changed, 168 insertions(+), 349 deletions(-) delete mode 100644 code/modules/research/research_shuttle.dm create mode 100644 code/modules/shuttles/mining.dm create mode 100644 code/modules/shuttles/research.dm create mode 100644 code/modules/shuttles/shuttle.dm diff --git a/baystation12.dme b/baystation12.dme index 92c011b43a..25531cc7f5 100644 --- a/baystation12.dme +++ b/baystation12.dme @@ -1197,7 +1197,6 @@ #include "code\modules\research\rdconsole.dm" #include "code\modules\research\rdmachines.dm" #include "code\modules\research\research.dm" -#include "code\modules\research\research_shuttle.dm" #include "code\modules\research\server.dm" #include "code\modules\research\xenoarchaeology\areas.dm" #include "code\modules\research\xenoarchaeology\chemistry.dm" @@ -1278,6 +1277,9 @@ #include "code\modules\security levels\keycard authentication.dm" #include "code\modules\security levels\security levels.dm" #include "code\modules\shuttles\engineering.dm" +#include "code\modules\shuttles\mining.dm" +#include "code\modules\shuttles\research.dm" +#include "code\modules\shuttles\shuttle.dm" #include "code\modules\supermatter\supermatter.dm" #include "code\modules\surgery\appendix.dm" #include "code\modules\surgery\bones.dm" diff --git a/code/game/machinery/computer/buildandrepair.dm b/code/game/machinery/computer/buildandrepair.dm index 3eb86ebaf6..03ae77614f 100644 --- a/code/game/machinery/computer/buildandrepair.dm +++ b/code/game/machinery/computer/buildandrepair.dm @@ -169,10 +169,7 @@ build_path = "/obj/machinery/computer/supplycomp" origin_tech = "programming=3" var/contraband_enabled = 0 -/obj/item/weapon/circuitboard/research_shuttle - name = "Circuit board (Research Shuttle)" - build_path = "/obj/machinery/computer/research_shuttle" - origin_tech = "programming=2" + /obj/item/weapon/circuitboard/operating name = "Circuit board (Operating Computer)" build_path = "/obj/machinery/computer/operating" @@ -196,20 +193,17 @@ /obj/item/weapon/circuitboard/splicer name = "Circuit board (Disease Splicer)" build_path = "/obj/machinery/computer/diseasesplicer" - /obj/item/weapon/circuitboard/mining_shuttle name = "Circuit board (Mining Shuttle)" - build_path = "/obj/machinery/computer/mining_shuttle" + build_path = "/obj/machinery/computer/shuttle_control/mining" origin_tech = "programming=2" - /obj/item/weapon/circuitboard/engineering_shuttle name = "Circuit board (Engineering Shuttle)" - build_path = "/obj/machinery/computer/engineering_shuttle" + build_path = "/obj/machinery/computer/shuttle_control/engineering" origin_tech = "programming=2" - /obj/item/weapon/circuitboard/research_shuttle name = "Circuit board (Research Shuttle)" - build_path = "/obj/machinery/computer/research_shuttle" + build_path = "/obj/machinery/computer/shuttle_control/research" origin_tech = "programming=2" /obj/item/weapon/circuitboard/HolodeckControl // Not going to let people get this, but it's just here for future name = "Circuit board (Holodeck Control)" diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm index 5129bba4a0..d2458f7d4a 100644 --- a/code/modules/admin/topic.dm +++ b/code/modules/admin/topic.dm @@ -1920,12 +1920,14 @@ ticker.mode.finalize_traitor(A.mind) 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(mining_shuttle_moving) + if(shuttle_moving["Mining"] || shuttle_moving["Mining"] == null) return feedback_inc("admin_secrets_fun_used",1) feedback_add_details("admin_secrets_fun_used","ShM") - move_mining_shuttle() + 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") diff --git a/code/modules/mining/mine_items.dm b/code/modules/mining/mine_items.dm index 288546872c..cc1cbc556b 100644 --- a/code/modules/mining/mine_items.dm +++ b/code/modules/mining/mine_items.dm @@ -38,132 +38,6 @@ new /obj/item/clothing/glasses/meson(src) -/**********************Shuttle Computer**************************/ - -var/mining_shuttle_tickstomove = 10 -var/mining_shuttle_moving = 0 -var/mining_shuttle_location = 0 // 0 = station 13, 1 = mining station - -proc/move_mining_shuttle() - if(mining_shuttle_moving) return - mining_shuttle_moving = 1 - spawn(mining_shuttle_tickstomove*10) - var/area/fromArea - var/area/toArea - if (mining_shuttle_location == 1) - fromArea = locate(/area/shuttle/mining/outpost) - toArea = locate(/area/shuttle/mining/station) - - else - fromArea = locate(/area/shuttle/mining/station) - toArea = locate(/area/shuttle/mining/outpost) - - var/list/dstturfs = list() - var/throwy = world.maxy - - for(var/turf/T in toArea) - dstturfs += T - if(T.y < throwy) - throwy = T.y - - // hey you, get out of the way! - for(var/turf/T in dstturfs) - // find the turf to move things to - var/turf/D = locate(T.x, throwy - 1, 1) - //var/turf/E = get_step(D, SOUTH) - for(var/atom/movable/AM as mob|obj in T) - AM.Move(D) - // NOTE: Commenting this out to avoid recreating mass driver glitch - /* - spawn(0) - AM.throw_at(E, 1, 1) - return - */ - - if(istype(T, /turf/simulated)) - del(T) - - for(var/mob/living/carbon/bug in toArea) // If someone somehow is still in the shuttle's docking area... - bug.gib() - - for(var/mob/living/simple_animal/pest in toArea) // And for the other kind of bug... - pest.gib() - - fromArea.move_contents_to(toArea) - if (mining_shuttle_location) - mining_shuttle_location = 0 - else - mining_shuttle_location = 1 - - for(var/mob/M in toArea) - if(M.client) - spawn(0) - if(M.buckled) - shake_camera(M, 3, 1) // buckled, not a lot of shaking - else - shake_camera(M, 10, 1) // unbuckled, HOLY SHIT SHAKE THE ROOM - if(istype(M, /mob/living/carbon)) - if(!M.buckled) - M.Weaken(3) - - mining_shuttle_moving = 0 - return - -/obj/machinery/computer/mining_shuttle - name = "mining shuttle console" - icon = 'icons/obj/computer.dmi' - icon_state = "shuttle" - req_access = list(access_mining) - circuit = "/obj/item/weapon/circuitboard/mining_shuttle" - var/hacked = 0 - var/location = 0 //0 = station, 1 = mining base - -/obj/machinery/computer/mining_shuttle/attack_hand(user as mob) - if(..(user)) - return - src.add_fingerprint(usr) - var/dat - - dat = "
Mining Shuttle Control
" - - if(mining_shuttle_moving) - dat += "Location: Moving
" - else - dat += "Location: [mining_shuttle_location ? "Outpost" : "Station"]
" - - dat += "Send
" - - - user << browse("[dat]", "window=miningshuttle;size=200x150") - -/obj/machinery/computer/mining_shuttle/Topic(href, href_list) - if(..()) - return - usr.set_machine(src) - src.add_fingerprint(usr) - if(href_list["move"]) - //if(ticker.mode.name == "blob") - // if(ticker.mode:declared) - // usr << "Under directive 7-10, [station_name()] is quarantined until further notice." - // return - - if (!mining_shuttle_moving) - usr << "\blue Shuttle recieved message and will be sent shortly." - move_mining_shuttle() - else - usr << "\blue Shuttle is already moving." - - updateUsrDialog() - -/obj/machinery/computer/mining_shuttle/attackby(obj/item/weapon/W as obj, mob/user as mob) - - if (istype(W, /obj/item/weapon/card/emag)) - src.req_access = list() - hacked = 1 - usr << "You fried the consoles ID checking system. It's now available to everyone!" - else - ..() - /******************************Lantern*******************************/ /obj/item/device/flashlight/lantern diff --git a/code/modules/research/research_shuttle.dm b/code/modules/research/research_shuttle.dm deleted file mode 100644 index b0119b42aa..0000000000 --- a/code/modules/research/research_shuttle.dm +++ /dev/null @@ -1,108 +0,0 @@ - -/**********************Shuttle Computer**************************/ - -//copy paste from the mining shuttle - -var/research_shuttle_tickstomove = 10 -var/research_shuttle_moving = 0 -var/research_shuttle_location = 0 // 0 = station 13, 1 = research station - -proc/move_research_shuttle() - if(research_shuttle_moving) return - research_shuttle_moving = 1 - spawn(research_shuttle_tickstomove*10) - var/area/fromArea - var/area/toArea - if (research_shuttle_location == 1) - fromArea = locate(/area/shuttle/research/outpost) - toArea = locate(/area/shuttle/research/station) - else - fromArea = locate(/area/shuttle/research/station) - toArea = locate(/area/shuttle/research/outpost) - - - var/list/dstturfs = list() - var/throwy = world.maxy - - for(var/turf/T in toArea) - dstturfs += T - if(T.y < throwy) - throwy = T.y - - // hey you, get out of the way! - for(var/turf/T in dstturfs) - // find the turf to move things to - var/turf/D = locate(T.x, throwy - 1, 1) - //var/turf/E = get_step(D, SOUTH) - for(var/atom/movable/AM as mob|obj in T) - AM.Move(D) - // NOTE: Commenting this out to avoid recreating mass driver glitch - /* - spawn(0) - AM.throw_at(E, 1, 1) - return - */ - - if(istype(T, /turf/simulated)) - del(T) - - for(var/mob/living/carbon/bug in toArea) // If someone somehow is still in the shuttle's docking area... - bug.gib() - - for(var/mob/living/simple_animal/pest in toArea) // And for the other kind of bug... - pest.gib() - - fromArea.move_contents_to(toArea) - if (research_shuttle_location) - research_shuttle_location = 0 - else - research_shuttle_location = 1 - research_shuttle_moving = 0 - return - -/obj/machinery/computer/research_shuttle - name = "Research Shuttle Console" - icon = 'icons/obj/computer.dmi' - icon_state = "shuttle" - req_access = list(access_research) - circuit = "/obj/item/weapon/circuitboard/research_shuttle" - var/hacked = 0 - var/location = 0 //0 = station, 1 = research base - -/obj/machinery/computer/research_shuttle/attack_hand(user as mob) - src.add_fingerprint(usr) - var/dat = "
Research shuttle: Send

" - - user << browse("[dat]", "window=researchshuttle;size=200x100") - -/obj/machinery/computer/research_shuttle/Topic(href, href_list) - if(..()) - return - usr.machine = src - src.add_fingerprint(usr) - if(href_list["move"]) - //if(ticker.mode.name == "blob") - // if(ticker.mode:declared) - // usr << "Under directive 7-10, [station_name()] is quarantined until further notice." - // return - - if (!research_shuttle_moving) - usr << "\blue Shuttle recieved message and will be sent shortly." - move_research_shuttle() - else - usr << "\blue Shuttle is already moving." - -/obj/machinery/computer/research_shuttle/attackby(obj/item/weapon/W as obj, mob/user as mob) - - if (istype(W, /obj/item/weapon/card/emag)) - var/obj/item/weapon/card/emag/E = W - if(E.uses) - E.uses-- - else - return - src.req_access = list() - hacked = 1 - usr << "You fried the consoles ID checking system. It's now available to everyone!" - - else - ..() diff --git a/code/modules/shuttles/engineering.dm b/code/modules/shuttles/engineering.dm index 1fa7165011..2de57d8118 100644 --- a/code/modules/shuttles/engineering.dm +++ b/code/modules/shuttles/engineering.dm @@ -1,108 +1,13 @@ -var/engineering_shuttle_tickstomove = 10 -var/engineering_shuttle_moving = 0 -var/engineering_shuttle_location = 1 //Starts at the construction site. - -proc/move_engineering_shuttle() - if(engineering_shuttle_moving) return - engineering_shuttle_moving = 1 - spawn(engineering_shuttle_tickstomove*10) - var/area/fromArea - var/area/toArea - if (engineering_shuttle_location == 1) - fromArea = locate(/area/shuttle/constructionsite/site) - toArea = locate(/area/shuttle/constructionsite/station) - - else - fromArea = locate(/area/shuttle/constructionsite/station) - toArea = locate(/area/shuttle/constructionsite/site) - - var/list/dstturfs = list() - var/throwy = world.maxy - - for(var/turf/T in toArea) - 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 toArea) - bug.gib() - - for(var/mob/living/simple_animal/pest in toArea) - pest.gib() - - fromArea.move_contents_to(toArea) - if (engineering_shuttle_location) - engineering_shuttle_location = 0 - else - engineering_shuttle_location = 1 - - for(var/mob/M in toArea) - 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) - - engineering_shuttle_moving = 0 - return - -/obj/machinery/computer/engineering_shuttle +/obj/machinery/computer/shuttle_control/engineering name = "engineering shuttle console" icon = 'icons/obj/computer.dmi' icon_state = "shuttle" + shuttle_tag = "Engineering" req_access = list(access_engine) circuit = "/obj/item/weapon/circuitboard/engineering_shuttle" - var/hacked = 0 - var/location = 0 + location = 1 -/obj/machinery/computer/engineering_shuttle/attack_hand(user as mob) - if(..(user)) - return - src.add_fingerprint(usr) - var/dat - - dat = "
Engineering Shuttle Control
" - - if(engineering_shuttle_moving) - dat += "Location: Moving
" - else - dat += "Location: [engineering_shuttle_location ? "Outpost" : "Station"]
" - - dat += "Send
" - - - user << browse("[dat]", "window=engineeringshuttle;size=200x150") - -/obj/machinery/computer/engineering_shuttle/Topic(href, href_list) - if(..()) - return - usr.set_machine(src) - src.add_fingerprint(usr) - if(href_list["move"]) - if (!engineering_shuttle_moving) - usr << "\blue Shuttle recieved message and will be sent shortly." - move_engineering_shuttle() - else - usr << "\blue Shuttle is already moving." - - updateUsrDialog() - -/obj/machinery/computer/engineering_shuttle/attackby(obj/item/weapon/W as obj, mob/user as mob) - - if (istype(W, /obj/item/weapon/card/emag)) - src.req_access = list() - hacked = 1 - usr << "You fried the consoles ID checking system. It's now available to everyone!" - else - ..() \ No newline at end of file +/obj/machinery/computer/shuttle_control/engineering/New() + offsite = locate(/area/shuttle/constructionsite/site) + station = locate(/area/shuttle/constructionsite/station) + ..() \ No newline at end of file diff --git a/code/modules/shuttles/mining.dm b/code/modules/shuttles/mining.dm new file mode 100644 index 0000000000..f0c8551b53 --- /dev/null +++ b/code/modules/shuttles/mining.dm @@ -0,0 +1,12 @@ +/obj/machinery/computer/shuttle_control/mining + name = "mining shuttle console" + icon = 'icons/obj/computer.dmi' + icon_state = "shuttle" + 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) + ..() \ No newline at end of file diff --git a/code/modules/shuttles/research.dm b/code/modules/shuttles/research.dm new file mode 100644 index 0000000000..b75dd35fe6 --- /dev/null +++ b/code/modules/shuttles/research.dm @@ -0,0 +1,12 @@ +/obj/machinery/computer/shuttle_control/research + name = "research shuttle console" + icon = 'icons/obj/computer.dmi' + icon_state = "shuttle" + 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) + ..() \ No newline at end of file diff --git a/code/modules/shuttles/shuttle.dm b/code/modules/shuttles/shuttle.dm new file mode 100644 index 0000000000..e1b8a00001 --- /dev/null +++ b/code/modules/shuttles/shuttle.dm @@ -0,0 +1,126 @@ +//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() + +/obj/machinery/computer/shuttle_control + name = "shuttle console" + icon = 'icons/obj/computer.dmi' + icon_state = "shuttle" + 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/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) + var/dat + + dat = "
[shuttle_tag] Shuttle Control
" + + if(shuttle_moving[shuttle_tag]) + dat += "Location: Moving
" + else + dat += "Location: [shuttle_locations[shuttle_tag] ? "Offsite" : "Station"]
" + + dat += "Send
" + + + user << browse("[dat]", "window=[shuttle_tag]shuttlecontrol;size=200x150") + +/obj/machinery/computer/shuttle_control/Topic(href, href_list) + if(..()) + return + usr.set_machine(src) + src.add_fingerprint(usr) + if(href_list["move"]) + if (!shuttle_moving[shuttle_tag]) + usr << "\blue [shuttle_tag] Shuttle recieved message and will be sent shortly." + move_shuttle(shuttle_tag,offsite,station) + 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) + + if (istype(W, /obj/item/weapon/card/emag)) + src.req_access = list() + 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(shuttle_locations[shuttle_tag])) + return + + if(shuttle_moving[shuttle_tag] == 1) return + shuttle_moving[shuttle_tag] = 1 + + spawn(shuttle_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) + + 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) + + shuttle_locations[shuttle_tag] = !shuttle_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) + + shuttle_moving[shuttle_tag] = 0 + + return \ No newline at end of file