mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 02:09:41 +00:00
Adds supply shuttle datum
This commit is contained in:
@@ -1293,6 +1293,7 @@
|
|||||||
#include "code\modules\shuttles\shuttle.dm"
|
#include "code\modules\shuttles\shuttle.dm"
|
||||||
#include "code\modules\shuttles\shuttle_console.dm"
|
#include "code\modules\shuttles\shuttle_console.dm"
|
||||||
#include "code\modules\shuttles\shuttle_specops.dm"
|
#include "code\modules\shuttles\shuttle_specops.dm"
|
||||||
|
#include "code\modules\shuttles\shuttle_supply.dm"
|
||||||
#include "code\modules\shuttles\shuttles_multi.dm"
|
#include "code\modules\shuttles\shuttles_multi.dm"
|
||||||
#include "code\modules\supermatter\supermatter.dm"
|
#include "code\modules\supermatter\supermatter.dm"
|
||||||
#include "code\modules\surgery\appendix.dm"
|
#include "code\modules\surgery\appendix.dm"
|
||||||
|
|||||||
@@ -110,13 +110,22 @@
|
|||||||
update_display(line1, line2)
|
update_display(line1, line2)
|
||||||
if(4) // supply shuttle timer
|
if(4) // supply shuttle timer
|
||||||
var/line1 = "SUPPLY"
|
var/line1 = "SUPPLY"
|
||||||
var/line2
|
var/line2 = ""
|
||||||
if(supply_shuttle.moving)
|
|
||||||
|
var/datum/shuttle/ferry/supply/shuttle = supply_shuttle.get_shuttle()
|
||||||
|
if (!shuttle)
|
||||||
|
line2 = "Error"
|
||||||
|
else if(shuttle.has_eta())
|
||||||
line2 = get_supply_shuttle_timer()
|
line2 = get_supply_shuttle_timer()
|
||||||
if(lentext(line2) > CHARS_PER_LINE)
|
if(lentext(line2) > CHARS_PER_LINE)
|
||||||
line2 = "Error"
|
line2 = "Error"
|
||||||
|
else if (shuttle.moving_status == SHUTTLE_WARMUP)
|
||||||
|
if (shuttle.at_station())
|
||||||
|
line2 = "Launch"
|
||||||
|
else
|
||||||
|
line2 = "ETA"
|
||||||
else
|
else
|
||||||
if(supply_shuttle.at_station)
|
if(shuttle.at_station())
|
||||||
line2 = "Docked"
|
line2 = "Docked"
|
||||||
else
|
else
|
||||||
line1 = ""
|
line1 = ""
|
||||||
@@ -162,8 +171,12 @@
|
|||||||
return ""
|
return ""
|
||||||
|
|
||||||
proc/get_supply_shuttle_timer()
|
proc/get_supply_shuttle_timer()
|
||||||
if(supply_shuttle.moving)
|
var/datum/shuttle/ferry/supply/shuttle = supply_shuttle.get_shuttle()
|
||||||
var/timeleft = round((supply_shuttle.eta_timeofday - world.timeofday) / 10,1)
|
if (!shuttle)
|
||||||
|
return "Error"
|
||||||
|
|
||||||
|
if(shuttle.has_eta())
|
||||||
|
var/timeleft = round((shuttle.arrive_time - world.time) / 10,1)
|
||||||
if(timeleft < 0)
|
if(timeleft < 0)
|
||||||
return "Late"
|
return "Late"
|
||||||
return "[add_zero(num2text((timeleft / 60) % 60),2)]:[add_zero(num2text(timeleft % 60), 2)]"
|
return "[add_zero(num2text((timeleft / 60) % 60),2)]:[add_zero(num2text(timeleft % 60), 2)]"
|
||||||
|
|||||||
@@ -411,9 +411,11 @@
|
|||||||
|
|
||||||
if(mode==47)
|
if(mode==47)
|
||||||
var/supplyData[0]
|
var/supplyData[0]
|
||||||
supplyData["shuttle_moving"] = supply_shuttle.moving
|
var/datum/shuttle/ferry/supply/shuttle = supply_shuttle.get_shuttle()
|
||||||
supplyData["shuttle_eta"] = supply_shuttle.eta
|
if (shuttle)
|
||||||
supplyData["shuttle_loc"] = supply_shuttle.at_station ? "Station" : "Dock"
|
supplyData["shuttle_moving"] = shuttle.has_eta()
|
||||||
|
supplyData["shuttle_eta"] = shuttle.eta_minutes()
|
||||||
|
supplyData["shuttle_loc"] = shuttle.at_station() ? "Station" : "Dock"
|
||||||
var/supplyOrderCount = 0
|
var/supplyOrderCount = 0
|
||||||
var/supplyOrderData[0]
|
var/supplyOrderData[0]
|
||||||
for(var/S in supply_shuttle.shoppinglist)
|
for(var/S in supply_shuttle.shoppinglist)
|
||||||
|
|||||||
@@ -142,15 +142,23 @@ var/list/mechtoys = list(
|
|||||||
var/list/requestlist = list()
|
var/list/requestlist = list()
|
||||||
var/list/supply_packs = list()
|
var/list/supply_packs = list()
|
||||||
//shuttle movement
|
//shuttle movement
|
||||||
var/at_station = 0
|
|
||||||
var/movetime = 1200
|
var/movetime = 1200
|
||||||
var/moving = 0
|
var/shuttle_tag = "Supply"
|
||||||
var/eta_timeofday
|
|
||||||
var/eta
|
|
||||||
|
|
||||||
New()
|
New()
|
||||||
ordernum = rand(1,9000)
|
ordernum = rand(1,9000)
|
||||||
|
|
||||||
|
proc/get_shuttle()
|
||||||
|
if (!shuttles || !(shuttle_tag in shuttles))
|
||||||
|
return null
|
||||||
|
|
||||||
|
var/datum/shuttle/ferry/supply/shuttle = shuttles[shuttle_tag]
|
||||||
|
|
||||||
|
if (!istype(shuttle))
|
||||||
|
return null
|
||||||
|
|
||||||
|
return shuttle
|
||||||
|
|
||||||
//Supply shuttle ticker - handles supply point regenertion and shuttle travelling between centcomm and the station
|
//Supply shuttle ticker - handles supply point regenertion and shuttle travelling between centcomm and the station
|
||||||
proc/process()
|
proc/process()
|
||||||
for(var/typepath in (typesof(/datum/supply_packs) - /datum/supply_packs))
|
for(var/typepath in (typesof(/datum/supply_packs) - /datum/supply_packs))
|
||||||
@@ -163,32 +171,13 @@ var/list/mechtoys = list(
|
|||||||
if(processing)
|
if(processing)
|
||||||
iteration++
|
iteration++
|
||||||
points += points_per_process
|
points += points_per_process
|
||||||
|
|
||||||
if(moving == 1)
|
var/datum/shuttle/ferry/supply/shuttle = get_shuttle()
|
||||||
var/ticksleft = (eta_timeofday - world.timeofday)
|
if (shuttle)
|
||||||
if(ticksleft > 0)
|
shuttle.process_shuttle()
|
||||||
eta = round(ticksleft/600,1)
|
|
||||||
else
|
|
||||||
eta = 0
|
|
||||||
var/datum/shuttle/S = shuttles["Supply"]
|
|
||||||
if (istype(S)) S.move()
|
|
||||||
moving = 0
|
|
||||||
at_station = !at_station
|
|
||||||
|
|
||||||
sleep(processing_interval)
|
sleep(processing_interval)
|
||||||
|
|
||||||
//Check whether the shuttle is allowed to move
|
|
||||||
proc/can_move()
|
|
||||||
if(moving) return 0
|
|
||||||
|
|
||||||
var/area/shuttle = locate(/area/supply/station)
|
|
||||||
if(!shuttle) return 0
|
|
||||||
|
|
||||||
if(forbidden_atoms_check(shuttle))
|
|
||||||
return 0
|
|
||||||
|
|
||||||
return 1
|
|
||||||
|
|
||||||
//To stop things being sent to centcomm which should not be sent to centcomm. Recursively checks for these types.
|
//To stop things being sent to centcomm which should not be sent to centcomm. Recursively checks for these types.
|
||||||
proc/forbidden_atoms_check(atom/A)
|
proc/forbidden_atoms_check(atom/A)
|
||||||
if(istype(A,/mob/living))
|
if(istype(A,/mob/living))
|
||||||
@@ -207,11 +196,10 @@ var/list/mechtoys = list(
|
|||||||
|
|
||||||
//Sellin
|
//Sellin
|
||||||
proc/sell()
|
proc/sell()
|
||||||
var/shuttle_at
|
var/datum/shuttle/ferry/supply/shuttle_datum = get_shuttle()
|
||||||
if(at_station) shuttle_at = SUPPLY_STATION_AREATYPE
|
if (!shuttle_datum) return
|
||||||
else shuttle_at = SUPPLY_DOCK_AREATYPE
|
|
||||||
|
|
||||||
var/area/shuttle = locate(shuttle_at)
|
var/area/shuttle = shuttle_datum.get_location_area()
|
||||||
if(!shuttle) return
|
if(!shuttle) return
|
||||||
|
|
||||||
var/phoron_count = 0
|
var/phoron_count = 0
|
||||||
@@ -259,11 +247,10 @@ var/list/mechtoys = list(
|
|||||||
proc/buy()
|
proc/buy()
|
||||||
if(!shoppinglist.len) return
|
if(!shoppinglist.len) return
|
||||||
|
|
||||||
var/shuttle_at
|
var/datum/shuttle/ferry/supply/shuttle_datum = get_shuttle()
|
||||||
if(at_station) shuttle_at = SUPPLY_STATION_AREATYPE
|
if (!shuttle_datum) return
|
||||||
else shuttle_at = SUPPLY_DOCK_AREATYPE
|
|
||||||
|
|
||||||
var/area/shuttle = locate(shuttle_at)
|
var/area/shuttle = shuttle_datum.get_location_area()
|
||||||
if(!shuttle) return
|
if(!shuttle) return
|
||||||
|
|
||||||
var/list/clear_turfs = list()
|
var/list/clear_turfs = list()
|
||||||
@@ -290,7 +277,7 @@ var/list/mechtoys = list(
|
|||||||
slip.info = "<h3>[command_name()] Shipping Manifest</h3><hr><br>"
|
slip.info = "<h3>[command_name()] Shipping Manifest</h3><hr><br>"
|
||||||
slip.info +="Order #[SO.ordernum]<br>"
|
slip.info +="Order #[SO.ordernum]<br>"
|
||||||
slip.info +="Destination: [station_name]<br>"
|
slip.info +="Destination: [station_name]<br>"
|
||||||
slip.info +="[supply_shuttle.shoppinglist.len] PACKAGES IN THIS SHIPMENT<br>"
|
slip.info +="[shoppinglist.len] PACKAGES IN THIS SHIPMENT<br>"
|
||||||
slip.info +="CONTENTS:<br><ul>"
|
slip.info +="CONTENTS:<br><ul>"
|
||||||
|
|
||||||
//spawn the stuff, finish generating the manifest while you're at it
|
//spawn the stuff, finish generating the manifest while you're at it
|
||||||
@@ -319,7 +306,7 @@ var/list/mechtoys = list(
|
|||||||
slip.info += "CHECK CONTENTS AND STAMP BELOW THE LINE TO CONFIRM RECEIPT OF GOODS<hr>"
|
slip.info += "CHECK CONTENTS AND STAMP BELOW THE LINE TO CONFIRM RECEIPT OF GOODS<hr>"
|
||||||
if (SP.contraband) slip.loc = null //we are out of blanks for Form #44-D Ordering Illicit Drugs.
|
if (SP.contraband) slip.loc = null //we are out of blanks for Form #44-D Ordering Illicit Drugs.
|
||||||
|
|
||||||
supply_shuttle.shoppinglist.Cut()
|
shoppinglist.Cut()
|
||||||
return
|
return
|
||||||
|
|
||||||
/obj/item/weapon/paper/manifest
|
/obj/item/weapon/paper/manifest
|
||||||
@@ -346,9 +333,11 @@ var/list/mechtoys = list(
|
|||||||
if(temp)
|
if(temp)
|
||||||
dat = temp
|
dat = temp
|
||||||
else
|
else
|
||||||
dat += {"<BR><B>Supply shuttle</B><HR>
|
var/datum/shuttle/ferry/supply/shuttle = supply_shuttle.get_shuttle()
|
||||||
Location: [supply_shuttle.moving ? "Moving to station ([supply_shuttle.eta] Mins.)":supply_shuttle.at_station ? "Station":"Dock"]<BR>
|
if (shuttle)
|
||||||
<HR>Supply points: [supply_shuttle.points]<BR>
|
dat += {"<BR><B>Supply shuttle</B><HR>
|
||||||
|
Location: [shuttle.has_eta() ? "Moving to station ([shuttle.eta_minutes()] Mins.)":shuttle.at_station() ? "Docked":"Away"]<BR>
|
||||||
|
<HR>Supply points: [supply_shuttle.points]<BR>
|
||||||
<BR>\n<A href='?src=\ref[src];order=categories'>Request items</A><BR><BR>
|
<BR>\n<A href='?src=\ref[src];order=categories'>Request items</A><BR><BR>
|
||||||
<A href='?src=\ref[src];vieworders=1'>View approved orders</A><BR><BR>
|
<A href='?src=\ref[src];vieworders=1'>View approved orders</A><BR><BR>
|
||||||
<A href='?src=\ref[src];viewrequests=1'>View requests</A><BR><BR>
|
<A href='?src=\ref[src];viewrequests=1'>View requests</A><BR><BR>
|
||||||
@@ -471,14 +460,48 @@ var/list/mechtoys = list(
|
|||||||
if (temp)
|
if (temp)
|
||||||
dat = temp
|
dat = temp
|
||||||
else
|
else
|
||||||
dat += {"<BR><B>Supply shuttle</B><HR>
|
var/datum/shuttle/ferry/supply/shuttle = supply_shuttle.get_shuttle()
|
||||||
\nLocation: [supply_shuttle.moving ? "Moving to station ([supply_shuttle.eta] Mins.)":supply_shuttle.at_station ? "Station":"Away"]<BR>
|
if (shuttle)
|
||||||
<HR>\nSupply points: [supply_shuttle.points]<BR>\n<BR>
|
dat += "<BR><B>Supply shuttle</B><HR>"
|
||||||
[supply_shuttle.moving ? "\n*Must be away to order items*<BR>\n<BR>":supply_shuttle.at_station ? "\n*Must be away to order items*<BR>\n<BR>":"\n<A href='?src=\ref[src];order=categories'>Order items</A><BR>\n<BR>"]
|
dat += "\nLocation: "
|
||||||
[supply_shuttle.moving ? "\n*Shuttle already called*<BR>\n<BR>":supply_shuttle.at_station ? "\n<A href='?src=\ref[src];send=1'>Send away</A><BR>\n<BR>":"\n<A href='?src=\ref[src];send=1'>Send to station</A><BR>\n<BR>"]
|
if (shuttle.has_eta())
|
||||||
|
dat += "In transit ([shuttle.eta_minutes()] Mins.)<BR>"
|
||||||
|
else
|
||||||
|
if (shuttle.at_station())
|
||||||
|
if (shuttle.docking_controller)
|
||||||
|
switch(shuttle.docking_controller.get_docking_status())
|
||||||
|
if ("docked") dat += "Docked at station<BR>"
|
||||||
|
if ("undocked") dat += "Undocked from station<BR>"
|
||||||
|
if ("docking") dat += "Docking with station [shuttle.can_force()? "<span class='warning'><A href='?src=\ref[src];force_send=1'>OVERRIDE</A></span>" : ""]<BR>"
|
||||||
|
if ("undocking") dat += "Undocking from station [shuttle.can_force()? "<span class='warning'><A href='?src=\ref[src];force_send=1'>OVERRIDE</A></span>" : ""]<BR>"
|
||||||
|
else
|
||||||
|
dat += "Station<BR>"
|
||||||
|
|
||||||
|
if (shuttle.can_launch())
|
||||||
|
dat += "<A href='?src=\ref[src];send=1'>Send away</A>"
|
||||||
|
else if (shuttle.can_cancel())
|
||||||
|
dat += "<A href='?src=\ref[src];cancel_send=1'>Cancel launch</A>"
|
||||||
|
else
|
||||||
|
dat += "*Shuttle is busy*"
|
||||||
|
dat += "<BR>\n<BR>"
|
||||||
|
else
|
||||||
|
dat += "Away<BR>"
|
||||||
|
if (shuttle.can_launch())
|
||||||
|
dat += "<A href='?src=\ref[src];send=1'>Request supply shuttle</A>"
|
||||||
|
else if (shuttle.can_cancel())
|
||||||
|
dat += "<A href='?src=\ref[src];cancel_send=1'>Cancel request</A>"
|
||||||
|
else
|
||||||
|
dat += "*Shuttle is busy*"
|
||||||
|
dat += "<BR>\n<BR>"
|
||||||
|
|
||||||
|
|
||||||
|
dat += {"<HR>\nSupply points: [supply_shuttle.points]<BR>\n<BR>
|
||||||
|
// [shuttle.at_station() ? "\n*Must be away to order items*<BR>\n<BR>":"\n<A href='?src=\ref[src];order=categories'>Order items</A><BR>\n<BR>"]
|
||||||
|
\n<A href='?src=\ref[src];order=categories'>Order items</A><BR>\n<BR>
|
||||||
\n<A href='?src=\ref[src];viewrequests=1'>View requests</A><BR>\n<BR>
|
\n<A href='?src=\ref[src];viewrequests=1'>View requests</A><BR>\n<BR>
|
||||||
\n<A href='?src=\ref[src];vieworders=1'>View orders</A><BR>\n<BR>
|
\n<A href='?src=\ref[src];vieworders=1'>View orders</A><BR>\n<BR>
|
||||||
\n<A href='?src=\ref[user];mach_close=computer'>Close</A>"}
|
\n<A href='?src=\ref[user];mach_close=computer'>Close</A>"}
|
||||||
|
|
||||||
|
|
||||||
user << browse(dat, "window=computer;size=575x450")
|
user << browse(dat, "window=computer;size=575x450")
|
||||||
onclose(user, "computer")
|
onclose(user, "computer")
|
||||||
@@ -497,6 +520,10 @@ var/list/mechtoys = list(
|
|||||||
if(!supply_shuttle)
|
if(!supply_shuttle)
|
||||||
world.log << "## ERROR: Eek. The supply_shuttle controller datum is missing somehow."
|
world.log << "## ERROR: Eek. The supply_shuttle controller datum is missing somehow."
|
||||||
return
|
return
|
||||||
|
var/datum/shuttle/ferry/supply/shuttle = supply_shuttle.get_shuttle()
|
||||||
|
if (!shuttle)
|
||||||
|
world.log << "## ERROR: Eek. The supply/shuttle datum is missing somehow."
|
||||||
|
return
|
||||||
if(..())
|
if(..())
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -505,28 +532,25 @@ var/list/mechtoys = list(
|
|||||||
|
|
||||||
//Calling the shuttle
|
//Calling the shuttle
|
||||||
if(href_list["send"])
|
if(href_list["send"])
|
||||||
if(!supply_shuttle.can_move())
|
if(shuttle.at_station())
|
||||||
temp = "For safety reasons the automated supply shuttle cannot transport live organisms, classified nuclear weaponry or homing beacons.<BR><BR><A href='?src=\ref[src];mainmenu=1'>OK</A>"
|
if (shuttle.forbidden_atoms_check())
|
||||||
|
temp = "For safety reasons the automated supply shuttle cannot transport live organisms, classified nuclear weaponry or homing beacons.<BR><BR><A href='?src=\ref[src];mainmenu=1'>OK</A>"
|
||||||
else if(supply_shuttle.at_station)
|
else
|
||||||
supply_shuttle.moving = -1
|
shuttle.launch(src)
|
||||||
supply_shuttle.sell()
|
temp = "Initiating launch sequence.<BR><BR><A href='?src=\ref[src];mainmenu=1'>OK</A>"
|
||||||
supply_shuttle.moving = 0
|
|
||||||
supply_shuttle.at_station = !supply_shuttle.at_station
|
|
||||||
|
|
||||||
var/datum/shuttle/S = shuttles["Supply"]
|
|
||||||
if (istype(S)) S.move()
|
|
||||||
|
|
||||||
temp = "The supply shuttle has departed.<BR><BR><A href='?src=\ref[src];mainmenu=1'>OK</A>"
|
|
||||||
else
|
else
|
||||||
supply_shuttle.moving = 1
|
shuttle.launch(src)
|
||||||
supply_shuttle.buy()
|
temp = "The supply shuttle has been called and will arrive in approximately [round(supply_shuttle.movetime/600,1)] minutes.<BR><BR><A href='?src=\ref[src];mainmenu=1'>OK</A>"
|
||||||
supply_shuttle.eta_timeofday = (world.timeofday + supply_shuttle.movetime) % 864000
|
|
||||||
temp = "The supply shuttle has been called and will arrive in [round(supply_shuttle.movetime/600,1)] minutes.<BR><BR><A href='?src=\ref[src];mainmenu=1'>OK</A>"
|
|
||||||
post_signal("supply")
|
post_signal("supply")
|
||||||
|
|
||||||
|
if (href_list["force_send"])
|
||||||
|
shuttle.force_launch(src)
|
||||||
|
|
||||||
|
if (href_list["cancel_send"])
|
||||||
|
shuttle.cancel_launch(src)
|
||||||
|
|
||||||
else if (href_list["order"])
|
else if (href_list["order"])
|
||||||
if(supply_shuttle.moving) return
|
//if(!shuttle.idle()) return //this shouldn't be necessary it seems
|
||||||
if(href_list["order"] == "categories")
|
if(href_list["order"] == "categories")
|
||||||
//all_supply_groups
|
//all_supply_groups
|
||||||
//Request what?
|
//Request what?
|
||||||
@@ -651,7 +675,7 @@ var/list/mechtoys = list(
|
|||||||
temp = "Current requests: <BR><BR>"
|
temp = "Current requests: <BR><BR>"
|
||||||
for(var/S in supply_shuttle.requestlist)
|
for(var/S in supply_shuttle.requestlist)
|
||||||
var/datum/supply_order/SO = S
|
var/datum/supply_order/SO = S
|
||||||
temp += "#[SO.ordernum] - [SO.object.name] requested by [SO.orderedby] [supply_shuttle.moving ? "":supply_shuttle.at_station ? "":"<A href='?src=\ref[src];confirmorder=[SO.ordernum]'>Approve</A> <A href='?src=\ref[src];rreq=[SO.ordernum]'>Remove</A>"]<BR>"
|
temp += "#[SO.ordernum] - [SO.object.name] requested by [SO.orderedby] [shuttle.idle() ? "":shuttle.at_station() ? "":"<A href='?src=\ref[src];confirmorder=[SO.ordernum]'>Approve</A> <A href='?src=\ref[src];rreq=[SO.ordernum]'>Remove</A>"]<BR>"
|
||||||
|
|
||||||
temp += "<BR><A href='?src=\ref[src];clearreq=1'>Clear list</A>"
|
temp += "<BR><A href='?src=\ref[src];clearreq=1'>Clear list</A>"
|
||||||
temp += "<BR><A href='?src=\ref[src];mainmenu=1'>OK</A>"
|
temp += "<BR><A href='?src=\ref[src];mainmenu=1'>OK</A>"
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
//These lists are populated in /datum/shuttle_controller/New()
|
//These lists are populated in /datum/shuttle_controller/New()
|
||||||
//Shuttle controller is instantiated in master_controller.dm.
|
//Shuttle controller is instantiated in master_controller.dm.
|
||||||
|
|
||||||
#define SHUTTLE_IDLE 0
|
//shuttle moving state defines are in setup.dm
|
||||||
#define SHUTTLE_WARMUP 1
|
|
||||||
#define SHUTTLE_INTRANSIT 2
|
|
||||||
|
|
||||||
var/global/list/shuttles
|
var/global/list/shuttles
|
||||||
|
|
||||||
@@ -128,7 +126,7 @@ var/global/list/shuttles
|
|||||||
var/datum/shuttle/ferry/shuttle
|
var/datum/shuttle/ferry/shuttle
|
||||||
|
|
||||||
//Supply and escape shuttles.
|
//Supply and escape shuttles.
|
||||||
shuttle = new()
|
shuttle = new/datum/shuttle/ferry/supply()
|
||||||
shuttle.location = 1
|
shuttle.location = 1
|
||||||
shuttle.area_offsite = locate(/area/supply/dock)
|
shuttle.area_offsite = locate(/area/supply/dock)
|
||||||
shuttle.area_station = locate(/area/supply/station)
|
shuttle.area_station = locate(/area/supply/station)
|
||||||
|
|||||||
@@ -22,9 +22,9 @@
|
|||||||
return
|
return
|
||||||
|
|
||||||
if(!destination)
|
if(!destination)
|
||||||
destination = (location == 1 ? area_station : area_offsite)
|
destination = get_location_area(!location)
|
||||||
if(!origin)
|
if(!origin)
|
||||||
origin = (location == 1 ? area_offsite : area_station)
|
origin = get_location_area(location)
|
||||||
|
|
||||||
..(origin, destination)
|
..(origin, destination)
|
||||||
|
|
||||||
@@ -33,23 +33,31 @@
|
|||||||
return
|
return
|
||||||
|
|
||||||
if(!destination)
|
if(!destination)
|
||||||
destination = (location == 1 ? area_station : area_offsite)
|
destination = get_location_area(!location)
|
||||||
if(!departing)
|
if(!departing)
|
||||||
departing = (location == 1 ? area_offsite : area_station)
|
departing = get_location_area(location)
|
||||||
|
|
||||||
..(departing, destination, interim, travel_time)
|
..(departing, destination, interim, travel_time)
|
||||||
|
|
||||||
/datum/shuttle/ferry/move(var/area/origin,var/area/destination)
|
/datum/shuttle/ferry/move(var/area/origin,var/area/destination)
|
||||||
if(!destination)
|
if(!destination)
|
||||||
destination = (location == 1 ? area_station : area_offsite)
|
destination = get_location_area(!location)
|
||||||
if(!origin)
|
if(!origin)
|
||||||
origin = (location == 1 ? area_offsite : area_station)
|
origin = get_location_area(location)
|
||||||
|
|
||||||
if (docking_controller && !docking_controller.undocked())
|
if (docking_controller && !docking_controller.undocked())
|
||||||
docking_controller.force_undock()
|
docking_controller.force_undock()
|
||||||
..(origin, destination)
|
..(origin, destination)
|
||||||
location = !location
|
location = !location
|
||||||
|
|
||||||
|
/datum/shuttle/ferry/proc/get_location_area(location_id = null)
|
||||||
|
if (isnull(location_id))
|
||||||
|
location_id = location
|
||||||
|
|
||||||
|
if (!location_id)
|
||||||
|
return area_station
|
||||||
|
return area_offsite
|
||||||
|
|
||||||
/datum/shuttle/ferry/proc/process_shuttle()
|
/datum/shuttle/ferry/proc/process_shuttle()
|
||||||
switch(process_state)
|
switch(process_state)
|
||||||
if (WAIT_LAUNCH)
|
if (WAIT_LAUNCH)
|
||||||
|
|||||||
76
code/modules/shuttles/shuttle_supply.dm
Normal file
76
code/modules/shuttles/shuttle_supply.dm
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/datum/shuttle/ferry/supply
|
||||||
|
var/away_location = 1 //the location to hide at while pretending to be in-transit
|
||||||
|
var/arrive_time = 0
|
||||||
|
|
||||||
|
/datum/shuttle/ferry/supply/short_jump(var/area/origin,var/area/destination)
|
||||||
|
if(moving_status != SHUTTLE_IDLE)
|
||||||
|
return
|
||||||
|
|
||||||
|
if(isnull(location))
|
||||||
|
return
|
||||||
|
|
||||||
|
if(!destination)
|
||||||
|
destination = get_location_area(!location)
|
||||||
|
if(!origin)
|
||||||
|
origin = get_location_area(location)
|
||||||
|
|
||||||
|
if (!at_station()) //at centcom
|
||||||
|
supply_shuttle.buy()
|
||||||
|
|
||||||
|
//it would be cool to play a sound here
|
||||||
|
moving_status = SHUTTLE_WARMUP
|
||||||
|
spawn(warmup_time*10)
|
||||||
|
if (moving_status == SHUTTLE_IDLE)
|
||||||
|
return //someone cancelled the launch
|
||||||
|
|
||||||
|
if (at_station() && forbidden_atoms_check())
|
||||||
|
//cancel the launch because of forbidden atoms. announce over supply channel?
|
||||||
|
return
|
||||||
|
|
||||||
|
//We pretend it's a long_jump by making the shuttle stay at centcom for the "in-transit" period.
|
||||||
|
var/area/away_area = get_location_area(away_location)
|
||||||
|
if (origin == away_area)
|
||||||
|
moving_status = SHUTTLE_INTRANSIT //pretend
|
||||||
|
else
|
||||||
|
move(origin, away_area)
|
||||||
|
|
||||||
|
//wait ETA here.
|
||||||
|
arrive_time = world.time + supply_shuttle.movetime
|
||||||
|
while (world.time <= arrive_time)
|
||||||
|
sleep(5)
|
||||||
|
|
||||||
|
if (destination != away_area)
|
||||||
|
move(away_area, destination)
|
||||||
|
|
||||||
|
moving_status = SHUTTLE_IDLE
|
||||||
|
|
||||||
|
if (!at_station()) //at centcom
|
||||||
|
supply_shuttle.sell()
|
||||||
|
|
||||||
|
// returns 1 if the supply shuttle should be prevented from moving because it contains forbidden atoms
|
||||||
|
/datum/shuttle/ferry/supply/proc/forbidden_atoms_check()
|
||||||
|
if (!at_station())
|
||||||
|
return 0 //if badmins want to send mobs or a nuke on the supply shuttle from centcom we don't care
|
||||||
|
|
||||||
|
return supply_shuttle.forbidden_atoms_check(get_location_area())
|
||||||
|
|
||||||
|
/datum/shuttle/ferry/supply/proc/at_station()
|
||||||
|
return (!location)
|
||||||
|
|
||||||
|
//returns 1 if the shuttle is moving and we can show valid ETAs
|
||||||
|
/datum/shuttle/ferry/supply/proc/has_eta()
|
||||||
|
return (moving_status == SHUTTLE_INTRANSIT)
|
||||||
|
|
||||||
|
//returns 1 if the shuttle is idle and we can still mess with the cargo shopping list
|
||||||
|
/datum/shuttle/ferry/supply/proc/idle()
|
||||||
|
return (moving_status == SHUTTLE_IDLE)
|
||||||
|
|
||||||
|
//returns the ETA in minutes
|
||||||
|
/datum/shuttle/ferry/supply/proc/eta_minutes()
|
||||||
|
var/ticksleft = arrive_time - world.time
|
||||||
|
return round(ticksleft/600,1)
|
||||||
@@ -761,3 +761,8 @@ var/list/RESTRICTED_CAMERA_NETWORKS = list( //Those networks can only be accesse
|
|||||||
#define COLOR_YELLOW "#FFFF00"
|
#define COLOR_YELLOW "#FFFF00"
|
||||||
#define COLOR_ORANGE "#FF9900"
|
#define COLOR_ORANGE "#FF9900"
|
||||||
#define COLOR_WHITE "#FFFFFF"
|
#define COLOR_WHITE "#FFFFFF"
|
||||||
|
|
||||||
|
//Shuttle moving status
|
||||||
|
#define SHUTTLE_IDLE 0
|
||||||
|
#define SHUTTLE_WARMUP 1
|
||||||
|
#define SHUTTLE_INTRANSIT 2
|
||||||
Reference in New Issue
Block a user