Merge pull request #5301 from mwerezak/cargo-shuttle2

Docking Controllers Stage 3: Cargo Shuttle
This commit is contained in:
Zuhayr
2014-06-19 21:08:29 +09:30
12 changed files with 289 additions and 147 deletions

View File

@@ -1,7 +1,7 @@
//TODO: rewrite and standardise all controller datums to the datum/controller type
//TODO: allow all controllers to be deleted for clean restarts (see WIP master controller stuff) - MC done - lighting done
/client/proc/restart_controller(controller in list("Master","Failsafe","Lighting","Supply Shuttle"))
/client/proc/restart_controller(controller in list("Master","Failsafe","Lighting","Supply"))
set category = "Debug"
set name = "Restart Controller"
set desc = "Restart one of the various periodic loop controllers for the game (be careful!)"
@@ -21,14 +21,14 @@
new /datum/controller/lighting()
lighting_controller.process()
feedback_add_details("admin_verb","RLighting")
if("Supply Shuttle")
supply_shuttle.process()
if("Supply")
supply_controller.process()
feedback_add_details("admin_verb","RSupply")
message_admins("Admin [key_name_admin(usr)] has restarted the [controller] controller.")
return
/client/proc/debug_controller(controller in list("Master","Failsafe","Ticker","Lighting","Air","Jobs","Sun","Radio","Supply Shuttle","Emergency Shuttle","Configuration","pAI", "Cameras", "Transfer Controller"))
/client/proc/debug_controller(controller in list("Master","Failsafe","Ticker","Lighting","Air","Jobs","Sun","Radio","Supply","Emergency Shuttle","Configuration","pAI", "Cameras", "Transfer Controller"))
set category = "Debug"
set name = "Debug Controller"
set desc = "Debug the various periodic loop controllers for the game (be careful!)"
@@ -59,8 +59,8 @@
if("Radio")
debug_variables(radio_controller)
feedback_add_details("admin_verb","DRadio")
if("Supply Shuttle")
debug_variables(supply_shuttle)
if("Supply")
debug_variables(supply_controller)
feedback_add_details("admin_verb","DSupply")
if("Emergency Shuttle")
debug_variables(emergency_shuttle)

View File

@@ -129,7 +129,7 @@ var/global/datum/controller/gameticker/ticker
//here to initialize the random events nicely at round start
setup_economy()
setup_shuttle_docks()
spawn(0)//Forking here so we dont have to wait for this to finish
@@ -154,7 +154,7 @@ var/global/datum/controller/gameticker/ticker
if(admins_number == 0)
send2adminirc("Round has started with no admins online.")
supply_shuttle.process() //Start the supply shuttle regenerating points -- TLE
supply_controller.process() //Start the supply shuttle regenerating points -- TLE
master_controller.process() //Start master_controller.process()
lighting_controller.process() //Start processing DynamicAreaLighting updates
@@ -320,7 +320,7 @@ var/global/datum/controller/gameticker/ticker
else
game_finished = (mode.check_finished() || (emergency_shuttle.location == 2 && emergency_shuttle.alert == 1))
mode_finished = game_finished
if(!mode.explosion_in_progress && game_finished && (mode_finished || post_game))
current_state = GAME_STATE_FINISHED
@@ -351,17 +351,17 @@ var/global/datum/controller/gameticker/ticker
world << "\blue <B>An admin has delayed the round end</B>"
else
world << "\blue <B>An admin has delayed the round end</B>"
else if (mode_finished)
post_game = 1
mode.cleanup()
//call a transfer shuttle vote
spawn(50)
world << "\red The round has ended!"
vote.autotransfer()
return 1
proc/getfactionbyname(var/name)

View File

