[MIRROR] Ports more operations to "tool_act" (#5718)

* Merge pull request #35854 from ACCount12/more_tool_act

Ports more operations to "tool_act"

* Ports more operations to "tool_act"
This commit is contained in:
CitadelStationBot
2018-02-27 05:04:27 -06:00
committed by Poojawa
parent f74ceb582c
commit 5f6c41fa30
12 changed files with 271 additions and 271 deletions
+51 -56
View File
@@ -106,73 +106,68 @@
return FALSE
return TRUE
// attackby item
// construction/deconstruction
// wrench: (un)anchor
// weldingtool: convert to real pipe
/obj/structure/disposalconstruct/wrench_act(mob/living/user, obj/item/I)
if(anchored)
anchored = FALSE
density = FALSE
to_chat(user, "<span class='notice'>You detach the [pipename] from the underfloor.</span>")
else
var/ispipe = is_pipe() // Indicates if we should change the level of this pipe
/obj/structure/disposalconstruct/attackby(obj/item/I, mob/user, params)
var/ispipe = is_pipe() // Indicates if we should change the level of this pipe
var/turf/T = get_turf(src)
if(T.intact && isfloorturf(T))
to_chat(user, "<span class='warning'>You can only attach the [pipename] if the floor plating is removed!</span>")
return TRUE
add_fingerprint(user)
if(!ispipe && iswallturf(T))
to_chat(user, "<span class='warning'>You can't build [pipename]s on walls, only disposal pipes!</span>")
return TRUE
var/turf/T = get_turf(src)
if(T.intact && isfloorturf(T))
to_chat(user, "<span class='warning'>You can only attach the [pipename] if the floor plating is removed!</span>")
return
if(ispipe)
var/dpdir = get_disposal_dir()
for(var/obj/structure/disposalpipe/CP in T)
var/pdir = CP.dpdir
if(istype(CP, /obj/structure/disposalpipe/broken))
pdir = CP.dir
if(pdir & dpdir)
to_chat(user, "<span class='warning'>There is already a disposal pipe at that location!</span>")
return TRUE
if(!ispipe && iswallturf(T))
to_chat(user, "<span class='warning'>You can't build [pipename]s on walls, only disposal pipes!</span>")
return
else // Disposal or outlet
var/found_trunk = FALSE
for(var/obj/structure/disposalpipe/CP in T)
if(istype(CP, /obj/structure/disposalpipe/trunk))
found_trunk = TRUE
break
if(istype(I, /obj/item/wrench))
if(anchored)
anchored = FALSE
density = FALSE
to_chat(user, "<span class='notice'>You detach the [pipename] from the underfloor.</span>")
else
if(ispipe)
var/dpdir = get_disposal_dir()
for(var/obj/structure/disposalpipe/CP in T)
var/pdir = CP.dpdir
if(istype(CP, /obj/structure/disposalpipe/broken))
pdir = CP.dir
if(pdir & dpdir)
to_chat(user, "<span class='warning'>There is already a disposal pipe at that location!</span>")
return
level = 1 // Pipes only, don't want disposal bins to disappear under the floors
if(!found_trunk)
to_chat(user, "<span class='warning'>The [pipename] requires a trunk underneath it in order to work!</span>")
return TRUE
else // Disposal or outlet
var/found_trunk = FALSE
for(var/obj/structure/disposalpipe/CP in T)
if(istype(CP, /obj/structure/disposalpipe/trunk))
found_trunk = TRUE
break
anchored = TRUE
density = initial(pipe_type.density)
to_chat(user, "<span class='notice'>You attach the [pipename] to the underfloor.</span>")
I.play_tool_sound(src, 100)
update_icon()
return TRUE
if(!found_trunk)
to_chat(user, "<span class='warning'>The [pipename] requires a trunk underneath it in order to work!</span>")
return
/obj/structure/disposalconstruct/welder_act(mob/living/user, obj/item/I)
if(anchored)
if(!I.tool_start_check(user, amount=0))
return TRUE
anchored = TRUE
density = initial(pipe_type.density)
to_chat(user, "<span class='notice'>You attach the [pipename] to the underfloor.</span>")
I.play_tool_sound(src, 100)
update_icon()
to_chat(user, "<span class='notice'>You start welding the [pipename] in place...</span>")
if(I.use_tool(src, user, 8, volume=50))
to_chat(user, "<span class='notice'>The [pipename] has been welded in place.</span>")
var/obj/O = new pipe_type(loc, src)
transfer_fingerprints_to(O)
else if(istype(I, /obj/item/weldingtool))
if(anchored)
if(!I.tool_start_check(user, amount=0))
return
to_chat(user, "<span class='notice'>You start welding the [pipename] in place...</span>")
if(I.use_tool(src, user, 8, volume=50))
to_chat(user, "<span class='notice'>The [pipename] has been welded in place.</span>")
var/obj/O = new pipe_type(loc, src)
transfer_fingerprints_to(O)
return
else
to_chat(user, "<span class='warning'>You need to attach it to the plating first!</span>")
return
else
to_chat(user, "<span class='warning'>You need to attach it to the plating first!</span>")
return TRUE
/obj/structure/disposalconstruct/proc/is_pipe()
return ispath(pipe_type, /obj/structure/disposalpipe)