mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-22 20:48:56 +01:00
Adds right-click support to AIs/Cyborgs (#57881)
Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com>
This commit is contained in:
@@ -67,6 +67,12 @@
|
||||
if(LAZYACCESS(modifiers, MIDDLE_CLICK))
|
||||
MiddleClickOn(A, params)
|
||||
return
|
||||
if(LAZYACCESS(modifiers, RIGHT_CLICK))
|
||||
var/secondary_result = A.attack_ai_secondary(src, modifiers)
|
||||
if(secondary_result == SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN || secondary_result == SECONDARY_ATTACK_CONTINUE_CHAIN)
|
||||
return
|
||||
else if(secondary_result != SECONDARY_ATTACK_CALL_NORMAL)
|
||||
CRASH("attack_ai_secondary did not return a SECONDARY_ATTACK_* define.")
|
||||
|
||||
if(world.time <= next_move)
|
||||
return
|
||||
@@ -90,12 +96,23 @@
|
||||
*/
|
||||
/mob/living/silicon/ai/UnarmedAttack(atom/A, proximity_flag, list/modifiers)
|
||||
A.attack_ai(src)
|
||||
|
||||
/mob/living/silicon/ai/RangedAttack(atom/A)
|
||||
A.attack_ai(src)
|
||||
|
||||
/atom/proc/attack_ai(mob/user)
|
||||
return
|
||||
|
||||
/**
|
||||
* What happens when the AI holds right-click on an item. Returns a SECONDARY_ATTACK_* value.
|
||||
*
|
||||
* Arguments:
|
||||
* * user The mob holding the right click
|
||||
* * modifiers The list of the custom click modifiers
|
||||
*/
|
||||
/atom/proc/attack_ai_secondary(mob/user, list/modifiers)
|
||||
return SECONDARY_ATTACK_CALL_NORMAL
|
||||
|
||||
/*
|
||||
Since the AI handles shift, ctrl, and alt-click differently
|
||||
than anything else in the game, atoms have separate procs
|
||||
|
||||
@@ -36,6 +36,12 @@
|
||||
if(LAZYACCESS(modifiers, CTRL_CLICK))
|
||||
CtrlClickOn(A)
|
||||
return
|
||||
if(LAZYACCESS(modifiers, RIGHT_CLICK) && !module_active)
|
||||
var/secondary_result = A.attack_robot_secondary(src, modifiers)
|
||||
if(secondary_result == SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN || secondary_result == SECONDARY_ATTACK_CONTINUE_CHAIN)
|
||||
return
|
||||
else if (secondary_result != SECONDARY_ATTACK_CALL_NORMAL)
|
||||
CRASH("attack_robot_secondary did not return a SECONDARY_ATTACK_* define.")
|
||||
|
||||
if(next_move >= world.time)
|
||||
return
|
||||
@@ -170,3 +176,13 @@
|
||||
/atom/proc/attack_robot(mob/user)
|
||||
attack_ai(user)
|
||||
return
|
||||
|
||||
/**
|
||||
* What happens when the cyborg without active module holds right-click on an item. Returns a SECONDARY_ATTACK_* value.
|
||||
*
|
||||
* Arguments:
|
||||
* * user The mob holding the right click
|
||||
* * modifiers The list of the custom click modifiers
|
||||
*/
|
||||
/atom/proc/attack_robot_secondary(mob/user, list/modifiers)
|
||||
return attack_ai_secondary(user, modifiers)
|
||||
|
||||
@@ -352,6 +352,9 @@ GLOBAL_LIST_INIT(dye_registry, list(
|
||||
START_PROCESSING(SSfastprocess, src)
|
||||
return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN
|
||||
|
||||
/obj/machinery/washing_machine/attack_ai_secondary(mob/user, modifiers)
|
||||
return attack_hand_secondary(user, modifiers)
|
||||
|
||||
/obj/machinery/washing_machine/deconstruct(disassembled = TRUE)
|
||||
if (!(flags_1 & NODECONSTRUCT_1))
|
||||
new /obj/item/stack/sheet/iron(drop_location(), 2)
|
||||
|
||||
Reference in New Issue
Block a user