Blobs locations are now more random.

Blobs now randomly pick a random turf without obstructions in maintenance, instead of from a pre-determined list of locations.
Blobs also now log their spawn location, which admins can use to jump to it.

Space vines and nuclear discs have been updated to use the same mechanics.
This commit is contained in:
PsiOmegaDelta
2015-10-13 16:54:46 +02:00
parent 452e2e36df
commit 3b5990121f
12 changed files with 74 additions and 46 deletions

View File

@@ -32,9 +32,11 @@
#include "code\__defines\research.dm"
#include "code\__defines\species_languages.dm"
#include "code\__defines\turfs.dm"
#include "code\_helpers\areas.dm"
#include "code\_helpers\atmospherics.dm"
#include "code\_helpers\datum_pool.dm"
#include "code\_helpers\files.dm"
#include "code\_helpers\functional.dm"
#include "code\_helpers\game.dm"
#include "code\_helpers\global_lists.dm"
#include "code\_helpers\icons.dm"

21
code/_helpers/areas.dm Normal file
View File

@@ -0,0 +1,21 @@
//Takes: Area type as text string or as typepath OR an instance of the area.
//Returns: A list of all turfs in areas of that type in the world.
/proc/get_area_turfs(var/areatype, var/list/predicates)
if(!areatype) return null
if(istext(areatype)) areatype = text2path(areatype)
if(isarea(areatype))
var/area/areatemp = areatype
areatype = areatemp.type
var/list/turfs = new/list()
for(var/areapath in typesof(areatype))
var/area/A = locate(areapath)
for(var/turf/T in A.contents)
if(!predicates || all_predicates_true(T, predicates))
turfs += T
return turfs
/proc/pick_area_turf(var/areatype, var/list/predicates)
var/list/turfs = get_area_turfs(areatype, predicates)
if(turfs && turfs.len)
return pick(turfs)

View File

@@ -0,0 +1,14 @@
/proc/all_predicates_true(var/input, var/list/predicates)
for(var/i = 1 to predicates.len)
if(!call(predicates[i])(input))
return FALSE
return TRUE
/proc/any_predicate_true(var/input, var/list/predicates)
if(!predicates.len)
return TRUE
for(var/i = 1 to predicates.len)
if(call(predicates[i])(input))
return TRUE
return FALSE

View File

@@ -32,3 +32,12 @@
if(!available_turfs.len)
available_turfs = start_turfs
return pick(available_turfs)
/proc/turf_contains_dense_objects(var/turf/T)
return T.contains_dense_objects()
/proc/not_turf_contains_dense_objects(var/turf/T)
return !turf_contains_dense_objects(T)
/proc/is_station_turf(var/turf/T)
return T && isStationLevel(T.z)

View File

@@ -718,21 +718,6 @@ proc/GaussRandRound(var/sigma,var/roundto)
if(istype(N, areatype)) areas += N
return areas
//Takes: Area type as text string or as typepath OR an instance of the area.
//Returns: A list of all turfs in areas of that type of that type in the world.
/proc/get_area_turfs(var/areatype)
if(!areatype) return null
if(istext(areatype)) areatype = text2path(areatype)
if(isarea(areatype))
var/area/areatemp = areatype
areatype = areatemp.type
var/list/turfs = new/list()
for(var/area/N in world)
if(istype(N, areatype))
for(var/turf/T in N) turfs += T
return turfs
//Takes: Area type as text string or as typepath OR an instance of the area.
//Returns: A list of all atoms (objs, turfs, mobs) in areas of that type of that type in the world.
/proc/get_area_all_atoms(var/areatype)

View File

@@ -61,8 +61,8 @@ var/list/teleportlocs = list()
for(var/area/AR in world)
if(istype(AR, /area/shuttle) || istype(AR, /area/syndicate_station) || istype(AR, /area/wizard_station)) continue
if(teleportlocs.Find(AR.name)) continue
var/turf/picked = pick(get_area_turfs(AR.type))
if (picked.z in config.station_levels)
var/turf/picked = pick_area_turf(AR.type, list(/proc/is_station_turf))
if (picked)
teleportlocs += AR.name
teleportlocs[AR.name] = AR
@@ -78,8 +78,8 @@ var/list/ghostteleportlocs = list()
if(istype(AR, /area/turret_protected/aisat) || istype(AR, /area/derelict) || istype(AR, /area/tdome) || istype(AR, /area/shuttle/specops/centcom))
ghostteleportlocs += AR.name
ghostteleportlocs[AR.name] = AR
var/turf/picked = pick(get_area_turfs(AR.type))
if (picked.z in config.player_levels)
var/turf/picked = pick_area_turf(AR.type, list(/proc/is_station_turf))
if (picked)
ghostteleportlocs += AR.name
ghostteleportlocs[AR.name] = AR

View File

