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

View File

@@ -374,7 +374,6 @@
#include "code\game\machinery\computer\station_alert.dm"
#include "code\game\machinery\computer\syndicate_shuttle.dm"
#include "code\game\machinery\computer\syndicate_specops_shuttle.dm"
#include "code\game\machinery\computer\vox_shuttle.dm"
#include "code\game\machinery\doors\airlock.dm"
#include "code\game\machinery\doors\airlock_electronics.dm"
#include "code\game\machinery\doors\alarmlock.dm"
@@ -1276,10 +1275,10 @@
#include "code\modules\scripting\Scanner\Tokens.dm"
#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\antagonist.dm"
#include "code\modules\shuttles\departmental.dm"
#include "code\modules\shuttles\shuttle.dm"
#include "code\modules\shuttles\shuttles_multi.dm"
#include "code\modules\supermatter\supermatter.dm"
#include "code\modules\surgery\appendix.dm"
#include "code\modules\surgery\bones.dm"

View File

@@ -272,8 +272,9 @@ datum/game_mode/proc/auto_declare_completion_heist()
return 1
/datum/game_mode/heist/check_finished()
if (!(is_raider_crew_alive()) || (vox_shuttle_location && (vox_shuttle_location == "start")))
return 1
// DO NOT FORGET TO FIX THIS.
//if (!(is_raider_crew_alive()) || (vox_shuttle_location && (vox_shuttle_location == "start")))
// return 1
return ..()
/datum/game_mode/heist/cleanup()

View File

@@ -1,141 +0,0 @@
#define VOX_SHUTTLE_MOVE_TIME 400
#define VOX_SHUTTLE_COOLDOWN 1200
//Copied from Syndicate shuttle.
var/global/vox_shuttle_location
var/global/announce_vox_departure = 1 //Stealth systems - give an announcement or not.
/obj/machinery/computer/vox_stealth
name = "skipjack cloaking field terminal"
icon = 'icons/obj/computer.dmi'
icon_state = "syndishuttle"
req_access = list(access_syndicate)
/obj/machinery/computer/vox_stealth/attackby(obj/item/I as obj, mob/user as mob)
return attack_hand(user)
/obj/machinery/computer/vox_stealth/attack_ai(mob/user as mob)
return attack_hand(user)
/obj/machinery/computer/vox_stealth/attack_paw(mob/user as mob)
return attack_hand(user)
/obj/machinery/computer/vox_stealth/attack_hand(mob/user as mob)
if(!allowed(user))
user << "\red Access Denied"
return
if(announce_vox_departure)
user << "\red Shuttle stealth systems have been activated. The Exodus will not be warned of our arrival."
announce_vox_departure = 0
else
user << "\red Shuttle stealth systems have been deactivated. The Exodus will be warned of our arrival."
announce_vox_departure = 1
/obj/machinery/computer/vox_station
name = "vox skipjack terminal"
icon = 'icons/obj/computer.dmi'
icon_state = "syndishuttle"
req_access = list(access_syndicate)
var/area/curr_location
var/moving = 0
var/lastMove = 0
var/warning //Warning about the end of the round.
/obj/machinery/computer/vox_station/New()
curr_location= locate(/area/shuttle/vox/station)
/obj/machinery/computer/vox_station/proc/vox_move_to(area/destination as area)
if(moving) return
if(lastMove + VOX_SHUTTLE_COOLDOWN > world.time) return
var/area/dest_location = locate(destination)
if(curr_location == dest_location) return
if(announce_vox_departure)
if(curr_location == locate(/area/shuttle/vox/station))
command_alert("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.", "NSV Icarus")
else if(dest_location == locate(/area/shuttle/vox/station))
command_alert("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.", "NSV Icarus")
moving = 1
lastMove = world.time
if(curr_location.z != dest_location.z)
var/area/transit_location = locate(/area/vox_station/transit)
curr_location.move_contents_to(transit_location)
curr_location = transit_location
sleep(VOX_SHUTTLE_MOVE_TIME)
curr_location.move_contents_to(dest_location)
curr_location = dest_location
moving = 0
return 1
/obj/machinery/computer/vox_station/attackby(obj/item/I as obj, mob/user as mob)
return attack_hand(user)
/obj/machinery/computer/vox_station/attack_ai(mob/user as mob)
return attack_hand(user)
/obj/machinery/computer/vox_station/attack_paw(mob/user as mob)
return attack_hand(user)
/obj/machinery/computer/vox_station/attack_hand(mob/user as mob)
if(!allowed(user))
user << "\red Access Denied"
return
user.set_machine(src)
var/dat = {"Location: [curr_location]<br>
Ready to move[max(lastMove + VOX_SHUTTLE_COOLDOWN - world.time, 0) ? " in [max(round((lastMove + VOX_SHUTTLE_COOLDOWN - world.time) * 0.1), 0)] seconds" : ": now"]<br>
<a href='?src=\ref[src];start=1'>Return to dark space</a><br>
<a href='?src=\ref[src];solars_fore_port=1'>Fore port solar</a> |
<a href='?src=\ref[src];solars_aft_port=1'>Aft port solar</a> |
<a href='?src=\ref[src];solars_fore_starboard=1'>Fore starboard solar</a><br>
<a href='?src=\ref[src];solars_aft_starboard=1'>Aft starboard solar</a> |
<a href='?src=\ref[src];mining=1'>Mining Asteroid</a><br>
<a href='?src=\ref[user];mach_close=computer'>Close</a>"}
user << browse(dat, "window=computer;size=575x450")
onclose(user, "computer")
return
/obj/machinery/computer/vox_station/Topic(href, href_list)
if(!isliving(usr)) return
var/mob/living/user = usr
if(in_range(src, user) || istype(user, /mob/living/silicon))
user.set_machine(src)
vox_shuttle_location = "station"
if(href_list["start"])
if(ticker && (istype(ticker.mode,/datum/game_mode/heist)))
if(!warning)
user << "\red Returning to dark space will end your raid and report your success or failure. If you are sure, press the button again."
warning = 1
return
vox_move_to(/area/shuttle/vox/station)
vox_shuttle_location = "start"
else if(href_list["solars_fore_starboard"])
vox_move_to(/area/vox_station/northeast_solars)
else if(href_list["solars_fore_port"])
vox_move_to(/area/vox_station/northwest_solars)
else if(href_list["solars_aft_starboard"])
vox_move_to(/area/vox_station/southeast_solars)
else if(href_list["solars_aft_port"])
vox_move_to(/area/vox_station/southwest_solars)
else if(href_list["mining"])
vox_move_to(/area/vox_station/mining)
add_fingerprint(usr)
updateUsrDialog()
return
/obj/machinery/computer/vox_station/bullet_act(var/obj/item/projectile/Proj)
visible_message("[Proj] ricochets off [src]!")

View File

@@ -1931,7 +1931,7 @@
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)
shuttles.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")

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"

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"

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"

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"

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"

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
..()

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()