mirror of
https://github.com/CHOMPstation/CHOMPstation.git
synced 2026-08-21 11:06:25 +01:00
VS: Allow weighted picklist spawners
This commit is contained in:
@@ -168,18 +168,23 @@
|
||||
density = 0
|
||||
anchored = 1
|
||||
|
||||
//Weighted with values (not %chance, but relative weight)
|
||||
//Can be left value-less for all equally likely
|
||||
var/list/mobs_to_pick_from
|
||||
var/mob/living/simple_animal/my_mob
|
||||
var/depleted = FALSE
|
||||
|
||||
//When the below chance fails, the spawner is marked as depleted and stops spawning
|
||||
var/prob_spawn = 100 //Chance of spawning a mob whenever they don't have one
|
||||
var/prob_fall = 5 //Above decreases by this much each time one spawns
|
||||
|
||||
//Settings to help mappers/coders have their mobs do what they want in this case
|
||||
var/faction //To prevent infighting if it spawns various mobs, set a faction
|
||||
var/atmos_comp //TRUE will set all their survivability to be within 20% of the current air
|
||||
var/guard //# will set the mobs to remain nearby their spawn point within this dist
|
||||
|
||||
//Internal use only
|
||||
var/mob/living/simple_animal/my_mob
|
||||
var/depleted = FALSE
|
||||
|
||||
/obj/tether_away_spawner/initialize()
|
||||
. = ..()
|
||||
|
||||
@@ -198,7 +203,7 @@
|
||||
|
||||
if(prob(prob_spawn))
|
||||
prob_spawn -= prob_fall
|
||||
var/picked_type = pick(mobs_to_pick_from)
|
||||
var/picked_type = pickweight(mobs_to_pick_from)
|
||||
my_mob = new picked_type(get_turf(src))
|
||||
my_mob.low_priority = TRUE
|
||||
|
||||
@@ -231,3 +236,18 @@
|
||||
processing_objects -= src
|
||||
depleted = TRUE
|
||||
return
|
||||
|
||||
//Shadekin spawner. Could have them show up on any mission, so it's here.
|
||||
//Make sure to put them away from others, so they don't get demolished by rude mobs.
|
||||
/obj/tether_away_spawner/shadekin
|
||||
name = "Shadekin Spawner"
|
||||
icon = 'icons/mob/vore_shadekin.dmi'
|
||||
icon_state = "spawner"
|
||||
|
||||
faction = "shadekin"
|
||||
prob_spawn = 1
|
||||
prob_fall = 1
|
||||
guard = 10 //Don't wander too far, to stay alive.
|
||||
mobs_to_pick_from = list(
|
||||
/mob/living/simple_animal/shadekin
|
||||
)
|
||||
|
||||
@@ -64,9 +64,10 @@
|
||||
prob_fall = 10
|
||||
guard = 20
|
||||
mobs_to_pick_from = list(
|
||||
/mob/living/simple_animal/hostile/hivebot/range,
|
||||
/mob/living/simple_animal/hostile/hivebot/range/ion,
|
||||
/mob/living/simple_animal/hostile/hivebot/range/laser
|
||||
/mob/living/simple_animal/hostile/hivebot/range = 3,
|
||||
/mob/living/simple_animal/hostile/hivebot/range/ion = 3,
|
||||
/mob/living/simple_animal/hostile/hivebot/range/laser = 3,
|
||||
/mob/living/simple_animal/hostile/badboi = 1
|
||||
)
|
||||
|
||||
/obj/tether_away_spawner/aerostat_surface
|
||||
@@ -77,8 +78,9 @@
|
||||
prob_fall = 10
|
||||
guard = 20
|
||||
mobs_to_pick_from = list(
|
||||
/mob/living/simple_animal/hostile/jelly,
|
||||
/mob/living/simple_animal/hostile/viscerator
|
||||
/mob/living/simple_animal/hostile/jelly = 3,
|
||||
/mob/living/simple_animal/hostile/viscerator = 2,
|
||||
/mob/living/simple_animal/hostile/badboi = 1
|
||||
)
|
||||
|
||||
/obj/structure/old_roboprinter
|
||||
|
||||
@@ -86,15 +86,17 @@
|
||||
|
||||
// Two mob spawners that are placed on the map that spawn some mobs!
|
||||
// They keep track of their mob, and when it's dead, spawn another (only if nobody is looking)
|
||||
// Note that if your map has step teleports, mobs may wander through them accidentally and not know how to get back
|
||||
/obj/tether_away_spawner/beach_outside
|
||||
name = "Beach Outside Spawner" //Just a name
|
||||
faction = "beach_out" //Sets all the mobs to this faction so they don't infight
|
||||
atmos_comp = TRUE //Sets up their atmos tolerances to work in this setting, even if they don't normally (20% up/down tolerance for each gas, and heat)
|
||||
prob_spawn = 50 //Chance of this spawner spawning a mob (once this is missed, the spawner is 'depleted' and won't spawn anymore)
|
||||
prob_fall = 25 //Chance goes down by this much each time it spawns one (not defining and prob_spawn 100 means they spawn as soon as one dies)
|
||||
guard = 40 //They'll stay within this range (not defining disables)
|
||||
guard = 40 //They'll stay within this range (not defining this disables them staying nearby and they will wander the map (and through step teleports))
|
||||
mobs_to_pick_from = list(
|
||||
/mob/living/simple_animal/snake
|
||||
/mob/living/simple_animal/snake = 3, //Snakes are 3x more likely to spawn than
|
||||
/mob/living/simple_animal/hostile/frog = 1 //these frogs are, with these values
|
||||
)
|
||||
|
||||
/obj/tether_away_spawner/beach_outside_friendly
|
||||
|
||||
Reference in New Issue
Block a user