Merge pull request #15098 from Very-Soft/redgate

Randomness updates
This commit is contained in:
Casey
2023-07-01 18:30:18 -04:00
committed by CHOMPStation2
parent ed75318989
commit 4cefffe8f4
3 changed files with 71 additions and 24 deletions

View File

@@ -1,4 +1,4 @@
/area/awaymission
/area
name = "\improper Unknown Location"
icon_state = "away"
var/list/valid_spawn_turfs = list()
@@ -6,47 +6,82 @@
var/list/valid_flora = list()
var/mobcountmax = 0
var/floracountmax = 0
var/semirandom = FALSE
var/semirandom_groups = 0
var/semirandom_group_min = 0
var/semirandom_group_max = 10
var/mob_intent = "default" //"default" uses default settings, use "hostile", "retaliate", or "passive" respectively
/area/awaymission/proc/EvalValidSpawnTurfs()
/area/proc/EvalValidSpawnTurfs()
//Adds turfs to the valid)turfs list, used for spawning.
if(mobcountmax || floracountmax)
if(mobcountmax || floracountmax || semirandom)
for(var/turf/simulated/floor/F in src)
valid_spawn_turfs += F
for(var/turf/unsimulated/floor/F in src)
valid_spawn_turfs += F
/area/awaymission/LateInitialize()
/area/LateInitialize()
..()
EvalValidSpawnTurfs()
if(!valid_spawn_turfs.len && (mobcountmax || floracountmax))
to_world_log("Error! [src] does not have any turfs!")
log_and_message_admins("Error! [src] does not have any turfs!")
return TRUE
//Handles random mob placement for mobcountmax, as defined/randomized in initialize of each individual area.
if(mobcountmax)
if(mobcountmax || semirandom)
spawn_mob_on_turf()
//Handles random flora placement for floracountmax, as defined/randomized in initialize of each individual area.
if(floracountmax)
spawn_flora_on_turf()
to_world("Away mission spawning done.")
message_admins("Away mission spawning done.")
/area/awaymission/proc/spawn_mob_on_turf()
/area/proc/spawn_mob_on_turf()
if(!valid_mobs.len)
to_world_log("[src] does not have a set valid mobs list!")
return TRUE
var/mob/M
var/turf/Turf
for(var/mobscount = 0 to mobcountmax)
M = pick(valid_mobs)
if(semirandom)
for(var/groupscount = 0 to (semirandom_groups - 1))
var/ourgroup = pickweight(valid_mobs)
var/goodnum = rand(semirandom_group_min, semirandom_group_max)
for(var/mobscount = 0 to (goodnum - 1))
M = pickweight(ourgroup)
Turf = pick(valid_spawn_turfs)
valid_spawn_turfs -= Turf
new M(Turf)
var/mob/ourmob = new M(Turf)
adjust_mob(ourmob)
else
for(var/mobscount = 0 to mobcountmax)
M = pickweight(valid_mobs)
Turf = pick(valid_spawn_turfs)
valid_spawn_turfs -= Turf
var/mob/ourmob = new M(Turf)
adjust_mob(ourmob)
/area/awaymission/proc/spawn_flora_on_turf()
/area/proc/adjust_mob(var/mob/living/M)
if(!isliving(M))
log_admin("[src] spawned [M.type], which is not mob/living, FIXIT")
return
var/datum/ai_holder/AI = M.ai_holder
switch(mob_intent)
if("default")
return
if("hostile")
AI.hostile = TRUE
AI.retaliate = TRUE
if("retaliate")
AI.hostile = FALSE
AI.retaliate = TRUE
if("passive")
AI.hostile = FALSE
AI.retaliate = FALSE
/area/proc/spawn_flora_on_turf()
if(!valid_flora.len)
to_world_log("[src] does not have a set valid flora list!")
return TRUE

View File

@@ -5,6 +5,9 @@
icon_state = "fakesun"
invisibility = INVISIBILITY_ABSTRACT
var/atom/movable/sun_visuals/sun
var/family = null //Allows multipe maps that are THEORETICALLY connected to use the same settings when not in a connected Z stack
var/shared_settings //Automatically set if using the family var
var/static/world_suns = list() //List of all the fake_suns in the world, used for checking for family members
var/list/possible_light_setups = list(
list(
@@ -78,13 +81,26 @@
)
/obj/effect/fake_sun/New(loc, ...)
. = ..()
world_suns += src
/obj/effect/fake_sun/Initialize()
..()
return INITIALIZE_HINT_LATELOAD
/obj/effect/fake_sun/LateInitialize()
. = ..()
var/list/choice = pick(possible_light_setups)
var/list/choice
if(family) //Allows one to make multiple fake_suns to use the same settings
for(var/obj/effect/fake_sun/l in world_suns) //check all the suns that exist
if(l.family == family && l.shared_settings) //do you have settings we need?
choice = l.shared_settings
break
if(!choice) //We didn't get anything from our family, let's pick something
choice = pick(possible_light_setups)
if(family) //Let's pass our settings on to our family
shared_settings = choice
if(choice["brightness"] <= LIGHTING_SOFT_THRESHOLD) // dark!
return

View File

@@ -254,7 +254,7 @@
name = "Redgate Submap"
desc = "Please do not use this."
mappath = null
associated_map_datum = null
associated_map_datum = /datum/map_z_level/common_lateload/redgate_destination
/datum/map_z_level/common_lateload/redgate_destination
name = "Redgate Destination"
@@ -269,25 +269,21 @@
name = "Teppi Ranch"
desc = "An abandoned teppi ranch!"
mappath = 'maps/redgate/teppiranch.dmm'
associated_map_datum = /datum/map_z_level/common_lateload/redgate_destination
/datum/map_template/common_lateload/redgate/innland
name = "Innland"
desc = "Caves and grass and a tavern, woah!"
mappath = 'maps/redgate/innland.dmm'
associated_map_datum = /datum/map_z_level/common_lateload/redgate_destination
/datum/map_template/common_lateload/redgate/abandonedisland
name = "Abandoned Island"
desc = "It seems like it used to be people here!"
mappath = 'maps/redgate/abandonedisland.dmm'
associated_map_datum = /datum/map_z_level/common_lateload/redgate_destination
/datum/map_template/common_lateload/redgate/darkadventure
name = "Dark Adventure"
desc = "This place seems broken!"
mappath = 'maps/redgate/darkadventure.dmm'
associated_map_datum = /datum/map_z_level/common_lateload/redgate_destination
//////////////////////////////////////////////////////////////////////////////////////
// Admin-use z-levels for loading whenever an admin feels like