Skip to content

Commit

Permalink
TGS Test Merge (#5802)
Browse files Browse the repository at this point in the history
  • Loading branch information
cm13-github committed Mar 1, 2024
2 parents 5e23607 + 162f5a1 commit 42a63ef
Show file tree
Hide file tree
Showing 37 changed files with 2,826 additions and 1,794 deletions.
3 changes: 3 additions & 0 deletions code/__DEFINES/dcs/signals/signals_datum.dm
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,6 @@

// from /proc/update_living_queens() : /mob/living/carbon/xenomorph/queen
#define COMSIG_HIVE_NEW_QUEEN "hive_new_queen"

/// Fired on the lazy template datum when the template is finished loading. (list/loaded_atom_movables, list/loaded_turfs, list/loaded_areas)
#define COMSIG_LAZY_TEMPLATE_LOADED "lazy_template_loaded"
12 changes: 10 additions & 2 deletions code/__DEFINES/shuttles.dm
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@
#define MOBILE_SHUTTLE_ID_ERT2 "ert_pmc_shuttle"
#define MOBILE_SHUTTLE_ID_ERT3 "ert_upp_shuttle"
#define MOBILE_SHUTTLE_ID_ERT4 "ert_twe_shuttle"
#define MOBILE_SHUTTLE_ID_ERT_SMALL "ert_rescue_shuttle"
#define MOBILE_SHUTTLE_ID_ERT_BIG "ert_boarding_shuttle"
#define MOBILE_SHUTTLE_ID_ERT_SMALL "ert_small_shuttle_north"
#define MOBILE_SHUTTLE_ID_ERT_BIG "ert_shuttle_big"

#define MOBILE_TRIJENT_ELEVATOR "trijentshuttle2"
#define STAT_TRIJENT_EMPTY "trijent_empty"
Expand Down Expand Up @@ -134,3 +134,11 @@
#define ESCAPE_SHUTTLE_SOUTH_PREFIX "escape_shuttle_s"

#define ESCAPE_SHUTTLE_DOCK_PREFIX "almayer-hangar-escape-shuttle-"

#define ERT_SHUTTLE_DEFAULT_RECHARGE 90 SECONDS

#define ADMIN_LANDING_PAD_1 "base-ert1"
#define ADMIN_LANDING_PAD_2 "base-ert2"
#define ADMIN_LANDING_PAD_3 "base-ert3"
#define ADMIN_LANDING_PAD_4 "base-ert4"
#define ADMIN_LANDING_PAD_5 "base-ert5"
3 changes: 3 additions & 0 deletions code/__DEFINES/traits.dm
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,9 @@

#define TRAIT_GUN_LIGHT_DEACTIVATED "t_gun_light_deactivated"

/// If this ID belongs to an ERT member
#define TRAIT_ERT_ID "ert_id"

// Miscellaneous item traits.
// Do NOT bloat this category, if needed make a new category (like shoe traits, xeno item traits...)

Expand Down
10 changes: 10 additions & 0 deletions code/__HELPERS/lazy_templates.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
GLOBAL_LIST_INIT(lazy_templates, generate_lazy_template_map())

/**
* Iterates through all lazy template datums that exist and returns a list of them as an associative list of type -> instance.
* */
/proc/generate_lazy_template_map()
. = list()
for(var/datum/lazy_template/template as anything in subtypesof(/datum/lazy_template))
.[template] = new template
return .
28 changes: 28 additions & 0 deletions code/controllers/subsystem/mapping.dm
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ SUBSYSTEM_DEF(mapping)
/// list of traits and their associated z leves
var/list/z_trait_levels = list()

/// list of lazy templates that have been loaded
var/list/loaded_lazy_templates

//dlete dis once #39770 is resolved
/datum/controller/subsystem/mapping/proc/HACK_LoadMapConfig()
if(!configs)
Expand Down Expand Up @@ -423,3 +426,28 @@ SUBSYSTEM_DEF(mapping)
if(!MC)
return MAIN_SHIP_DEFAULT_NAME
return MC.map_name

/datum/controller/subsystem/mapping/proc/lazy_load_template(datum/lazy_template/template_to_load, force = FALSE)
RETURN_TYPE(/datum/turf_reservation)

UNTIL(initialized)
var/static/lazy_loading = FALSE
UNTIL(!lazy_loading)

lazy_loading = TRUE
. = _lazy_load_template(template_to_load, force)
lazy_loading = FALSE
return .

/datum/controller/subsystem/mapping/proc/_lazy_load_template(datum/lazy_template/template_to_load, force = FALSE)
PRIVATE_PROC(TRUE)

if(LAZYACCESS(loaded_lazy_templates, template_to_load) && !force)
var/datum/lazy_template/template = GLOB.lazy_templates[template_to_load]
return template.reservations[1]
LAZYSET(loaded_lazy_templates, template_to_load, TRUE)

var/datum/lazy_template/target = GLOB.lazy_templates[template_to_load]
if(!target)
CRASH("Attempted to lazy load a template key that does not exist: '[template_to_load]'")
return target.lazy_load()
1 change: 1 addition & 0 deletions code/datums/emergency_calls/cbrn.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
name = "CBRN (Squad)"
arrival_message = "A CBRN squad has been dispatched to your ship. Stand by."
objectives = "Handle the chemical, biological, radiological, or nuclear threat. Further orders may be provided."
home_base = /datum/lazy_template/ert/weyland_station
mob_min = 3
mob_max = 5
max_heavies = 0
Expand Down
1 change: 1 addition & 0 deletions code/datums/emergency_calls/clf.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
objectives = "Assault the USCM, and sabotage as much as you can. Ensure any survivors escape in your custody."
probability = 20
hostility = TRUE
home_base = /datum/lazy_template/ert/clf_station
var/max_synths = 1
var/synths = 0

Expand Down
1 change: 1 addition & 0 deletions code/datums/emergency_calls/cmb.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
name = "CMB - Colonial Marshals Patrol Team (Friendly)"
mob_max = 5
probability = 10
home_base = /datum/lazy_template/ert/weyland_station

var/max_synths = 1
var/synths = 0
Expand Down
9 changes: 6 additions & 3 deletions code/datums/emergency_calls/deathsquad.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
arrival_message = "'!`2*%slau#*jer t*h$em a!l%. le&*ve n(o^ w&*nes%6es.*v$e %#d ou^'"
objectives = "Whiteout protocol is in effect for the target. Ensure there are no traces of the infestation or any witnesses."
probability = 0
shuttle_id = "Distress_PMC"
shuttle_id = MOBILE_SHUTTLE_ID_ERT2
home_base = /datum/lazy_template/ert/weyland_station
name_of_spawn = /obj/effect/landmark/ert_spawns/distress_pmc
item_spawn = /obj/effect/landmark/ert_spawns/distress_pmc/item
max_medics = 1
Expand Down Expand Up @@ -91,7 +92,8 @@
mob_max = 8
mob_min = 5
probability = 0
shuttle_id = "Distress_PMC"
shuttle_id = MOBILE_SHUTTLE_ID_ERT2
home_base = /datum/lazy_template/ert/weyland_station
name_of_spawn = /obj/effect/landmark/ert_spawns/distress_pmc

/datum/emergency_call/marsoc/create_member(datum/mind/M, turf/override_spawn_loc)
Expand Down Expand Up @@ -120,8 +122,9 @@
mob_max = 8
mob_min = 5
probability = 0
shuttle_id = "Distress_PMC"
shuttle_id = MOBILE_SHUTTLE_ID_ERT2
name_of_spawn = /obj/effect/landmark/ert_spawns/distress_pmc
home_base = /datum/lazy_template/ert/weyland_station

/datum/emergency_call/marsoc_covert/create_member(datum/mind/M)

Expand Down
45 changes: 39 additions & 6 deletions code/datums/emergency_calls/emergency_call.dm
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,19 @@
var/max_heavies = 1
var/max_smartgunners = 1
var/shuttle_id = MOBILE_SHUTTLE_ID_ERT1 //Empty shuttle ID means we're not using shuttles (aka spawn straight into cryo)
var/auto_shuttle_launch = FALSE
var/auto_shuttle_launch = TRUE
var/spawn_max_amount = FALSE

var/ert_message = "An emergency beacon has been activated"

var/time_required_for_job = 5 HOURS

/// the shuttle being used by this distress call
var/obj/docking_port/mobile/emergency_response/shuttle

/// the [/datum/lazy_template] we should attempt to spawn in for the return journey
var/home_base = /datum/lazy_template/ert/freelancer_station

/datum/game_mode/proc/initialize_emergency_calls()
if(all_calls.len) //It's already been set up.
return
Expand Down Expand Up @@ -269,12 +275,15 @@
if(M.client)
to_chat(M, SPAN_NOTICE("Distress beacon: [src.name] finalized."))

var/obj/docking_port/mobile/shuttle = SSshuttle.getShuttle(shuttle_id)
if(shuttle_id && !override_spawn_loc)
if(!SSmapping.shuttle_templates[shuttle_id])
message_admins("Distress beacon: [name] does not have a valid shuttle_id: [shuttle_id]")
CRASH("ert called with invalid shuttle_id")

if(!istype(shuttle))
if(shuttle_id) //Cryo distress doesn't have a shuttle
message_admins("Warning: Distress shuttle not found.")
spawn_items()
var/datum/map_template/shuttle/new_shuttle = SSmapping.shuttle_templates[shuttle_id]
shuttle = SSshuttle.load_template_to_transit(new_shuttle)
shuttle.control_doors("force-lock", force = TRUE, external_only = TRUE)
shuttle.distress_beacon = src

if(shuttle && auto_shuttle_launch)
var/obj/structure/machinery/computer/shuttle/ert/comp = shuttle.getControlConsole()
Expand Down Expand Up @@ -321,6 +330,13 @@
else
marine_announcement(arrival_message, "Intercepted Transmission:")

for(var/datum/mind/spawned as anything in members)
if(ishuman(spawned.current))
var/mob/living/carbon/human/spawned_human = spawned.current
var/obj/item/card/id/id = spawned_human.get_idcard()
if(id)
ADD_TRAIT(id, TRAIT_ERT_ID, src)

/datum/emergency_call/proc/add_candidate(mob/M)
if(!M.client || (M.mind && (M.mind in candidates)) || istype(M, /mob/living/carbon/xenomorph))
return FALSE //Not connected or already there or something went wrong.
Expand All @@ -335,6 +351,23 @@

/datum/emergency_call/proc/get_spawn_point(is_for_items)
var/landmark

if(shuttle)
if(is_for_items)
landmark = SAFEPICK(shuttle.local_landmarks[item_spawn])
else
landmark = SAFEPICK(shuttle.local_landmarks[name_of_spawn])

if(landmark)
return get_turf(landmark)

var/list/valid_turfs = list()
for(var/turf/open/floor/valid_turf in shuttle.return_turfs())
valid_turfs += valid_turf

if(length(valid_turfs))
return pick(valid_turfs)

if(is_for_items)
landmark = SAFEPICK(GLOB.ert_spawns[item_spawn])
else
Expand Down
14 changes: 14 additions & 0 deletions code/datums/emergency_calls/ert_stations.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/datum/lazy_template/ert/clf_station
map_name = "clf_ert_station"

/datum/lazy_template/ert/freelancer_station
map_name = "freelancer_ert_station"

/datum/lazy_template/ert/twe_station
map_name = "twe_ert_station"

/datum/lazy_template/ert/upp_station
map_name = "upp_ert_station"

/datum/lazy_template/ert/weyland_station
map_name = "weyland_ert_station"
1 change: 1 addition & 0 deletions code/datums/emergency_calls/forsaken_xenos.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
mob_min = 1
mob_max = 4
hostility = TRUE
shuttle_id = ""
name_of_spawn = /obj/effect/landmark/ert_spawns/groundside_xeno
objectives = "You have been left behind to safeguard the abandoned colony. Do not allow trespassers."

Expand Down
1 change: 1 addition & 0 deletions code/datums/emergency_calls/goons.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
name = "Weyland-Yutani Corporate Security (Squad)"
mob_max = 6
probability = 0
home_base = /datum/lazy_template/ert/weyland_station

/datum/emergency_call/goon/New()
..()
Expand Down
4 changes: 3 additions & 1 deletion code/datums/emergency_calls/inspection.dm
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@
name = "Inspection - Corporate"
mob_max = 2
mob_min = 1
home_base = /datum/lazy_template/ert/weyland_station
name_of_spawn = /obj/effect/landmark/ert_spawns/distress_pmc
item_spawn = /obj/effect/landmark/ert_spawns/distress_pmc/item
probability = 0
Expand Down Expand Up @@ -207,6 +208,7 @@
mob_max = 4
mob_min = 1
probability = 0
home_base = /datum/lazy_template/ert/weyland_station

var/max_synths = 1
var/synths = 0
Expand Down Expand Up @@ -304,7 +306,7 @@
name = "Inspection - Colonial Marshals Ledger Investigation Team"
mob_max = 3 //Marshal, Deputy, ICC CL
mob_min = 2
shuttle_id = "Distress_PMC"
shuttle_id = MOBILE_SHUTTLE_ID_ERT2

max_synths = 0
will_spawn_icc_liaison = TRUE
Expand Down
4 changes: 2 additions & 2 deletions code/datums/emergency_calls/pizza.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
mob_min = 1
arrival_message = "'That'll be... sixteen orders of cheesy fries, eight large double topping pizzas, nine bottles of Four Loko... hello? Is anyone on this ship? Your pizzas are getting cold.'"
objectives = "Make sure you get a tip!"
shuttle_id = "Distress_Small"
shuttle_id = MOBILE_SHUTTLE_ID_ERT_SMALL
name_of_spawn = /obj/effect/landmark/ert_spawns/distress_pizza
probability = 1

Expand All @@ -32,7 +32,7 @@
name = "Pizza Delivery (Cryo)"
probability = 0
name_of_spawn = /obj/effect/landmark/ert_spawns/distress_cryo
shuttle_id = ""
shuttle_id = MOBILE_SHUTTLE_ID_ERT_SMALL

/obj/effect/landmark/ert_spawns/distress_pizza
name = "Distress_Pizza"
3 changes: 2 additions & 1 deletion code/datums/emergency_calls/pmc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
name = "Weyland-Yutani PMC (Squad)"
mob_max = 6
probability = 20
shuttle_id = "Distress_PMC"
shuttle_id = MOBILE_SHUTTLE_ID_ERT2
home_base = /datum/lazy_template/ert/weyland_station
name_of_spawn = /obj/effect/landmark/ert_spawns/distress_pmc
item_spawn = /obj/effect/landmark/ert_spawns/distress_pmc/item

Expand Down
1 change: 1 addition & 0 deletions code/datums/emergency_calls/royal_marines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
name = "Royal Marines Commando (Squad) (Friendly)"
mob_max = 7
probability = 15
home_base = /datum/lazy_template/ert/twe_station
name_of_spawn = /obj/effect/landmark/ert_spawns/distress_twe
item_spawn = /obj/effect/landmark/ert_spawns/distress_twe/item
max_engineers = 0
Expand Down
3 changes: 2 additions & 1 deletion code/datums/emergency_calls/upp.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
name = "UPP Naval Infantry (Squad)"
mob_max = 9
probability = 20
shuttle_id = "Distress_UPP"
shuttle_id = MOBILE_SHUTTLE_ID_ERT3
home_base = /datum/lazy_template/ert/upp_station
name_of_spawn = /obj/effect/landmark/ert_spawns/distress_upp
item_spawn = /obj/effect/landmark/ert_spawns/distress_upp/item
//1 leader, 1 engineer, 2 medics, 1 specialist, 5 soldiers
Expand Down
2 changes: 1 addition & 1 deletion code/datums/emergency_calls/upp_commando.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
mob_max = 6
probability = 0
objectives = "Stealthily assault the ship. Use your silenced weapons, tranquilizers, and night vision to get the advantage on the enemy. Take out the power systems, comms and engine. Stick together and keep a low profile."
shuttle_id = "Distress_UPP"
shuttle_id = MOBILE_SHUTTLE_ID_ERT3
name_of_spawn = /obj/effect/landmark/ert_spawns/distress_upp
item_spawn = /obj/effect/landmark/ert_spawns/distress_upp/item
hostility = TRUE
Expand Down
Loading

0 comments on commit 42a63ef

Please sign in to comment.