mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-23 21:18:37 +01:00
[MIRROR] Fixes mech equipment being unusable for AIs (#2345)
* Fixes mech equipment being unusable for AIs (#55248) Adds a signal listener on mechs that listens for middle clicks, and calls a proc that will, in turn, call the normal click proc if the user is an AI. Middle clicks now pass through params just like left clicks. * Fixes mech equipment being unusable for AIs * Add CI-conform #2347 to this. Co-authored-by: zxaber <37497534+zxaber@users.noreply.github.com> Co-authored-by: Alex 'Avunia' Takiya <git@takiya.cloud>
This commit is contained in:
co-authored by
zxaber
Alex 'Avunia' Takiya
parent
d186605a20
commit
5b373aaf92
@@ -64,6 +64,9 @@
|
||||
if(modifiers["ctrl"])
|
||||
CtrlClickOn(A)
|
||||
return
|
||||
if(modifiers["middle"])
|
||||
MiddleClickOn(A, params)
|
||||
return
|
||||
|
||||
if(world.time <= next_move)
|
||||
return
|
||||
|
||||
@@ -86,7 +86,7 @@
|
||||
CtrlShiftClickOn(A)
|
||||
return
|
||||
if(modifiers["middle"])
|
||||
MiddleClickOn(A)
|
||||
MiddleClickOn(A, params)
|
||||
return
|
||||
if(modifiers["shift"])
|
||||
ShiftClickOn(A)
|
||||
@@ -285,8 +285,8 @@
|
||||
* Middle click
|
||||
* Mainly used for swapping hands
|
||||
*/
|
||||
/mob/proc/MiddleClickOn(atom/A)
|
||||
. = SEND_SIGNAL(src, COMSIG_MOB_MIDDLECLICKON, A)
|
||||
/mob/proc/MiddleClickOn(atom/A, params)
|
||||
. = SEND_SIGNAL(src, COMSIG_MOB_MIDDLECLICKON, A, params)
|
||||
if(. & COMSIG_MOB_CANCEL_CLICKON)
|
||||
return
|
||||
swap_hand()
|
||||
|
||||
@@ -521,7 +521,7 @@
|
||||
if(is_currently_ejecting)
|
||||
return
|
||||
var/list/mouse_control = params2list(params)
|
||||
if(isAI(user) && !mouse_control["middle"])//AIs use MMB
|
||||
if(isAI(user) == !mouse_control["middle"])//BASICALLY if a human uses MMB, or an AI doesn't, then do nothing.
|
||||
return
|
||||
if(phasing)
|
||||
to_chat(occupants, "[icon2html(src, occupants)]<span class='warning'>Unable to interact with objects while phasing.</span>")
|
||||
@@ -566,6 +566,9 @@
|
||||
target.mech_melee_attack(src, user)
|
||||
TIMER_COOLDOWN_START(src, COOLDOWN_MECHA_MELEE_ATTACK, melee_cooldown)
|
||||
|
||||
/obj/vehicle/sealed/mecha/proc/on_middlemouseclick(mob/user, atom/target, params)
|
||||
if(isAI(user))
|
||||
on_mouseclick(user, target, params)
|
||||
|
||||
//////////////////////////////////
|
||||
//////// Movement procs ////////
|
||||
@@ -1086,6 +1089,7 @@
|
||||
/obj/vehicle/sealed/mecha/add_occupant(mob/M, control_flags)
|
||||
RegisterSignal(M, COMSIG_LIVING_DEATH, .proc/mob_exit)
|
||||
RegisterSignal(M, COMSIG_MOB_CLICKON, .proc/on_mouseclick)
|
||||
RegisterSignal(M, COMSIG_MOB_MIDDLECLICKON, .proc/on_middlemouseclick) //For AIs
|
||||
RegisterSignal(M, COMSIG_MOB_SAY, .proc/display_speech_bubble)
|
||||
. = ..()
|
||||
update_icon()
|
||||
@@ -1093,6 +1097,7 @@
|
||||
/obj/vehicle/sealed/mecha/remove_occupant(mob/M)
|
||||
UnregisterSignal(M, COMSIG_LIVING_DEATH)
|
||||
UnregisterSignal(M, COMSIG_MOB_CLICKON)
|
||||
UnregisterSignal(M, COMSIG_MOB_MIDDLECLICKON)
|
||||
UnregisterSignal(M, COMSIG_MOB_SAY)
|
||||
M.clear_alert("charge")
|
||||
M.clear_alert("mech damage")
|
||||
|
||||
Reference in New Issue
Block a user