Files
Paradise/code/modules/events/carp_migration.dm
DGamerL bad8b31afa Changes all .len to length() where applicable (#25174)
* Globals work

* Double access works

* All other things

* Revert "All other things"

This reverts commit 6574442eb6.

* More changes that compile and work

* IT WORKS AAAAAA

* Changes even more .len to length()

* Apply suggestions from code review

* Update code/datums/mind.dm

* Update code/__HELPERS/sorts/InsertSort.dm

Co-authored-by: Deniz <66401072+Oyu07@users.noreply.github.com>

* Update code/__HELPERS/sanitize_values.dm

Co-authored-by: Deniz <66401072+Oyu07@users.noreply.github.com>

---------

Co-authored-by: FunnyMan3595 (Charlie Nolan) <funnyman@google.com>
Co-authored-by: Deniz <66401072+Oyu07@users.noreply.github.com>
2024-04-19 17:32:09 +00:00

45 lines
1.5 KiB
Plaintext

/datum/event/carp_migration
announceWhen = 50
endWhen = 900
var/list/spawned_mobs = list(
/mob/living/simple_animal/hostile/carp = 95,
/mob/living/simple_animal/hostile/carp/megacarp = 5)
/datum/event/carp_migration/setup()
announceWhen = rand(40, 60)
endWhen = rand(600, 1200)
/datum/event/carp_migration/announce()
var/announcement = ""
if(severity == EVENT_LEVEL_MAJOR)
announcement = "Massive migration of unknown biological entities has been detected near [station_name()], please stand-by."
else
announcement = "Unknown biological entities have been detected near [station_name()], please stand-by."
GLOB.minor_announcement.Announce(announcement, "Lifesign Alert")
/datum/event/carp_migration/start()
if(severity == EVENT_LEVEL_MAJOR)
spawn_fish(length(GLOB.landmarks_list))
else if(severity == EVENT_LEVEL_MODERATE)
spawn_fish(rand(4, 6)) //12 to 30 carp, in small groups
else
spawn_fish(rand(1, 3), 1, 2) //1 to 6 carp, alone or in pairs
/datum/event/carp_migration/proc/spawn_fish(num_groups, group_size_min = 3, group_size_max = 5)
var/list/spawn_locations = list()
for(var/thing in GLOB.carplist)
spawn_locations.Add(get_turf(thing))
spawn_locations = shuffle(spawn_locations)
num_groups = min(num_groups, length(spawn_locations))
var/i = 1
while(i <= num_groups)
var/group_size = rand(group_size_min, group_size_max)
for(var/j = 1, j <= group_size, j++)
var/carptype = pickweight(spawned_mobs)
new carptype(spawn_locations[i])
i++