More interactions for small mobs (#6764)

Small mobs such as rats can now bite cables.
Small mobs that can ventcrawl now interact with atmospheric machines that contain pumps
Small mobs can no longer block airlocks by standing in them.
This commit is contained in:
Werner
2019-07-24 20:52:06 +03:00
committed by Erki
parent 65b3a6b632
commit e3e13ec14a
5 changed files with 133 additions and 2 deletions
@@ -23,6 +23,78 @@
L.ventcrawl_layer = layer
. = ..()
/obj/machinery/atmospherics/binary/pump/Entered(atom/movable/AM)
. = ..()
Blend(AM, network2)
/obj/machinery/atmospherics/unary/vent_scrubber/Entered(atom/movable/AM)
. = ..()
Blend(AM, null)
/obj/machinery/atmospherics/unary/outlet_injector/Entered(atom/movable/AM)
. = ..()
Blend(AM, null)
//Blends a mob AM and outputs the contents via vents in pipe_network N
// If the network is not set, creates a local cloud
/obj/machinery/atmospherics/proc/Blend(atom/movable/AM, var/datum/pipe_network/N)
//If its not small or the device isnt enabled, it wont blend
if(!issmall(AM) || !use_power)
return FALSE
//Get the things we need to create the "output"
var/mob/living/L = AM
var/blood_color = "#A10808"
if(L.blood_color)
blood_color = L.blood_color
if(iscarbon(AM))
var/mob/living/carbon/C = AM
blood_color = C.species.blood_color
var/reagent_amount = L.mob_size * 2
//Blend the Mob
to_chat(AM, span("danger","\The [src] blends you to a fine dust."))
L.death()
qdel(L)
//Output what´s left through the connected vents
if(N)
var/count = 0
for(var/V in N.normal_members)
CHECK_TICK
if(count > reagent_amount)
return TRUE
var/obj/machinery/atmospherics/unary/vent_pump/vent = V
if(istype(V, /obj/machinery/atmospherics/unary/vent_pump) && vent.loc && !vent.is_welded())
var/datum/reagents/R = new/datum/reagents(reagent_amount)
R.my_atom = vent
R.add_reagent("blood", reagent_amount, list("blood_colour" = blood_color))
var/datum/effect/effect/system/smoke_spread/chem/smoke = new
smoke.show_log = 0 // This displays a log on creation
smoke.show_touch_log = 1 // This displays a log when a player is chemically affected
smoke.set_up(R, 3, 0, vent, 20)
playsound(vent.loc, 'sound/effects/smoke.ogg', 50, 1, -3)
smoke.start()
qdel(R)
count++
else
var/datum/reagents/R = new/datum/reagents(reagent_amount)
R.my_atom = src
R.add_reagent("blood", reagent_amount, list("blood_colour" = blood_color))
var/datum/effect/effect/system/smoke_spread/chem/smoke = new
smoke.show_log = 0 // This displays a log on creation
smoke.show_touch_log = 1 // This displays a log when a player is chemically affected
smoke.set_up(R, 3, 0, src, 20)
playsound(src.loc, 'sound/effects/smoke.ogg', 50, 1, -3)
smoke.start()
qdel(R)
return TRUE
/obj/machinery/atmospherics/relaymove(mob/living/user, direction)
if(user.loc != src || !(direction & initialize_directions)) //can't go in a way we aren't connecting to
return
@@ -44,6 +116,8 @@
user.remove_ventcrawl()
user.add_ventcrawl(target_move)
user.forceMove(target_move)
if(!user || !user.client)
return
user.client.eye = target_move //if we don't do this, Byond only updates the eye every tick - required for smooth movement
if(world.time > user.next_play_vent)
user.next_play_vent = world.time+30
@@ -115,4 +189,4 @@ obj/machinery/atmospherics/trinary/isConnectable(var/obj/machinery/atmospherics/
if(!do_after(L, 100, needhand = 0, act_target = get_turf(src)) || !can_z_crawl(L, direction))
to_chat(L, span("danger", "You gave up on climbing [travel_direction_name] the pipe."))
return FALSE
return ventcrawl_to(L, node2, null)
return ventcrawl_to(L, node2, null)