diff --git a/code/_onclick/click_alt.dm b/code/_onclick/click_alt.dm index 16c8e843995..03674904bd6 100644 --- a/code/_onclick/click_alt.dm +++ b/code/_onclick/click_alt.dm @@ -6,7 +6,11 @@ /mob/proc/base_click_alt(atom/target) SHOULD_NOT_OVERRIDE(TRUE) - var/turf/tile = isturf(target) ? target : get_turf(target) + // Check if they've hooked in to prevent src from alt clicking anything + if(SEND_SIGNAL(src, COMSIG_MOB_ALTCLICKON, target) & COMSIG_MOB_CANCEL_CLICKON) + return + + var/turf/tile = get_turf(target) if(isobserver(src) || isrevenant(src)) open_lootpanel(tile) diff --git a/code/modules/vehicles/mecha/_mecha.dm b/code/modules/vehicles/mecha/_mecha.dm index 8152f97e1a4..9d059ba7e22 100644 --- a/code/modules/vehicles/mecha/_mecha.dm +++ b/code/modules/vehicles/mecha/_mecha.dm @@ -707,6 +707,26 @@ target.mech_melee_attack(src, user) TIMER_COOLDOWN_START(src, COOLDOWN_MECHA_MELEE_ATTACK, melee_cooldown) + +/// Driver alt clicks anything while in mech +/obj/vehicle/sealed/mecha/proc/on_click_alt(mob/user, atom/target, params) + SIGNAL_HANDLER + + . = COMSIG_MOB_CANCEL_CLICKON // Cancel base_click_alt + + if(target != src) + return + + if(!(user in occupants)) + return + + if(!(user in return_controllers_with_flag(VEHICLE_CONTROL_DRIVE))) + to_chat(user, span_warning("You're in the wrong seat to control movement.")) + return + + toggle_strafe() + + /// middle mouse click signal wrapper for AI users /obj/vehicle/sealed/mecha/proc/on_middlemouseclick(mob/user, atom/target, params) SIGNAL_HANDLER diff --git a/code/modules/vehicles/mecha/mecha_actions.dm b/code/modules/vehicles/mecha/mecha_actions.dm index d544c829667..8bfde871e0d 100644 --- a/code/modules/vehicles/mecha/mecha_actions.dm +++ b/code/modules/vehicles/mecha/mecha_actions.dm @@ -91,16 +91,6 @@ chassis.toggle_strafe() -/obj/vehicle/sealed/mecha/click_alt(mob/living/user) - if(!(user in occupants)) - return CLICK_ACTION_BLOCKING - if(!(user in return_controllers_with_flag(VEHICLE_CONTROL_DRIVE))) - to_chat(user, span_warning("You're in the wrong seat to control movement.")) - return CLICK_ACTION_BLOCKING - - toggle_strafe() - return CLICK_ACTION_SUCCESS - /obj/vehicle/sealed/mecha/proc/toggle_strafe() if(!(mecha_flags & CAN_STRAFE)) to_chat(occupants, "this mecha doesn't support strafing!") @@ -108,7 +98,9 @@ strafe = !strafe - to_chat(occupants, "strafing mode [strafe?"on":"off"].") + for(var/mob/occupant in occupants) + balloon_alert(occupant, "strafing [strafe?"on":"off"]") + occupant.playsound_local(src, 'sound/machines/terminal_eject.ogg', 50, TRUE) log_message("Toggled strafing mode [strafe?"on":"off"].", LOG_MECHA) for(var/occupant in occupants) diff --git a/code/modules/vehicles/mecha/mecha_mob_interaction.dm b/code/modules/vehicles/mecha/mecha_mob_interaction.dm index 7accab008f1..d16e4af1541 100644 --- a/code/modules/vehicles/mecha/mecha_mob_interaction.dm +++ b/code/modules/vehicles/mecha/mecha_mob_interaction.dm @@ -159,24 +159,26 @@ setDir(SOUTH) return ..() -/obj/vehicle/sealed/mecha/add_occupant(mob/M, control_flags) - RegisterSignal(M, COMSIG_MOB_CLICKON, PROC_REF(on_mouseclick), TRUE) - RegisterSignal(M, COMSIG_MOB_SAY, PROC_REF(display_speech_bubble), TRUE) - RegisterSignal(M, COMSIG_MOVABLE_KEYBIND_FACE_DIR, PROC_REF(on_turn), TRUE) +/obj/vehicle/sealed/mecha/add_occupant(mob/driver, control_flags) + RegisterSignal(driver, COMSIG_MOB_CLICKON, PROC_REF(on_mouseclick), TRUE) + RegisterSignal(driver, COMSIG_MOB_SAY, PROC_REF(display_speech_bubble), TRUE) + RegisterSignal(driver, COMSIG_MOVABLE_KEYBIND_FACE_DIR, PROC_REF(on_turn), TRUE) + RegisterSignal(driver, COMSIG_MOB_ALTCLICKON, PROC_REF(on_click_alt)) . = ..() update_appearance() -/obj/vehicle/sealed/mecha/remove_occupant(mob/M) - UnregisterSignal(M, list( +/obj/vehicle/sealed/mecha/remove_occupant(mob/driver) + UnregisterSignal(driver, list( COMSIG_MOB_CLICKON, COMSIG_MOB_SAY, COMSIG_MOVABLE_KEYBIND_FACE_DIR, + COMSIG_MOB_ALTCLICKON, )) - M.clear_alert(ALERT_CHARGE) - M.clear_alert(ALERT_MECH_DAMAGE) - if(M.client) - M.update_mouse_pointer() - M.client.view_size.resetToDefault() + driver.clear_alert(ALERT_CHARGE) + driver.clear_alert(ALERT_MECH_DAMAGE) + if(driver.client) + driver.update_mouse_pointer() + driver.client.view_size.resetToDefault() zoom_mode = FALSE . = ..() update_appearance()