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:
committed by
CitadelStationBot
parent
5e1ff26276
commit
eb7974df7d
@@ -1,6 +1,6 @@
|
||||
/obj/machinery/power/emitter
|
||||
name = "emitter"
|
||||
desc = "A heavy-duty industrial laser, often used in containment fields and power generation.\n<span class='notice'>Alt-click to rotate it clockwise.</span>"
|
||||
desc = "A heavy-duty industrial laser, often used in containment fields and power generation."
|
||||
icon = 'icons/obj/singularity.dmi'
|
||||
icon_state = "emitter"
|
||||
|
||||
@@ -75,28 +75,15 @@
|
||||
power_usage -= 50 * M.rating
|
||||
active_power_usage = power_usage
|
||||
|
||||
/obj/machinery/power/emitter/verb/rotate()
|
||||
set name = "Rotate"
|
||||
set category = "Object"
|
||||
set src in oview(1)
|
||||
/obj/machinery/power/emitter/ComponentInitialize()
|
||||
. = ..()
|
||||
AddComponent(/datum/component/simple_rotation,ROTATION_ALTCLICK | ROTATION_FLIP ,null,CALLBACK(src, .proc/can_be_rotated))
|
||||
|
||||
if(usr.stat || !usr.canmove || usr.restrained())
|
||||
return
|
||||
if (src.anchored)
|
||||
to_chat(usr, "<span class='warning'>It is fastened to the floor!</span>")
|
||||
return 0
|
||||
src.setDir(turn(src.dir, 270))
|
||||
return 1
|
||||
|
||||
/obj/machinery/power/emitter/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/machinery/power/emitter/proc/can_be_rotated(mob/user,rotation_type)
|
||||
if (anchored)
|
||||
to_chat(user, "<span class='warning'>It is fastened to the floor!</span>")
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/power/emitter/Destroy()
|
||||
if(SSticker.IsRoundInProgress())
|
||||
|
||||
@@ -46,8 +46,6 @@
|
||||
if(PA_CONSTRUCTION_PANEL_OPEN)
|
||||
to_chat(user, "The panel is open.")
|
||||
|
||||
to_chat(user, "<span class='notice'>Alt-click to rotate it clockwise.</span>")
|
||||
|
||||
/obj/structure/particle_accelerator/Destroy()
|
||||
construction_state = PA_CONSTRUCTION_UNSECURED
|
||||
if(master)
|
||||
@@ -56,41 +54,10 @@
|
||||
master = null
|
||||
return ..()
|
||||
|
||||
/obj/structure/particle_accelerator/verb/rotate()
|
||||
set name = "Rotate Clockwise"
|
||||
set category = "Object"
|
||||
set src in oview(1)
|
||||
/obj/structure/particle_accelerator/ComponentInitialize()
|
||||
. = ..()
|
||||
AddComponent(/datum/component/simple_rotation,ROTATION_ALTCLICK | ROTATION_CLOCKWISE | ROTATION_COUNTERCLOCKWISE | ROTATION_VERBS )
|
||||
|
||||
if(usr.stat || !usr.canmove || usr.restrained())
|
||||
return
|
||||
if (anchored)
|
||||
to_chat(usr, "It is fastened to the floor!")
|
||||
return 0
|
||||
setDir(turn(dir, -90))
|
||||
return 1
|
||||
|
||||
/obj/structure/particle_accelerator/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/structure/particle_accelerator/verb/rotateccw()
|
||||
set name = "Rotate Counter Clockwise"
|
||||
set category = "Object"
|
||||
set src in oview(1)
|
||||
|
||||
if(usr.stat || !usr.canmove || usr.restrained())
|
||||
return
|
||||
if (anchored)
|
||||
to_chat(usr, "It is fastened to the floor!")
|
||||
return 0
|
||||
setDir(turn(dir, -90))
|
||||
return 1
|
||||
|
||||
/obj/structure/particle_accelerator/attackby(obj/item/W, mob/user, params)
|
||||
var/did_something = FALSE
|
||||
|
||||
@@ -14,13 +14,8 @@
|
||||
var/obj/pipe_type = /obj/structure/disposalpipe/segment
|
||||
var/pipename
|
||||
|
||||
|
||||
/obj/structure/disposalconstruct/examine(mob/user)
|
||||
..()
|
||||
to_chat(user, "<span class='notice'>Alt-click to rotate it clockwise.</span>")
|
||||
|
||||
/obj/structure/disposalconstruct/New(loc, _pipe_type, _dir = SOUTH, flip = FALSE, obj/make_from)
|
||||
..()
|
||||
/obj/structure/disposalconstruct/Initialize(loc, _pipe_type, _dir = SOUTH, flip = FALSE, obj/make_from)
|
||||
. = ..()
|
||||
if(make_from)
|
||||
pipe_type = make_from.type
|
||||
setDir(make_from.dir)
|
||||
@@ -34,7 +29,8 @@
|
||||
pipename = initial(pipe_type.name)
|
||||
|
||||
if(flip)
|
||||
flip()
|
||||
GET_COMPONENT(rotcomp,/datum/component/simple_rotation)
|
||||
rotcomp.BaseRot(null,ROTATION_FLIP)
|
||||
|
||||
update_icon()
|
||||
|
||||
@@ -91,51 +87,24 @@
|
||||
dpdir |= turn(dir, 180)
|
||||
return dpdir
|
||||
|
||||
// flip and rotate verbs
|
||||
/obj/structure/disposalconstruct/verb/rotate()
|
||||
set name = "Rotate Pipe"
|
||||
set category = "Object"
|
||||
set src in view(1)
|
||||
/obj/structure/disposalconstruct/ComponentInitialize()
|
||||
. = ..()
|
||||
AddComponent(/datum/component/simple_rotation,ROTATION_ALTCLICK | ROTATION_CLOCKWISE | ROTATION_FLIP | ROTATION_VERBS ,null,CALLBACK(src, .proc/can_be_rotated), CALLBACK(src, .proc/after_rot))
|
||||
|
||||
if(usr.incapacitated())
|
||||
return
|
||||
|
||||
if(anchored)
|
||||
to_chat(usr, "<span class='warning'>You must unfasten the pipe before rotating it!</span>")
|
||||
return
|
||||
|
||||
setDir(turn(dir, -90))
|
||||
/obj/structure/disposalconstruct/proc/after_rot(mob/user,rotation_type)
|
||||
if(rotation_type == ROTATION_FLIP)
|
||||
var/obj/structure/disposalpipe/temp = pipe_type
|
||||
if(initial(temp.flip_type))
|
||||
if(dir in GLOB.diagonals) // Fix RPD-induced diagonal turning
|
||||
setDir(turn(dir, 45))
|
||||
pipe_type = initial(temp.flip_type)
|
||||
update_icon()
|
||||
|
||||
/obj/structure/disposalconstruct/AltClick(mob/user)
|
||||
..()
|
||||
if(!in_range(src, user))
|
||||
return
|
||||
else
|
||||
rotate()
|
||||
|
||||
/obj/structure/disposalconstruct/verb/flip()
|
||||
set name = "Flip Pipe"
|
||||
set category = "Object"
|
||||
set src in view(1)
|
||||
|
||||
if(usr.incapacitated())
|
||||
return
|
||||
|
||||
/obj/structure/disposalconstruct/proc/can_be_rotated(mob/user,rotation_type)
|
||||
if(anchored)
|
||||
to_chat(usr, "<span class='warning'>You must unfasten the pipe before flipping it!</span>")
|
||||
return
|
||||
|
||||
setDir(turn(dir, 180))
|
||||
|
||||
var/obj/structure/disposalpipe/temp = pipe_type
|
||||
if(initial(temp.flip_type))
|
||||
if(dir in GLOB.diagonals) // Fix RPD-induced diagonal turning
|
||||
setDir(turn(dir, 45))
|
||||
pipe_type = initial(temp.flip_type)
|
||||
|
||||
update_icon()
|
||||
|
||||
to_chat(user, "<span class='warning'>You must unfasten the pipe before rotating it!</span>")
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
// attackby item
|
||||
// wrench: (un)anchor
|
||||
|
||||
Reference in New Issue
Block a user