mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-23 05:00:55 +01:00
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.
This commit is contained in:
@@ -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