Minor refactor of spawners, fixed rogue drone and carp events not spawning mobs (#17849)

* lessens the use of GLOB.landmarks_list

* delete redundant blob icon

* Apply suggestions from code review

Co-authored-by: moxian <moxian@users.noreply.github.com>

* review part 2

* aa review

Co-authored-by: moxian <moxian@users.noreply.github.com>
This commit is contained in:
S34N
2022-05-24 14:26:36 +01:00
committed by GitHub
co-authored by moxian
parent 27f72f078d
commit 83e228cbcb
17 changed files with 130 additions and 192 deletions
-3
View File
@@ -10,9 +10,6 @@
log_and_message_admins("Warning: Could not spawn any mobs for event Blob")
/datum/event/blob/start()
var/turf/T = pick(GLOB.blobstart)
if(!T)
return kill()
INVOKE_ASYNC(src, .proc/make_blob)
/datum/event/blob/proc/make_blob()
+2 -4
View File
@@ -30,10 +30,8 @@
/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.landmarks_list)
var/obj/effect/landmark/C = thing
if(C.name == "carpspawn")
spawn_locations.Add(C.loc)
for(var/thing in GLOB.carplist)
spawn_locations.Add(get_turf(thing))
spawn_locations = shuffle(spawn_locations)
num_groups = min(num_groups, spawn_locations.len)
+2 -4
View File
@@ -5,10 +5,8 @@
/datum/event/rogue_drone/start()
var/list/possible_spawns = list()
for(var/thing in GLOB.landmarks_list)
var/obj/effect/landmark/C = thing
if(C.name == "carpspawn") //spawn them at the same place as carp
possible_spawns.Add(C)
for(var/thing in GLOB.carplist)
possible_spawns.Add(thing)
var/num = rand(2, 12)
for(var/i = 0, i < num, i++)
+4 -15
View File
@@ -18,22 +18,11 @@
var/datum/mind/player_mind = new /datum/mind(key_of_slaughter)
player_mind.active = TRUE
var/list/spawn_locs = list()
for(var/thing in GLOB.landmarks_list)
var/obj/effect/landmark/L = thing
if(isturf(L.loc))
switch(L.name)
if("revenantspawn")
spawn_locs += L.loc
if(!spawn_locs) //If we can't find any revenant spawns, try the carp spawns
for(var/thing in GLOB.landmarks_list)
var/obj/effect/landmark/L = thing
if(isturf(L.loc))
switch(L.name)
if("carpspawn")
spawn_locs += L.loc
if(!spawn_locs) //If we can't find either, just spawn the revenant at the player's location
for(var/obj/effect/landmark/spawner/rev/L in GLOB.landmarks_list)
spawn_locs += get_turf(L)
if(!spawn_locs) //If we can't find a good place, just spawn the revenant at the player's location
spawn_locs += get_turf(player_mind.current)
if(!spawn_locs) //If we can't find THAT, then just retry
if(!spawn_locs) //If we can't find THAT, then give up
kill()
return
var/obj/effect/dummy/slaughter/holder = new /obj/effect/dummy/slaughter(pick(spawn_locs))
+2 -4
View File
@@ -24,10 +24,8 @@ GLOBAL_LIST_INIT(unused_trade_stations, list("sol"))
return
var/list/spawnlocs = list()
for(var/thing in GLOB.landmarks_list)
var/obj/effect/landmark/landmark = thing
if(landmark.name == "traderstart_[station]")
spawnlocs += get_turf(landmark)
for(var/obj/effect/landmark/spawner/soltrader/S in GLOB.landmarks_list)
spawnlocs += get_turf(S)
if(!spawnlocs.len)
return