mirror of
https://github.com/CHOMPstation/CHOMPstation.git
synced 2026-08-24 12:36:22 +01:00
adds an effect file for grubs
So they can grow similar to spiderlings
This commit is contained in:
@@ -0,0 +1,127 @@
|
||||
/obj/effect/spider/grub
|
||||
name = "grub larva"
|
||||
desc = "It never stays still for long."
|
||||
// icon = 'grub_vr.dmi'
|
||||
icon_state = "spiderling"
|
||||
anchored = 0
|
||||
layer = 2.7
|
||||
health = 3
|
||||
var/last_itch = 0
|
||||
var/amount_grown = -1
|
||||
var/obj/machinery/atmospherics/unary/vent_pump/entry_vent
|
||||
var/travelling_in_vent = 0
|
||||
|
||||
/obj/effect/spider/grub/New(var/location, var/atom/parent)
|
||||
pixel_x = rand(6,-6)
|
||||
pixel_y = rand(6,-6)
|
||||
processing_objects |= src
|
||||
//60% chance to grow up
|
||||
if(prob(60))
|
||||
amount_grown = 1
|
||||
get_light_and_color(parent)
|
||||
..()
|
||||
|
||||
/obj/effect/spider/grub/Destroy()
|
||||
processing_objects -= src
|
||||
walk(src, 0) // Because we might have called walk_to, we must stop the walk loop or BYOND keeps an internal reference to us forever.
|
||||
return ..()
|
||||
|
||||
/obj/effect/grubs/grub/Bump(atom/user)
|
||||
if(istype(user, /obj/structure/table))
|
||||
src.loc = user.loc
|
||||
else
|
||||
..()
|
||||
|
||||
/obj/effect/spider/grub/proc/die()
|
||||
visible_message("<span class='alert'>[src] dies!</span>")
|
||||
new /obj/effect/decal/cleanable/spiderling_remains(src.loc) //Leaving this. It works.
|
||||
qdel(src)
|
||||
|
||||
/obj/effect/spider/grub/healthcheck()
|
||||
if(health <= 0)
|
||||
die()
|
||||
|
||||
/obj/effect/spider/grub/process()
|
||||
if(travelling_in_vent)
|
||||
if(istype(src.loc, /turf))
|
||||
travelling_in_vent = 0
|
||||
entry_vent = null
|
||||
else if(entry_vent)
|
||||
if(get_dist(src, entry_vent) <= 1)
|
||||
if(entry_vent.network && entry_vent.network.normal_members.len)
|
||||
var/list/vents = list()
|
||||
for(var/obj/machinery/atmospherics/unary/vent_pump/temp_vent in entry_vent.network.normal_members)
|
||||
vents.Add(temp_vent)
|
||||
if(!vents.len)
|
||||
entry_vent = null
|
||||
return
|
||||
var/obj/machinery/atmospherics/unary/vent_pump/exit_vent = pick(vents)
|
||||
/*if(prob(50))
|
||||
src.visible_message("<B>[src] scrambles into the ventillation ducts!</B>")*/
|
||||
|
||||
spawn(rand(20,60))
|
||||
loc = exit_vent
|
||||
var/travel_time = round(get_dist(loc, exit_vent.loc) / 2)
|
||||
spawn(travel_time)
|
||||
|
||||
if(!exit_vent || exit_vent.welded)
|
||||
loc = entry_vent
|
||||
entry_vent = null
|
||||
return
|
||||
|
||||
if(prob(50))
|
||||
src.visible_message("<span class='notice'>You hear something squeezing through the ventilation ducts.</span>",2)
|
||||
sleep(travel_time)
|
||||
|
||||
if(!exit_vent || exit_vent.welded)
|
||||
loc = entry_vent
|
||||
entry_vent = null
|
||||
return
|
||||
loc = exit_vent.loc
|
||||
entry_vent = null
|
||||
var/area/new_area = get_area(loc)
|
||||
if(new_area)
|
||||
new_area.Entered(src)
|
||||
else
|
||||
entry_vent = null
|
||||
//=================
|
||||
|
||||
if(isturf(loc))
|
||||
if(prob(25))
|
||||
var/list/nearby = trange(5, src) - loc
|
||||
if(nearby.len)
|
||||
var/target_atom = pick(nearby)
|
||||
walk_to(src, target_atom, 5)
|
||||
if(prob(25))
|
||||
src.visible_message("<span class='notice'>\The [src] slides[pick(" away"," around","")].</span>")
|
||||
else if(prob(5))
|
||||
//vent crawl!
|
||||
for(var/obj/machinery/atmospherics/unary/vent_pump/v in view(7,src))
|
||||
if(!v.welded)
|
||||
entry_vent = v
|
||||
walk_to(src, entry_vent, 5)
|
||||
break
|
||||
|
||||
if(amount_grown >= 100)
|
||||
var/spawn_type = /mob/living/simple_animal/retaliate/solargrub
|
||||
new spawn_type(src.loc, src)
|
||||
qdel(src)
|
||||
else if(isorgan(loc))
|
||||
if(!amount_grown) amount_grown = 1
|
||||
var/obj/item/organ/external/O = loc
|
||||
if(!O.owner || O.owner.stat == DEAD || amount_grown > 80)
|
||||
O.implants -= src
|
||||
src.loc = O.owner ? O.owner.loc : O.loc
|
||||
src.visible_message("<span class='warning'>\A [src] makes its way out of [O.owner ? "[O.owner]'s [O.name]" : "\the [O]"]!</span>")
|
||||
if(O.owner)
|
||||
O.owner.apply_damage(1, BRUTE, O.organ_tag)
|
||||
else if(prob(1))
|
||||
O.owner.apply_damage(1, TOX, O.organ_tag)
|
||||
if(world.time > last_itch + 30 SECONDS)
|
||||
last_itch = world.time
|
||||
O.owner << "<span class='notice'>Your [O.name] itches...</span>"
|
||||
else if(prob(1))
|
||||
src.visible_message("<span class='notice'>\The [src] squelches.</span>")
|
||||
|
||||
if(amount_grown)
|
||||
amount_grown += rand(0,2)
|
||||
Reference in New Issue
Block a user