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
+6 -21
View File
@@ -2,7 +2,7 @@ GLOBAL_LIST_EMPTY(doppler_arrays)
/obj/machinery/doppler_array
name = "tachyon-doppler array"
desc = "A highly precise directional sensor array which measures the release of quants from decaying tachyons. The doppler shifting of the mirror-image formed by these quants can reveal the size, location and temporal affects of energetic disturbances within a large radius ahead of the array.\n<span class='notice'>Alt-click to rotate it clockwise.</span>"
desc = "A highly precise directional sensor array which measures the release of quants from decaying tachyons. The doppler shifting of the mirror-image formed by these quants can reveal the size, location and temporal affects of energetic disturbances within a large radius ahead of the array.\n"
icon = 'icons/obj/machines/research.dmi'
icon_state = "tdoppler"
density = TRUE
@@ -15,6 +15,9 @@ GLOBAL_LIST_EMPTY(doppler_arrays)
. = ..()
GLOB.doppler_arrays += src
/obj/machinery/doppler_array/ComponentInitialize()
AddComponent(/datum/component/simple_rotation,ROTATION_ALTCLICK | ROTATION_CLOCKWISE,null,null,CALLBACK(src,.proc/rot_message))
/obj/machinery/doppler_array/Destroy()
GLOB.doppler_arrays -= src
return ..()
@@ -40,28 +43,10 @@ GLOBAL_LIST_EMPTY(doppler_arrays)
else
return ..()
/obj/machinery/doppler_array/verb/rotate()
set name = "Rotate Tachyon-doppler Dish"
set category = "Object"
set src in oview(1)
if(!usr || !isturf(usr.loc))
return
if(usr.stat || usr.restrained() || !usr.canmove)
return
setDir(turn(dir, -90))
to_chat(usr, "<span class='notice'>You adjust [src]'s dish to face to the [dir2text(dir)].</span>")
/obj/machinery/doppler_array/proc/rot_message(mob/user)
to_chat(user, "<span class='notice'>You adjust [src]'s dish to face to the [dir2text(dir)].</span>")
playsound(src, 'sound/items/screwdriver2.ogg', 50, 1)
/obj/machinery/doppler_array/AltClick(mob/living/user)
if(!istype(user) || 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/machinery/doppler_array/proc/sense_explosion(turf/epicenter,devastation_range,heavy_impact_range,light_impact_range,
took,orig_dev_range,orig_heavy_range,orig_light_range)
if(stat & NOPOWER)
+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))