Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added signals to attack_ai(), attack_robot(), and interact() #11306

Merged
merged 21 commits into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#define COMPONENT_NO_AFTERATTACK (1<<0)
///from base of atom/attack_hulk(): (/mob/living/carbon/human)
#define COMSIG_ATOM_HULK_ATTACK "hulk_attack"
///from base of atom/attack_ai(): (/mob/user)
#define COMSIG_ATOM_ATTACK_AI "attack_ai"
///from base of atom/animal_attack(): (/mob/user)
#define COMSIG_ATOM_ATTACK_ANIMAL "attack_animal"
//from base of atom/attack_basic_mob(): (/mob/user)
Expand All @@ -25,3 +27,5 @@
#define COMSIG_ATOM_ATTACK_HAND "atom_attack_hand"
///from base of atom/attack_paw(): (mob/user)
#define COMSIG_ATOM_ATTACK_PAW "atom_attack_paw"
///from base of atom/attack_robot(): (mob/user)
#define COMSIG_ATOM_ATTACK_ROBOT "atom_attack_robot"
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@

#define COMSIG_ITEM_ATTACK_EFFECT "item_effect_attacked"

///from the base of obj/item/proc/GetAccess(): ()
#define COMSIG_ITEM_GET_ACCESS "item_get_access"
///from the base of obj/item/proc/GetID(): ()
#define COMSIG_ITEM_GET_ID "item_get_id"

//////////////////////////////

// /obj/effect/mine signals
Expand Down
4 changes: 3 additions & 1 deletion code/_onclick/ai.dm
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@
A.attack_ai(src)

/atom/proc/attack_ai(mob/user)
return
if(SEND_SIGNAL(src, COMSIG_ATOM_ATTACK_AI, user) & COMPONENT_CANCEL_ATTACK_CHAIN)
return TRUE
return FALSE

/*
Since the AI handles shift, ctrl, and alt-click differently
Expand Down
5 changes: 3 additions & 2 deletions code/_onclick/cyborg.dm
Original file line number Diff line number Diff line change
Expand Up @@ -182,5 +182,6 @@
A.attack_robot(src)

/atom/proc/attack_robot(mob/user)
attack_ai(user)
return
mystery3525 marked this conversation as resolved.
Show resolved Hide resolved
if(SEND_SIGNAL(src, COMSIG_ATOM_ATTACK_ROBOT, user) & COMPONENT_CANCEL_ATTACK_CHAIN)
return TRUE
return FALSE
6 changes: 6 additions & 0 deletions code/game/machinery/_machinery.dm
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,9 @@ Class Procs:
user.visible_message("<span class='danger'>[user] smashes [src] with [user.p_their()] paws[damage ? "." : ", without leaving a mark!"]</span>", null, null, COMBAT_MESSAGE_RANGE)

/obj/machinery/attack_robot(mob/user)
. = ..()
if(.)
return
if(!(interaction_flags_machine & INTERACT_MACHINE_ALLOW_SILICON) && !IsAdminGhost(user))
return FALSE
if(Adjacent(user) && can_buckle && has_buckled_mobs()) //so that borgs (but not AIs, sadly (perhaps in a future PR?)) can unbuckle people from machines
Expand All @@ -475,6 +478,9 @@ Class Procs:
return _try_interact(user)

/obj/machinery/attack_ai(mob/user)
. = ..()
if(.)
return
if(!(interaction_flags_machine & INTERACT_MACHINE_ALLOW_SILICON) && !IsAdminGhost(user))
return FALSE
if(iscyborg(user))// For some reason attack_robot doesn't work
Expand Down
3 changes: 3 additions & 0 deletions code/game/objects/items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,9 @@ GLOBAL_VAR_INIT(rpg_loot_items, FALSE)
attack_paw(A)

/obj/item/attack_ai(mob/user)
. = ..()
if(.)
return
if(istype(src.loc, /obj/item/robot_module))
//If the item is part of a cyborg module, equip it
if(!iscyborg(user))
Expand Down
4 changes: 2 additions & 2 deletions code/modules/jobs/access.dm
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@
return TRUE

/obj/item/proc/GetAccess()
return list()
. = SEND_SIGNAL(src, COMSIG_ITEM_GET_ACCESS) || list()

/obj/item/proc/GetID()
return null
. = SEND_SIGNAL(src, COMSIG_ITEM_GET_ID)

/obj/item/proc/RemoveID()
return null
Expand Down
Loading