Files
Aurora.3/code/modules/blob/blob.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

346 lines
9.6 KiB
Plaintext

//I will need to recode parts of this but I am way too tired atm
/obj/effect/blob
name = "blob"
icon = 'icons/mob/blob.dmi'
icon_state = "blob"
light_range = 3
light_color = "#b5ff5b"
desc = "Some blob creature thingy"
density = 1
opacity = 0
anchored = 1
mouse_opacity = 2
layer = 4
var/maxHealth = 30
var/health
var/regen_rate = 4
var/brute_resist = 4
var/laser_resist = 4 // Special resist for laser based weapons - Emitters or handheld energy weaponry. Damage is divided by this and THEN by fire_resist.
var/fire_resist = 1
var/secondary_core_growth_chance = 10.0 //% chance to grow a secondary blob core instead of whatever was suposed to grown. Secondary cores are considerably weaker, but still nasty.
var/expandType = /obj/effect/blob
var/obj/effect/blob/core/parent_core = null
var/blob_may_process = 1
var/hangry = 0 //if the blob will attack or not.
var/blob_cost = 1 //point cost of the blob tile
/obj/effect/blob/New(loc)
START_PROCESSING(SScalamity, src)
health = maxHealth
var/matrix/M = matrix()
M.Turn(90 * pick(0,1,2,3))
src.transform = M
update_icon()
return ..(loc)
/obj/effect/blob/Destroy()
// Sanity time.
if (parent_core)
parent_core.blob_count -= blob_cost
parent_core = null
STOP_PROCESSING(SScalamity, src)
return ..()
/obj/effect/blob/process()
if(!parent_core)
src.take_damage(5)
src.regen_rate = -5
playsound(loc, 'sound/effects/splat.ogg', 50, 1)
return
// Make deleting the parent more responsive.
if(QDELING(parent_core))
parent_core = null
return
for(var/mob/living/L in src.loc)
if(L.stat == DEAD)
if(prob(10))
if(istype(L, /mob/living/carbon/human))
var/mob/living/carbon/human/H = L
H.ChangeToHusk()
if(!(HUSK in H.mutations))
if(health < maxHealth)
health += rand(10,30)
if(health > maxHealth)
health = maxHealth
else if(istype(L, /mob/living/silicon))
continue
else
L.gib()
if(health < maxHealth)
health += rand(10,30)
if(health > maxHealth)
health = maxHealth
continue
L.visible_message("<span class='danger'>The blob absorbs \the [L]!</span>", "<span class='danger'>The blob absorbs you!</span>")
playsound(loc, 'sound/effects/attackblob.ogg', 50, 1)
L.take_organ_damage(rand(5, 10))
if(health < maxHealth)
health += rand(1,10)
if(health > maxHealth)
health = maxHealth
hangry += 8
for(var/mob/living/L in range(src,"3x3"))
var/obj/effect/blob/B = locate() in get_turf(L)
if(!B)
if(!hangry)
if(L.stat == DEAD)
continue
if(prob(40))
L.visible_message("<span class='danger'>The blob sucks \the [L] into itself!</span>", "<span class='danger'>The blob sucks you in!</span>")
playsound(loc, 'sound/effects/attackblob.ogg', 50, 1)
L.take_organ_damage(rand(5, 10))
L.forceMove(src.loc)
else
L.visible_message("<span class='danger'>The blob glomps \the [L]!</span>", "<span class='danger'>The blob glomps you!</span>")
playsound(loc, 'sound/effects/attackblob.ogg', 50, 1)
L.take_organ_damage(rand(5, 20))
if(health < maxHealth)
health += rand(1,10)
if(health > maxHealth)
health = maxHealth
hangry += 2
for(var/obj/fire/F in range(src,"3x3")) //very snowflake, but much better than actually coding complex thermodynamics for these fuckers
if(prob(50))
src.visible_message("<span class='danger'>The blob melts away under the heat of the flames!</span>")
F = locate() in get_turf(src)
if(F)
src.take_damage(rand(5, 20) / fire_resist)
else
src.take_damage(rand(1, 10) / fire_resist)
for(var/obj/mecha/M in range(src,"3x3"))
M.visible_message("<span class='danger'>The blob attacks \the [M]!</span>")
M.take_damage(rand(20,40))
hangry -= 1
if(hangry < 0)
hangry = 0
/obj/effect/blob/CanPass(var/atom/movable/mover, vra/turf/target, var/height = 0, var/air_group = 0)
if(air_group || height == 0)
return 1
return 0
/obj/effect/blob/ex_act(var/severity)
switch(severity)
if(1)
take_damage(rand(100, 120) / brute_resist)
if(2)
take_damage(rand(60, 100) / brute_resist)
if(3)
take_damage(rand(20, 60) / brute_resist)
/obj/effect/blob/update_icon()
if(health > maxHealth / 2)
icon_state = "blob"
else
icon_state = "blob_damaged"
/obj/effect/blob/proc/take_damage(var/damage)
health -= damage
if(health < 0)
playsound(loc, 'sound/effects/splat.ogg', 50, 1)
qdel(src)
else
update_icon()
/obj/effect/blob/proc/regen()
health = min(health + regen_rate, maxHealth)
update_icon()
/obj/effect/blob/proc/expand(var/turf/T)
if(istype(T, /turf/unsimulated/) || istype(T, /turf/space) || (istype(T, /turf/simulated/mineral) && T.density))
return
if(istype(T, /turf/simulated/wall))
var/turf/simulated/wall/SW = T
SW.ex_act(2)
return
for(var/obj/O in T)
if(O.density)
O.ex_act(2)
return
// Above things, we destroy completely and thus can use locate. Mobs are different.
for(var/mob/living/L in T)
if(L.stat == DEAD)
continue
if(prob(30))
L.visible_message("<span class='danger'>The blob sucks \the [L] into itself!</span>", "<span class='danger'>The blob sucks you in!</span>")
playsound(loc, 'sound/effects/attackblob.ogg', 50, 1)
L.take_organ_damage(rand(5, 10))
L.forceMove(src.loc)
else
L.visible_message("<span class='danger'>The blob pulverizes \the [L]!</span>", "<span class='danger'>The blob pulverizes you!</span>")
playsound(loc, 'sound/effects/attackblob.ogg', 50, 1)
L.take_organ_damage(rand(30, 40))
if(health < maxHealth)
health += rand(1,10)
if(health > maxHealth)
health = maxHealth
return
if(parent_core)
if(parent_core.blob_count < parent_core.blob_limit)
if(!(locate(/obj/effect/blob/core/) in range(T, 2)) && prob(secondary_core_growth_chance) && (parent_core.core_count < parent_core.core_limit))
var/obj/effect/blob/core/secondary/S = new /obj/effect/blob/core/secondary(T)
S.parent_core = src.parent_core
src.parent_core.core_count += blob_cost
else
var/obj/effect/blob/C = new expandType(T)
C.parent_core = src.parent_core
parent_core.blob_count += blob_cost
/obj/effect/blob/proc/pulse(var/forceLeft, var/list/dirs)
regen()
sleep(4)
var/pushDir = pick(dirs)
var/turf/T = get_step(src, pushDir)
var/obj/effect/blob/B = (locate() in T)
if(!B)
if(prob(health+45))
expand(T)
return
if(forceLeft)
B.pulse(forceLeft - 1, dirs)
/obj/effect/blob/bullet_act(var/obj/item/projectile/Proj)
if(!Proj)
return
switch(Proj.damage_type)
if(BRUTE)
take_damage(Proj.damage / brute_resist)
if(BURN)
take_damage((Proj.damage / laser_resist) / fire_resist)
return 0
/obj/effect/blob/attackby(var/obj/item/weapon/W, var/mob/user)
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
user.do_attack_animation(src)
playsound(loc, 'sound/effects/attackblob.ogg', 50, 1)
visible_message("<span class='danger'>\The [src] has been attacked with \the [W][(user ? " by [user]." : ".")]</span>")
var/damage = 0
switch(W.damtype)
if("fire")
damage = (W.force / fire_resist)
if(istype(W, /obj/item/weapon/weldingtool))
playsound(loc, 'sound/items/Welder.ogg', 100, 1)
if("brute")
if(prob(30))
visible_message("<span class='danger'>\The [W] gets caught in the gelatinous folds of \the [src]</span>")
user.drop_from_inventory(W)
W.forceMove(src.loc)
return
damage = (W.force / brute_resist)
take_damage(damage)
return
/obj/effect/blob/core
name = "blob core"
icon = 'icons/mob/blob.dmi'
icon_state = "blob_core"
light_range = 1
light_power = 2
light_color = "#F3D203"
maxHealth = 200
brute_resist = 2
laser_resist = 7
regen_rate = 2
fire_resist = 2
var/core_count //amount of secondary cores
var/core_limit = 4 //for if a badmin ever wants the station to die, they can set this higher
var/blob_count = 1 //amount of actual blob pieces
var/blob_limit = 150 //9x4+100 + a bit, maximum amount of blobs allowed.
expandType = /obj/effect/blob/shield
/obj/effect/blob/core/New()
if(!parent_core)
parent_core = src
..()
/obj/effect/blob/core/update_icon()
var/health_percent = (health / maxHealth) * 100
switch(health_percent)
if(66 to INFINITY)
icon_state = "blob_core"
if(33 to 66)
icon_state = "blob_node"
if(-INFINITY to 33)
icon_state = "blob_factory"
/obj/effect/blob/core/process()
set waitfor = 0
..()
if(!blob_may_process)
return
blob_may_process = 0
sleep(0)
pulse(20, list(NORTH, EAST))
pulse(20, list(NORTH, WEST))
pulse(20, list(SOUTH, EAST))
pulse(20, list(SOUTH, WEST))
blob_may_process = 1
// Half the stats of a normal core. Blob has a very small probability of growing these when spreading. These will spread the blob further.
/obj/effect/blob/core/secondary
name = "small blob core"
icon = 'icons/mob/blob.dmi'
icon_state = "blob_core"
maxHealth = 100
brute_resist = 1
fire_resist = 1
laser_resist = 4
regen_rate = 1
expandType = /obj/effect/blob
/obj/effect/blob/core/secondary/New()
health = maxHealth
update_icon()
return ..(loc)
/obj/effect/blob/core/secondary/Destroy()
if(parent_core)
parent_core.core_count -= 1
return ..()
/obj/effect/blob/shield
name = "strong blob"
icon = 'icons/mob/blob.dmi'
icon_state = "blob_idle"
maxHealth = 60
brute_resist = 1
fire_resist = 2
laser_resist = 4
blob_cost = 0 //so that the core can regrow its shields when they break
/obj/effect/blob/shield/New()
update_nearby_tiles()
..()
/obj/effect/blob/shield/Destroy()
density = 0
update_nearby_tiles()
return ..()
/obj/effect/blob/shield/update_icon()
if(health > maxHealth * 2 / 3)
icon_state = "blob_idle"
else if(health > maxHealth / 3)
icon_state = "blob"
else
icon_state = "blob_damaged"
/obj/effect/blob/shield/CanPass(var/atom/movable/mover, var/turf/target, var/height = 0, var/air_group = 0)
return !density