Simple rotation component. (#34476)

I'm going to port other rotations to it when i don't feel lazy.
Closes #34064
This commit is contained in:
AnturK
2018-01-23 09:09:15 +01:00
committed by CitadelStationBot
parent 5e1ff26276
commit eb7974df7d
12 changed files with 225 additions and 315 deletions
+5 -27
View File
@@ -36,9 +36,9 @@ Buildable meters
/obj/item/pipe/quaternary
RPD_type = PIPE_ONEDIR
/obj/item/pipe/examine(mob/user)
..()
to_chat(user, "<span class='notice'>Alt-click to rotate it clockwise.</span>")
/obj/item/pipe/ComponentInitialize()
//Flipping handled manually due to custom handling for trinary pipes
AddComponent(/datum/component/simple_rotation,ROTATION_ALTCLICK | ROTATION_CLOCKWISE ,null,null, CALLBACK(src, .proc/fixdir))
/obj/item/pipe/Initialize(mapload, _pipe_type, _dir, obj/machinery/atmospherics/make_from)
if(make_from)
@@ -84,19 +84,6 @@ Buildable meters
name = "[initial(fakeA.name)] fitting"
icon_state = initial(fakeA.pipe_state)
// rotate the pipe item clockwise
/obj/item/pipe/verb/rotate()
set category = "Object"
set name = "Rotate Pipe"
set src in view(1)
if ( usr.stat || usr.restrained() || !usr.canmove )
return
setDir(turn(dir, -90))
fixdir()
/obj/item/pipe/verb/flip()
set category = "Object"
set name = "Flip Pipe"
@@ -115,16 +102,6 @@ Buildable meters
setDir(turn(dir, flipped ? 45 : -45))
flipped = !flipped
/obj/item/pipe/AltClick(mob/user)
..()
if(user.incapacitated())
to_chat(user, "<span class='warning'>You can't do that right now!</span>")
return
if(!in_range(src, user))
return
else
rotate()
/obj/item/pipe/Move()
var/old_dir = dir
..()
@@ -145,7 +122,8 @@ Buildable meters
setDir(turn(dir, 45))
/obj/item/pipe/attack_self(mob/user)
return rotate()
setDir(turn(dir,-90))
fixdir()
/obj/item/pipe/attackby(obj/item/W, mob/user, params)
if (!istype(W, /obj/item/wrench))