Files
Aurora.3/code/modules/events/infestation.dm
Lohikar f6dc33a465 Newmap - SMC, Openturf, Arrivals Controller, and Mine Turf Improvements (#1958)
* Replace SSingulo with SScalamity; processing cleanup
- SScalamity now handles blobs as well as singularity-types.
- Processing subtypes have been simplified to not require a stop_processing definition.

* this is probably important

* Remove cascade disabling SSgarbage

* Fixed a bug where dust() did not qdel the target mob

* Misc fixes

* Fix decals surviving break-to-plating

* Subsystem flag tweaks

* Apparently subsystems are new'd before config is.

* Fix paper icons

* Speculative fix for insane lag

* Better machinery stat

* Make organs not use SSoverlay

* Misc bugfixes & tweaks

* Nightmode fixes

* Changelog for SMC

* Port /tg/'s improved MC crash handling

* Add some more SS Recover() procs

* supply_controller -> SScargo

* More New() -> Initialize()

* pAI and robot construction overlays

* Fix cargo unit tests

* Merge the DMM Suite's atom/New() into atoms_init

* Lighting pre-baking

* Lighting initialization logging

* Fix some bad SS init orders

* Fix SSlighting logging; rename Processes to MC

* Speculative fix for insane GC lag

* Prebaked openturf/icon_smooth & fix lighting prebake

* SS init status; SSatoms LATEQDEL

* Fix bug with MC init stat panel

* Fix parallax

* Misc

* Ignore SS_NO_DISPLAY during init

* apparently this is important

* REEEEEE

* Image GC fixes; broadcaster radio-new sanity

* RCON Cleanup

* Move pAI recruiter into subsystem

* Move global solars list into sun subsystem

* Make chickens not use a global

* Demote SSdisposals to SS_BACKGROUND; garbage-debug cleanup

* Speed up space init a little

* Fix bad timer flags on floor drying

* Subsystem panic-restart verb for mins

* Explosion speedup

* Minor subsystem & MC logging tweaks

* SSopenturf improvements

* Make pipenet actually initialize (whoops)

* Minor tweaks

* Implement lighting rounding

* comments are hard okay

* Minor lattice tweaks

* Fix some timer issues & better closet init

* Timer sanity

* Request console tweaks + Storage init sanity

* Minor SSmachiner RCON improvements

* Further reduce world-start timer count

* Standardize subsystem logging

* Garbage hard delete profiling from /tg/

* Timer hang detection & recovery

* Log machines that sleep in process() and fuck up SSmachinery

* Fix an issue with external airlocks sleeping in process()

* Failsafe logging

* Minor tweaks

* Revert "Request console tweaks + Storage init sanity"

This reverts commit 98d3579e35.

* Re-implement RC changes

* Fix SQL FT saving

* Fix SSmachinery sleep in disposals

* Minor SS tweaks

* Paper fixes

* Blood drying fixes

* Merge gameticker and SSticker

* Minor global list init cleanup

* Lagcheck biogenerator & bags

* Tweak SScargo init order; RIG Initialize()

* Caching tweaks

* Remove rogue comma

* Initialize fixes

* Lighting destroy cleanup

* Fix emagging airlocks

* Initial SSicon implementation

* Tweaks & Fixes

* Fire + Air alarm queued icon updates

* Overlays + Queued icon cleanup

* Runtime & background fixes

* Kill some meaningless set statements

* Kill some image qdels

* Bump up lighting rounding val

* Fix adv. scanner destroy runtimes

* Remove unneeded icon update limiting

* Move icon smoothing into helpers

* Show a warning if DM 510 compiles without memory leak hack enabled

* Re-organize subsystems & MC defines a little

* Airlock SFX

* Log of Changes

* Make SSicon_update disable itself when not doing anything

* Fix respawn verb runtime when used early in server-init

* Add more information to MC's stat_entry()

* Replace direct refernces to gcDestroyed with QDEL* macros

* plant_controller -> SSplants

* More plant tweaks

* Add more humor to changelog

* Move parallax globals into SSparallax

* Lighting responsiveness tweaks

* Fix parallax init order & better MC init panel stat

* Make mobs GC

* More overlays + Remove intercom spawn()

* SSfast_process; make pinpointers not use spawn-recursion to process
Also made the SM Cascade beach process with SSprocessing instead of a spawn loop.

* Update changelog

* Mob GC tweaks

* Del() cleanup

* Fix insomniac ZAS connection edges

* Minor pAI cleanup

* Convert more things to SSoverlay; fix duplicated overlay in field gens

* SM Bluespace turf tweaks

* Update SSgarbage debug globals list

* Human-type qdel tweaks

* Subsystem suspension; stat_entry improvements

* SQL Statistics cleanup

* Fix runtimes with ambrosia

* More disable() -> suspend(); fix nightmode again

* Human qdel fix; minor tweaks

* Update turbolift to work with StonedMC

* Make lifts use timers instead of a subsystem

* Make SSassets start earlier

* Convert the radio controller into a subsystem

* Fix some missing CHECK_TICKs in asteroid generation

* MC stat tweaks; make shouldnt_see a typecache

* Kill some redundant debug-controller entries

* radio_controller -> SSradio

* Better SSgarbage hard-del logging from /tg/ upstream

* Logging tweaks + GELF

* Misc client caching improvements

* Slime SSoverlay

* Oven icon fixes

* Implant fixes
- Death implants will no longer spam Common on death of user.
- Death implants should handle a deleted user better.

* Holder tweaks + Welding tool Initialize()

* Fix some bad subsystem logging

* Fix suit cooling units spawning without cells

* Starlight tweaks

* Gibber infinite gib fix

* More SSoverlay stuff

* Make crates use CUT_OVERLAY_IN

* Make SSarrivals suspend instead of disable

* Make openturf use split/phased tick checks

* Speculative fix for unwet timer runtimes

* Blood overlay tweaks/fixes

* Update crusher to play nice with SMC + SSoverlay

* Openturf improvements and fixes

* Minor turbolift tweaks

* Lighting performance improvements + ChangeTurf tweaks

* this is probably important

* Fix wall weld noises on changeturf

* More ChangeTurf tweaks

* Explosion tweaks

* Pre-game lobby tweaks

* Openturf tweaks

* Prevent admins from starting the game before init finishes

* Fix Travis

* Kill an unused var

* Fix ChangeTurf runtimes on openturfs

* Fixes

* Browser datum fixes, asset caching

* Update changelog

* Changelog

* Lobby tweaks

* Ticker tweaks; kill ticker var

* Further lobby tweaks

* Cascade tweaks

* air_master -> SSair

* Reduce overhead from radio autosay

* alarm_manager -> SSalarm

* bomb_processor -> SSexplosives

* corp_regs -> SSlaw

* ZAS overlay fixes

* Small wall icon optimization

* Fix effects master

* Assembly tweaks

* Megavend fixes

* Shuttle fixes

* Camera alert performance improvements

* Fix some world.log spam from lighting overlays

* Fix some Initialize() procs

* Openspace responsiveness tweaks

* Make HE pipes animate through openturfs

* Kill a spawn
2017-05-02 14:40:40 -04:00

217 lines
6.0 KiB
Plaintext

//Infestation event now has two modes.
//Mundane event spawns some creatures in a place, and tells you which and where.
//Moderate event spawns twice the amount of two types of creatures, in two places. And tells you where but not what spawns
#define LOC_KITCHEN 0
#define LOC_ATMOS 1
#define LOC_INCIN 2
#define LOC_CHAPEL 3
#define LOC_LIBRARY 4
#define LOC_HYDRO 5
#define LOC_VAULT 6
#define LOC_CONSTR 7
#define LOC_TECH 8
#define LOC_ARMORY 9
#define LOC_DORMS 10
#define LOC_FITNESS 11
#define LOC_HOLODECK 12
#define LOC_DISPOSAL 13
#define LOC_CARGO 14
#define LOC_MEETING 15
#define LOC_LOCKER 16
#define LOC_XENO 17
#define VERM_MICE 0
#define VERM_LIZARDS 1
#define VERM_SPIDERS 2
#define VERM_DIYAAB 3
#define VERM_BATS 4
#define VERM_YITHIAN 5
#define VERM_TINDALOS 6
/datum/event/infestation
announceWhen = 10
endWhen = 11
var/location
var/numlocs = 0
var/list/locstrings = list()
var/vermin
var/vermstring
var/spawn_area_type
var/list/turf/simulated/floor/turfs
no_fake = 1
/datum/event/infestation/start()
locstrings = new/list(2)
choose_location()
spawn_creatures()
if (severity == EVENT_LEVEL_MODERATE)
choose_location()
spawn_creatures()
/datum/event/infestation/proc/choose_location()
location = rand(0,17)
turfs = list()
numlocs++
switch(location)
if(LOC_KITCHEN)
spawn_area_type = /area/crew_quarters/kitchen
locstrings[numlocs] = "the kitchen"
if(LOC_ATMOS)
spawn_area_type = /area/engineering/atmos
locstrings[numlocs] = "atmospherics"
if(LOC_INCIN)
spawn_area_type = /area/maintenance/incinerator
locstrings[numlocs] = "the incinerator"
if(LOC_CHAPEL)
spawn_area_type = /area/chapel/main
locstrings[numlocs] = "the chapel"
if(LOC_LIBRARY)
spawn_area_type = /area/library
locstrings[numlocs] = "the library"
if(LOC_HYDRO)
spawn_area_type = /area/hydroponics
locstrings[numlocs] = "hydroponics"
if(LOC_VAULT)
spawn_area_type = /area/security/nuke_storage
locstrings[numlocs] = "the vault"
if(LOC_CONSTR)
spawn_area_type = /area/construction
locstrings[numlocs] = "the construction area"
if(LOC_TECH)
spawn_area_type = /area/storage/tech
locstrings[numlocs] = "technical storage"
if(LOC_ARMORY)
spawn_area_type = /area/security/armoury
locstrings[numlocs] = "the armoury"
if(LOC_DORMS)
spawn_area_type = /area/crew_quarters/sleep
locstrings[numlocs] = "the dormitories"
if(LOC_FITNESS)
spawn_area_type = /area/crew_quarters/fitness
locstrings[numlocs] = "the fitness room"
if(LOC_HOLODECK)
spawn_area_type = /area/holodeck/alphadeck
locstrings[numlocs] = "the holodeck"
if(LOC_DISPOSAL)
spawn_area_type = /area/quartermaster/office
locstrings[numlocs] = "the cargo disposals office"
if(LOC_CARGO)
spawn_area_type = /area/quartermaster/loading
locstrings[numlocs] = "the cargo bay"
if(LOC_MEETING)
spawn_area_type = /area/bridge/meeting_room
locstrings[numlocs] = "the command meeting room"
if(LOC_LOCKER)
spawn_area_type = /area/crew_quarters/locker
locstrings[numlocs] = "the locker room"
if(LOC_XENO)
spawn_area_type = /area/rnd/xenobiology
locstrings[numlocs] = "xenobiology"
for(var/areapath in typesof(spawn_area_type))
var/area/A = locate(areapath)
for(var/turf/simulated/floor/F in A.contents)
if(turf_clear(F))
turfs += F
/datum/event/infestation/proc/spawn_creatures()
var/list/spawn_types = list()
var/max_number
vermin = rand(0,6)
switch(vermin)
if(VERM_MICE)
spawn_types = list(/mob/living/simple_animal/mouse/gray, /mob/living/simple_animal/mouse/brown, /mob/living/simple_animal/mouse/white)
max_number = 16
//Large quantities of mice aren't a potential lag issue since they decompose to
//inert skeletons now
vermstring = "mice"
if(VERM_LIZARDS)
spawn_types = list(/mob/living/simple_animal/lizard)
max_number = 12
vermstring = "lizards"
if(VERM_SPIDERS)
spawn_types = list(/obj/effect/spider/spiderling)
max_number = 5
vermstring = "spiders"
if (VERM_DIYAAB)
spawn_types = list(/mob/living/simple_animal/hostile/diyaab)
max_number = 4
vermstring = "strange creatures"
if (VERM_BATS)
spawn_types = list(/mob/living/simple_animal/hostile/scarybat)
max_number = 4
vermstring = "space bats"
if (VERM_YITHIAN)
spawn_types = list(/mob/living/simple_animal/yithian)
max_number = 7
vermstring = "strange creatures"
if (VERM_TINDALOS)
spawn_types = list(/mob/living/simple_animal/tindalos)
max_number = 7
vermstring = "strange creatures"
if (severity == EVENT_LEVEL_MODERATE)
max_number *= 2
var/num = rand(2,max_number)
while(turfs.len > 0 && num > 0)
var/turf/simulated/floor/T = pick(turfs)
turfs.Remove(T)
num--
if(vermin == VERM_SPIDERS)
var/obj/effect/spider/spiderling/S = new /obj/effect/spider/spiderling(T)
S.amount_grown = 1
S.growth_rate = (rand(50,300)/1000)//At most, they grow at 30% the usual rate. As low as 1/20th
if (severity == EVENT_LEVEL_MODERATE)
S.growth_rate *= 2//They grow faster on the higher severity event
else
var/spawn_type = pick(spawn_types)
new spawn_type(T)
/datum/event/infestation/announce()
if (severity == EVENT_LEVEL_MODERATE)
command_announcement.Announce("Bioscans indicate that large numbers of lifeforms have been breeding in [locstrings[1]] and [locstrings[2]]. Clear them out, before this starts to affect productivity.", "Vermin infestation")
else
command_announcement.Announce("Bioscans indicate that [vermstring] have been breeding in [locstrings[1]]. Clear them out, before this starts to affect productivity.", "Vermin infestation")
#undef LOC_KITCHEN
#undef LOC_ATMOS
#undef LOC_INCIN
#undef LOC_CHAPEL
#undef LOC_LIBRARY
#undef LOC_HYDRO
#undef LOC_VAULT
#undef LOC_CONSTR
#undef LOC_TECH
#undef LOC_ARMORY
#undef LOC_DORMS
#undef LOC_FITNESS
#undef LOC_HOLODECK
#undef LOC_DISPOSAL
#undef LOC_CARGO
#undef LOC_MEETING
#undef LOC_LOCKER
#undef LOC_XENO
#undef VERM_MICE
#undef VERM_LIZARDS
#undef VERM_SPIDERS
#undef VERM_DIYAAB
#undef VERM_BATS
#undef VERM_YITHIAN
#undef VERM_TINDALOS