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())
|
||||
|
||||
Reference in New Issue
Block a user