Files
Bubberstation/code/modules/events/carp_migration.dm
nevimer 759c2dd73a Merge remote-tracking branch 'upstream/master' into overlay
# Conflicts:
#	.github/CODEOWNERS
#	_maps/RandomRuins/LavaRuins/skyrat/lavaland_surface_syndicate_base1_skyrat.dmm
#	_maps/RandomRuins/SpaceRuins/bus.dmm
#	_maps/RandomZLevels/blackmesa.dmm
#	_maps/map_files/KiloStation/KiloStation.dmm
#	_maps/map_files/VoidRaptor/VoidRaptor.dmm
#	_maps/map_files/generic/CentCom_skyrat_z2.dmm
#	_maps/shuttles/skyrat/goldeneye_cruiser.dmm
#	_maps/skyrat/automapper/automapper_config.toml
#	_maps/templates/lazy_templates/wizard_den.dmm
#	code/__DEFINES/callbacks.dm
#	code/__DEFINES/jobs.dm
#	code/__DEFINES/~skyrat_defines/gun.dm
#	code/datums/components/fertile_egg.dm
#	code/datums/components/transforming.dm
#	code/datums/elements/bane.dm
#	code/datums/votes/map_vote.dm
#	code/game/objects/items/AI_modules/hacked.dm
#	code/game/objects/items/food/egg.dm
#	code/game/objects/items/melee/baton.dm
#	code/game/objects/items/stacks/sheets/glass.dm
#	code/game/objects/structures/flora.dm
#	code/game/objects/structures/morgue.dm
#	code/modules/antagonists/fugitive/hunters/hunter.dm
#	code/modules/antagonists/traitor/objectives/final_objective/final_objective.dm
#	code/modules/antagonists/traitor/objectives/kidnapping.dm
#	code/modules/art/statues.dm
#	code/modules/events/ghost_role/changeling_event.dm
#	code/modules/events/spacevine.dm
#	code/modules/mining/machine_redemption.dm
#	code/modules/mob/living/simple_animal/friendly/farm_animals.dm
#	code/modules/mob_spawn/mob_spawn.dm
#	code/modules/projectiles/ammunition/energy/laser.dm
#	code/modules/projectiles/guns/ballistic/pistol.dm
#	code/modules/projectiles/guns/ballistic/rifle.dm
#	code/modules/unit_tests/screenshots/screenshot_humanoids__datum_species_hemophage.png
#	code/modules/unit_tests/screenshots/screenshot_humanoids__datum_species_human_felinid.png
#	code/modules/uplink/uplink_items.dm
#	code/modules/vending/autodrobe.dm
#	config/config.txt
#	config/game_options.txt
#	config/maps.txt
#	config/skyrat/skyrat_config.txt
#	html/changelogs/archive/2023-03.yml
#	icons/mob/clothing/feet.dmi
#	icons/mob/clothing/under/costume.dmi
#	icons/mob/inhands/clothing/shoes_lefthand.dmi
#	icons/mob/inhands/clothing/shoes_righthand.dmi
#	icons/mob/inhands/clothing/suits_lefthand.dmi
#	icons/mob/inhands/clothing/suits_righthand.dmi
#	icons/mob/species/human/human_face.dmi
#	icons/obj/clothing/shoes.dmi
#	icons/obj/clothing/under/costume.dmi
#	modular_skyrat/master_files/code/datums/components/fullauto.dm
#	modular_skyrat/master_files/code/datums/traits/negative.dm
#	modular_skyrat/master_files/code/datums/traits/neutral.dm
#	modular_skyrat/master_files/code/modules/clothing/under/jobs/security.dm
#	modular_skyrat/master_files/code/modules/projectiles/guns/ballistic/revolver.dm
#	modular_skyrat/master_files/icons/mob/clothing/under/civilian.dmi
#	modular_skyrat/master_files/icons/mob/clothing/under/civilian_digi.dmi
#	modular_skyrat/modules/aesthetics/guns/code/guns.dm
#	modular_skyrat/modules/aesthetics/guns/icons/guns.dmi
#	modular_skyrat/modules/blueshield/code/blueshield.dm
#	modular_skyrat/modules/blueshield/code/medkit.dm
#	modular_skyrat/modules/blueshield/code/special.dm
#	modular_skyrat/modules/customization/modules/clothing/under/misc.dm
#	modular_skyrat/modules/customization/modules/mob/living/carbon/human/species/hemophage.dm
#	modular_skyrat/modules/events/code/event_overrides.dm
#	modular_skyrat/modules/gunsgalore/icons/guns/gunsgalore_guns40x32.dmi
#	modular_skyrat/modules/loadouts/loadout_items/donator/personal/donator_personal.dm
#	modular_skyrat/modules/manufacturer_examine/code/gun_company_additions.dm
#	modular_skyrat/modules/manufacturer_examine/code/manufacturer_component.dm
#	modular_skyrat/modules/mapping/code/mob_spawns.dm
#	modular_skyrat/modules/modular_weapons/code/rifle.dm
#	modular_skyrat/modules/novaya_ert/code/automatic.dm
#	modular_skyrat/modules/sec_haul/code/guns/guns.dm
#	modular_skyrat/modules/tribal_extended/code/weapons/bow.dm
#	tgstation.dme
#	tgui/packages/tgui/interfaces/OreRedemptionMachine.js
#	tgui/packages/tgui/interfaces/VotePanel.tsx
2023-05-20 21:59:27 -04:00

