mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 18:22:39 +00:00
Updates blob
Remains of player blob axed. blob_act() axed. Blob now has an arbitary set of things it can attack. It will flow over everything else. Blob has an awful tendency to destroy non-craftables. Will test more tomorrow. Blob will now attack mechs. Fixes #8106. Fixes #10705.
This commit is contained in:
206
code/modules/blob/blob.dm
Normal file
206
code/modules/blob/blob.dm
Normal file
@@ -0,0 +1,206 @@
|
||||
//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
|
||||
desc = "Some blob creature thingy"
|
||||
density = 1
|
||||
opacity = 0
|
||||
anchored = 1
|
||||
mouse_opacity = 2
|
||||
|
||||
var/maxHealth = 30
|
||||
var/health
|
||||
var/brute_resist = 4
|
||||
var/fire_resist = 1
|
||||
var/expandType = /obj/effect/blob
|
||||
|
||||
/obj/effect/blob/New(loc)
|
||||
health = maxHealth
|
||||
set_dir(pick(1,2,4,8))
|
||||
update_icon()
|
||||
return ..(loc)
|
||||
|
||||
/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 + 1, maxHealth)
|
||||
update_icon()
|
||||
|
||||
/obj/effect/blob/proc/expand(var/turf/T)
|
||||
if(istype(T, /turf/unsimulated/) || istype(T, /turf/space))
|
||||
return
|
||||
if(istype(T, /turf/simulated/wall))
|
||||
var/turf/simulated/wall/SW = T
|
||||
SW.take_damage(80)
|
||||
return
|
||||
var/obj/structure/girder/G = locate() in T
|
||||
if(G)
|
||||
if(prob(40))
|
||||
G.dismantle()
|
||||
return
|
||||
var/obj/structure/window/W = locate() in T
|
||||
if(W)
|
||||
W.shatter()
|
||||
return
|
||||
var/obj/structure/grille/GR = locate() in T
|
||||
if(GR)
|
||||
qdel(GR)
|
||||
return
|
||||
var/obj/machinery/door/D = locate() in T
|
||||
if(D && D.density)
|
||||
D.ex_act(2)
|
||||
return
|
||||
var/obj/structure/foamedmetal/F = locate() in T
|
||||
if(F)
|
||||
qdel(F)
|
||||
return
|
||||
var/obj/structure/inflatable/I = locate() in T
|
||||
if(I)
|
||||
I.deflate(1)
|
||||
return
|
||||
|
||||
var/obj/vehicle/V = locate() in T
|
||||
if(V)
|
||||
V.ex_act(2)
|
||||
return
|
||||
var/obj/machinery/bot/B = locate() in T
|
||||
if(B)
|
||||
B.ex_act(2)
|
||||
return
|
||||
var/obj/mecha/M = locate() in T
|
||||
if(M)
|
||||
M.take_damage(40)
|
||||
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
|
||||
L.visible_message("<span class='danger'>The blob attacks \the [L]!</span>", "<span class='danger'>The blob attacks you!</span>")
|
||||
playsound(loc, 'sound/effects/attackblob.ogg', 50, 1)
|
||||
L.take_organ_damage(rand(30, 40))
|
||||
return
|
||||
new expandType(T, min(health, 30))
|
||||
|
||||
/obj/effect/blob/proc/pulse(var/forceLeft, var/list/dirs)
|
||||
regen()
|
||||
sleep(5)
|
||||
var/pushDir = pick(dirs)
|
||||
var/turf/T = get_step(src, pushDir)
|
||||
var/obj/effect/blob/B = (locate() in T)
|
||||
if(!B)
|
||||
if(prob(health))
|
||||
expand(T)
|
||||
return
|
||||
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 / fire_resist)
|
||||
return 0
|
||||
|
||||
/obj/effect/blob/attackby(var/obj/item/weapon/W, var/mob/user)
|
||||
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
|
||||
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")
|
||||
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"
|
||||
maxHealth = 200
|
||||
brute_resist = 2
|
||||
fire_resist = 2
|
||||
|
||||
expandType = /obj/effect/blob/shield
|
||||
|
||||
/obj/effect/blob/core/update_icon()
|
||||
return
|
||||
|
||||
/obj/effect/blob/core/New(loc)
|
||||
processing_objects.Add(src)
|
||||
return ..(loc)
|
||||
|
||||
/obj/effect/blob/core/Destroy()
|
||||
processing_objects.Remove(src)
|
||||
return ..()
|
||||
|
||||
/obj/effect/blob/core/process()
|
||||
pulse(20, list(NORTH, EAST))
|
||||
pulse(20, list(NORTH, WEST))
|
||||
pulse(20, list(SOUTH, EAST))
|
||||
pulse(20, list(SOUTH, WEST))
|
||||
|
||||
/obj/effect/blob/shield
|
||||
name = "strong blob"
|
||||
icon = 'icons/mob/blob.dmi'
|
||||
icon_state = "blob_idle"
|
||||
desc = "Some blob creature thingy"
|
||||
maxHealth = 60
|
||||
brute_resist = 1
|
||||
fire_resist = 2
|
||||
|
||||
/obj/effect/blob/shield/New()
|
||||
..()
|
||||
update_nearby_tiles()
|
||||
|
||||
/obj/effect/blob/shield/Destroy()
|
||||
density = 0
|
||||
update_nearby_tiles()
|
||||
..()
|
||||
|
||||
/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
|
||||
Reference in New Issue
Block a user