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 all 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 @@ -31,3 +31,6 @@
#define COMSIG_ATOM_ATTACK_ROBOT "atom_attack_robot"
///from base of atom/attack_silicon(): (mob/user)
#define COMSIG_ATOM_ATTACK_SILICON "atom_attack_silicon"

///from base of atom/interact(): (mob/user)
#define COMSIG_ATOM_INTERACT "atom_interact"
5 changes: 4 additions & 1 deletion code/_onclick/other_mobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,15 @@
return FALSE

/atom/proc/interact(mob/user)
if(SEND_SIGNAL(src, COMSIG_ATOM_INTERACT, user))
return TRUE
if(interaction_flags_atom & INTERACT_ATOM_NO_FINGERPRINT_INTERACT)
add_hiddenprint(user)
else
add_fingerprint(user)
if(interaction_flags_atom & INTERACT_ATOM_UI_INTERACT)
return ui_interact(user)
ui_interact(user)
return TRUE
return FALSE

/mob/living/carbon/RangedAttack(atom/A, mouseparams)
Expand Down
4 changes: 4 additions & 0 deletions code/game/machinery/_machinery.dm
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,8 @@ Class Procs:
if(isAI(user))
CRASH("An AI just tried to run attack_robot().") // They should not be running the same procs anymore.
. = ..()
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 @@ -481,6 +483,8 @@ Class Procs:
if(iscyborg(user))
CRASH("A cyborg just tried to run attack_ai().") // They should not be running the same procs anymore.
. = ..()
if(.)
return
if(!(interaction_flags_machine & INTERACT_MACHINE_ALLOW_SILICON) && !IsAdminGhost(user))
return FALSE

Expand Down
2 changes: 2 additions & 0 deletions code/game/objects/items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,8 @@ GLOBAL_VAR_INIT(rpg_loot_items, FALSE)
. += research_msg.Join()

/obj/item/interact(mob/user)
if(SEND_SIGNAL(src, COMSIG_ATOM_INTERACT, user))
. = TRUE
add_fingerprint(user)
ui_interact(user)

Expand Down
3 changes: 0 additions & 3 deletions code/game/objects/items/devices/camera_bug.dm
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@
tracking = null
return ..()

/obj/item/camera_bug/interact(mob/user)
ui_interact(user)

/obj/item/camera_bug/ui_interact(mob/user = usr)
. = ..()
var/datum/browser/popup = new(user, "camerabug","Camera Bug",nref=src)
Expand Down
4 changes: 0 additions & 4 deletions code/game/objects/items/devices/traitordevices.dm
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,6 @@ effective or pretty fucking useless.
/obj/item/healthanalyzer/rad_laser/attack_self(mob/user)
interact(user)

/obj/item/healthanalyzer/rad_laser/interact(mob/user)
ui_interact(user)


/obj/item/healthanalyzer/rad_laser/ui_state(mob/user)
return GLOB.hands_state

Expand Down
1 change: 1 addition & 0 deletions code/game/objects/structures/crates_lockers/closets.dm
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
armor = list(MELEE = 20, BULLET = 10, LASER = 10, ENERGY = 0, BOMB = 10, BIO = 0, RAD = 0, FIRE = 70, ACID = 60, STAMINA = 0, BLEED = 0)
blocks_emissive = EMISSIVE_BLOCK_GENERIC
pass_flags_self = LETPASSCLICKS | PASSSTRUCTURE
interaction_flags_atom = NONE
var/contents_initialised = FALSE
var/enable_door_overlay = TRUE
var/has_opened_overlay = TRUE
Expand Down
3 changes: 0 additions & 3 deletions code/modules/clothing/ears/_ears.dm
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,6 @@
return TRUE
interact(user)

/obj/item/clothing/ears/headphones/interact(mob/user)
ui_interact(user)

/obj/item/clothing/ears/headphones/ui_interact(mob/living/user)
if(!isliving(user) || user.stat != CONSCIOUS || (HAS_TRAIT(user, TRAIT_HANDS_BLOCKED) && !ispAI(user)))
return
Expand Down
3 changes: 0 additions & 3 deletions code/modules/instruments/items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@
return TRUE
interact(user)

/obj/item/instrument/interact(mob/user)
ui_interact(user)

/obj/item/instrument/ui_interact(mob/living/user)
if((!isliving(user) || user.stat != CONSCIOUS || HAS_TRAIT(user, TRAIT_HANDS_BLOCKED)) && !ispAI(user))
return
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/obj/item/modular_computer/interact(mob/user)
if(enabled)
ui_interact(user)
return ..()
else
turn_on(user)

Expand Down
Loading