Skip to content

Commit

Permalink
Removes non combat click delay (#7802)
Browse files Browse the repository at this point in the history
# About the pull request
Basically #2130 but coded differently
<!-- Remove this text and explain what the purpose of your PR is.

Mention if you have tested your changes. If you changed a map, make sure
you used the mapmerge tool.
If this is an Issue Correction, you can type "Fixes Issue #169420" to
link the PR to the corresponding Issue number #169420.

Remember: something that is self-evident to you might not be to others.
Explain your rationale fully, even if you feel it goes without saying.
-->

# Explain why it's good for the game
#2130
# Testing Photographs and Procedure
<details>
<summary>Screenshots & Videos</summary>

Put screenshots and videos here with an empty line between the
screenshots and the `<details>` tags.

</details>


# Changelog
:cl:
del: Removed non-combat click delay, interacting with items not on your
person should be significantly smoother
balance: Clicking on the floor (open turfs) with an item will no longer
cause a click delay
/:cl:

---------

Co-authored-by: harryob <[email protected]>
  • Loading branch information
Git-Nivrak and hry-gh authored Dec 31, 2024
1 parent 66a41ac commit 9b17397
Show file tree
Hide file tree
Showing 88 changed files with 149 additions and 114 deletions.
7 changes: 6 additions & 1 deletion code/__DEFINES/_click.dm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//Defines file for byond click related parameters
//Defines file for click related parameters
//this is mostly for ease of use and for finding all the things that use say RIGHT_CLICK rather then just searching "right"

//Mouse buttons held
Expand Down Expand Up @@ -35,3 +35,8 @@

//Pixel coordinates in screen_loc format ("[tile_x]:[pixel_x],[tile_y]:[pixel_y]")
#define SCREEN_LOC "screen-loc"

/// From /mob/proc/click_adjacent() : (atom/A, obj/item/W, mods) makes it so the affterattack proc isn't called
#define ATTACKBY_HINT_NO_AFTERATTACK (1 << 0)
/// From /mob/proc/click_adjacent() : (atom/A, obj/item/W, mods) applies the click delay to next_move
#define ATTACKBY_HINT_UPDATE_NEXT_MOVE (1 << 1)
14 changes: 9 additions & 5 deletions code/_onclick/click.dm
Original file line number Diff line number Diff line change
Expand Up @@ -146,16 +146,20 @@

/mob/proc/click_adjacent(atom/A, obj/item/W, mods)
if(W)
if(W.attack_speed && !src.contains(A)) //Not being worn or carried in the user's inventory somewhere, including internal storages.
next_move += W.attack_speed

if(!A.attackby(W, src, mods) && A && !QDELETED(A))
var/attackby_result = A.attackby(W, src, mods)
var/afterattack_result
if(!QDELETED(A) && !(attackby_result & ATTACKBY_HINT_NO_AFTERATTACK))
// in case the attackby slept
if(!W)
if(!isitem(A) && !issurface(A))
next_move += 4
UnarmedAttack(A, 1, mods)
return

W.afterattack(A, src, 1, mods)
afterattack_result = W.afterattack(A, src, 1, mods)

if(W.attack_speed && !src.contains(A) && (attackby_result & ATTACKBY_HINT_UPDATE_NEXT_MOVE) || (afterattack_result & ATTACKBY_HINT_UPDATE_NEXT_MOVE))
next_move += W.attack_speed
else
if(!isitem(A) && !issurface(A))
next_move += 4
Expand Down
5 changes: 3 additions & 2 deletions code/_onclick/item_attack.dm
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
visible_message(SPAN_DANGER("[src] has been hit by [user] with [W]."), null, null, 5, CHAT_TYPE_MELEE_HIT)
user.animation_attack_on(src)
user.flick_attack_overlay(src, "punch")
return ATTACKBY_HINT_UPDATE_NEXT_MOVE

/mob/living/attackby(obj/item/I, mob/user)
/* Commented surgery code, proof of concept. Would need to tweak human attackby to prevent duplication; mob/living don't have separate limb objects.
Expand Down Expand Up @@ -121,5 +122,5 @@
var/hit = H.attacked_by(src, user)
if (hit && hitsound)
playsound(loc, hitsound, 25, 1)
return hit
return TRUE
return (hit|ATTACKBY_HINT_UPDATE_NEXT_MOVE)
return (ATTACKBY_HINT_NO_AFTERATTACK|ATTACKBY_HINT_UPDATE_NEXT_MOVE)
2 changes: 2 additions & 0 deletions code/datums/agents/tools/chloroform.dm
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@

uses--

return (ATTACKBY_HINT_NO_AFTERATTACK|ATTACKBY_HINT_UPDATE_NEXT_MOVE)

/obj/item/weapon/chloroform/proc/grab_stun(mob/living/M, mob/living/user)
M.anchored = TRUE
ADD_TRAIT(M, TRAIT_IMMOBILIZED, CHLOROFORM_TRAIT)
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/atmoalter/canister.dm
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ update_flag
visible_message(SPAN_DANGER("[user] hits [src] with [W]!"))
update_health(W.force)
src.add_fingerprint(user)
..()
. = ..()

SSnano.nanomanager.update_uis(src) // Update all NanoUIs attached to src

Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/atmoalter/portable_atmospherics.dm
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,5 @@
cell = null
return

..()
. = ..()

4 changes: 2 additions & 2 deletions code/game/machinery/atmoalter/scrubber.dm
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
if(istype(I, /obj/item/tank))
return

..()
. = ..()


/obj/structure/machinery/portable_atmospherics/powered/scrubber/huge/stationary
Expand All @@ -103,4 +103,4 @@
to_chat(user, SPAN_NOTICE(" The bolts are too tight for you to unscrew!"))
return

..()
. = ..()
4 changes: 2 additions & 2 deletions code/game/machinery/bots/bots.dm
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,10 @@
health -= W.force * W.demolition_mod * fire_dam_coeff
if("brute")
health -= W.force * W.demolition_mod * brute_dam_coeff
..()
. = ..()
healthcheck()
else
..()
. = ..()

/obj/structure/machinery/bot/bullet_act(obj/projectile/Proj)
health -= Proj.ammo.damage
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/bots/floorbot.dm
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
to_chat(user, SPAN_WARNING("Access denied."))
src.updateUsrDialog()
else
..()
. = ..()

/obj/structure/machinery/bot/floorbot/Topic(href, href_list)
if(..())
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/bots/medbot.dm
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@
return

else
..()
. = ..()
if (health < maxhealth && !HAS_TRAIT(W, TRAIT_TOOL_SCREWDRIVER) && W.force)
step_to(src, (get_step_away(src,user)))

Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/bots/mulebot.dm
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@
else
to_chat(user, "You hit [src] with \the [I] but to no effect.")
else
..()
. = ..()
return


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 @@ -197,7 +197,7 @@ GLOBAL_LIST_EMPTY_TYPED(all_cameras, /obj/structure/machinery/camera)
to_chat(O, "[U] holds \a [itemname] up to one of the cameras ...")
show_browser(O, info, itemname, itemname)
else
..()
. = ..()
return

/obj/structure/machinery/camera/proc/toggle_cam_status(mob/user, silent)
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/computer/HolodeckControl.dm
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
to_chat(user, "It's a holotable! There are no bolts!")
return

..()
. = ..()

/obj/structure/surface/table/holotable/wood
name = "table"
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/computer/camera_console.dm
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@
return TRUE
toggle_anchored(wrench, user)
return TRUE
..()
. = ..()

/obj/structure/machinery/computer/cameras/wooden_tv/broadcast/toggle_anchored(obj/item/wrench, mob/user)
. = ..()
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 @@ -44,7 +44,7 @@
last_user_name = scan.registered_name
last_user_rank = scan.rank
to_chat(user, "You insert [O].")
..()
. = ..()

/obj/structure/machinery/computer/med_data/attack_remote(user as mob)
return src.attack_hand(user)
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/computer/security.dm
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
scanner = O
to_chat(user, "You insert [O].")

..()
. = ..()

/obj/structure/machinery/computer/secure_data/attack_remote(mob/user as mob)
return attack_hand(user)
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/computer/sentencing.dm
Original file line number Diff line number Diff line change
Expand Up @@ -242,4 +242,4 @@
incident.criminal_gid = add_zero(num2hex(id.registered_gid), 6)
ping("\The [src] pings, \"Criminal [id.registered_name] verified.\"")

..()
. = ..()
2 changes: 1 addition & 1 deletion code/game/machinery/computer/skills.dm
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
O.forceMove(src)
scan = O
to_chat(user, "You insert [O].")
..()
. = ..()

/obj/structure/machinery/computer/skills/attack_remote(mob/user as mob)
return attack_hand(user)
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/deployable.dm
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
health -= W.force * W.demolition_mod * 0.5
if (health <= 0)
explode()
..()
. = ..()

/obj/structure/machinery/deployable/barrier/ex_act(severity)
src.health -= severity/2
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/doors/airlock_control.dm
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@
if (istype(I, /obj/item/card/id))
attack_hand(user)
return
..()
. = ..()

/obj/structure/machinery/access_button/attack_hand(mob/user)
add_fingerprint(usr)
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/doors/multi_tile.dm
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@
control.status = SHUTTLE_DOOR_UNLOCKED
to_chat(user, SPAN_WARNING("You successfully restored the remote connection to [src]."))
return
..()
. = ..()

/obj/structure/machinery/door/airlock/multi_tile/almayer/dropshiprear/unlock(forced = FALSE)
if(is_reserved_level(z) && !forced)
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/doors/poddoor/almayer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
/obj/structure/machinery/door/poddoor/almayer/locked/attackby(obj/item/C as obj, mob/user as mob)
if(HAS_TRAIT(C, TRAIT_TOOL_CROWBAR))
return
..()
. = ..()

/obj/structure/machinery/door/poddoor/almayer/closed
density = TRUE
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/doors/poddoor/shutters/shutters.dm
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@
/obj/structure/machinery/door/poddoor/shutters/almayer/uniform_vendors/attackby(obj/item/attacking_item, mob/user)
if(HAS_TRAIT(attacking_item, TRAIT_TOOL_CROWBAR) || attacking_item.pry_capable)
return
..()
. = ..()

/obj/structure/machinery/door/poddoor/shutters/almayer/uniform_vendors/antitheft
name = "Anti-Theft Shutters"
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/doors/unpowered.dm
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
/obj/structure/machinery/door/unpowered/attackby(obj/item/I as obj, mob/user as mob)
if(src.locked)
return
..()
. = ..()
return

/obj/structure/machinery/door/unpowered/shuttle
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/doors/windowdoor.dm
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@
visible_message(SPAN_DANGER("<B>[src] was hit by [I].</B>"))
if(I.damtype == BRUTE || I.damtype == BURN)
take_damage(aforce)
return 1
return (ATTACKBY_HINT_NO_AFTERATTACK|ATTACKBY_HINT_UPDATE_NEXT_MOVE)
else
return try_to_activate_door(user)

Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/fire_alarm.dm
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ FIRE ALARM
qdel(src)
return

..()
. = ..()
return

/obj/structure/machinery/firealarm/power_change()
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/nuclearbomb.dm
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ GLOBAL_VAR_INIT(bomb_set, FALSE)
disable()
playsound(loc, 'sound/items/Wirecutter.ogg', 100, 1)
return
..()
. = ..()

/obj/structure/machinery/nuclearbomb/attack_hand(mob/user as mob)
if(user.is_mob_incapacitated() || get_dist(src, user) > 1 || isRemoteControlling(user))
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/spaceheater.dm
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
close_browser(user, "spaceheater")
user.unset_interaction()
else
..()
. = ..()
return

/obj/structure/machinery/space_heater/attack_hand(mob/user as mob)
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/telecomms/portable_comms.dm
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,5 @@
return
if(istype(I, /obj/item/circuitboard/machine) && !istype(I, /obj/item/circuitboard/machine/telecomms/relay/tower))
return
..()
. = ..()

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

src.add_fingerprint(usr)
else
..()
. = ..()

return

Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/vending/cm_vending.dm
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,7 @@ GLOBAL_LIST_EMPTY(vending_products)
. = redeem_token(W, user)
return

..()
. = ..()

/obj/structure/machinery/cm_vending/proc/get_listed_products(mob/user)
return listed_products
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/vending/vending.dm
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ GLOBAL_LIST_EMPTY_TYPED(total_vending_machines, /obj/structure/machinery/vending
tgui_interact(user)
return

..()
. = ..()

/obj/structure/machinery/vending/proc/scan_card(obj/item/card/card)
if(!currently_vending) return
Expand Down
6 changes: 3 additions & 3 deletions code/game/machinery/washing_machine.dm
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@
if(user.drop_inv_item_to_loc(crayon, src))
crayon = W
else
..()
. = ..()
else
..()
. = ..()

else if(istype(W,/obj/item/stack/sheet/hairlesshide) || \
istype(W,/obj/item/clothing/under) || \
Expand Down Expand Up @@ -137,7 +137,7 @@
else
to_chat(user, SPAN_NOTICE(" The washing machine is full."))
else
..()
. = ..()
update_icon()

/obj/structure/machinery/washing_machine/attack_hand(mob/user as mob)
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/effects/effect_system/foam.dm
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@
take_damage(I.force * I.sharp * FOAMED_METAL_ITEM_MELEE) //human advantage, sharper items do more damage
else
take_damage(I.force * FOAMED_METAL_ITEM_MELEE) //blunt items can damage it still
return TRUE
return (ATTACKBY_HINT_NO_AFTERATTACK|ATTACKBY_HINT_UPDATE_NEXT_MOVE)

return FALSE

Expand Down
2 changes: 2 additions & 0 deletions code/game/objects/items/devices/flash.dm
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@

do_flash(M, user, FALSE)

return (ATTACKBY_HINT_NO_AFTERATTACK|ATTACKBY_HINT_UPDATE_NEXT_MOVE)

//AOE flash

/obj/item/device/flash/attack_self(mob/living/carbon/user as mob, flag = 0, emp = 0)
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/fulton.dm
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ GLOBAL_LIST_EMPTY(deployed_fultons)
return

/obj/item/stack/fulton/attack(mob/M as mob, mob/user as mob)
return
return ATTACKBY_HINT_UPDATE_NEXT_MOVE

/obj/item/stack/fulton/attack_hand(mob/user as mob)
if (attached_atom)
Expand Down
1 change: 1 addition & 0 deletions code/game/objects/items/handcuffs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
if(SLOT_LEGS)
if(!attacked_carbon.legcuffed)
apply_legcuffs(attacked_carbon, user)
return ATTACKBY_HINT_UPDATE_NEXT_MOVE

/obj/item/restraint/proc/place_handcuffs(mob/living/carbon/target, mob/user)
playsound(src.loc, cuff_sound, 25, 1, 4)
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/reagent_containers/hypospray.dm
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@
to_chat(user, SPAN_NOTICE("[trans] units injected. [reagents.total_volume] units remaining in [src]'s [mag.name]."))
else
to_chat(user, SPAN_NOTICE("[trans] units injected. [reagents.total_volume] units remaining in [src]."))
return TRUE
return (ATTACKBY_HINT_NO_AFTERATTACK|ATTACKBY_HINT_UPDATE_NEXT_MOVE)

/obj/item/reagent_container/hypospray/Initialize()
. = ..()
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/tools/cleaning_tools.dm
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
/obj/effect/attackby(obj/item/I, mob/user)
if(istype(I, /obj/item/tool/mop) || istype(I, /obj/item/tool/soap))
return
..()
. = ..()



Expand Down
Loading

0 comments on commit 9b17397

Please sign in to comment.