[MIRROR] Rotation component refactor and improvements [MDB IGNORE] (#11304)

* Rotation component refactor and improvements

* Update code/modules/power/singularity/emitter.dm

* e

Co-authored-by: Tim <timothymtorres@gmail.com>
Co-authored-by: Tom <8881105+tf-4@users.noreply.github.com>
Co-authored-by: Gandalf <9026500+Gandalf2k15@users.noreply.github.com>
This commit is contained in:
SkyratBot
2022-02-08 01:38:20 +00:00
committed by GitHub
co-authored by Tim Tom Gandalf
parent e73aa07ddd
commit d682fbfbc8
33 changed files with 203 additions and 393 deletions
@@ -40,6 +40,7 @@
)
AddElement(/datum/element/connect_loc, loc_connections)
AddComponent(/datum/component/simple_rotation, ROTATION_NEEDS_ROOM)
/obj/structure/windoor_assembly/Destroy()
set_density(FALSE)
@@ -321,27 +322,6 @@
//Update to reflect changes(if applicable)
update_appearance()
/obj/structure/windoor_assembly/ComponentInitialize()
. = ..()
var/static/rotation_flags = ROTATION_ALTCLICK | ROTATION_CLOCKWISE | ROTATION_COUNTERCLOCKWISE | ROTATION_VERBS
AddComponent(/datum/component/simple_rotation, rotation_flags, can_be_rotated=CALLBACK(src, .proc/can_be_rotated), after_rotation=CALLBACK(src,.proc/after_rotation))
/obj/structure/windoor_assembly/proc/can_be_rotated(mob/user,rotation_type)
if(anchored)
to_chat(user, span_warning("[src] cannot be rotated while it is fastened to the floor!"))
return FALSE
var/target_dir = turn(dir, rotation_type == ROTATION_CLOCKWISE ? -90 : 90)
if(!valid_window_location(loc, target_dir, is_fulltile = FALSE))
to_chat(user, span_warning("[src] cannot be rotated in that direction!"))
return FALSE
return TRUE
/obj/structure/windoor_assembly/proc/after_rotation(mob/user)
update_appearance()
//Flips the windoor assembly, determines whather the door opens to the left or the right
/obj/structure/windoor_assembly/verb/flip()
set name = "Flip Windoor Assembly"