@@ -418,10 +418,14 @@ obj/machinery/nuclearbomb/proc/nukehack_win(mob/user as mob)
nuke_disks |= src
/obj/item/weapon/disk/nuclear/Destroy()
if(!nuke_disks.len && blobstart.len > 0)
var/obj/D = new /obj/item/weapon/disk/nuclear(pick(blobstart))
message_admins("[src], the last authentication disk, has been destroyed. Spawning [D] at ([D.x], [D.y], [D.z]).")
log_game("[src], the last authentication disk, has been destroyed. Spawning [D] at ([D.x], [D.y], [D.z]).")
nuke_disks -= src
if(!nuke_disks.len)
var/turf/T = pick_area_turf(/area/maintenance, /proc/not_turf_contains_dense_objects)
if(T)
var/obj/D = new /obj/item/weapon/disk/nuclear(T)
log_and_message_admins_with_location("[src], the last authentication disk, has been destroyed. Spawning [D] at ([D.x], [D.y], [D.z]).", T.x, T.y, T.z)
else
log_and_message_admins("[src], the last authentication disk, has been destroyed. Failed to respawn disc!")
..()
/obj/item/weapon/disk/nuclear/touch_map_edge()

View File

@@ -52,10 +52,6 @@
prisonsecuritywarp += loc
qdel(src)
return
if("blobstart")
blobstart += loc
qdel(src)
return
if("xeno_spawn")
xeno_spawn += loc
qdel(src)

View File

@@ -71,7 +71,6 @@ var/list/tdomeobserve = list()
var/list/tdomeadmin = list()
var/list/prisonsecuritywarp = list() // Prison security goes to these.
var/list/prisonwarped = list() // List of players already warped.
var/list/blobstart = list()
var/list/ninjastart = list()
var/list/cardinal = list(NORTH, SOUTH, EAST, WEST)

View File

@@ -1,6 +1,9 @@
/mob/var/lastattacker = null
/mob/var/lastattacked = null
/mob/var/attack_log = list( )
/mob/var/attack_log = list()
proc/log_and_message_admins_with_location(var/message, var/x, var/y, var/z, var/mob/user = usr)
log_and_message_admins("[message] (<a HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[x];Y=[y];Z=[z]'>JMP</a>)", user)
proc/log_and_message_admins(var/message as text, var/mob/user = usr)
log_admin(user ? "[key_name(user)] [message]" : "EVENT [message]")

View File

@@ -1,6 +1,5 @@
/datum/event/blob
announceWhen = 12
endWhen = 120
var/obj/effect/blob/core/Blob
@@ -8,10 +7,13 @@
level_seven_announcement()
/datum/event/blob/start()
var/turf/T = pick(blobstart)
var/turf/T = pick_area_turf(/area/maintenance, list(/proc/is_station_turf, /proc/not_turf_contains_dense_objects))
if(!T)
log_and_message_admins("Blob failed to find a viable turf.")
kill()
return
log_and_message_admins_with_location("Event: Blob spawned at \the [get_area(T)] ([T.x],[T.y],[T.z])", T.x, T.y, T.z)
Blob = new /obj/effect/blob/core(T)
for(var/i = 1; i < rand(3, 4), i++)
Blob.process()

View File

@@ -3,15 +3,8 @@
/proc/spacevine_infestation(var/potency_min=70, var/potency_max=100, var/maturation_min=5, var/maturation_max=15)
spawn() //to stop the secrets panel hanging
var/list/turf/simulated/floor/turfs = list() //list of all the empty floor turfs in the hallway areas
for(var/areapath in typesof(/area/hallway))
var/area/A = locate(areapath)
for(var/turf/simulated/floor/F in A.contents)
if(turf_clear(F))
turfs += F
if(turfs.len) //Pick a turf to spawn at if we can
var/turf/simulated/floor/T = pick(turfs)
var/turf/T = pick_area_turf(/area/hallway, list(/proc/is_station_turf, /proc/not_turf_contains_dense_objects))
if(T)
var/datum/seed/seed = plant_controller.create_random_seed(1)
seed.set_trait(TRAIT_SPREAD,2) // So it will function properly as vines.
seed.set_trait(TRAIT_POTENCY,rand(potency_min, potency_max)) // 70-100 potency will help guarantee a wide spread and powerful effects.
@@ -23,9 +16,9 @@
vine.mature_time = 0
vine.process()
message_admins("<span class='notice'>Event: Spacevines spawned at [T.loc] ([T.x],[T.y],[T.z])</span>")
log_and_message_admins_with_location("Event: Spacevines spawned at [T.loc] ([T.x],[T.y],[T.z])", T.x, T.y, T.z)
return
message_admins("<span class='notice'>Event: Spacevines failed to find a viable turf.</span>")
log_and_message_admins("<span class='notice'>Event: Spacevines failed to find a viable turf.</span>")
/obj/effect/dead_plant
anchored = 1