mirror of
https://github.com/Citadel-Station-13/Citadel-Station-13-RP.git
synced 2026-08-23 09:46:45 +01:00
<!-- Write **BELOW** The Headers and **ABOVE** The comments else it may not be viewable. --> <!-- You can view Contributing.MD for a detailed description of the pull request process. --> ## About The Pull Request converts global vars to regular defines <!-- Describe The Pull Request. Please be sure every change is documented or this can delay review and even discourage maintainers from merging your PR! --> ## Why It's Good For The Game <!-- Argue for the merits of your changes and how they benefit the game, especially if they are controversial and/or far reaching. If you can't actually explain WHY what you are doing will improve the game, then it probably isn't good for the game in the first place. --> ## Changelog <!-- If your PR modifies aspects of the game that can be concretely observed by players or admins you should add a changelog. If your change does NOT meet this description, remove this section. Be sure to properly mark your PRs to prevent unnecessary GBP loss. You can read up on GBP and it's effects on PRs in the tgstation guides for contributors. Please note that maintainers freely reserve the right to remove and add tags should they deem it appropriate. You can attempt to finagle the system all you want, but it's best to shoot for clear communication right off the bat. --> 🆑 code: radiocode now uses defines, you cant tweak it from world.variables anymore (or whatever that is) /🆑 <!-- Both 🆑's are required for the changelog to work! You can put your name to the right of the first 🆑 if you want to overwrite your GitHub username as author ingame. --> <!-- You can use multiple of the same prefix (they're only used for the icon ingame) and delete the unneeded ones. Despite some of the tags, changelogs should generally represent how a player might be affected by the changes rather than a summary of the PR's contents. -->
92 lines
3.0 KiB
Plaintext
92 lines
3.0 KiB
Plaintext
// Formerly /datum/shuttle/autodock/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
|
|
|
|
// Set the supply shuttle displays to read out the ETA
|
|
var/datum/signal/S = new()
|
|
S.source = src
|
|
S.data = list("command" = "supply")
|
|
var/datum/radio_frequency/F = radio_controller.return_frequency(FREQ_STATUS_DISPLAYS)
|
|
F.post_signal(src, S)
|
|
|
|
//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
|
|
SSsupply.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 + SSsupply.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
|
|
SSsupply.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(SSsupply.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()
|
|
return round((arrive_time - world.time) / (1 MINUTE), 1) // Floor, so it's an actual timer
|
|
|
|
// returns the ETA in seconds
|
|
/datum/shuttle/autodock/ferry/supply/proc/eta_seconds()
|
|
return round((arrive_time - world.time) / (1 SECOND)) // Floor, so it's an actual timer
|