diff --git a/code/datums/components/rotation.dm b/code/datums/components/rotation.dm index 8002629f421..2d1d149c8b0 100644 --- a/code/datums/components/rotation.dm +++ b/code/datums/components/rotation.dm @@ -1,79 +1,66 @@ -#define ROTATION_ALTCLICK (1<<0) -#define ROTATION_WRENCH (1<<1) -#define ROTATION_VERBS (1<<2) -#define ROTATION_COUNTERCLOCKWISE (1<<3) -#define ROTATION_CLOCKWISE (1<<4) -#define ROTATION_FLIP (1<<5) +/// If an object needs to be rotated with a wrench +#define ROTATION_REQUIRE_WRENCH (1<<0) +/// If ghosts can rotate an object (if the ghost config is enabled) +#define ROTATION_GHOSTS_ALLOWED (1<<1) +/// If an object will ignore anchored for rotation (used for chairs) +#define ROTATION_IGNORE_ANCHORED (1<<2) +/// If an object will omit flipping from rotation (used for pipes since they use custom handling) +#define ROTATION_NO_FLIPPING (1<<3) +/// If an object needs to have an empty spot available in target direction (used for windoors and railings) +#define ROTATION_NEEDS_ROOM (1<<4) + +/// Rotate an object clockwise +#define ROTATION_CLOCKWISE -90 +/// Rotate an object counterclockwise +#define ROTATION_COUNTERCLOCKWISE 90 +/// Rotate an object upside down +#define ROTATION_FLIP 180 /datum/component/simple_rotation - var/datum/callback/can_user_rotate //Checks if user can rotate - var/datum/callback/can_be_rotated //Check if object can be rotated at all - var/datum/callback/after_rotation //Additional stuff to do after rotation - + /// Additional stuff to do after rotation + var/datum/callback/AfterRotation + /// Rotation flags for special behavior var/rotation_flags = NONE - var/default_rotation_direction = ROTATION_CLOCKWISE -/datum/component/simple_rotation/Initialize(rotation_flags = NONE ,can_user_rotate,can_be_rotated,after_rotation) +/** + * Adds the ability to rotate an object by Alt-click or using Right-click verbs. + * + * args: + * * rotation_flags (optional) Bitflags that determine behavior for rotation (defined at the top of this file) + * * AfterRotation (optional) Callback proc that is used after the object is rotated (sound effects, balloon alerts, etc.) +**/ +/datum/component/simple_rotation/Initialize(rotation_flags = NONE, AfterRotation) if(!ismovable(parent)) return COMPONENT_INCOMPATIBLE - //throw if no rotation direction is specificed ? - src.rotation_flags = rotation_flags + src.AfterRotation = AfterRotation || CALLBACK(src, .proc/DefaultAfterRotation) - if(can_user_rotate) - src.can_user_rotate = can_user_rotate - else - src.can_user_rotate = CALLBACK(src,.proc/default_can_user_rotate) +/datum/component/simple_rotation/proc/AddSignals() + RegisterSignal(parent, COMSIG_CLICK_ALT, .proc/RotateLeft) + RegisterSignal(parent, COMSIG_CLICK_ALT_SECONDARY, .proc/RotateRight) + RegisterSignal(parent, COMSIG_PARENT_EXAMINE, .proc/ExamineMessage) - if(can_be_rotated) - src.can_be_rotated = can_be_rotated - else - src.can_be_rotated = CALLBACK(src,.proc/default_can_be_rotated) +/datum/component/simple_rotation/proc/AddVerbs() + var/obj/rotated_obj = parent + rotated_obj.verbs += /atom/movable/proc/SimpleRotateClockwise + rotated_obj.verbs += /atom/movable/proc/SimpleRotateCounterclockwise + if(!(rotation_flags & ROTATION_NO_FLIPPING)) + rotated_obj.verbs += /atom/movable/proc/SimpleRotateFlip - if(after_rotation) - src.after_rotation = after_rotation - else - src.after_rotation = CALLBACK(src,.proc/default_after_rotation) - - //Try Clockwise,counter,flip in order - if(src.rotation_flags & ROTATION_FLIP) - default_rotation_direction = ROTATION_FLIP - if(src.rotation_flags & ROTATION_COUNTERCLOCKWISE) - default_rotation_direction = ROTATION_COUNTERCLOCKWISE - if(src.rotation_flags & ROTATION_CLOCKWISE) - default_rotation_direction = ROTATION_CLOCKWISE - -/datum/component/simple_rotation/proc/add_signals() - if(rotation_flags & ROTATION_ALTCLICK) - RegisterSignal(parent, COMSIG_CLICK_ALT, .proc/HandRot) - RegisterSignal(parent, COMSIG_PARENT_EXAMINE, .proc/ExamineMessage) - if(rotation_flags & ROTATION_WRENCH) - RegisterSignal(parent, COMSIG_ATOM_TOOL_ACT(TOOL_WRENCH), .proc/WrenchRot) - -/datum/component/simple_rotation/proc/add_verbs() - if(rotation_flags & ROTATION_VERBS) - var/atom/movable/AM = parent - if(rotation_flags & ROTATION_FLIP) - AM.verbs += /atom/movable/proc/simple_rotate_flip - if(src.rotation_flags & ROTATION_CLOCKWISE) - AM.verbs += /atom/movable/proc/simple_rotate_clockwise - if(src.rotation_flags & ROTATION_COUNTERCLOCKWISE) - AM.verbs += /atom/movable/proc/simple_rotate_counterclockwise - -/datum/component/simple_rotation/proc/remove_verbs() +/datum/component/simple_rotation/proc/RemoveVerbs() if(parent) - var/atom/movable/AM = parent - AM.verbs -= /atom/movable/proc/simple_rotate_flip - AM.verbs -= /atom/movable/proc/simple_rotate_clockwise - AM.verbs -= /atom/movable/proc/simple_rotate_counterclockwise + var/obj/rotated_obj = parent + rotated_obj.verbs -= /atom/movable/proc/SimpleRotateFlip + rotated_obj.verbs -= /atom/movable/proc/SimpleRotateClockwise + rotated_obj.verbs -= /atom/movable/proc/SimpleRotateCounterclockwise -/datum/component/simple_rotation/proc/remove_signals() - UnregisterSignal(parent, list(COMSIG_CLICK_ALT, COMSIG_PARENT_EXAMINE, COMSIG_PARENT_ATTACKBY)) +/datum/component/simple_rotation/proc/RemoveSignals() + UnregisterSignal(parent, list(COMSIG_CLICK_ALT, COMSIG_CLICK_ALT_SECONDARY, COMSIG_PARENT_EXAMINE)) /datum/component/simple_rotation/RegisterWithParent() - add_verbs() - add_signals() + AddVerbs() + AddSignals() . = ..() /datum/component/simple_rotation/PostTransfer() @@ -83,87 +70,108 @@ return COMPONENT_NOTRANSFER /datum/component/simple_rotation/UnregisterFromParent() - remove_verbs() - remove_signals() + RemoveVerbs() + RemoveSignals() . = ..() /datum/component/simple_rotation/Destroy() - QDEL_NULL(can_user_rotate) - QDEL_NULL(can_be_rotated) - QDEL_NULL(after_rotation) + QDEL_NULL(AfterRotation) //Signals + verbs removed via UnRegister . = ..() /datum/component/simple_rotation/ClearFromParent() - remove_verbs() + RemoveVerbs() return ..() /datum/component/simple_rotation/proc/ExamineMessage(datum/source, mob/user, list/examine_list) SIGNAL_HANDLER + examine_list += span_notice("Alt + Right-click to rotate it clockwise. Alt + Left-click to rotate it counterclockwise.") + if(rotation_flags & ROTATION_REQUIRE_WRENCH) + examine_list += span_notice("This requires a wrench to be rotated.") - if(rotation_flags & ROTATION_ALTCLICK) - examine_list += span_notice("Alt-click to rotate it clockwise.") - -/datum/component/simple_rotation/proc/HandRot(datum/source, mob/user, rotation = default_rotation_direction) +/datum/component/simple_rotation/proc/RotateRight(datum/source, mob/user) SIGNAL_HANDLER + Rotate(user, ROTATION_CLOCKWISE) - if(!can_be_rotated.Invoke(user, rotation) || !can_user_rotate.Invoke(user, rotation)) - return - BaseRot(user, rotation) - -/datum/component/simple_rotation/proc/WrenchRot(datum/source, obj/item/I, mob/living/user) +/datum/component/simple_rotation/proc/RotateLeft(datum/source, mob/user) SIGNAL_HANDLER + Rotate(user, ROTATION_COUNTERCLOCKWISE) - if(!can_be_rotated.Invoke(user,default_rotation_direction) || !can_user_rotate.Invoke(user,default_rotation_direction)) +/datum/component/simple_rotation/proc/Rotate(mob/user, degrees) + if(QDELETED(user)) + CRASH("[src] is being rotated [user ? "with a qdeleting" : "without a"] user") + if(!istype(user)) + CRASH("[src] is being rotated without a user of the wrong type: [user.type]") + if(!isnum(degrees)) + CRASH("[src] is being rotated without providing the amount of degrees needed") + + if(!CanBeRotated(user, degrees) || !CanUserRotate(user, degrees)) return - BaseRot(user,default_rotation_direction) - return COMPONENT_BLOCK_TOOL_ATTACK -/datum/component/simple_rotation/proc/BaseRot(mob/user,rotation_type) - var/atom/movable/AM = parent - var/rot_degree - switch(rotation_type) - if(ROTATION_CLOCKWISE) - rot_degree = -90 - if(ROTATION_COUNTERCLOCKWISE) - rot_degree = 90 - if(ROTATION_FLIP) - rot_degree = 180 - AM.setDir(turn(AM.dir,rot_degree)) - after_rotation.Invoke(user,rotation_type) + var/obj/rotated_obj = parent + rotated_obj.setDir(turn(rotated_obj.dir, degrees)) + rotated_obj.balloon_alert(user, "you [degrees == ROTATION_FLIP ? "flip" : "rotate"] [rotated_obj]") + if(rotation_flags & ROTATION_REQUIRE_WRENCH) + playsound(rotated_obj, 'sound/items/ratchet.ogg', 50, TRUE) + + AfterRotation.Invoke(user, degrees) -/datum/component/simple_rotation/proc/default_can_user_rotate(mob/living/user, rotation_type) - if(!istype(user) || !user.canUseTopic(parent, BE_CLOSE, NO_DEXTERITY, FALSE, !iscyborg(user))) +/datum/component/simple_rotation/proc/CanUserRotate(mob/user, degrees) + if(isliving(user) && user.canUseTopic(parent, BE_CLOSE, NO_DEXTERITY, FALSE, !iscyborg(user))) + return TRUE + if((rotation_flags & ROTATION_GHOSTS_ALLOWED) && isobserver(user) && CONFIG_GET(flag/ghost_interaction)) + return TRUE + return FALSE + +/datum/component/simple_rotation/proc/CanBeRotated(mob/user, degrees) + var/obj/rotated_obj = parent + + if(rotation_flags & ROTATION_REQUIRE_WRENCH) + if(!isliving(user)) + return FALSE + var/obj/item/tool = user.get_active_held_item() + if(!tool || tool.tool_behaviour != TOOL_WRENCH) + rotated_obj.balloon_alert(user, "need a wrench") + return FALSE + if(!(rotation_flags & ROTATION_IGNORE_ANCHORED) && rotated_obj.anchored) + if(istype(rotated_obj, /obj/structure/window)) + rotated_obj.balloon_alert(user, "need to unscrew") + else + rotated_obj.balloon_alert(user, "need to unwrench") return FALSE + + if(rotation_flags & ROTATION_NEEDS_ROOM) + var/target_dir = turn(rotated_obj.dir, degrees) + var/obj/structure/window/rotated_window = rotated_obj + var/fulltile = istype(rotated_window) ? rotated_window.fulltile : FALSE + if(!valid_window_location(rotated_obj.loc, target_dir, is_fulltile = fulltile)) + rotated_obj.balloon_alert(user, "cannot rotate in that direction") + return FALSE return TRUE -/datum/component/simple_rotation/proc/default_can_be_rotated(mob/user, rotation_type) - var/atom/movable/AM = parent - return !AM.anchored +/datum/component/simple_rotation/proc/DefaultAfterRotation(mob/user, degrees) + return -/datum/component/simple_rotation/proc/default_after_rotation(mob/user, rotation_type) - to_chat(user,span_notice("You [rotation_type == ROTATION_FLIP ? "flip" : "rotate"] [parent].")) - -/atom/movable/proc/simple_rotate_clockwise() +/atom/movable/proc/SimpleRotateClockwise() set name = "Rotate Clockwise" set category = "Object" set src in oview(1) var/datum/component/simple_rotation/rotcomp = GetComponent(/datum/component/simple_rotation) if(rotcomp) - rotcomp.HandRot(null,usr,ROTATION_CLOCKWISE) + rotcomp.Rotate(usr, ROTATION_CLOCKWISE) -/atom/movable/proc/simple_rotate_counterclockwise() +/atom/movable/proc/SimpleRotateCounterclockwise() set name = "Rotate Counter-Clockwise" set category = "Object" set src in oview(1) var/datum/component/simple_rotation/rotcomp = GetComponent(/datum/component/simple_rotation) if(rotcomp) - rotcomp.HandRot(null,usr,ROTATION_COUNTERCLOCKWISE) + rotcomp.Rotate(usr, ROTATION_COUNTERCLOCKWISE) -/atom/movable/proc/simple_rotate_flip() +/atom/movable/proc/SimpleRotateFlip() set name = "Flip" set category = "Object" set src in oview(1) var/datum/component/simple_rotation/rotcomp = GetComponent(/datum/component/simple_rotation) if(rotcomp) - rotcomp.HandRot(null,usr,ROTATION_FLIP) + rotcomp.Rotate(usr, ROTATION_FLIP) diff --git a/code/game/machinery/computer/buildandrepair.dm b/code/game/machinery/computer/buildandrepair.dm index 21b53078e0e..24d0782283b 100644 --- a/code/game/machinery/computer/buildandrepair.dm +++ b/code/game/machinery/computer/buildandrepair.dm @@ -3,6 +3,10 @@ icon_state = "0" state = 0 +/obj/structure/frame/computer/Initialize(mapload) + . = ..() + AddComponent(/datum/component/simple_rotation) + /obj/structure/frame/computer/attackby(obj/item/P, mob/living/user, params) add_fingerprint(user) switch(state) @@ -172,14 +176,3 @@ if(state >= 3) new /obj/item/stack/cable_coil(drop_location(), 5) ..() - -/obj/structure/frame/computer/AltClick(mob/user) - ..() - if(!user.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE, !iscyborg(user))) - return - - if(anchored) - to_chat(usr, span_warning("You must unwrench [src] before rotating it!")) - return - - setDir(turn(dir, -90)) diff --git a/code/game/machinery/doppler_array.dm b/code/game/machinery/doppler_array.dm index f1c17cb7c7a..a99dd24d2e3 100644 --- a/code/game/machinery/doppler_array.dm +++ b/code/game/machinery/doppler_array.dm @@ -23,10 +23,9 @@ RegisterSignal(SSdcs, COMSIG_GLOB_EXPLOSION, .proc/sense_explosion) RegisterSignal(src, COMSIG_MOVABLE_SET_ANCHORED, .proc/power_change) printer_ready = world.time + PRINTER_TIMEOUT - -/obj/machinery/doppler_array/ComponentInitialize() - . = ..() - AddComponent(/datum/component/simple_rotation,ROTATION_ALTCLICK | ROTATION_CLOCKWISE,null,null,CALLBACK(src,.proc/rot_message)) + // Alt clicking when unwrenched does not rotate. (likely from UI not returning the mouse click) + // Also there is no sprite change for rotation dir, this shouldn't even have a rotate component tbh + AddComponent(/datum/component/simple_rotation, AfterRotation = CALLBACK(src, .proc/RotationMessage)) /datum/data/tachyon_record name = "Log Recording" @@ -126,7 +125,7 @@ return return ..() -/obj/machinery/doppler_array/proc/rot_message(mob/user) +/obj/machinery/doppler_array/proc/RotationMessage(mob/user) to_chat(user, span_notice("You adjust [src]'s dish to face to the [dir2text(dir)].")) playsound(src, 'sound/items/screwdriver2.ogg', 50, TRUE) diff --git a/code/game/machinery/iv_drip.dm b/code/game/machinery/iv_drip.dm index fb69e500e4b..996ec692828 100644 --- a/code/game/machinery/iv_drip.dm +++ b/code/game/machinery/iv_drip.dm @@ -344,14 +344,8 @@ /obj/machinery/iv_drip/plumbing/Initialize(mapload) . = ..() - - AddComponent(/datum/component/simple_rotation, ROTATION_ALTCLICK | ROTATION_CLOCKWISE | ROTATION_COUNTERCLOCKWISE | ROTATION_VERBS, null, CALLBACK(src, .proc/can_be_rotated)) AddComponent(/datum/component/plumbing/iv_drip, anchored) -///Check if we can be rotated for the rotation component -/obj/machinery/iv_drip/plumbing/proc/can_be_rotated(mob/user,rotation_type) - return !anchored - /obj/machinery/iv_drip/plumbing/wrench_act(mob/living/user, obj/item/I) ..() default_unfasten_wrench(user, I) diff --git a/code/game/machinery/pipe/construction.dm b/code/game/machinery/pipe/construction.dm index e838abb3f8b..d090382e48f 100644 --- a/code/game/machinery/pipe/construction.dm +++ b/code/game/machinery/pipe/construction.dm @@ -43,10 +43,6 @@ Buildable meters /obj/item/pipe/quaternary RPD_type = PIPE_ONEDIR -/obj/item/pipe/ComponentInitialize() - //Flipping handled manually due to custom handling for trinary pipes - AddComponent(/datum/component/simple_rotation, ROTATION_ALTCLICK | ROTATION_CLOCKWISE) - /obj/item/pipe/Initialize(mapload, _pipe_type, _dir, obj/machinery/atmospherics/make_from, device_color, device_init_dir = SOUTH) if(make_from) make_from_existing(make_from) @@ -59,6 +55,9 @@ Buildable meters update() pixel_x += rand(-5, 5) pixel_y += rand(-5, 5) + + //Flipping handled manually due to custom handling for trinary pipes + AddComponent(/datum/component/simple_rotation, ROTATION_NO_FLIPPING) return ..() /obj/item/pipe/proc/make_from_existing(obj/machinery/atmospherics/make_from) @@ -99,7 +98,7 @@ Buildable meters /obj/item/pipe/verb/flip() set category = "Object" - set name = "Flip Pipe" + set name = "Invert Pipe" set src in view(1) if ( usr.incapacitated() ) @@ -302,23 +301,28 @@ Buildable meters /obj/item/pipe/examine(mob/user) . = ..() . += span_notice("The pipe layer is set to [piping_layer].") - . += span_notice("You can change the pipe layer by Alt-Right-Clicking the device.") - . += span_notice("You can rotate it by using it in hand or by Alt-Left-Clicking the device.") + . += span_notice("You can change the pipe layer by Right-Clicking the device.") -/obj/item/pipe/alt_click_secondary(mob/user) +/obj/item/pipe/attack_hand_secondary(mob/user, list/modifiers) . = ..() + if(. == SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN) + return var/layer_to_set = (piping_layer >= PIPING_LAYER_MAX) ? PIPING_LAYER_MIN : (piping_layer + 1) set_piping_layer(layer_to_set) - visible_message("You set the pipe layer to [piping_layer].") + balloon_alert(user, "pipe layer set to [piping_layer]") + return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN /obj/item/pipe/trinary/flippable/examine(mob/user) . = ..() - . += span_notice("You can flip the device by Ctrl-Clicking it.") + . += span_notice("You can flip the device by Right-Clicking it.") -/obj/item/pipe/trinary/flippable/CtrlClick(mob/user) +/obj/item/pipe/trinary/flippable/attack_hand_secondary(mob/user, list/modifiers) . = ..() + if(. == SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN) + return do_a_flip() - visible_message("You flip the device.") + balloon_alert(user, "pipe was flipped") + return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN /obj/item/pipe_meter name = "meter" diff --git a/code/game/objects/items/RPD.dm b/code/game/objects/items/RPD.dm index b6080ed226c..f376c9d6358 100644 --- a/code/game/objects/items/RPD.dm +++ b/code/game/objects/items/RPD.dm @@ -622,7 +622,7 @@ GLOBAL_LIST_INIT(transit_tube_recipes, list( if(queued_p_flipped) tube.setDir(turn(queued_p_dir, 45)) - tube.simple_rotate_flip() + tube.SimpleRotateFlip() tube.add_fingerprint(usr) if(mode & WRENCH_MODE) diff --git a/code/game/objects/structures/beds_chairs/chair.dm b/code/game/objects/structures/beds_chairs/chair.dm index 3ccf5d3b87a..fa50925c5a4 100644 --- a/code/game/objects/structures/beds_chairs/chair.dm +++ b/code/game/objects/structures/beds_chairs/chair.dm @@ -28,25 +28,11 @@ addtimer(CALLBACK(src, .proc/RemoveFromLatejoin), 0) if(prob(0.2)) name = "tactical [name]" + MakeRotate() -/obj/structure/chair/ComponentInitialize() - . = ..() - AddComponent(/datum/component/simple_rotation,ROTATION_ALTCLICK | ROTATION_CLOCKWISE, CALLBACK(src, .proc/can_user_rotate),CALLBACK(src, .proc/can_be_rotated),null) - -/obj/structure/chair/proc/can_be_rotated(mob/user) - return TRUE - -/obj/structure/chair/proc/can_user_rotate(mob/user) - var/mob/living/L = user - - if(istype(L)) - if(!user.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE, !iscyborg(user))) - return FALSE - else - return TRUE - else if(isobserver(user) && CONFIG_GET(flag/ghost_interaction)) - return TRUE - return FALSE +///This proc adds the rotate component, overwrite this if you for some reason want to change some specific args. +/obj/structure/chair/proc/MakeRotate() + AddComponent(/datum/component/simple_rotation, ROTATION_IGNORE_ANCHORED|ROTATION_GHOSTS_ALLOWED) /obj/structure/chair/Destroy() RemoveFromLatejoin() diff --git a/code/game/objects/structures/beds_chairs/pew.dm b/code/game/objects/structures/beds_chairs/pew.dm index 4caa07648d0..e2a17b542a5 100644 --- a/code/game/objects/structures/beds_chairs/pew.dm +++ b/code/game/objects/structures/beds_chairs/pew.dm @@ -9,6 +9,10 @@ buildstackamount = 3 item_chair = null +///This proc adds the rotate component, overwrite this if you for some reason want to change some specific args. +/obj/structure/chair/pew/MakeRotate() + AddComponent(/datum/component/simple_rotation, ROTATION_REQUIRE_WRENCH|ROTATION_IGNORE_ANCHORED) + /obj/structure/chair/pew/left name = "left wooden pew end" icon_state = "pewend_left" @@ -70,16 +74,3 @@ /obj/structure/chair/pew/right/post_unbuckle_mob() . = ..() update_rightpewarmrest() - -/obj/structure/chair/pew/can_user_rotate(mob/user) - . = ..() - if(!.) - return - - var/mob/living/living_user = user - if(!istype(living_user)) - return - var/obj/item/tool = living_user.get_active_held_item() - if(!tool || tool.tool_behaviour != TOOL_WRENCH) - balloon_alert(user, "you need a wrench!") - return FALSE diff --git a/code/game/objects/structures/railings.dm b/code/game/objects/structures/railings.dm index 7ad89fae15d..c9cc37b4089 100644 --- a/code/game/objects/structures/railings.dm +++ b/code/game/objects/structures/railings.dm @@ -32,7 +32,7 @@ ) AddElement(/datum/element/connect_loc, loc_connections) - AddComponent(/datum/component/simple_rotation,ROTATION_ALTCLICK | ROTATION_CLOCKWISE | ROTATION_COUNTERCLOCKWISE | ROTATION_VERBS ,null,CALLBACK(src, .proc/can_be_rotated),CALLBACK(src,.proc/after_rotation)) + AddComponent(/datum/component/simple_rotation, ROTATION_NEEDS_ROOM) /obj/structure/railing/attackby(obj/item/I, mob/living/user, params) ..() @@ -111,21 +111,6 @@ leaving.Bump(src) return COMPONENT_ATOM_BLOCK_EXIT -/obj/structure/railing/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)) //Expanded to include rails, as well! - to_chat(user, span_warning("[src] cannot be rotated in that direction!")) - return FALSE - return TRUE - /obj/structure/railing/proc/check_anchored(checked_anchored) if(anchored == checked_anchored) return TRUE - -/obj/structure/railing/proc/after_rotation(mob/user,rotation_type) - add_fingerprint(user) diff --git a/code/game/objects/structures/shower.dm b/code/game/objects/structures/shower.dm index eb31958f7f9..156edf4535e 100644 --- a/code/game/objects/structures/shower.dm +++ b/code/game/objects/structures/shower.dm @@ -211,12 +211,7 @@ /obj/structure/showerframe/Initialize(mapload) . = ..() - AddComponent(/datum/component/simple_rotation, ROTATION_ALTCLICK | ROTATION_CLOCKWISE | ROTATION_COUNTERCLOCKWISE | ROTATION_VERBS, null, CALLBACK(src, .proc/can_be_rotated)) - -/obj/structure/showerframe/proc/can_be_rotated(mob/user, rotation_type) - if(anchored) - to_chat(user, span_warning("It is fastened to the floor!")) - return !anchored + AddComponent(/datum/component/simple_rotation) /obj/effect/mist name = "mist" diff --git a/code/game/objects/structures/transit_tubes/transit_tube_construction.dm b/code/game/objects/structures/transit_tubes/transit_tube_construction.dm index 0364d13b315..93fd564e303 100644 --- a/code/game/objects/structures/transit_tubes/transit_tube_construction.dm +++ b/code/game/objects/structures/transit_tubes/transit_tube_construction.dm @@ -14,6 +14,10 @@ var/flipped_build_type var/base_icon +/obj/structure/c_transit_tube/Initialize(mapload) + . = ..() + AddComponent(/datum/component/simple_rotation, AfterRotation = CALLBACK(src, .proc/AfterRotation)) + /obj/structure/c_transit_tube/proc/can_wrench_in_loc(mob/user) var/turf/source_turf = get_turf(loc) var/existing_tubes = 0 @@ -24,13 +28,9 @@ return FALSE return TRUE -/obj/structure/c_transit_tube/ComponentInitialize() - . = ..() - AddComponent(/datum/component/simple_rotation,ROTATION_ALTCLICK | ROTATION_CLOCKWISE | ROTATION_FLIP | ROTATION_VERBS,null,null,CALLBACK(src,.proc/after_rot)) - -/obj/structure/c_transit_tube/proc/after_rot(mob/user,rotation_type) - if(flipped_build_type && rotation_type == ROTATION_FLIP) - setDir(turn(dir,-180)) //Turn back we don't actually flip +/obj/structure/c_transit_tube/proc/AfterRotation(mob/user, degrees) + if(flipped_build_type && degrees == ROTATION_FLIP) + setDir(turn(dir, degrees)) //Turn back we don't actually flip flipped = !flipped var/cur_flip = initial(flipped) ? !flipped : flipped if(cur_flip) diff --git a/code/game/objects/structures/watercloset.dm b/code/game/objects/structures/watercloset.dm index 07eeae44cce..f1f8cf67494 100644 --- a/code/game/objects/structures/watercloset.dm +++ b/code/game/objects/structures/watercloset.dm @@ -456,14 +456,9 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/urinal, 32) anchored = FALSE material_flags = MATERIAL_EFFECTS | MATERIAL_ADD_PREFIX | MATERIAL_COLOR | MATERIAL_AFFECT_STATISTICS -/obj/structure/sinkframe/ComponentInitialize() +/obj/structure/sinkframe/Initialize(mapload) . = ..() - AddComponent(/datum/component/simple_rotation, ROTATION_ALTCLICK | ROTATION_CLOCKWISE | ROTATION_COUNTERCLOCKWISE | ROTATION_VERBS, null, CALLBACK(src, .proc/can_be_rotated)) - -/obj/structure/sinkframe/proc/can_be_rotated(mob/user, rotation_type) - if(anchored) - to_chat(user, span_warning("It is fastened to the floor!")) - return !anchored + AddComponent(/datum/component/simple_rotation) /obj/structure/sinkframe/attackby(obj/item/I, mob/living/user, params) if(istype(I, /obj/item/stock_parts/water_recycler)) diff --git a/code/game/objects/structures/windoor_assembly.dm b/code/game/objects/structures/windoor_assembly.dm index e85101982e9..0d0a0df7d52 100644 --- a/code/game/objects/structures/windoor_assembly.dm +++ b/code/game/objects/structures/windoor_assembly.dm @@ -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" diff --git a/code/game/objects/structures/window.dm b/code/game/objects/structures/window.dm index 21b4acf23df..02a28004d63 100644 --- a/code/game/objects/structures/window.dm +++ b/code/game/objects/structures/window.dm @@ -70,6 +70,7 @@ flags_1 |= ALLOW_DARK_PAINTS_1 RegisterSignal(src, COMSIG_OBJ_PAINTED, .proc/on_painted) AddElement(/datum/element/atmos_sensitive, mapload) + AddComponent(/datum/component/simple_rotation, ROTATION_NEEDS_ROOM, AfterRotation = CALLBACK(src,.proc/AfterRotation)) var/static/list/loc_connections = list( COMSIG_ATOM_EXIT = .proc/on_exit, @@ -78,10 +79,6 @@ if (flags_1 & ON_BORDER_1) AddElement(/datum/element/connect_loc, loc_connections) -/obj/structure/window/ComponentInitialize() - . = ..() - AddComponent(/datum/component/simple_rotation, ROTATION_ALTCLICK | ROTATION_CLOCKWISE | ROTATION_COUNTERCLOCKWISE | ROTATION_VERBS ,null,CALLBACK(src, .proc/can_be_rotated),CALLBACK(src,.proc/after_rotation)) - /obj/structure/window/rcd_vals(mob/user, obj/item/construction/rcd/the_rcd) switch(the_rcd.mode) if(RCD_DECONSTRUCT) @@ -295,21 +292,8 @@ if (fulltile) . += new /obj/item/shard(location) -/obj/structure/window/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 = fulltile)) - to_chat(user, span_warning("[src] cannot be rotated in that direction!")) - return FALSE - return TRUE - -/obj/structure/window/proc/after_rotation(mob/user,rotation_type) +/obj/structure/window/proc/AfterRotation(mob/user, degrees) air_update_turf(TRUE, FALSE) - add_fingerprint(user) /obj/structure/window/proc/on_painted(obj/structure/window/source, is_dark_color) SIGNAL_HANDLER diff --git a/code/modules/art/statues.dm b/code/modules/art/statues.dm index 338ffca3328..ec46422a0ee 100644 --- a/code/modules/art/statues.dm +++ b/code/modules/art/statues.dm @@ -21,15 +21,7 @@ . = ..() AddElement(art_type, impressiveness) AddElement(/datum/element/beauty, impressiveness * 75) - AddComponent(/datum/component/simple_rotation, ROTATION_ALTCLICK | ROTATION_CLOCKWISE, CALLBACK(src, .proc/can_user_rotate), CALLBACK(src, .proc/can_be_rotated), null) - -/obj/structure/statue/proc/can_be_rotated(mob/user) - if(!anchored) - return TRUE - to_chat(user, span_warning("It's bolted to the floor, you'll need to unwrench it first.")) - -/obj/structure/statue/proc/can_user_rotate(mob/user) - return user.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE, !iscyborg(user)) + AddComponent(/datum/component/simple_rotation) /obj/structure/statue/attackby(obj/item/W, mob/living/user, params) add_fingerprint(user) diff --git a/code/modules/assembly/holder.dm b/code/modules/assembly/holder.dm index 19cfecdabf0..b3e80dc378b 100644 --- a/code/modules/assembly/holder.dm +++ b/code/modules/assembly/holder.dm @@ -14,10 +14,9 @@ var/obj/item/assembly/a_left = null var/obj/item/assembly/a_right = null -/obj/item/assembly_holder/ComponentInitialize() +/obj/item/assembly_holder/Initialize(mapload) . = ..() - var/static/rotation_flags = ROTATION_ALTCLICK | ROTATION_CLOCKWISE | ROTATION_COUNTERCLOCKWISE | ROTATION_FLIP | ROTATION_VERBS - AddComponent(/datum/component/simple_rotation, rotation_flags) + AddComponent(/datum/component/simple_rotation) /obj/item/assembly_holder/Destroy() QDEL_NULL(a_left) diff --git a/code/modules/assembly/infrared.dm b/code/modules/assembly/infrared.dm index 5b3b4cd75af..73222df5825 100644 --- a/code/modules/assembly/infrared.dm +++ b/code/modules/assembly/infrared.dm @@ -18,13 +18,9 @@ . = ..() beams = list() START_PROCESSING(SSobj, src) + AddComponent(/datum/component/simple_rotation, AfterRotation = CALLBACK(src, .proc/AfterRotation)) -/obj/item/assembly/infra/ComponentInitialize() - . = ..() - var/static/rotation_flags = ROTATION_ALTCLICK | ROTATION_CLOCKWISE | ROTATION_COUNTERCLOCKWISE | ROTATION_FLIP | ROTATION_VERBS - AddComponent(/datum/component/simple_rotation, rotation_flags, after_rotation=CALLBACK(src,.proc/after_rotation)) - -/obj/item/assembly/infra/proc/after_rotation() +/obj/item/assembly/infra/proc/AfterRotation(mob/user, degrees) refreshBeam() /obj/item/assembly/infra/Destroy() diff --git a/code/modules/atmospherics/machinery/components/binary_devices/circulator.dm b/code/modules/atmospherics/machinery/components/binary_devices/circulator.dm index 40e4f206369..f82bf4a280c 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/circulator.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/circulator.dm @@ -21,14 +21,14 @@ var/mode = CIRCULATOR_HOT var/obj/machinery/power/generator/generator +/obj/machinery/atmospherics/components/binary/circulator/Initialize(mapload) + . = ..() + AddComponent(/datum/component/simple_rotation) + //default cold circ for mappers /obj/machinery/atmospherics/components/binary/circulator/cold mode = CIRCULATOR_COLD -/obj/machinery/atmospherics/components/binary/circulator/ComponentInitialize() - . = ..() - AddComponent(/datum/component/simple_rotation,ROTATION_ALTCLICK | ROTATION_CLOCKWISE | ROTATION_COUNTERCLOCKWISE | ROTATION_VERBS ) - /obj/machinery/atmospherics/components/binary/circulator/Destroy() if(generator) disconnectFromGenerator() diff --git a/code/modules/hydroponics/hydroponics.dm b/code/modules/hydroponics/hydroponics.dm index aa98cec64fb..90a5de85bc0 100644 --- a/code/modules/hydroponics/hydroponics.dm +++ b/code/modules/hydroponics/hydroponics.dm @@ -69,13 +69,10 @@ /obj/machinery/hydroponics/constructable/ComponentInitialize() . = ..() - AddComponent(/datum/component/simple_rotation, ROTATION_ALTCLICK | ROTATION_CLOCKWISE | ROTATION_COUNTERCLOCKWISE | ROTATION_VERBS, null, CALLBACK(src, .proc/can_be_rotated)) + AddComponent(/datum/component/simple_rotation) AddComponent(/datum/component/plumbing/simple_demand) AddComponent(/datum/component/usb_port, list(/obj/item/circuit_component/hydroponics)) -/obj/machinery/hydroponics/constructable/proc/can_be_rotated(mob/user, rotation_type) - return !anchored - /obj/machinery/hydroponics/constructable/RefreshParts() var/tmp_capacity = 0 for (var/obj/item/stock_parts/matter_bin/M in component_parts) diff --git a/code/modules/plumbing/plumbers/_plumb_machinery.dm b/code/modules/plumbing/plumbers/_plumb_machinery.dm index d0ef91a3095..04c9c69138c 100644 --- a/code/modules/plumbing/plumbers/_plumb_machinery.dm +++ b/code/modules/plumbing/plumbers/_plumb_machinery.dm @@ -21,10 +21,7 @@ . = ..() set_anchored(bolt) create_reagents(buffer, reagent_flags) - AddComponent(/datum/component/simple_rotation, ROTATION_ALTCLICK | ROTATION_CLOCKWISE | ROTATION_COUNTERCLOCKWISE | ROTATION_VERBS, null, CALLBACK(src, .proc/can_be_rotated)) - -/obj/machinery/plumbing/proc/can_be_rotated(mob/user,rotation_type) - return !anchored + AddComponent(/datum/component/simple_rotation) /obj/machinery/plumbing/examine(mob/user) . = ..() diff --git a/code/modules/plumbing/plumbers/bottler.dm b/code/modules/plumbing/plumbers/bottler.dm index b83c073bb8f..a5b5e857c05 100644 --- a/code/modules/plumbing/plumbers/bottler.dm +++ b/code/modules/plumbing/plumbers/bottler.dm @@ -29,12 +29,6 @@ if(!valid_output_configuration) . += span_warning("A flashing notification on the screen reads: \"Output location error!\"") -/obj/machinery/plumbing/bottler/can_be_rotated(mob/user, rotation_type) - if(anchored) - to_chat(user, span_warning("It is fastened to the floor!")) - return FALSE - return TRUE - ///changes the tile array /obj/machinery/plumbing/bottler/setDir(newdir) . = ..() diff --git a/code/modules/plumbing/plumbers/fermenter.dm b/code/modules/plumbing/plumbers/fermenter.dm index 5eb67234af9..c2f0779744e 100644 --- a/code/modules/plumbing/plumbers/fermenter.dm +++ b/code/modules/plumbing/plumbers/fermenter.dm @@ -18,12 +18,6 @@ ) AddElement(/datum/element/connect_loc, loc_connections) -/obj/machinery/plumbing/grinder_chemical/can_be_rotated(mob/user, rotation_type) - if(anchored) - to_chat(user, span_warning("It is fastened to the floor!")) - return FALSE - return TRUE - /obj/machinery/plumbing/fermenter/setDir(newdir) . = ..() eat_dir = newdir diff --git a/code/modules/plumbing/plumbers/grinder_chemical.dm b/code/modules/plumbing/plumbers/grinder_chemical.dm index fbf23480ab1..aff33880acf 100644 --- a/code/modules/plumbing/plumbers/grinder_chemical.dm +++ b/code/modules/plumbing/plumbers/grinder_chemical.dm @@ -17,12 +17,6 @@ ) AddElement(/datum/element/connect_loc, loc_connections) -/obj/machinery/plumbing/grinder_chemical/can_be_rotated(mob/user, rotation_type) - if(anchored) - to_chat(user, span_warning("It is fastened to the floor!")) - return FALSE - return TRUE - /obj/machinery/plumbing/grinder_chemical/setDir(newdir) . = ..() eat_dir = newdir diff --git a/code/modules/power/generator.dm b/code/modules/power/generator.dm index c82d8f38fbc..4df2c9be02f 100644 --- a/code/modules/power/generator.dm +++ b/code/modules/power/generator.dm @@ -17,15 +17,12 @@ /obj/machinery/power/generator/Initialize(mapload) . = ..() + AddComponent(/datum/component/simple_rotation) find_circs() connect_to_network() SSair.start_processing_machine(src) update_appearance() -/obj/machinery/power/generator/ComponentInitialize() - . = ..() - AddComponent(/datum/component/simple_rotation,ROTATION_ALTCLICK | ROTATION_CLOCKWISE | ROTATION_COUNTERCLOCKWISE | ROTATION_VERBS ) - /obj/machinery/power/generator/Destroy() kill_circs() SSair.stop_processing_machine(src) diff --git a/code/modules/power/singularity/emitter.dm b/code/modules/power/singularity/emitter.dm index f68b7392990..ac42a4cd1d0 100644 --- a/code/modules/power/singularity/emitter.dm +++ b/code/modules/power/singularity/emitter.dm @@ -59,21 +59,6 @@ ///stores the direction and orientation of the last projectile var/last_projectile_params - -/obj/machinery/power/emitter/welded/Initialize(mapload) - welded = TRUE - . = ..() - -/obj/machinery/power/emitter/ctf - name = "Energy Cannon" - active = TRUE - active_power_usage = 0 - idle_power_usage = 0 - locked = TRUE - req_access_txt = "100" - welded = TRUE - use_power = NO_POWER_USE - /obj/machinery/power/emitter/Initialize(mapload) . = ..() RefreshParts() @@ -86,11 +71,13 @@ sparks = new sparks.attach(src) sparks.set_up(5, TRUE, src) - -/obj/machinery/power/emitter/ComponentInitialize() - . = ..() + AddComponent(/datum/component/simple_rotation) AddElement(/datum/element/empprotection, EMP_PROTECT_SELF | EMP_PROTECT_WIRES) +/obj/machinery/power/emitter/welded/Initialize(mapload) + welded = TRUE + . = ..() + /obj/machinery/power/emitter/set_anchored(anchorvalue) . = ..() if(!anchored && welded) //make sure they're keep in sync in case it was forcibly unanchored by badmins or by a megafauna. @@ -132,16 +119,6 @@ . += span_notice("Its status display reads: Emitting one beam every [DisplayTimeText(fire_delay)].") . += span_notice("Power consumption at [display_power(active_power_usage)].") -/obj/machinery/power/emitter/ComponentInitialize() - . = ..() - AddComponent(/datum/component/simple_rotation, ROTATION_ALTCLICK | ROTATION_CLOCKWISE | ROTATION_COUNTERCLOCKWISE | ROTATION_VERBS, null, CALLBACK(src, .proc/can_be_rotated)) - -/obj/machinery/power/emitter/proc/can_be_rotated(mob/user, rotation_type) - if(!anchored) - return TRUE - to_chat(user, span_warning("It is fastened to the floor!")) - return FALSE - /obj/machinery/power/emitter/should_have_node() return welded @@ -560,3 +537,13 @@ delay = world.time + 10 else if (emitter.charge < 10) playsound(src,'sound/machines/buzz-sigh.ogg', 50, TRUE) + +/obj/machinery/power/emitter/ctf + name = "Energy Cannon" + active = TRUE + active_power_usage = 0 + idle_power_usage = 0 + locked = TRUE + req_access_txt = "100" + welded = TRUE + use_power = NO_POWER_USE diff --git a/code/modules/reagents/chemistry/machinery/chem_dispenser.dm b/code/modules/reagents/chemistry/machinery/chem_dispenser.dm index e3cdb1f22ba..b3fccddd85c 100644 --- a/code/modules/reagents/chemistry/machinery/chem_dispenser.dm +++ b/code/modules/reagents/chemistry/machinery/chem_dispenser.dm @@ -501,7 +501,7 @@ /obj/machinery/chem_dispenser/drinks/Initialize(mapload) . = ..() - AddComponent(/datum/component/simple_rotation, ROTATION_ALTCLICK | ROTATION_CLOCKWISE) + AddComponent(/datum/component/simple_rotation) /obj/machinery/chem_dispenser/drinks/setDir() var/old = dir diff --git a/code/modules/reagents/reagent_dispenser.dm b/code/modules/reagents/reagent_dispenser.dm index 0e9967b8105..10d8acb2c4d 100644 --- a/code/modules/reagents/reagent_dispenser.dm +++ b/code/modules/reagents/reagent_dispenser.dm @@ -243,22 +243,23 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/reagent_dispensers/wall/virusfood, 30 desc = "A stationary, plumbed, water tank." can_be_tanked = FALSE +/obj/structure/reagent_dispensers/plumbed/Initialize(mapload) + . = ..() + AddComponent(/datum/component/plumbing/simple_supply) + /obj/structure/reagent_dispensers/plumbed/wrench_act(mob/living/user, obj/item/I) ..() default_unfasten_wrench(user, I) return TRUE -/obj/structure/reagent_dispensers/plumbed/ComponentInitialize() - AddComponent(/datum/component/plumbing/simple_supply) - /obj/structure/reagent_dispensers/plumbed/storage name = "stationary storage tank" icon_state = "tank_stationary" reagent_id = null //start empty -/obj/structure/reagent_dispensers/plumbed/storage/ComponentInitialize() +/obj/structure/reagent_dispensers/plumbed/storage/Initialize(mapload) . = ..() - AddComponent(/datum/component/simple_rotation, ROTATION_ALTCLICK | ROTATION_CLOCKWISE | ROTATION_COUNTERCLOCKWISE | ROTATION_VERBS, null, CALLBACK(src, .proc/can_be_rotated)) + AddComponent(/datum/component/simple_rotation) /obj/structure/reagent_dispensers/plumbed/storage/update_overlays() . = ..() @@ -272,11 +273,6 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/reagent_dispensers/wall/virusfood, 30 tank_color.color = mix_color_from_reagents(reagents.reagent_list) . += tank_color -/obj/structure/reagent_dispensers/plumbed/storage/proc/can_be_rotated(mob/user, rotation_type) - if(anchored) - to_chat(user, span_warning("It is fastened to the floor!")) - return !anchored - /obj/structure/reagent_dispensers/plumbed/fuel name = "stationary fuel tank" icon_state = "fuel_stationary" diff --git a/code/modules/recycling/disposal/construction.dm b/code/modules/recycling/disposal/construction.dm index 9f09ee4ee72..65af3f28653 100644 --- a/code/modules/recycling/disposal/construction.dm +++ b/code/modules/recycling/disposal/construction.dm @@ -33,14 +33,15 @@ pipename = initial(pipe_type.name) + AddComponent(/datum/component/simple_rotation, AfterRotation = CALLBACK(src, .proc/AfterRotation)) + AddElement(/datum/element/undertile, TRAIT_T_RAY_VISIBLE) + if(flip) var/datum/component/simple_rotation/rotcomp = GetComponent(/datum/component/simple_rotation) - rotcomp.BaseRot(null,ROTATION_FLIP) + rotcomp.Rotate(usr, ROTATION_FLIP) // this only gets used by pipes created by RPDs or pipe dispensers update_appearance() - AddElement(/datum/element/undertile, TRAIT_T_RAY_VISIBLE) - /obj/structure/disposalconstruct/Move() var/old_dir = dir ..() @@ -85,12 +86,8 @@ dpdir |= turn(dir, 180) return dpdir -/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)) - -/obj/structure/disposalconstruct/proc/after_rot(mob/user,rotation_type) - if(rotation_type == ROTATION_FLIP) +/obj/structure/disposalconstruct/proc/AfterRotation(mob/user, degrees) + if(degrees == ROTATION_FLIP) var/obj/structure/disposalpipe/temp = pipe_type if(initial(temp.flip_type)) if(ISDIAGONALDIR(dir)) // Fix RPD-induced diagonal turning @@ -98,12 +95,6 @@ pipe_type = initial(temp.flip_type) update_appearance() -/obj/structure/disposalconstruct/proc/can_be_rotated(mob/user,rotation_type) - if(anchored) - to_chat(user, span_warning("You must unfasten the pipe before rotating it!")) - return FALSE - return TRUE - // construction/deconstruction // wrench: (un)anchor // weldingtool: convert to real pipe diff --git a/code/modules/vehicles/wheelchair.dm b/code/modules/vehicles/wheelchair.dm index 8d03ef2f2da..ae0fe88ff87 100644 --- a/code/modules/vehicles/wheelchair.dm +++ b/code/modules/vehicles/wheelchair.dm @@ -20,10 +20,7 @@ make_ridable() wheels_overlay = image(icon, overlay_icon, FLY_LAYER) ADD_TRAIT(src, TRAIT_NO_IMMOBILIZE, INNATE_TRAIT) - -/obj/vehicle/ridden/wheelchair/ComponentInitialize() //Since it's technically a chair I want it to have chair properties - . = ..() - AddComponent(/datum/component/simple_rotation,ROTATION_ALTCLICK | ROTATION_CLOCKWISE, CALLBACK(src, .proc/can_user_rotate),CALLBACK(src, .proc/can_be_rotated),null) + AddComponent(/datum/component/simple_rotation) //Since it's technically a chair I want it to have chair properties /obj/vehicle/ridden/wheelchair/atom_destruction(damage_flag) new /obj/item/stack/rods(drop_location(), 1) @@ -58,21 +55,6 @@ if(has_buckled_mobs()) . += wheels_overlay - -///used for simple rotation component checks -/obj/vehicle/ridden/wheelchair/proc/can_be_rotated(mob/living/user) - return TRUE - -///used in simple rotation component checks as to whether a user can rotate this chair -/obj/vehicle/ridden/wheelchair/proc/can_user_rotate(mob/living/user) - var/mob/living/L = user - if(istype(L)) - if(!user.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE, !iscyborg(user))) - return FALSE - if(isobserver(user) && CONFIG_GET(flag/ghost_interaction)) - return TRUE - return FALSE - /// I assign the ridable element in this so i don't have to fuss with hand wheelchairs and motor wheelchairs having different subtypes /obj/vehicle/ridden/wheelchair/proc/make_ridable() AddElement(/datum/element/ridable, /datum/component/riding/vehicle/wheelchair/hand) diff --git a/modular_skyrat/modules/modular_items/lewd_items/code/lewd_machinery/milking_machine.dm b/modular_skyrat/modules/modular_items/lewd_items/code/lewd_machinery/milking_machine.dm index 1a6b180d975..22bb48b7a1b 100644 --- a/modular_skyrat/modules/modular_items/lewd_items/code/lewd_machinery/milking_machine.dm +++ b/modular_skyrat/modules/modular_items/lewd_items/code/lewd_machinery/milking_machine.dm @@ -191,12 +191,6 @@ ////////////////////////////////////////////////////////// // Override block to change the standard chair behavior // ////////////////////////////////////////////////////////// -// Object cannot rotate -/obj/structure/chair/milking_machine/can_be_rotated(mob/user) - return FALSE -// User cannot rotate the object -/obj/structure/chair/milking_machine/can_user_rotate(mob/user) - return FALSE // Another plug to disable rotation /obj/structure/chair/milking_machine/attack_tk(mob/user) return FALSE diff --git a/modular_skyrat/modules/modular_items/lewd_items/code/lewd_structures/bdsm_furniture.dm b/modular_skyrat/modules/modular_items/lewd_items/code/lewd_structures/bdsm_furniture.dm index ba2f1a713d9..f3260c28572 100644 --- a/modular_skyrat/modules/modular_items/lewd_items/code/lewd_structures/bdsm_furniture.dm +++ b/modular_skyrat/modules/modular_items/lewd_items/code/lewd_structures/bdsm_furniture.dm @@ -115,12 +115,6 @@ user_unbuckle_mob(buckled_mob, user) -// Object cannot rotate -/obj/structure/chair/x_stand/can_be_rotated(mob/user) - return FALSE -// User cannot rotate the object -/obj/structure/chair/x_stand/can_user_rotate(mob/user) - return FALSE // Another plug to disable rotation /obj/structure/chair/x_stand/attack_tk(mob/user) return FALSE diff --git a/modular_skyrat/modules/singularity_engine/code/particle_accelerator/particle_accelerator.dm b/modular_skyrat/modules/singularity_engine/code/particle_accelerator/particle_accelerator.dm index d7efd09d8b8..172c4dadc9b 100644 --- a/modular_skyrat/modules/singularity_engine/code/particle_accelerator/particle_accelerator.dm +++ b/modular_skyrat/modules/singularity_engine/code/particle_accelerator/particle_accelerator.dm @@ -52,7 +52,7 @@ /obj/structure/particle_accelerator/ComponentInitialize() . = ..() - AddComponent(/datum/component/simple_rotation,ROTATION_ALTCLICK | ROTATION_CLOCKWISE | ROTATION_COUNTERCLOCKWISE | ROTATION_VERBS ) + AddComponent(/datum/component/simple_rotation) /obj/structure/particle_accelerator/set_anchored(anchorvalue) diff --git a/modular_skyrat/modules/wrestlingring/code/wrestlingring.dm b/modular_skyrat/modules/wrestlingring/code/wrestlingring.dm index 93c21ba623c..1ef983c707e 100644 --- a/modular_skyrat/modules/wrestlingring/code/wrestlingring.dm +++ b/modular_skyrat/modules/wrestlingring/code/wrestlingring.dm @@ -71,7 +71,7 @@ ini_dir = dir AddElement(/datum/element/climbable, climb_time = 20, climb_stun = 0) - AddComponent(/datum/component/simple_rotation,ROTATION_ALTCLICK | ROTATION_CLOCKWISE | ROTATION_COUNTERCLOCKWISE | ROTATION_VERBS ,null,CALLBACK(src, .proc/can_be_rotated),CALLBACK(src,.proc/after_rotation)) + AddComponent(/datum/component/simple_rotation, ROTATION_NEEDS_ROOM) var/static/list/loc_connections = list( COMSIG_ATOM_ENTERED = .proc/on_enter, @@ -130,18 +130,10 @@ return TRUE return . || mover.throwing || mover.movement_type & (FLYING | FLOATING) -/obj/structure/wrestling_corner/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 - return TRUE /obj/structure/wrestling_corner/proc/check_anchored(checked_anchored) return anchored == checked_anchored -/obj/structure/wrestling_corner/proc/after_rotation(mob/user,rotation_type) - add_fingerprint(user) - /obj/structure/wrestling_corner/proc/on_enter(datum/source, atom/movable/movable) SIGNAL_HANDLER if(ishuman(movable))