From 67752bd40b54641bda5487f0dd133d77bdea13d3 Mon Sep 17 00:00:00 2001 From: PsiOmega Date: Wed, 20 Aug 2014 12:21:42 +0200 Subject: [PATCH] Allows clicking (simulated) floors to drop pipes This makes it possible to install pipes under immovable objects, similar to power cables. --- code/game/machinery/pipe/construction.dm | 7 ++++++- code/modules/mob/inventory.dm | 10 ++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/code/game/machinery/pipe/construction.dm b/code/game/machinery/pipe/construction.dm index b8975feaeb0..421ad9a9bbe 100644 --- a/code/game/machinery/pipe/construction.dm +++ b/code/game/machinery/pipe/construction.dm @@ -189,7 +189,12 @@ Buildable meters icon_state = islist[pipe_type + 1] //called when a turf is attacked with a pipe item -// place the pipe on the turf, setting pipe level to 1 (underfloor) if the turf is not intact +/obj/item/pipe/afterattack(turf/simulated/floor/target, mob/user, proximity) + if(!proximity) return + if(istype(target)) + user.drop_from_inventory(src, target) + else + return ..() // rotate the pipe item clockwise diff --git a/code/modules/mob/inventory.dm b/code/modules/mob/inventory.dm index 09c0e0e4cb4..91253e2ca6c 100644 --- a/code/modules/mob/inventory.dm +++ b/code/modules/mob/inventory.dm @@ -85,15 +85,18 @@ return 0 -/mob/proc/drop_from_inventory(var/obj/item/W) +/mob/proc/drop_from_inventory(var/obj/item/W, var/atom/Target = null) if(W) + if(!Target) + Target = loc + if(client) client.screen -= W u_equip(W) if(!W) return 1 // self destroying objects (tk, grabs) W.layer = initial(W.layer) - W.loc = loc + W.loc = Target - var/turf/T = get_turf(loc) + var/turf/T = get_turf(Target) if(isturf(T)) T.Entered(W) @@ -316,4 +319,3 @@ if (del_on_fail) del(W) return equipped -