Skip to content

Commit

Permalink
refactors attack hand proc header (#6720)
Browse files Browse the repository at this point in the history
needed for #5677 

this is to make that PR slightly easier to review.
  • Loading branch information
silicons authored Sep 6, 2024
1 parent 6b8a74e commit 0c8dd52
Show file tree
Hide file tree
Showing 430 changed files with 506 additions and 504 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
/// for now, this is a signal with (item, user, hit_zone)
#define COMSIG_MOB_LEGACY_RESOLVE_ITEM_ATTACK "legacy-mob-item-resolve-attack"
/// used by passive parry to detect
/// signal with (user, list/params)
/// signal with (user, datum/event_args/actor/clickchain/e_args)
/// :skull:
#define COMSIG_MOB_LEGACY_ATTACK_HAND_INTERCEPT "legacy-mob-legacy-attack-hand"
2 changes: 1 addition & 1 deletion code/game/atoms/buckling.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
return CLICKCHAIN_DO_NOT_PROPAGATE
return ..()

/atom/movable/attack_hand(mob/user, list/params)
/atom/movable/attack_hand(mob/user, datum/event_args/actor/clickchain/e_args)
if(user.a_intent == INTENT_HARM)
return ..()
. = ..()
Expand Down
10 changes: 4 additions & 6 deletions code/game/atoms/movable/special/overlay.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@
// todo: nuke this shit from orbit, this is awful.
var/atom/master = null

/atom/movable/overlay/attackby(a, b)
if (src.master)
return src.master.attackby(a, b)
/atom/movable/overlay/attackby(obj/item/I, mob/user, list/params, clickchain_flags, damage_multiplier)
return master.attackby(arglist(args))

/atom/movable/overlay/attack_hand(a, b, c)
if (src.master)
return src.master.attack_hand(a, b, c)
/atom/movable/overlay/attack_hand(mob/user, datum/event_args/actor/clickchain/e_args)
return master.attack_hand(arglist(args))
12 changes: 8 additions & 4 deletions code/game/click/other_mobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,16 @@
if(istype(G) && G.Touch(A,1))
return

A.attack_hand(src)
A.attack_hand(src, new /datum/event_args/actor/clickchain(src))

/// Return TRUE to cancel other attack hand effects that respect it.
// todo: /datum/event_args/actor/clickchain
/atom/proc/attack_hand(mob/user, list/params)
var/datum/event_args/actor/clickchain/e_args = new(user, target = src, intent = user.a_intent, params = params)
// todo: better desc
// todo: e_args is not specified all the time, yet.
/atom/proc/attack_hand(mob/user, datum/event_args/actor/clickchain/e_args)
// todo: remove
if(isnull(e_args))
e_args = new(user)
// end
if(on_attack_hand(e_args))
return TRUE
if(user.a_intent == INTENT_HARM)
Expand Down
2 changes: 1 addition & 1 deletion code/game/dna/dna_modifier.dm
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@
src.add_hiddenprint(user)
nano_ui_interact(user)

/obj/machinery/computer/scan_consolenew/attack_hand(mob/user, list/params)
/obj/machinery/computer/scan_consolenew/attack_hand(mob/user, datum/event_args/actor/clickchain/e_args)
if(!..())
nano_ui_interact(user)

Expand Down
2 changes: 1 addition & 1 deletion code/game/gamemodes/cult/cult_structures.dm
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
. = ..()
START_PROCESSING(SSobj, src)

/obj/structure/cult/pylon/attack_hand(mob/user, list/params)
/obj/structure/cult/pylon/attack_hand(mob/user, datum/event_args/actor/clickchain/e_args)
attackpylon(user, 5)

/obj/structure/cult/pylon/attack_generic(var/mob/user, var/damage)
Expand Down
2 changes: 1 addition & 1 deletion code/game/gamemodes/cult/ritual.dm
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ var/global/list/rnwords = list("ire","ego","nahlizet","certum","veri","jatkaa","
return


/obj/effect/rune/attack_hand(mob/user, list/params)
/obj/effect/rune/attack_hand(mob/user, datum/event_args/actor/clickchain/e_args)
if(!ishuman(user))
return
var/mob/living/carbon/human/H = user
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/CableLayer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
. = ..()
layCable(new_turf,M_Dir)

/obj/machinery/cablelayer/attack_hand(mob/user, list/params)
/obj/machinery/cablelayer/attack_hand(mob/user, datum/event_args/actor/clickchain/e_args)
if(!cable&&!on)
to_chat(user, SPAN_WARNING("\The [src] doesn't have any cable loaded."))
return
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/OpTable.dm
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
if(prob(25))
density = 0

/obj/machinery/optable/attack_hand(mob/user, list/params)
/obj/machinery/optable/attack_hand(mob/user, datum/event_args/actor/clickchain/e_args)
if(MUTATION_HULK in usr.mutations)
visible_message(SPAN_DANGER("\The [usr] destroys \the [src]!"))
density = FALSE
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/Sleeper.dm
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
/obj/machinery/sleep_console/attack_ai(mob/user)
return attack_hand(user)

/obj/machinery/sleep_console/attack_hand(mob/user, list/params)
/obj/machinery/sleep_console/attack_hand(mob/user, datum/event_args/actor/clickchain/e_args)
if(..())
return 1

Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/_machinery.dm
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@
return attack_hand(user)

// todo: refactor
/obj/machinery/attack_hand(mob/user, list/params)
/obj/machinery/attack_hand(mob/user, datum/event_args/actor/clickchain/e_args)
if(user.a_intent == INTENT_HARM)
return ..()
if(IsAdminGhost(user))
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/adv_med.dm
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@
. = ..()
return attack_hand(user)

/obj/machinery/body_scanconsole/attack_hand(mob/user, list/params)
/obj/machinery/body_scanconsole/attack_hand(mob/user, datum/event_args/actor/clickchain/e_args)
if(machine_stat & (NOPOWER|BROKEN))
return

Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/ai_slipper.dm
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
/obj/machinery/ai_slipper/attack_ai(mob/user as mob)
return attack_hand(user)

/obj/machinery/ai_slipper/attack_hand(mob/user, list/params)
/obj/machinery/ai_slipper/attack_hand(mob/user, datum/event_args/actor/clickchain/e_args)
if(machine_stat & (NOPOWER|BROKEN))
return
if((get_dist(src, user) > 1))
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/atm_ret_field.dm
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@
update_nearby_tiles() //Force ZAS update
. = ..()

/obj/structure/atmospheric_retention_field/attack_hand(mob/user, list/params)
/obj/structure/atmospheric_retention_field/attack_hand(mob/user, datum/event_args/actor/clickchain/e_args)
if(density)
to_chat(user, "You touch the retention field, and it crackles faintly. Tingly!")
else
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/atmo_control.dm
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
radio_controller.remove_object(src, frequency)
..()

/obj/machinery/computer/general_air_control/attack_hand(mob/user, list/params)
/obj/machinery/computer/general_air_control/attack_hand(mob/user, datum/event_args/actor/clickchain/e_args)
if(..(user))
return

Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/bioprinter.dm
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@

. = ..()

/obj/machinery/organ_printer/attack_hand(mob/user, list/params)
/obj/machinery/organ_printer/attack_hand(mob/user, datum/event_args/actor/clickchain/e_args)

if(machine_stat & (BROKEN|NOPOWER))
return
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/bomb_tester.dm
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
return
..()

/obj/machinery/bomb_tester/attack_hand(mob/user, list/params)
/obj/machinery/bomb_tester/attack_hand(mob/user, datum/event_args/actor/clickchain/e_args)
add_fingerprint(user)
ui_interact(user)

Expand Down
4 changes: 2 additions & 2 deletions code/game/machinery/buttons.dm
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
/obj/machinery/button/attackby(obj/item/W, mob/user)
return attack_hand(user)

/obj/machinery/button/attack_hand(obj/item/W, mob/user)
/obj/machinery/button/attack_hand(mob/user, datum/event_args/actor/clickchain/e_args)
if(..())
return TRUE
playsound(src, 'sound/machines/button.ogg', 100, TRUE)
Expand All @@ -30,7 +30,7 @@
desc = "A remote control switch for polarized windows."
var/range = 7

/obj/machinery/button/windowtint/attack_hand(mob/user, list/params)
/obj/machinery/button/windowtint/attack_hand(mob/user, datum/event_args/actor/clickchain/e_args)
if (..())
return TRUE
else
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/camera/camera.dm
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ CREATE_WALL_MOUNTING_TYPES(/obj/machinery/camera)
src.view_range = num
GLOB.cameranet.updateVisibility(src, 0)

/obj/machinery/camera/attack_hand(mob/user, list/params)
/obj/machinery/camera/attack_hand(mob/user, datum/event_args/actor/clickchain/e_args)
var/mob/living/carbon/human/L = user
if(!istype(L))
return
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/camera/camera_assembly.dm
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
else
icon_state = "cameracase"

/obj/item/camera_assembly/attack_hand(mob/user, list/params)
/obj/item/camera_assembly/attack_hand(mob/user, datum/event_args/actor/clickchain/e_args)
if(!anchored)
..()

Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/cell_charger.dm
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
else if(default_part_replacement(user, W))
return

/obj/machinery/cell_charger/attack_hand(mob/user, list/params)
/obj/machinery/cell_charger/attack_hand(mob/user, datum/event_args/actor/clickchain/e_args)
add_fingerprint(user)

if(charging)
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/cloning.dm
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
add_hiddenprint(user)
return attack_hand(user)

/obj/machinery/clonepod/attack_hand(mob/user, list/params)
/obj/machinery/clonepod/attack_hand(mob/user, datum/event_args/actor/clickchain/e_args)
if((isnull(occupant)) || (machine_stat & NOPOWER))
return
if((!isnull(occupant)) && (occupant.stat != 2))
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/computer/Operating.dm
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
return
ui_interact(user)

/obj/machinery/computer/operating/attack_hand(mob/user, list/params)
/obj/machinery/computer/operating/attack_hand(mob/user, datum/event_args/actor/clickchain/e_args)
if(machine_stat & (BROKEN|NOPOWER))
return
ui_interact(user)
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/computer/RCON_Console.dm
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
// Proc: attack_hand()
// Parameters: 1 (user - Person which clicked this computer)
// Description: Opens UI of this machine.
/obj/machinery/computer/rcon/attack_hand(mob/user, list/params)
/obj/machinery/computer/rcon/attack_hand(mob/user, datum/event_args/actor/clickchain/e_args)
..()
ui_interact(user)

Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/computer/aifixer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
to_chat(user, SPAN_NOTICE("There is no AI loaded onto this computer, and no AI loaded onto [I]. What exactly are you trying to do here?"))
return ..()

/obj/machinery/computer/aifixer/attack_hand(mob/user, list/params)
/obj/machinery/computer/aifixer/attack_hand(mob/user, datum/event_args/actor/clickchain/e_args)
if(machine_stat & (NOPOWER|BROKEN))
return
ui_interact(user)
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/computer/arcade/amputation.dm
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
icon_screen = null
circuit = /obj/item/circuitboard/arcade/amputation

/obj/machinery/computer/arcade/amputation/attack_hand(mob/user, list/modifiers)
/obj/machinery/computer/arcade/amputation/attack_hand(mob/user, datum/event_args/actor/clickchain/e_args)
if(!iscarbon(user))
return
var/mob/living/carbon/c_user = user
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/computer/arcade/claw_machine.dm
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@
/obj/machinery/computer/arcade/clawmachine/Initialize(mapload)
. = ..()

/obj/machinery/computer/arcade/clawmachine/attack_hand(mob/user, list/params)
/obj/machinery/computer/arcade/clawmachine/attack_hand(mob/user, datum/event_args/actor/clickchain/e_args)
if(..())
return
ui_interact(user)
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/computer/atmos_alert.dm
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ var/global/list/minor_air_alarms = list()
atmosphere_alarm.unregister_alarm(src)
return ..()

/obj/machinery/computer/atmos_alert/attack_hand(mob/user, list/params)
/obj/machinery/computer/atmos_alert/attack_hand(mob/user, datum/event_args/actor/clickchain/e_args)
ui_interact(user)

/obj/machinery/computer/atmos_alert/ui_interact(mob/user, datum/tgui/ui, datum/tgui/parent_ui)
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/computer/atmos_control.dm
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
/obj/machinery/computer/atmoscontrol/attack_ai(mob/user)
ui_interact(user)

/obj/machinery/computer/atmoscontrol/attack_hand(mob/user, list/params)
/obj/machinery/computer/atmoscontrol/attack_hand(mob/user, datum/event_args/actor/clickchain/e_args)
if(..())
return TRUE
ui_interact(user)
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/computer/camera.dm
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
/obj/machinery/computer/security/ui_interact(mob/user, datum/tgui/ui = null)
camera.ui_interact(user, ui)

/obj/machinery/computer/security/attack_hand(mob/user, list/params)
/obj/machinery/computer/security/attack_hand(mob/user, datum/event_args/actor/clickchain/e_args)
add_fingerprint(user)
if(machine_stat & (BROKEN|NOPOWER))
return
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/computer/cloning.dm
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
/obj/machinery/computer/cloning/attack_ai(mob/user as mob)
return attack_hand(user)

/obj/machinery/computer/cloning/attack_hand(mob/user, list/params)
/obj/machinery/computer/cloning/attack_hand(mob/user, datum/event_args/actor/clickchain/e_args)
user.set_machine(src)
add_fingerprint(user)

Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/computer/command/card.dm
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
/obj/machinery/computer/card/attack_ai(var/mob/user as mob)
return attack_hand(user)

/obj/machinery/computer/card/attack_hand(mob/user, list/params)
/obj/machinery/computer/card/attack_hand(mob/user, datum/event_args/actor/clickchain/e_args)
if(..())
return
if(machine_stat & (NOPOWER|BROKEN))
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/computer/communications.dm
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@
/obj/machinery/computer/communications/attack_ai(var/mob/user as mob)
return src.attack_hand(user)

/obj/machinery/computer/communications/attack_hand(mob/user, list/params)
/obj/machinery/computer/communications/attack_hand(mob/user, datum/event_args/actor/clickchain/e_args)
if(..())
return
if ((LEGACY_MAP_DATUM) && !(src.z in (LEGACY_MAP_DATUM).contact_levels))
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/computer/crew.dm
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
/obj/machinery/computer/crew/attack_ai(mob/user)
attack_hand(user)

/obj/machinery/computer/crew/attack_hand(mob/user, list/params)
/obj/machinery/computer/crew/attack_hand(mob/user, datum/event_args/actor/clickchain/e_args)
..()
if(machine_stat & (BROKEN|NOPOWER))
return
Expand Down
4 changes: 2 additions & 2 deletions code/game/machinery/computer/law.dm
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
..()


/obj/machinery/computer/aiupload/attack_hand(mob/user, list/params)
/obj/machinery/computer/aiupload/attack_hand(mob/user, datum/event_args/actor/clickchain/e_args)
if(machine_stat & NOPOWER)
to_chat(user, "The upload computer has no power!")
return
Expand Down Expand Up @@ -71,7 +71,7 @@
return ..()


/obj/machinery/computer/borgupload/attack_hand(mob/user, list/params)
/obj/machinery/computer/borgupload/attack_hand(mob/user, datum/event_args/actor/clickchain/e_args)
if(machine_stat& NOPOWER)
to_chat(user, "The upload computer has no power!")
return
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/computer/medical.dm
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
/obj/machinery/computer/med_data/attack_ai(user as mob)
return attack_hand(user)

/obj/machinery/computer/med_data/attack_hand(mob/user, list/params)
/obj/machinery/computer/med_data/attack_hand(mob/user, datum/event_args/actor/clickchain/e_args)
if(..())
return

Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/computer/message.dm
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
linkedServer = message_servers[1]
return ..()

/obj/machinery/computer/message_monitor/attack_hand(mob/user, list/params)
/obj/machinery/computer/message_monitor/attack_hand(mob/user, datum/event_args/actor/clickchain/e_args)
if(machine_stat & (NOPOWER|BROKEN))
return
if(!istype(user))
Expand Down
4 changes: 2 additions & 2 deletions code/game/machinery/computer/pod.dm
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
/obj/machinery/computer/pod/attack_ai(var/mob/user as mob)
return attack_hand(user)

/obj/machinery/computer/pod/attack_hand(mob/user, list/params)
/obj/machinery/computer/pod/attack_hand(mob/user, datum/event_args/actor/clickchain/e_args)
if(..())
return

Expand Down Expand Up @@ -142,7 +142,7 @@
title = "External Airlock Controls"
req_access = list(ACCESS_FACTION_SYNDICATE)

/obj/machinery/computer/pod/old/syndicate/attack_hand(mob/user, list/params)
/obj/machinery/computer/pod/old/syndicate/attack_hand(mob/user, datum/event_args/actor/clickchain/e_args)
if(!allowed(user))
to_chat(user, "<span class='warning'>Access Denied</span>")
return
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/computer/prisoner.dm
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
/obj/machinery/computer/prisoner/attack_ai(var/mob/user as mob)
return src.attack_hand(user)

/obj/machinery/computer/prisoner/attack_hand(mob/user, list/params)
/obj/machinery/computer/prisoner/attack_hand(mob/user, datum/event_args/actor/clickchain/e_args)
if(..())
return
ui_interact(user)
Expand Down
Loading

0 comments on commit 0c8dd52

Please sign in to comment.