mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-24 04:27:35 +01:00
Supply controller now holds a ref to it's shuttle
Instead of having to look it up every time. Conflicts: code/game/supplyshuttle.dm
This commit is contained in:
@@ -117,7 +117,7 @@
|
||||
var/line1 = "SUPPLY"
|
||||
var/line2 = ""
|
||||
|
||||
var/datum/shuttle/ferry/supply/shuttle = supply_controller.get_shuttle()
|
||||
var/datum/shuttle/ferry/supply/shuttle = supply_controller.shuttle
|
||||
if (!shuttle)
|
||||
line2 = "Error"
|
||||
else if(shuttle.has_eta())
|
||||
@@ -176,7 +176,7 @@
|
||||
return ""
|
||||
|
||||
proc/get_supply_shuttle_timer()
|
||||
var/datum/shuttle/ferry/supply/shuttle = supply_controller.get_shuttle()
|
||||
var/datum/shuttle/ferry/supply/shuttle = supply_controller.shuttle
|
||||
if (!shuttle)
|
||||
return "Error"
|
||||
|
||||
|
||||
@@ -412,7 +412,7 @@
|
||||
|
||||
if(mode==47)
|
||||
var/supplyData[0]
|
||||
var/datum/shuttle/ferry/supply/shuttle = supply_controller.get_shuttle()
|
||||
var/datum/shuttle/ferry/supply/shuttle = supply_controller.shuttle
|
||||
if (shuttle)
|
||||
supplyData["shuttle_moving"] = shuttle.has_eta()
|
||||
supplyData["shuttle_eta"] = shuttle.eta_minutes()
|
||||
|
||||
+24
-28
@@ -143,21 +143,24 @@ var/list/mechtoys = list(
|
||||
var/list/supply_packs = list()
|
||||
//shuttle movement
|
||||
var/movetime = 1200
|
||||
var/shuttle_tag = "Supply"
|
||||
var/datum/shuttle/ferry/supply/shuttle
|
||||
|
||||
New()
|
||||
ordernum = rand(1,9000)
|
||||
|
||||
proc/get_shuttle()
|
||||
if (!shuttles || !(shuttle_tag in shuttles))
|
||||
return null
|
||||
if ("Supply" in shuttles && istype(shuttles["Supply"], /datum/shuttle/ferry/supply))
|
||||
shuttle = shuttles["Supply"]
|
||||
|
||||
var/datum/shuttle/ferry/supply/shuttle = shuttles[shuttle_tag]
|
||||
|
||||
if (!istype(shuttle))
|
||||
return null
|
||||
|
||||
return shuttle
|
||||
//still don't have the shuttle, so create one
|
||||
if (!shuttle)
|
||||
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
|
||||
|
||||
//Supply shuttle ticker - handles supply point regenertion and shuttle travelling between centcomm and the station
|
||||
proc/process()
|
||||
@@ -178,8 +181,7 @@ var/list/mechtoys = list(
|
||||
set background = 1
|
||||
while(1)
|
||||
if(processing)
|
||||
var/datum/shuttle/ferry/supply/shuttle = get_shuttle()
|
||||
if (shuttle && shuttle.in_use)
|
||||
if (shuttle.in_use)
|
||||
shuttle.process_shuttle()
|
||||
|
||||
sleep(10)
|
||||
@@ -204,21 +206,18 @@ var/list/mechtoys = list(
|
||||
|
||||
//Sellin
|
||||
proc/sell()
|
||||
var/datum/shuttle/ferry/supply/shuttle_datum = get_shuttle()
|
||||
if (!shuttle_datum) return
|
||||
|
||||
var/area/shuttle = shuttle_datum.get_location_area()
|
||||
if(!shuttle) return
|
||||
var/area/area_shuttle = shuttle.get_location_area()
|
||||
if(!area_shuttle) return
|
||||
|
||||
var/plasma_count = 0
|
||||
var/plat_count = 0
|
||||
|
||||
for(var/atom/movable/MA in shuttle)
|
||||
for(var/atom/movable/MA in area_shuttle)
|
||||
if(MA.anchored) continue
|
||||
|
||||
// Must be in a crate!
|
||||
if(istype(MA,/obj/structure/closet/crate))
|
||||
callHook("sell_crate", list(MA, shuttle))
|
||||
callHook("sell_crate", list(MA, area_shuttle))
|
||||
|
||||
points += points_per_crate
|
||||
var/find_slip = 1
|
||||
@@ -255,15 +254,12 @@ var/list/mechtoys = list(
|
||||
proc/buy()
|
||||
if(!shoppinglist.len) return
|
||||
|
||||
var/datum/shuttle/ferry/supply/shuttle_datum = get_shuttle()
|
||||
if (!shuttle_datum) return
|
||||
|
||||
var/area/shuttle = shuttle_datum.get_location_area()
|
||||
if(!shuttle) return
|
||||
var/area/area_shuttle = shuttle.get_location_area()
|
||||
if(!area_shuttle) return
|
||||
|
||||
var/list/clear_turfs = list()
|
||||
|
||||
for(var/turf/T in shuttle)
|
||||
for(var/turf/T in area_shuttle)
|
||||
if(T.density || T.contents.len) continue
|
||||
clear_turfs += T
|
||||
|
||||
@@ -341,7 +337,7 @@ var/list/mechtoys = list(
|
||||
if(temp)
|
||||
dat = temp
|
||||
else
|
||||
var/datum/shuttle/ferry/supply/shuttle = supply_controller.get_shuttle()
|
||||
var/datum/shuttle/ferry/supply/shuttle = supply_controller.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>
|
||||
@@ -468,7 +464,7 @@ var/list/mechtoys = list(
|
||||
if (temp)
|
||||
dat = temp
|
||||
else
|
||||
var/datum/shuttle/ferry/supply/shuttle = supply_controller.get_shuttle()
|
||||
var/datum/shuttle/ferry/supply/shuttle = supply_controller.shuttle
|
||||
if (shuttle)
|
||||
dat += "<BR><B>Supply shuttle</B><HR>"
|
||||
dat += "\nLocation: "
|
||||
@@ -527,7 +523,7 @@ var/list/mechtoys = list(
|
||||
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()
|
||||
var/datum/shuttle/ferry/supply/shuttle = supply_controller.shuttle
|
||||
if (!shuttle)
|
||||
world.log << "## ERROR: Eek. The supply/shuttle datum is missing somehow."
|
||||
return
|
||||
|
||||
@@ -125,16 +125,6 @@ var/global/list/shuttles
|
||||
|
||||
var/datum/shuttle/ferry/shuttle
|
||||
|
||||
//Supply and escape shuttles.
|
||||
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.
|
||||
shuttle = new()
|
||||
shuttle.location = 1
|
||||
|
||||
@@ -58,6 +58,9 @@
|
||||
if (!at_station()) //at centcom
|
||||
supply_controller.sell()
|
||||
|
||||
/datum/shuttle/ferry/emergency/long_jump(var/area/departing,var/area/destination,var/area/interim,var/travel_time)
|
||||
short_jump(departing, destination) //long jumps are disabled
|
||||
|
||||
// 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())
|
||||
|
||||
Reference in New Issue
Block a user