mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-01-30 10:53:24 +00:00
Largely ported from the work done at Baystation in https://github.com/Baystation12/Baystation12/pull/17460 and later commits. - Shuttles no longer require a separate area for each location they jump to. Instead destinations are indicated by landmark objects, which are not necessarily exclusive to that shuttle. This means that more than one shuttle could use the same docking port (not at the same time of course). - Enhanced shuttle control computers to use nanoui if they didn't. - Organizes shuttle datum code a bit better so there is less re-inventing the wheel in subtypes. - Allows the possibility of shuttles (or destinations) that start on late-loaded maps. - Deprecate the "extra" shuttle areas that are no longer needed and update shuttle areas in unit tests This all required a bit of infrastructure improvements. - ChangeArea proc, for changing the area of a turf. - Fixed lighting overlays actually being able to be destroyed. - Added a few utility macros and procs. - Added "turf translation" procs which are like move_contents_to but more flexible.
82 lines
2.6 KiB
Plaintext
82 lines
2.6 KiB
Plaintext
// Formerly /datum/shuttle/ferry/supply
|
|
/datum/shuttle/autodock/ferry/supply
|
|
var/away_location = FERRY_LOCATION_OFFSITE //the location to hide at while pretending to be in-transit
|
|
var/late_chance = 80
|
|
var/max_late_time = 300
|
|
flags = SHUTTLE_FLAGS_PROCESS|SHUTTLE_FLAGS_SUPPLY
|
|
category = /datum/shuttle/autodock/ferry/supply
|
|
|
|
/datum/shuttle/autodock/ferry/supply/short_jump(var/obj/effect/shuttle_landmark/destination)
|
|
if(moving_status != SHUTTLE_IDLE)
|
|
return
|
|
|
|
if(isnull(location))
|
|
return
|
|
|
|
//it would be cool to play a sound here
|
|
moving_status = SHUTTLE_WARMUP
|
|
spawn(warmup_time*10)
|
|
|
|
make_sounds(HYPERSPACE_WARMUP)
|
|
sleep(5 SECONDS) // so the sound finishes.
|
|
|
|
if (moving_status == SHUTTLE_IDLE)
|
|
make_sounds(HYPERSPACE_END)
|
|
return //someone cancelled the launch
|
|
|
|
if (at_station() && forbidden_atoms_check())
|
|
//cancel the launch because of forbidden atoms. announce over supply channel?
|
|
moving_status = SHUTTLE_IDLE
|
|
make_sounds(HYPERSPACE_END)
|
|
return
|
|
|
|
if (!at_station()) //at centcom
|
|
supply_controller.buy()
|
|
|
|
//We pretend it's a long_jump by making the shuttle stay at centcom for the "in-transit" period.
|
|
var/obj/effect/shuttle_landmark/away_waypoint = get_location_waypoint(away_location)
|
|
moving_status = SHUTTLE_INTRANSIT
|
|
|
|
//If we are at the away_landmark then we are just pretending to move, otherwise actually do the move
|
|
if (next_location == away_waypoint)
|
|
attempt_move(away_waypoint)
|
|
|
|
//wait ETA here.
|
|
arrive_time = world.time + supply_controller.movetime
|
|
while (world.time <= arrive_time)
|
|
sleep(5)
|
|
|
|
if (next_location != away_waypoint)
|
|
//late
|
|
if (prob(late_chance))
|
|
sleep(rand(0,max_late_time))
|
|
|
|
attempt_move(destination)
|
|
|
|
moving_status = SHUTTLE_IDLE
|
|
make_sounds(HYPERSPACE_END)
|
|
|
|
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/autodock/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
|
|
|
|
for(var/area/A in shuttle_area)
|
|
if(supply_controller.forbidden_atoms_check(A))
|
|
return 1
|
|
|
|
/datum/shuttle/autodock/ferry/supply/proc/at_station()
|
|
return (!location)
|
|
|
|
//returns 1 if the shuttle is idle and we can still mess with the cargo shopping list
|
|
/datum/shuttle/autodock/ferry/supply/proc/idle()
|
|
return (moving_status == SHUTTLE_IDLE)
|
|
|
|
//returns the ETA in minutes
|
|
/datum/shuttle/autodock/ferry/supply/proc/eta_minutes()
|
|
var/ticksleft = arrive_time - world.time
|
|
return round(ticksleft/600,1)
|