@@ -110,13 +110,22 @@
update_display(line1, line2)
if(4) // supply shuttle timer
var/line1 = "SUPPLY"
var/line2
if(supply_shuttle.moving)
var/line2 = ""
var/datum/shuttle/ferry/supply/shuttle = supply_controller.get_shuttle()
if (!shuttle)
line2 = "Error"
else if(shuttle.has_eta())
line2 = get_supply_shuttle_timer()
if(lentext(line2) > CHARS_PER_LINE)
line2 = "Error"
else if (shuttle.moving_status == SHUTTLE_WARMUP)
if (shuttle.at_station())
line2 = "Launch"
else
line2 = "ETA"
else
if(supply_shuttle.at_station)
if(shuttle.at_station())
line2 = "Docked"
else
line1 = ""
@@ -162,8 +171,12 @@
return ""
proc/get_supply_shuttle_timer()
if(supply_shuttle.moving)
var/timeleft = round((supply_shuttle.eta_timeofday - world.timeofday) / 10,1)
var/datum/shuttle/ferry/supply/shuttle = supply_controller.get_shuttle()
if (!shuttle)
return "Error"
if(shuttle.has_eta())
var/timeleft = round((shuttle.arrive_time - world.time) / 10,1)
if(timeleft < 0)
return "Late"
return "[add_zero(num2text((timeleft / 60) % 60),2)]:[add_zero(num2text(timeleft % 60), 2)]"

View File

@@ -411,12 +411,14 @@
if(mode==47)
var/supplyData[0]
supplyData["shuttle_moving"] = supply_shuttle.moving
supplyData["shuttle_eta"] = supply_shuttle.eta
supplyData["shuttle_loc"] = supply_shuttle.at_station ? "Station" : "Dock"
var/datum/shuttle/ferry/supply/shuttle = supply_controller.get_shuttle()
if (shuttle)
supplyData["shuttle_moving"] = shuttle.has_eta()
supplyData["shuttle_eta"] = shuttle.eta_minutes()
supplyData["shuttle_loc"] = shuttle.at_station() ? "Station" : "Dock"
var/supplyOrderCount = 0
var/supplyOrderData[0]
for(var/S in supply_shuttle.shoppinglist)
for(var/S in supply_controller.shoppinglist)
var/datum/supply_order/SO = S
supplyOrderData[++supplyOrderData.len] = list("Number" = SO.ordernum, "Name" = html_encode(SO.object.name), "ApprovedBy" = SO.orderedby, "Comment" = html_encode(SO.comment))
@@ -428,7 +430,7 @@
var/requestCount = 0
var/requestData[0]
for(var/S in supply_shuttle.requestlist)
for(var/S in supply_controller.requestlist)
var/datum/supply_order/SO = S
requestCount++
requestData[++requestData.len] = list("Number" = SO.ordernum, "Name" = html_encode(SO.object.name), "OrderedBy" = SO.orderedby, "Comment" = html_encode(SO.comment))

View File

