Admins can now customize the stray drop pod event. (#72975)

## About The Pull Request

Gives admins the ability to rig where the stray drop pod will drop in
addition to rigging what type of cargo crate regular drop pods contains
and how many telecrystals and which uplink syndicate droppods will use.
## Why It's Good For The Game

More control for admins regarding drop pods, while admins can spawn drop
pods normally these drop pods have slightly different behavior that
changes their usecase. I think it'd be highly useful for admins to for
example spawn in a clown ops surplus crate as part of a TC trade or
randomly spawn a crate full of gnomes thats announced to the crew so
they can hunt for them.
## Changelog
🆑
admin: Admins can now customize the crate type and landing zone of the
stray drop pod event.
/🆑
This commit is contained in:
NamelessFairy
2023-02-01 15:39:40 -07:00
committed by GitHub
parent 1d8de116cb
commit 619acdc474
2 changed files with 89 additions and 13 deletions
+9 -2
View File
@@ -262,14 +262,15 @@
crate_type = /obj/structure/closet/crate
///Total TC worth of contained uplink items
var/crate_value = 30
var/uplink_flag = UPLINK_TRAITORS
///What uplink the contents are pulled from
var/contents_uplink_type = UPLINK_TRAITORS
///Generate assorted uplink items, taking into account the same surplus modifiers used for surplus crates
/datum/supply_pack/misc/syndicate/fill(obj/structure/closet/crate/C)
var/list/uplink_items = list()
for(var/datum/uplink_item/item_path as anything in SStraitor.uplink_items_by_type)
var/datum/uplink_item/item = SStraitor.uplink_items_by_type[item_path]
if(item.purchasable_from & UPLINK_TRAITORS && item.item)
if(item.purchasable_from & contents_uplink_type && item.item)
uplink_items += item
while(crate_value)
@@ -283,6 +284,12 @@
crate_value -= uplink_item.cost
new uplink_item.item(C)
///Syndicate supply crate that can have its contents value changed by admins, uses a seperate datum to avoid having admins touch the original one.
/datum/supply_pack/misc/syndicate/custom_value
/datum/supply_pack/misc/syndicate/custom_value/proc/setup_contents(value, uplink)
crate_value = value
contents_uplink_type = uplink
/datum/supply_pack/misc/fishing_portal
name = "Fishing Portal Generator Crate"
+80 -11
View File
@@ -7,6 +7,40 @@
earliest_start = 10 MINUTES
category = EVENT_CATEGORY_BUREAUCRATIC
description = "A pod containing a random supply crate lands on the station."
admin_setup = /datum/event_admin_setup/stray_cargo
/datum/event_admin_setup/stray_cargo
///Admin setable override that is used instead of selecting a random location
var/atom/landing_turf_override
///Admin setable override to spawn a specific cargo pack type
var/pack_type_override
/datum/event_admin_setup/stray_cargo/prompt_admins()
var/admin_targeted = tgui_alert(usr,"Aimed at turf we're on?", "Pod Targetting", list("Yes", "No", "Cancel"))
switch(admin_targeted)
if("Yes")
landing_turf_override = get_turf(usr)
if("No")
landing_turf_override = null
else
return ADMIN_CANCEL_EVENT
var/admin_selected_pack = tgui_alert(usr,"Select pod contents?", "Pod Contents", list("Yes", "No", "Cancel"))
switch(admin_selected_pack)
if("Yes")
override_contents()
if("No")
pack_type_override = null
else
return ADMIN_CANCEL_EVENT
message_admins("[key_name_admin(usr)] has aimed a stray cargo pod at [landing_turf_override ? AREACOORD(landing_turf_override) : "a random location"]. The pod contents are [pack_type_override ? pack_type_override : "random"].")
log_admin("[key_name_admin(usr)] has aimed a stray cargo pod at [landing_turf_override ? AREACOORD(landing_turf_override) : "a random location"]. The pod contents are [pack_type_override ? pack_type_override : "random"].")
/datum/event_admin_setup/stray_cargo/proc/override_contents()
pack_type_override = tgui_input_list(usr, "Choose a cargo crate to drop.", "Choose pod contents.", sort_list(subtypesof(/datum/supply_pack), /proc/cmp_typepaths_asc))
/datum/event_admin_setup/stray_cargo/apply_to_event(datum/round_event/stray_cargo/event)
event.admin_override_turf = landing_turf_override
event.admin_override_contents = pack_type_override
///Spawns a cargo pod containing a random cargo supply pack on a random area of the station
/datum/round_event/stray_cargo
@@ -14,6 +48,10 @@
announce_chance = 75
var/list/possible_pack_types = list() ///List of possible supply packs dropped in the pod, if empty picks from the cargo list
var/static/list/stray_spawnable_supply_packs = list() ///List of default spawnable supply packs, filtered from the cargo list
///Admin setable override that is used instead of selecting a random location
var/atom/admin_override_turf
///Admin setable override to spawn a specific cargo pack type
var/admin_override_contents
/datum/round_event/stray_cargo/announce(fake)
priority_announce("Stray cargo pod detected on long-range scanners. Expected location of impact: [impact_area.name].", "Collision Alert")
@@ -24,7 +62,10 @@
*/
/datum/round_event/stray_cargo/setup()
start_when = rand(20, 40)
impact_area = find_event_area()
if(admin_override_turf)
impact_area = get_area(admin_override_turf)
else
impact_area = find_event_area()
if(!impact_area)
CRASH("No valid areas for cargo pod found.")
var/list/turf_test = get_area_turfs(impact_area)
@@ -46,23 +87,33 @@
var/turf/T = i
if(T.density)
valid_turfs -= T
var/turf/LZ = pick(valid_turfs)
var/pack_type
if(possible_pack_types.len)
pack_type = pick(possible_pack_types)
var/turf/landing_zone
if(admin_override_turf)
landing_zone = admin_override_turf
else
pack_type = pick(stray_spawnable_supply_packs)
var/datum/supply_pack/SP
landing_zone = pick(valid_turfs)
var/pack_type
if(admin_override_contents)
pack_type = admin_override_contents
else
if(possible_pack_types.len)
pack_type = pick(possible_pack_types)
else
pack_type = pick(stray_spawnable_supply_packs)
var/datum/supply_pack/supply_pack
if(ispath(pack_type, /datum/supply_pack))
SP = new pack_type
supply_pack = new pack_type
else // treat this as a supply pack id and resolving it with SSshuttle
SP = SSshuttle.supply_packs[pack_type]
var/obj/structure/closet/crate/crate = SP.generate(null)
if(admin_override_contents)
supply_pack = admin_override_contents //Syndicate crates create a new datum while being customized which will result in this being triggered. Outside of this situation this should never trigger
else
supply_pack = SSshuttle.supply_packs[pack_type]
var/obj/structure/closet/crate/crate = supply_pack.generate(null)
if(crate) //empty supply packs are a thing! get memed on.
crate.locked = FALSE //Unlock secure crates
crate.update_appearance()
var/obj/structure/closet/supplypod/pod = make_pod()
new /obj/effect/pod_landingzone(LZ, pod, crate)
new /obj/effect/pod_landingzone(landing_zone, pod, crate)
///Handles the creation of the pod, in case it needs to be modified beforehand
/datum/round_event/stray_cargo/proc/make_pod()
@@ -96,6 +147,24 @@
max_occurrences = 1
earliest_start = 30 MINUTES
description = "A pod containing syndicate gear lands on the station."
admin_setup = /datum/event_admin_setup/stray_cargo/syndicate
/datum/event_admin_setup/stray_cargo/syndicate
/datum/event_admin_setup/stray_cargo/syndicate/override_contents()
var/datum/supply_pack/misc/syndicate/custom_value/syndicate_pack = new
var/pack_telecrystals = tgui_input_number(usr, "Please input crate's value in telecrystals.", "Set Telecrystals.", 30)
if(isnull(pack_telecrystals))
return ADMIN_CANCEL_EVENT
var/list/possible_uplinks = list("Traitor" = UPLINK_TRAITORS, "Nuke Op" = UPLINK_NUKE_OPS, "Clown Op" = UPLINK_CLOWN_OPS)
var/uplink_type = tgui_input_list(usr, "Choose uplink to draw items from.", "Choose uplink type.", possible_uplinks)
var/selection
if(!isnull(uplink_type))
selection = possible_uplinks[uplink_type]
else
return ADMIN_CANCEL_EVENT
syndicate_pack.setup_contents(pack_telecrystals, selection)
pack_type_override = syndicate_pack
/datum/round_event/stray_cargo/syndicate
possible_pack_types = list(/datum/supply_pack/misc/syndicate)