mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-30 00:29:02 +01:00
Adds the ability for ERTs to use a custom shuttle (#71348)
## About The Pull Request ERTs can now have a custom shuttle template defined on their type, which, should the "use custom shuttle" toggle be enabled while creating the ERT, will spawn them in deep space on the given shuttle instead of at Centcom. Applies the new system to the bounty hunter ERT ## Why It's Good For The Game Not all ERTs are NT enough to start at Centcom all the time, and it gives more control over ERTs ## Changelog 🆑 admin: ERTs can now have a custom shuttle that they can spawn on, on a toggle while creating said ERT. /🆑
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
.["mainsettings"]["leader_experience"]["value"] = newtemplate.leader_experience ? "Yes" : "No"
|
||||
.["mainsettings"]["random_names"]["value"] = newtemplate.random_names ? "Yes" : "No"
|
||||
.["mainsettings"]["spawn_admin"]["value"] = newtemplate.spawn_admin ? "Yes" : "No"
|
||||
.["mainsettings"]["use_custom_shuttle"]["value"] = newtemplate.use_custom_shuttle ? "Yes" : "No"
|
||||
|
||||
|
||||
/datum/admins/proc/equipAntagOnDummy(mob/living/carbon/human/dummy/mannequin, datum/antagonist/antag)
|
||||
@@ -87,11 +88,12 @@
|
||||
"open_armory" = list("desc" = "Open armory doors", "type" = "boolean", "value" = "[(ertemplate.opendoors ? "Yes" : "No")]"),
|
||||
"leader_experience" = list("desc" = "Pick an experienced leader", "type" = "boolean", "value" = "[(ertemplate.leader_experience ? "Yes" : "No")]"),
|
||||
"random_names" = list("desc" = "Randomize names", "type" = "boolean", "value" = "[(ertemplate.random_names ? "Yes" : "No")]"),
|
||||
"spawn_admin" = list("desc" = "Spawn yourself as briefing officer", "type" = "boolean", "value" = "[(ertemplate.spawn_admin ? "Yes" : "No")]")
|
||||
"spawn_admin" = list("desc" = "Spawn yourself as briefing officer", "type" = "boolean", "value" = "[(ertemplate.spawn_admin ? "Yes" : "No")]"),
|
||||
"use_custom_shuttle" = list("desc" = "Use the ERT's custom shuttle (if it has one)", "type" = "boolean", "value" = "[(ertemplate.use_custom_shuttle ? "Yes" : "No")]"),
|
||||
)
|
||||
)
|
||||
|
||||
var/list/prefreturn = presentpreflikepicker(usr,"Customize ERT", "Customize ERT", Button1="Ok", width = 600, StealFocus = 1,Timeout = 0, settings=settings)
|
||||
var/list/prefreturn = presentpreflikepicker(usr, "Customize ERT", "Customize ERT", Button1="Ok", width = 600, StealFocus = 1,Timeout = 0, settings=settings)
|
||||
|
||||
if (isnull(prefreturn))
|
||||
return FALSE
|
||||
@@ -109,36 +111,75 @@
|
||||
ertemplate.teamsize = prefs["teamsize"]["value"]
|
||||
ertemplate.mission = prefs["mission"]["value"]
|
||||
ertemplate.polldesc = prefs["polldesc"]["value"]
|
||||
ertemplate.enforce_human = prefs["enforce_human"]["value"] == "Yes" // these next 5 are effectively toggles
|
||||
ertemplate.enforce_human = prefs["enforce_human"]["value"] == "Yes" // these next 6 are effectively toggles
|
||||
ertemplate.opendoors = prefs["open_armory"]["value"] == "Yes"
|
||||
ertemplate.leader_experience = prefs["leader_experience"]["value"] == "Yes"
|
||||
ertemplate.random_names = prefs["random_names"]["value"] == "Yes"
|
||||
ertemplate.spawn_admin = prefs["spawn_admin"]["value"] == "Yes"
|
||||
ertemplate.use_custom_shuttle = prefs["use_custom_shuttle"]["value"] == "Yes"
|
||||
|
||||
var/list/spawnpoints = GLOB.emergencyresponseteamspawn
|
||||
var/index = 0
|
||||
|
||||
var/list/mob/dead/observer/candidates = poll_ghost_candidates("Do you wish to be considered for [ertemplate.polldesc]?", "deathsquad")
|
||||
var/teamSpawned = FALSE
|
||||
|
||||
// This list will take priority over spawnpoints if not empty
|
||||
var/list/spawn_turfs = list()
|
||||
|
||||
// Takes precedence over spawnpoints[1] if not null
|
||||
var/turf/brief_spawn
|
||||
|
||||
if(!length(candidates))
|
||||
return FALSE
|
||||
|
||||
if(ertemplate.use_custom_shuttle && ertemplate.ert_template)
|
||||
to_chat(usr, span_boldnotice("Attempting to spawn ERT custom shuttle, this may take a few seconds..."))
|
||||
var/datum/map_template/shuttle/ship = new ertemplate.ert_template
|
||||
var/x = rand(TRANSITIONEDGE, world.maxx - TRANSITIONEDGE - ship.width)
|
||||
var/y = rand(TRANSITIONEDGE, world.maxy - TRANSITIONEDGE - ship.height)
|
||||
var/z = SSmapping.empty_space.z_value
|
||||
var/turf/located_turf = locate(x, y, z)
|
||||
if(!located_turf)
|
||||
CRASH("ERT shuttle found no place to load in")
|
||||
|
||||
if(!ship.load(located_turf))
|
||||
CRASH("Loading ERT shuttle failed!")
|
||||
|
||||
var/list/shuttle_turfs = ship.get_affected_turfs(located_turf)
|
||||
|
||||
for(var/turf/affected_turf as anything in shuttle_turfs)
|
||||
for(var/obj/effect/landmark/ert_shuttle_spawn/spawner in affected_turf)
|
||||
spawn_turfs += get_turf(spawner)
|
||||
|
||||
if(!brief_spawn)
|
||||
brief_spawn = locate(/obj/effect/landmark/ert_shuttle_brief_spawn) in affected_turf
|
||||
|
||||
if(!length(spawn_turfs))
|
||||
stack_trace("ERT shuttle loaded but found no spawnpoints, placing the ERT at wherever inside the shuttle instead.")
|
||||
|
||||
for(var/turf/open/floor/open_turf in shuttle_turfs)
|
||||
if(!is_safe_turf(open_turf))
|
||||
continue
|
||||
spawn_turfs += open_turf
|
||||
|
||||
|
||||
if(ertemplate.spawn_admin)
|
||||
if(isobserver(usr))
|
||||
var/mob/living/carbon/human/admin_officer = new (spawnpoints[1])
|
||||
var/mob/living/carbon/human/admin_officer = new (brief_spawn || spawnpoints[1])
|
||||
var/chosen_outfit = usr.client?.prefs?.read_preference(/datum/preference/choiced/brief_outfit)
|
||||
usr.client.prefs.safe_transfer_prefs_to(admin_officer, is_antag = TRUE)
|
||||
admin_officer.equipOutfit(chosen_outfit)
|
||||
admin_officer.key = usr.key
|
||||
|
||||
else
|
||||
to_chat(usr, span_warning("Could not spawn you in as briefing officer as you are not a ghost!"))
|
||||
|
||||
var/list/mob/dead/observer/candidates = poll_ghost_candidates("Do you wish to be considered for [ertemplate.polldesc]?", "deathsquad")
|
||||
var/teamSpawned = FALSE
|
||||
|
||||
if(candidates.len == 0)
|
||||
return FALSE
|
||||
|
||||
//Pick the (un)lucky players
|
||||
var/numagents = min(ertemplate.teamsize,candidates.len)
|
||||
var/numagents = min(ertemplate.teamsize, length(candidates))
|
||||
|
||||
//Create team
|
||||
var/datum/team/ert/ert_team = new ertemplate.team ()
|
||||
var/datum/team/ert/ert_team = new ertemplate.team()
|
||||
if(ertemplate.rename_team)
|
||||
ert_team.name = ertemplate.rename_team
|
||||
|
||||
@@ -167,9 +208,14 @@
|
||||
earmarked_leader = pick(candidates)
|
||||
|
||||
while(numagents && candidates.len)
|
||||
var/spawnloc = spawnpoints[index+1]
|
||||
//loop through spawnpoints one at a time
|
||||
index = (index + 1) % spawnpoints.len
|
||||
var/turf/spawnloc
|
||||
if(length(spawn_turfs))
|
||||
spawnloc = pick(spawn_turfs)
|
||||
else
|
||||
spawnloc = spawnpoints[index+1]
|
||||
//loop through spawnpoints one at a time
|
||||
index = (index + 1) % spawnpoints.len
|
||||
|
||||
var/mob/dead/observer/chosen_candidate = earmarked_leader || pick(candidates) // this way we make sure that our leader gets chosen
|
||||
candidates -= chosen_candidate
|
||||
if(!chosen_candidate?.key)
|
||||
|
||||
Reference in New Issue
Block a user