mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-01-03 06:01:46 +00:00
couple of things : 1.) alien weeds spawning with a node param works totally fine ingame ( AKA vomited by an alium ), but when placed on map in DM they will trigger nullpointer errors for every single weed placed. this seems to went undetected simply because there are no weeds on the map at startup, ever since your asteroid abandoned outpost got replaced with that vox trading station. 2.) it took me a moment to understand what node/Destroy() is supposed to do. it looped through its list of spawned weeds and nulls only its own linked_node var. that could have been done by src.linked_node = null, but i dont think that is the intention of the loop. for safe GCing the linked_node var of all weeds that got spawned by this node need to be nulled, not only its own. 3.) to be safe, the turf/space check should happen before any list operations are done, also replaced del() with qdel() here. 4.) the linked_node check of weeds/proc/Life() should be one of the first things to happen, which saves a lot of checks. 5.) the layer of weeds being default 3 was quite annoying as the weeds made it hard to click all kinds of layer 3 items and objects. fixed for weeds, nodes will still be 3 to properly show above things like AI holopads. 6.) i took the liberty of changing the node/node param to node/N , rename the spawns list to connected_weeds and move weeds/Destroy() up for better readability.
516 lines
12 KiB
Plaintext
516 lines
12 KiB
Plaintext
/* Alien Effects!
|
|
* Contains:
|
|
* effect/alien
|
|
* Resin
|
|
* Weeds
|
|
* Acid
|
|
* Egg
|
|
*/
|
|
|
|
/*
|
|
* effect/alien
|
|
*/
|
|
/obj/effect/alien
|
|
name = "alien thing"
|
|
desc = "theres something alien about this"
|
|
icon = 'icons/mob/alien.dmi'
|
|
// unacidable = 1 //Aliens won't ment their own.
|
|
|
|
/*
|
|
* Resin
|
|
*/
|
|
/obj/effect/alien/resin
|
|
name = "resin"
|
|
desc = "Looks like some kind of slimy growth."
|
|
icon_state = "resin"
|
|
|
|
density = 1
|
|
opacity = 1
|
|
anchored = 1
|
|
var/health = 200
|
|
var/turf/linked_turf
|
|
|
|
wall
|
|
name = "resin wall"
|
|
desc = "Purple slime solidified into a wall."
|
|
icon_state = "resinwall" //same as resin, but consistency ho!
|
|
|
|
membrane
|
|
name = "resin membrane"
|
|
desc = "Purple slime just thin enough to let light pass through."
|
|
icon_state = "resinmembrane"
|
|
opacity = 0
|
|
health = 120
|
|
|
|
/obj/effect/alien/resin/New()
|
|
..()
|
|
linked_turf = get_turf(src)
|
|
linked_turf.thermal_conductivity = WALL_HEAT_TRANSFER_COEFFICIENT
|
|
|
|
/obj/effect/alien/resin/Destroy()
|
|
if(linked_turf)
|
|
linked_turf.thermal_conductivity = initial(linked_turf.thermal_conductivity)
|
|
..()
|
|
|
|
|
|
/obj/effect/alien/resin/proc/healthcheck()
|
|
if(health <=0)
|
|
density = 0
|
|
qdel(src)
|
|
return
|
|
|
|
/obj/effect/alien/resin/bullet_act(var/obj/item/projectile/Proj)
|
|
health -= Proj.damage
|
|
..()
|
|
healthcheck()
|
|
return
|
|
|
|
/obj/effect/alien/resin/ex_act(severity)
|
|
switch(severity)
|
|
if(1.0)
|
|
health-=50
|
|
if(2.0)
|
|
health-=50
|
|
if(3.0)
|
|
if (prob(50))
|
|
health-=50
|
|
else
|
|
health-=25
|
|
healthcheck()
|
|
return
|
|
|
|
/obj/effect/alien/resin/blob_act()
|
|
health-=50
|
|
healthcheck()
|
|
return
|
|
|
|
/obj/effect/alien/resin/meteorhit()
|
|
health-=50
|
|
healthcheck()
|
|
return
|
|
|
|
/obj/effect/alien/resin/hitby(AM as mob|obj)
|
|
..()
|
|
for(var/mob/O in viewers(src, null))
|
|
O.show_message("\red <B>[src] was hit by [AM].</B>", 1)
|
|
var/tforce = 0
|
|
if(ismob(AM))
|
|
tforce = 10
|
|
else
|
|
tforce = AM:throwforce
|
|
playsound(loc, 'sound/effects/attackblob.ogg', 100, 1)
|
|
health = max(0, health - tforce)
|
|
healthcheck()
|
|
..()
|
|
return
|
|
|
|
/obj/effect/alien/resin/attack_hand()
|
|
if (M_HULK in usr.mutations)
|
|
usr << "\blue You easily destroy the [name]."
|
|
for(var/mob/O in oviewers(src))
|
|
O.show_message("\red [usr] destroys the [name]!", 1)
|
|
health = 0
|
|
else
|
|
usr << "\blue You claw at the [name]."
|
|
for(var/mob/O in oviewers(src))
|
|
O.show_message("\red [usr] claws at the [name]!", 1)
|
|
health -= rand(5,10)
|
|
healthcheck()
|
|
return
|
|
|
|
/obj/effect/alien/resin/attack_paw()
|
|
return attack_hand()
|
|
|
|
/obj/effect/alien/resin/attack_alien()
|
|
if (islarva(usr))//Safety check for larva. /N
|
|
return
|
|
usr << "\green You claw at the [name]."
|
|
for(var/mob/O in oviewers(src))
|
|
O.show_message("\red [usr] claws at the resin!", 1)
|
|
playsound(loc, 'sound/effects/attackblob.ogg', 100, 1)
|
|
health -= rand(40, 60)
|
|
if(health <= 0)
|
|
usr << "\green You slice the [name] to pieces."
|
|
for(var/mob/O in oviewers(src))
|
|
O.show_message("\red [usr] slices the [name] apart!", 1)
|
|
healthcheck()
|
|
return
|
|
|
|
/obj/effect/alien/resin/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
|
/*if (istype(W, /obj/item/weapon/grab) && get_dist(src,user)<2)
|
|
var/obj/item/weapon/grab/G = W
|
|
if(isalien(user)&&(ishuman(G.affecting)||ismonkey(G.affecting)))
|
|
//Only aliens can stick humans and monkeys into resin walls. Also, the wall must not have a person inside already.
|
|
if(!affecting)
|
|
if(G.state<2)
|
|
user << "\red You need a better grip to do that!"
|
|
return
|
|
G.affecting.loc = src
|
|
G.affecting.paralysis = 10
|
|
for(var/mob/O in viewers(world.view, src))
|
|
if (O.client)
|
|
O << text("\green [] places [] in the resin wall!", G.assailant, G.affecting)
|
|
affecting=G.affecting
|
|
del(W)
|
|
spawn(0)
|
|
process()
|
|
else
|
|
user << "\red This wall is already occupied."
|
|
return */
|
|
|
|
var/aforce = W.force
|
|
health = max(0, health - aforce)
|
|
playsound(loc, 'sound/effects/attackblob.ogg', 100, 1)
|
|
healthcheck()
|
|
..()
|
|
return
|
|
|
|
/obj/effect/alien/resin/CanPass(atom/movable/mover, turf/target, height=0, air_group=0)
|
|
if(air_group) return 0
|
|
if(istype(mover) && mover.checkpass(PASSGLASS))
|
|
return !opacity
|
|
return !density
|
|
|
|
|
|
/*
|
|
* Weeds
|
|
*/
|
|
#define NODERANGE 3
|
|
|
|
/obj/effect/alien/weeds
|
|
name = "weeds"
|
|
desc = "Weird purple weeds."
|
|
icon_state = "weeds"
|
|
|
|
anchored = 1
|
|
density = 0
|
|
layer = 2
|
|
var/health = 15
|
|
var/obj/effect/alien/weeds/node/linked_node = null
|
|
|
|
/obj/effect/alien/weeds/Destroy()
|
|
if(linked_node)
|
|
linked_node.connected_weeds.Remove(src)
|
|
linked_node = null
|
|
..()
|
|
|
|
/obj/effect/alien/weeds/node
|
|
icon_state = "weednode"
|
|
name = "purple sac"
|
|
desc = "Weird purple octopus-like thing."
|
|
layer = 3
|
|
luminosity = NODERANGE
|
|
var/node_range = NODERANGE
|
|
var/list/obj/effect/alien/weeds/connected_weeds
|
|
|
|
/obj/effect/alien/weeds/node/Destroy()
|
|
for(var/obj/effect/alien/weeds/W in connected_weeds)
|
|
W.linked_node = null
|
|
..()
|
|
|
|
/obj/effect/alien/weeds/node/New()
|
|
connected_weeds = new()
|
|
..(src.loc, src)
|
|
|
|
/obj/effect/alien/weeds/New(pos, var/obj/effect/alien/weeds/node/N)
|
|
..()
|
|
|
|
if(istype(loc, /turf/space))
|
|
qdel(src)
|
|
return
|
|
|
|
linked_node = N
|
|
if(linked_node)
|
|
linked_node.connected_weeds.Add(src)
|
|
|
|
if(icon_state == "weeds")icon_state = pick("weeds", "weeds1", "weeds2")
|
|
spawn(rand(150, 200))
|
|
if(src)
|
|
Life()
|
|
return
|
|
|
|
/obj/effect/alien/weeds/proc/Life()
|
|
//set background = 1
|
|
var/turf/U = get_turf(src)
|
|
/*
|
|
if (locate(/obj/movable, U))
|
|
U = locate(/obj/movable, U)
|
|
if(U.density == 1)
|
|
del(src)
|
|
return
|
|
|
|
Alien plants should do something if theres a lot of poison
|
|
if(U.poison> 200000)
|
|
health -= round(U.poison/200000)
|
|
update()
|
|
return
|
|
*/
|
|
if (istype(U, /turf/space))
|
|
del(src)
|
|
return
|
|
|
|
if(!linked_node || (get_dist(linked_node, src) > linked_node.node_range) )
|
|
return
|
|
|
|
direction_loop:
|
|
for(var/dirn in cardinal)
|
|
|
|
var/turf/T = get_step(src, dirn)
|
|
|
|
if (!istype(T) || T.density || locate(/obj/effect/alien/weeds) in T || istype(T.loc, /area/arrival) || istype(T, /turf/space))
|
|
continue
|
|
|
|
// if (locate(/obj/movable, T)) // don't propogate into movables
|
|
// continue
|
|
|
|
for(var/obj/O in T)
|
|
if(O.density)
|
|
continue direction_loop
|
|
|
|
new /obj/effect/alien/weeds(T, linked_node)
|
|
|
|
|
|
/obj/effect/alien/weeds/ex_act(severity)
|
|
switch(severity)
|
|
if(1.0)
|
|
qdel(src)
|
|
if(2.0)
|
|
if (prob(50))
|
|
qdel(src)
|
|
if(3.0)
|
|
if (prob(5))
|
|
qdel(src)
|
|
return
|
|
|
|
|
|
/obj/effect/alien/weeds/fire_act(null, temperature, volume)
|
|
if(temperature > T0C+200)
|
|
health -= 1 * temperature
|
|
healthcheck()
|
|
|
|
|
|
/obj/effect/alien/weeds/attackby(var/obj/item/weapon/W, var/mob/user)
|
|
if(W.attack_verb.len)
|
|
visible_message("\red <B>\The [src] have been [pick(W.attack_verb)] with \the [W][(user ? " by [user]." : ".")]")
|
|
else
|
|
visible_message("\red <B>\The [src] have been attacked with \the [W][(user ? " by [user]." : ".")]")
|
|
|
|
var/damage = W.force / 4.0
|
|
|
|
if(istype(W, /obj/item/weapon/weldingtool))
|
|
var/obj/item/weapon/weldingtool/WT = W
|
|
|
|
if(WT.remove_fuel(0, user))
|
|
damage = 15
|
|
playsound(loc, 'sound/items/Welder.ogg', 100, 1)
|
|
|
|
health -= damage
|
|
healthcheck()
|
|
|
|
/obj/effect/alien/weeds/proc/healthcheck()
|
|
if(health <= 0)
|
|
qdel(src)
|
|
|
|
|
|
/obj/effect/alien/weeds/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume)
|
|
if(exposed_temperature > 300)
|
|
health -= 5
|
|
healthcheck()
|
|
|
|
/*/obj/effect/alien/weeds/burn(fi_amount)
|
|
if (fi_amount > 18000)
|
|
spawn( 0 )
|
|
del(src)
|
|
return
|
|
return 0
|
|
return 1
|
|
*/
|
|
|
|
#undef NODERANGE
|
|
|
|
|
|
/*
|
|
* Acid
|
|
*/
|
|
/obj/effect/alien/acid
|
|
name = "acid"
|
|
desc = "Burbling corrossive stuff. I wouldn't want to touch it."
|
|
icon_state = "acid"
|
|
|
|
density = 0
|
|
opacity = 0
|
|
anchored = 1
|
|
|
|
var/atom/target
|
|
var/ticks = 0
|
|
var/target_strength = 0
|
|
|
|
/obj/effect/alien/acid/New(loc, target)
|
|
..(loc)
|
|
src.target = target
|
|
|
|
if(isturf(target)) // Turf take twice as long to take down.
|
|
target_strength = 8
|
|
else
|
|
target_strength = 4
|
|
tick()
|
|
|
|
/obj/effect/alien/acid/proc/tick()
|
|
if(!target)
|
|
del(src)
|
|
|
|
ticks += 1
|
|
|
|
if(ticks >= target_strength)
|
|
|
|
for(var/mob/O in hearers(src, null))
|
|
O.show_message("\green <B>[src.target] collapses under its own weight into a puddle of goop and undigested debris!</B>", 1)
|
|
|
|
if(istype(target, /turf/simulated/wall)) // I hate turf code.
|
|
var/turf/simulated/wall/W = target
|
|
W.dismantle_wall(1)
|
|
else
|
|
del(target)
|
|
del(src)
|
|
return
|
|
|
|
switch(target_strength - ticks)
|
|
if(6)
|
|
visible_message("\green <B>[src.target] is holding up against the acid!</B>")
|
|
if(4)
|
|
visible_message("\green <B>[src.target]\s structure is being melted by the acid!</B>")
|
|
if(2)
|
|
visible_message("\green <B>[src.target] is struggling to withstand the acid!</B>")
|
|
if(0 to 1)
|
|
visible_message("\green <B>[src.target] begins to crumble under the acid!</B>")
|
|
spawn(rand(150, 200)) tick()
|
|
|
|
/*
|
|
* Egg
|
|
*/
|
|
/var/const //for the status var
|
|
BURST = 0
|
|
BURSTING = 1
|
|
GROWING = 2
|
|
GROWN = 3
|
|
|
|
MIN_GROWTH_TIME = 1800 //time it takes to grow a hugger
|
|
MAX_GROWTH_TIME = 3000
|
|
|
|
/obj/effect/alien/egg
|
|
desc = "It looks like a weird egg"
|
|
name = "egg"
|
|
icon_state = "egg_growing"
|
|
density = 0
|
|
anchored = 1
|
|
|
|
var/health = 100
|
|
var/status = GROWING //can be GROWING, GROWN or BURST; all mutually exclusive
|
|
|
|
New()
|
|
if(aliens_allowed)
|
|
..()
|
|
spawn(rand(MIN_GROWTH_TIME,MAX_GROWTH_TIME))
|
|
Grow()
|
|
else
|
|
del(src)
|
|
|
|
attack_paw(user as mob)
|
|
if(isalien(user))
|
|
switch(status)
|
|
if(BURST)
|
|
user << "\red You clear the hatched egg."
|
|
del(src)
|
|
return
|
|
if(GROWING)
|
|
user << "\red The child is not developed yet."
|
|
return
|
|
if(GROWN)
|
|
user << "\red You retrieve the child."
|
|
Burst(0)
|
|
return
|
|
else
|
|
return attack_hand(user)
|
|
|
|
attack_hand(user as mob)
|
|
user << "It feels slimy."
|
|
return
|
|
|
|
proc/GetFacehugger()
|
|
return locate(/mob/living/carbon/alien/facehugger) in contents
|
|
|
|
proc/Grow()
|
|
icon_state = "egg"
|
|
status = GROWN
|
|
new /mob/living/carbon/alien/facehugger(src)
|
|
return
|
|
|
|
proc/Burst(var/kill = 1) //drops and kills the hugger if any is remaining
|
|
if(status == GROWN || status == GROWING)
|
|
var/mob/living/carbon/alien/facehugger/child = GetFacehugger()
|
|
icon_state = "egg_hatched"
|
|
flick("egg_opening", src)
|
|
status = BURSTING
|
|
spawn(15)
|
|
status = BURST
|
|
if(!child)
|
|
src.visible_message("\red The egg bursts apart revealing nothing")
|
|
status = "GROWN"
|
|
new /obj/effect/decal/cleanable/xenoblood(src)
|
|
loc.contents += child//need to write the code for giving it to the alien later
|
|
if(kill && istype(child))
|
|
child.death()
|
|
else
|
|
for(var/mob/M in range(1,src))
|
|
if(CanHug(M))
|
|
child.Attach(M)
|
|
break
|
|
|
|
|
|
/obj/effect/alien/egg/bullet_act(var/obj/item/projectile/Proj)
|
|
health -= Proj.damage
|
|
..()
|
|
healthcheck()
|
|
return
|
|
|
|
|
|
/obj/effect/alien/egg/attackby(var/obj/item/weapon/W, var/mob/user)
|
|
if(health <= 0)
|
|
return
|
|
if(W.attack_verb.len)
|
|
src.visible_message("\red <B>\The [src] has been [pick(W.attack_verb)] with \the [W][(user ? " by [user]." : ".")]")
|
|
else
|
|
src.visible_message("\red <B>\The [src] has been attacked with \the [W][(user ? " by [user]." : ".")]")
|
|
var/damage = W.force / 4.0
|
|
|
|
if(istype(W, /obj/item/weapon/weldingtool))
|
|
var/obj/item/weapon/weldingtool/WT = W
|
|
|
|
if(WT.remove_fuel(0, user))
|
|
damage = 15
|
|
playsound(get_turf(src), 'sound/items/Welder.ogg', 100, 1)
|
|
|
|
src.health -= damage
|
|
src.healthcheck()
|
|
|
|
|
|
/obj/effect/alien/egg/proc/healthcheck()
|
|
if(health <= 0)
|
|
Burst()
|
|
|
|
/obj/effect/alien/egg/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume)
|
|
if(exposed_temperature > 500)
|
|
health -= 5
|
|
healthcheck()
|
|
|
|
/obj/effect/alien/egg/HasProximity(atom/movable/AM as mob|obj)
|
|
if(status == GROWN)
|
|
if(!CanHug(AM))
|
|
return
|
|
|
|
var/mob/living/carbon/C = AM
|
|
if(C.stat == CONSCIOUS && C.status_flags & XENO_HOST)
|
|
return
|
|
|
|
Burst(0)
|