Skip to content

Commit

Permalink
Added signals to attack_ai(), attack_robot(), and interact() (#11306)
Browse files Browse the repository at this point in the history
* added signals

* attack_robot()

* attack_robot()

* add the . = ..()

* run that back

* so apparently this is very important for cyborgs to be able to function

* COMSIG_ATOM_INTERACT and cleaning up interact()

* we should probably return true all the time

* fixes lockers and crates not being able to be opened

* cleans this up a bit

* cleans things up

* forgot this

* Revert "cleans this up a bit"

This reverts commit 20cf008.

* reverts random change
  • Loading branch information
mystery3525 authored Oct 11, 2024
1 parent 96a86e1 commit efa7132
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 15 deletions.
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
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

0 comments on commit efa7132

Please sign in to comment.