103 lines
4.1 KiB
Plaintext

/datum/round_event_control/carp_migration
name = "Carp Migration"
typepath = /datum/round_event/carp_migration
weight = 10
min_players = 30
earliest_start = 45 MINUTES
max_occurrences = 2 //BUBBER EDIT: FIXES THIS DAMN CARP EVENT.
category = EVENT_CATEGORY_ENTITIES
description = "Summons a school of space carp."
min_wizard_trigger_potency = 0
max_wizard_trigger_potency = 3
admin_setup = list(/datum/event_admin_setup/carp_migration)
/datum/round_event_control/carp_migration/New()
. = ..()
if(!HAS_TRAIT(SSstation, STATION_TRAIT_CARP_INFESTATION))
return
weight *= 3
max_occurrences *= 2
earliest_start *= 0.5
/datum/round_event/carp_migration
announce_when = 3
start_when = 50
/// Set to true when we announce something to ghosts, to prevent duplicate announcements
var/hasAnnounced = FALSE
/// Most common mob type to spawn, must be a child of /mob/living/basic/carp
var/carp_type = /mob/living/basic/carp
/// Rarer mob type to spawn, must also be a child of /mob/living/basic/carp. If one of these is created, it will take priority to show ghosts.
var/boss_type = /mob/living/basic/carp/mega
/// What to describe detecting near the station
var/fluff_signal = "Unknown biological entities"
/// Associated lists of z level to a list of points to travel to, so that grouped fish move to the same places
var/list/z_migration_paths = list()
/datum/round_event/carp_migration/setup()
start_when = rand(40, 60)
/datum/round_event/carp_migration/announce(fake)
priority_announce("[fluff_signal] have been detected near [station_name()], please stand-by.", "Lifesign Alert")
/datum/round_event/carp_migration/start()
// Stores the most recent fish we spawn
var/mob/living/basic/carp/fish
for(var/obj/effect/landmark/carpspawn/spawn_point in GLOB.landmarks_list)
if(prob(95))
fish = new carp_type(spawn_point.loc)
else
fish = new boss_type(spawn_point.loc)
fishannounce(fish) //Prefer to announce the megacarps over the regular fishies
var/z_level_key = "[spawn_point.z]"
if (!z_migration_paths[z_level_key])
z_migration_paths[z_level_key] = pick_carp_migration_points(z_level_key)
if (z_migration_paths[z_level_key]) // Still possible we failed to set anything here if we're unlucky
fish.migrate_to(z_migration_paths[z_level_key])
fishannounce(fish)
/// Generate two locations for carp to travel to, one in the station and one off in space
/datum/round_event/carp_migration/proc/pick_carp_migration_points(z_level_key)
var/list/valid_areas = list()
var/list/station_areas = GLOB.the_station_areas
for (var/area/potential_area as anything in SSmapping.areas_in_z[z_level_key])
if (!is_type_in_list(potential_area, station_areas))
continue
valid_areas += potential_area
var/turf/station_turf = get_safe_random_station_turf(valid_areas)
if (!station_turf)
return list()
var/turf/exit_turf = get_edge_target_turf(station_turf, pick(GLOB.alldirs))
return list(WEAKREF(station_turf), WEAKREF(exit_turf))
/datum/round_event/carp_migration/proc/fishannounce(atom/fish)
if (!hasAnnounced)
announce_to_ghosts(fish) //Only anounce the first fish
hasAnnounced = TRUE
/datum/event_admin_setup/carp_migration
/// Admin set list of turfs for carp to travel to for each z level
var/list/targets_per_z = list()
/datum/event_admin_setup/carp_migration/prompt_admins()
targets_per_z = list()
if (tgui_alert(usr, "Direct carp to your current location? Only applies to your current Z level.", "Carp Direction", list("Yes", "No")) != "Yes")
return
record_admin_location()
while (tgui_alert(usr, "Add additional locations? Only applies to your current Z level.", "More Carp Direction", list("Yes", "No")) == "Yes")
record_admin_location()
/// Stores the admin's current location corresponding to the z level of that location
/datum/event_admin_setup/carp_migration/proc/record_admin_location()
var/turf/aimed_turf = get_turf(usr)
var/z_level_key = "[aimed_turf.z]"
if (!targets_per_z[z_level_key])
targets_per_z[z_level_key] = list()
targets_per_z[z_level_key] += WEAKREF(aimed_turf)
/datum/event_admin_setup/carp_migration/apply_to_event(datum/round_event/carp_migration/event)
event.z_migration_paths = targets_per_z