@@ -4,7 +4,7 @@
#define SUPPLY_STATION_AREATYPE "/area/supply/station" //Type of the supply shuttle area for station
#define SUPPLY_DOCK_AREATYPE "/area/supply/dock" //Type of the supply shuttle area for dock
var/datum/controller/supply_shuttle/supply_shuttle = new()
var/datum/controller/supply/supply_controller = new()
var/list/mechtoys = list(
/obj/item/toy/prize/ripley,
@@ -125,7 +125,7 @@ var/list/mechtoys = list(
var/orderedby = null
var/comment = null
/datum/controller/supply_shuttle
/datum/controller/supply
var/processing = 1
var/processing_interval = 300
var/iteration = 0
@@ -142,15 +142,23 @@ var/list/mechtoys = list(
var/list/requestlist = list()
var/list/supply_packs = list()
//shuttle movement
var/at_station = 0
var/movetime = 1200
var/moving = 0
var/eta_timeofday
var/eta
var/shuttle_tag = "Supply"
New()
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
proc/process()
for(var/typepath in (typesof(/datum/supply_packs) - /datum/supply_packs))
@@ -164,30 +172,17 @@ var/list/mechtoys = list(
iteration++
points += points_per_process
if(moving == 1)
var/ticksleft = (eta_timeofday - world.timeofday)
if(ticksleft > 0)
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)
//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
spawn(0)
set background = 1
while(1)
if(processing)
var/datum/shuttle/ferry/supply/shuttle = get_shuttle()
if (shuttle && shuttle.in_use)
shuttle.process_shuttle()
sleep(10)
//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)
@@ -207,11 +202,10 @@ var/list/mechtoys = list(
//Sellin
proc/sell()
var/shuttle_at
if(at_station) shuttle_at = SUPPLY_STATION_AREATYPE
else shuttle_at = SUPPLY_DOCK_AREATYPE
var/datum/shuttle/ferry/supply/shuttle_datum = get_shuttle()
if (!shuttle_datum) return
var/area/shuttle = locate(shuttle_at)
var/area/shuttle = shuttle_datum.get_location_area()
if(!shuttle) return
var/phoron_count = 0
@@ -259,11 +253,10 @@ var/list/mechtoys = list(
proc/buy()
if(!shoppinglist.len) return
var/shuttle_at
if(at_station) shuttle_at = SUPPLY_STATION_AREATYPE
else shuttle_at = SUPPLY_DOCK_AREATYPE
var/datum/shuttle/ferry/supply/shuttle_datum = get_shuttle()
if (!shuttle_datum) return
var/area/shuttle = locate(shuttle_at)
var/area/shuttle = shuttle_datum.get_location_area()
if(!shuttle) return
var/list/clear_turfs = list()
@@ -290,7 +283,7 @@ var/list/mechtoys = list(
slip.info = "<h3>[command_name()] Shipping Manifest</h3><hr><br>"
slip.info +="Order #[SO.ordernum]<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>"
//spawn the stuff, finish generating the manifest while you're at it
@@ -319,7 +312,7 @@ var/list/mechtoys = list(
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.
supply_shuttle.shoppinglist.Cut()
shoppinglist.Cut()
return
/obj/item/weapon/paper/manifest
@@ -346,9 +339,11 @@ var/list/mechtoys = list(
if(temp)
dat = temp
else
dat += {"<BR><B>Supply shuttle</B><HR>
Location: [supply_shuttle.moving ? "Moving to station ([supply_shuttle.eta] Mins.)":supply_shuttle.at_station ? "Station":"Dock"]<BR>
<HR>Supply points: [supply_shuttle.points]<BR>
var/datum/shuttle/ferry/supply/shuttle = supply_controller.get_shuttle()
if (shuttle)
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_controller.points]<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];viewrequests=1'>View requests</A><BR><BR>
@@ -370,18 +365,18 @@ var/list/mechtoys = list(
//all_supply_groups
//Request what?
last_viewed_group = "categories"
temp = "<b>Supply points: [supply_shuttle.points]</b><BR>"
temp = "<b>Supply points: [supply_controller.points]</b><BR>"
temp += "<A href='?src=\ref[src];mainmenu=1'>Main Menu</A><HR><BR><BR>"
temp += "<b>Select a category</b><BR><BR>"
for(var/supply_group_name in all_supply_groups )
temp += "<A href='?src=\ref[src];order=[supply_group_name]'>[supply_group_name]</A><BR>"
else
last_viewed_group = href_list["order"]
temp = "<b>Supply points: [supply_shuttle.points]</b><BR>"
temp = "<b>Supply points: [supply_controller.points]</b><BR>"
temp += "<A href='?src=\ref[src];order=categories'>Back to all categories</A><HR><BR><BR>"
temp += "<b>Request from: [last_viewed_group]</b><BR><BR>"
for(var/supply_name in supply_shuttle.supply_packs )
var/datum/supply_packs/N = supply_shuttle.supply_packs[supply_name]
for(var/supply_name in supply_controller.supply_packs )
var/datum/supply_packs/N = supply_controller.supply_packs[supply_name]
if(N.hidden || N.contraband || N.group != last_viewed_group) continue //Have to send the type instead of a reference to
temp += "<A href='?src=\ref[src];doorder=[supply_name]'>[supply_name]</A> Cost: [N.cost]<BR>" //the obj because it would get caught by the garbage
@@ -392,7 +387,7 @@ var/list/mechtoys = list(
return
//Find the correct supply_pack datum
var/datum/supply_packs/P = supply_shuttle.supply_packs[href_list["doorder"]]
var/datum/supply_packs/P = supply_controller.supply_packs[href_list["doorder"]]
if(!istype(P)) return
var/timeout = world.time + 600
@@ -409,11 +404,11 @@ var/list/mechtoys = list(
else if(issilicon(usr))
idname = usr.real_name
supply_shuttle.ordernum++
supply_controller.ordernum++
var/obj/item/weapon/paper/reqform = new /obj/item/weapon/paper(loc)
reqform.name = "Requisition Form - [P.name]"
reqform.info += "<h3>[station_name] Supply Requisition Form</h3><hr>"
reqform.info += "INDEX: #[supply_shuttle.ordernum]<br>"
reqform.info += "INDEX: #[supply_controller.ordernum]<br>"
reqform.info += "REQUESTED BY: [idname]<br>"
reqform.info += "RANK: [idrank]<br>"
reqform.info += "REASON: [reason]<br>"
@@ -429,24 +424,24 @@ var/list/mechtoys = list(
//make our supply_order datum
var/datum/supply_order/O = new /datum/supply_order()
O.ordernum = supply_shuttle.ordernum
O.ordernum = supply_controller.ordernum
O.object = P
O.orderedby = idname
supply_shuttle.requestlist += O
supply_controller.requestlist += O
temp = "Thanks for your request. The cargo team will process it as soon as possible.<BR>"
temp += "<BR><A href='?src=\ref[src];order=[last_viewed_group]'>Back</A> <A href='?src=\ref[src];mainmenu=1'>Main Menu</A>"
else if (href_list["vieworders"])
temp = "Current approved orders: <BR><BR>"
for(var/S in supply_shuttle.shoppinglist)
for(var/S in supply_controller.shoppinglist)
var/datum/supply_order/SO = S
temp += "[SO.object.name] approved by [SO.orderedby] [SO.comment ? "([SO.comment])":""]<BR>"
temp += "<BR><A href='?src=\ref[src];mainmenu=1'>OK</A>"
else if (href_list["viewrequests"])
temp = "Current requests: <BR><BR>"
for(var/S in supply_shuttle.requestlist)
for(var/S in supply_controller.requestlist)
var/datum/supply_order/SO = S
temp += "#[SO.ordernum] - [SO.object.name] requested by [SO.orderedby]<BR>"
temp += "<BR><A href='?src=\ref[src];mainmenu=1'>OK</A>"
@@ -471,14 +466,47 @@ var/list/mechtoys = list(
if (temp)
dat = temp
else
dat += {"<BR><B>Supply shuttle</B><HR>
\nLocation: [supply_shuttle.moving ? "Moving to station ([supply_shuttle.eta] Mins.)":supply_shuttle.at_station ? "Station":"Away"]<BR>
<HR>\nSupply points: [supply_shuttle.points]<BR>\n<BR>
[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>"]
[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>"]
var/datum/shuttle/ferry/supply/shuttle = supply_controller.get_shuttle()
if (shuttle)
dat += "<BR><B>Supply shuttle</B><HR>"
dat += "\nLocation: "
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_controller.points]<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];vieworders=1'>View orders</A><BR>\n<BR>
\n<A href='?src=\ref[user];mach_close=computer'>Close</A>"}
user << browse(dat, "window=computer;size=575x450")
onclose(user, "computer")
@@ -494,8 +522,12 @@ var/list/mechtoys = list(
return
/obj/machinery/computer/supplycomp/Topic(href, href_list)
if(!supply_shuttle)
world.log << "## ERROR: Eek. The supply_shuttle controller datum is missing somehow."
if(!supply_controller)
world.log << "## ERROR: Eek. The supply_controller controller datum is missing somehow."
return
var/datum/shuttle/ferry/supply/shuttle = supply_controller.get_shuttle()
if (!shuttle)
world.log << "## ERROR: Eek. The supply/shuttle datum is missing somehow."
return
if(..())
return
@@ -505,51 +537,48 @@ var/list/mechtoys = list(
//Calling the shuttle
if(href_list["send"])
if(!supply_shuttle.can_move())
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)
supply_shuttle.moving = -1
supply_shuttle.sell()
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>"
if(shuttle.at_station())
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
shuttle.launch(src)
temp = "Initiating launch sequence.<BR><BR><A href='?src=\ref[src];mainmenu=1'>OK</A>"
else
supply_shuttle.moving = 1
supply_shuttle.buy()
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>"
shuttle.launch(src)
temp = "The supply shuttle has been called and will arrive in approximately [round(supply_controller.movetime/600,1)] minutes.<BR><BR><A href='?src=\ref[src];mainmenu=1'>OK</A>"
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"])
if(supply_shuttle.moving) return
//if(!shuttle.idle()) return //this shouldn't be necessary it seems
if(href_list["order"] == "categories")
//all_supply_groups
//Request what?
last_viewed_group = "categories"
temp = "<b>Supply points: [supply_shuttle.points]</b><BR>"
temp = "<b>Supply points: [supply_controller.points]</b><BR>"
temp += "<A href='?src=\ref[src];mainmenu=1'>Main Menu</A><HR><BR><BR>"
temp += "<b>Select a category</b><BR><BR>"
for(var/supply_group_name in all_supply_groups )
temp += "<A href='?src=\ref[src];order=[supply_group_name]'>[supply_group_name]</A><BR>"
else
last_viewed_group = href_list["order"]
temp = "<b>Supply points: [supply_shuttle.points]</b><BR>"
temp = "<b>Supply points: [supply_controller.points]</b><BR>"
temp += "<A href='?src=\ref[src];order=categories'>Back to all categories</A><HR><BR><BR>"
temp += "<b>Request from: [last_viewed_group]</b><BR><BR>"
for(var/supply_name in supply_shuttle.supply_packs )
var/datum/supply_packs/N = supply_shuttle.supply_packs[supply_name]
for(var/supply_name in supply_controller.supply_packs )
var/datum/supply_packs/N = supply_controller.supply_packs[supply_name]
if((N.hidden && !hacked) || (N.contraband && !can_order_contraband) || N.group != last_viewed_group) continue //Have to send the type instead of a reference to
temp += "<A href='?src=\ref[src];doorder=[supply_name]'>[supply_name]</A> Cost: [N.cost]<BR>" //the obj because it would get caught by the garbage
/*temp = "Supply points: [supply_shuttle.points]<BR><HR><BR>Request what?<BR><BR>"
/*temp = "Supply points: [supply_controller.points]<BR><HR><BR>Request what?<BR><BR>"
for(var/supply_name in supply_shuttle.supply_packs )
var/datum/supply_packs/N = supply_shuttle.supply_packs[supply_name]
for(var/supply_name in supply_controller.supply_packs )
var/datum/supply_packs/N = supply_controller.supply_packs[supply_name]
if(N.hidden && !hacked) continue
if(N.contraband && !can_order_contraband) continue
temp += "<A href='?src=\ref[src];doorder=[supply_name]'>[supply_name]</A> Cost: [N.cost]<BR>" //the obj because it would get caught by the garbage
@@ -562,7 +591,7 @@ var/list/mechtoys = list(
return
//Find the correct supply_pack datum
var/datum/supply_packs/P = supply_shuttle.supply_packs[href_list["doorder"]]
var/datum/supply_packs/P = supply_controller.supply_packs[href_list["doorder"]]
if(!istype(P)) return
var/timeout = world.time + 600
@@ -579,11 +608,11 @@ var/list/mechtoys = list(
else if(issilicon(usr))
idname = usr.real_name
supply_shuttle.ordernum++
supply_controller.ordernum++
var/obj/item/weapon/paper/reqform = new /obj/item/weapon/paper(loc)
reqform.name = "Requisition Form - [P.name]"
reqform.info += "<h3>[station_name] Supply Requisition Form</h3><hr>"
reqform.info += "INDEX: #[supply_shuttle.ordernum]<br>"
reqform.info += "INDEX: #[supply_controller.ordernum]<br>"
reqform.info += "REQUESTED BY: [idname]<br>"
reqform.info += "RANK: [idrank]<br>"
reqform.info += "REASON: [reason]<br>"
@@ -599,10 +628,10 @@ var/list/mechtoys = list(
//make our supply_order datum
var/datum/supply_order/O = new /datum/supply_order()
O.ordernum = supply_shuttle.ordernum
O.ordernum = supply_controller.ordernum
O.object = P
O.orderedby = idname
supply_shuttle.requestlist += O
supply_controller.requestlist += O
temp = "Order request placed.<BR>"
temp += "<BR><A href='?src=\ref[src];order=[last_viewed_group]'>Back</A> | <A href='?src=\ref[src];mainmenu=1'>Main Menu</A> | <A href='?src=\ref[src];confirmorder=[O.ordernum]'>Authorize Order</A>"
@@ -613,15 +642,15 @@ var/list/mechtoys = list(
var/datum/supply_order/O
var/datum/supply_packs/P
temp = "Invalid Request"
for(var/i=1, i<=supply_shuttle.requestlist.len, i++)
var/datum/supply_order/SO = supply_shuttle.requestlist[i]
for(var/i=1, i<=supply_controller.requestlist.len, i++)
var/datum/supply_order/SO = supply_controller.requestlist[i]
if(SO.ordernum == ordernum)
O = SO
P = O.object
if(supply_shuttle.points >= P.cost)
supply_shuttle.requestlist.Cut(i,i+1)
supply_shuttle.points -= P.cost
supply_shuttle.shoppinglist += O
if(supply_controller.points >= P.cost)
supply_controller.requestlist.Cut(i,i+1)
supply_controller.points -= P.cost
supply_controller.shoppinglist += O
temp = "Thanks for your order.<BR>"
temp += "<BR><A href='?src=\ref[src];viewrequests=1'>Back</A> <A href='?src=\ref[src];mainmenu=1'>Main Menu</A>"
else
@@ -631,7 +660,7 @@ var/list/mechtoys = list(
else if (href_list["vieworders"])
temp = "Current approved orders: <BR><BR>"
for(var/S in supply_shuttle.shoppinglist)
for(var/S in supply_controller.shoppinglist)
var/datum/supply_order/SO = S
temp += "#[SO.ordernum] - [SO.object.name] approved by [SO.orderedby][SO.comment ? " ([SO.comment])":""]<BR>"// <A href='?src=\ref[src];cancelorder=[S]'>(Cancel)</A><BR>"
temp += "<BR><A href='?src=\ref[src];mainmenu=1'>OK</A>"
@@ -649,9 +678,9 @@ var/list/mechtoys = list(
*/
else if (href_list["viewrequests"])
temp = "Current requests: <BR><BR>"
for(var/S in supply_shuttle.requestlist)
for(var/S in supply_controller.requestlist)
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] <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];mainmenu=1'>OK</A>"
@@ -659,16 +688,16 @@ var/list/mechtoys = list(
else if (href_list["rreq"])
var/ordernum = text2num(href_list["rreq"])
temp = "Invalid Request.<BR>"
for(var/i=1, i<=supply_shuttle.requestlist.len, i++)
var/datum/supply_order/SO = supply_shuttle.requestlist[i]
for(var/i=1, i<=supply_controller.requestlist.len, i++)
var/datum/supply_order/SO = supply_controller.requestlist[i]
if(SO.ordernum == ordernum)
supply_shuttle.requestlist.Cut(i,i+1)
supply_controller.requestlist.Cut(i,i+1)
temp = "Request removed.<BR>"
break
temp += "<BR><A href='?src=\ref[src];viewrequests=1'>Back</A> <A href='?src=\ref[src];mainmenu=1'>Main Menu</A>"
else if (href_list["clearreq"])
supply_shuttle.requestlist.Cut()
supply_controller.requestlist.Cut()
temp = "List cleared.<BR>"
temp += "<BR><A href='?src=\ref[src];mainmenu=1'>OK</A>"

View File

@@ -6,6 +6,7 @@
icon_state = "conveyor0"
name = "conveyor belt"
desc = "A conveyor belt."
layer = 2 // so they appear under stuff
anchored = 1
var/operating = 0 // 1 if running forward, -1 if backwards, 0 if off
var/operable = 1 // true if can operate (no broken segments in this belt run)

View File

@@ -1,9 +1,7 @@
//These lists are populated in /datum/shuttle_controller/New()
//Shuttle controller is instantiated in master_controller.dm.
#define SHUTTLE_IDLE 0
#define SHUTTLE_WARMUP 1
#define SHUTTLE_INTRANSIT 2
//shuttle moving state defines are in setup.dm
var/global/list/shuttles
@@ -128,10 +126,13 @@ var/global/list/shuttles
var/datum/shuttle/ferry/shuttle
//Supply and escape shuttles.
shuttle = new()
shuttle = new/datum/shuttle/ferry/supply()
shuttle.location = 1
shuttle.warmup_time = 10
shuttle.area_offsite = locate(/area/supply/dock)
shuttle.area_station = locate(/area/supply/station)
shuttle.docking_controller_tag = "supply_shuttle"
shuttle.dock_target_station = "cargo_bay"
shuttles["Supply"] = shuttle
// Admin shuttles.

View File

@@ -22,9 +22,9 @@
return
if(!destination)
destination = (location == 1 ? area_station : area_offsite)
destination = get_location_area(!location)
if(!origin)
origin = (location == 1 ? area_offsite : area_station)
origin = get_location_area(location)
..(origin, destination)
@@ -33,23 +33,31 @@
return
if(!destination)
destination = (location == 1 ? area_station : area_offsite)
destination = get_location_area(!location)
if(!departing)
departing = (location == 1 ? area_offsite : area_station)
departing = get_location_area(location)
..(departing, destination, interim, travel_time)
/datum/shuttle/ferry/move(var/area/origin,var/area/destination)
if(!destination)
destination = (location == 1 ? area_station : area_offsite)
destination = get_location_area(!location)
if(!origin)
origin = (location == 1 ? area_offsite : area_station)
origin = get_location_area(location)
if (docking_controller && !docking_controller.undocked())
docking_controller.force_undock()
..(origin, destination)
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()
switch(process_state)
if (WAIT_LAUNCH)

View File

@@ -0,0 +1,82 @@
/datum/shuttle/ferry/supply
var/away_location = 1 //the location to hide at while pretending to be in-transit
var/arrive_time = 0
var/late_chance = 80
var/max_late_time = 300
/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_controller.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_controller.movetime
while (world.time <= arrive_time)
sleep(5)
if (destination != away_area)
move(away_area, destination)
//late
if (prob(late_chance))
sleep(rand(0,max_late_time))
moving_status = SHUTTLE_IDLE
if (!at_station()) //at centcom
supply_controller.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_controller.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)

View File

@@ -761,3 +761,8 @@ var/list/RESTRICTED_CAMERA_NETWORKS = list( //Those networks can only be accesse
#define COLOR_YELLOW "#FFFF00"
#define COLOR_ORANGE "#FF9900"
#define COLOR_WHITE "#FFFFFF"
//Shuttle moving status
#define SHUTTLE_IDLE 0
#define SHUTTLE_WARMUP 1
#define SHUTTLE_INTRANSIT 2