Use a generic ai handler instead. Fix AI wire cut

This commit is contained in:
joep van der velden
2020-09-22 00:23:54 +02:00
parent bf87e128da
commit d55c605961
2 changed files with 22 additions and 21 deletions
+5 -10
View File
@@ -194,26 +194,22 @@
// AIRLOCKS
/obj/machinery/door/airlock/AIAltShiftClick(mob/user) // Sets/Unsets Emergency Access Override
if(emagged)
to_chat(user, "<span class='warning'>Unable to interface: Internal error.</span>")
if(!ai_control_check(user))
return
toggle_emergency_status(user)
/obj/machinery/door/airlock/AIShiftClick(mob/user) // Opens and closes doors!
if(emagged)
to_chat(user, "<span class='warning'>Unable to interface: Internal error.</span>")
if(!ai_control_check(user))
return
open_close(user)
/obj/machinery/door/airlock/AICtrlClick(mob/living/silicon/user) // Bolts doors
if(emagged)
to_chat(user, "<span class='warning'>Unable to interface: Internal error.</span>")
if(!ai_control_check(user))
return
toggle_bolt(user)
/obj/machinery/door/airlock/AIAltClick(mob/living/silicon/user) // Electrifies doors.
if(emagged)
to_chat(user, "<span class='warning'>Unable to interface: Internal error.</span>")
if(!ai_control_check(user))
return
if(wires.is_cut(WIRE_ELECTRIFY))
to_chat(user, "<span class='warning'>The electrification wire is cut - Cannot electrify the door.</span>")
@@ -224,8 +220,7 @@
/obj/machinery/door/airlock/AIMiddleClick(mob/living/user) // Toggles door bolt lights.
if(emagged)
to_chat(user, "<span class='warning'>Unable to interface: Internal error.</span>")
if(!ai_control_check(user))
return
toggle_light(user)
+17 -11
View File
@@ -757,6 +757,22 @@ About the new airlock wires panel:
else
try_to_activate_door(user)
/obj/machinery/door/airlock/proc/ai_control_check(mob/user)
if(!issilicon(user))
return TRUE
if(emagged)
to_chat(user, "<span class='warning'>Unable to interface: Internal error.</span>")
return FALSE
if(!canAIControl())
if(canAIHack(user))
hack(user)
else
if(isAllPowerLoss())
to_chat(user, "<span class='warning'>Unable to interface: Connection timed out.</span>")
else
to_chat(user, "<span class='warning'>Unable to interface: Connection refused.</span>")
return FALSE
return TRUE
/obj/machinery/door/airlock/tgui_act(action, params)
if(..())
@@ -764,17 +780,7 @@ About the new airlock wires panel:
if(!issilicon(usr) && !usr.can_admin_interact())
to_chat(usr, "<span class='warning'>Access denied. Only silicons may use this interface.</span>")
return
if(issilicon(usr) && emagged)
to_chat(usr, "<span class='warning'>Unable to interface: Internal error.</span>")
return
if(!canAIControl() && !isobserver(usr))
if(canAIHack(usr))
hack(usr)
else
if(isAllPowerLoss())
to_chat(usr, "<span class='warning'>Unable to interface: Connection timed out.</span>")
else
to_chat(usr, "<span class='warning'>Unable to interface: Connection refused.</span>")
if(!ai_control_check(usr))
return
. = TRUE
switch(action)