Skip to content

Commit

Permalink
3291 - Fixes the ability to manipulate a dummy from a distance using …
Browse files Browse the repository at this point in the history
…the tablet (#4268)

# About the pull request

Closes #3291 

This code fixes an issue where you can manipulate a dummy at a distance.

# Explain why it's good for the game

N/A, an issue was raised for it.


# Testing Photographs and Procedure


https://github.com/cmss13-devs/cmss13/assets/8283338/40e61fb6-c833-4faa-a0fe-e2423ba7870e

# Changelog

:cl:
fix: Fixes admin training dummy interaction distance
/:cl:
  • Loading branch information
Xufysz committed Aug 28, 2023
1 parent 76a645f commit fcef7ad
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
24 changes: 23 additions & 1 deletion code/game/objects/items/devices/dummy_tablet.dm
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,20 @@
linked_dummy = null
. = ..()

/**
* Checks if the user is adjacent to the dummy
*
* Returns TRUE if the user is adjacent to the dummy, FALSE otherwise
*
* * arg-1: The user
*/
/obj/item/device/professor_dummy_tablet/proc/is_adjacent_to_dummy(mob/user)
if (get_dist(linked_dummy, user) > 1)
to_chat(user, "You are too far away to use the tablet.")
return FALSE

return TRUE

/obj/item/device/professor_dummy_tablet/proc/link_mob(mob/living/carbon/human/H)
linked_dummy = H

Expand All @@ -20,6 +34,12 @@
interact(user)

/obj/item/device/professor_dummy_tablet/interact(mob/user as mob)
if (isnull(linked_dummy))
return

if (!is_adjacent_to_dummy(user))
return

user.set_interaction(src)
var/dat = "<head><title>Professor DUMMY Control Tablet</title></head><body>"

Expand Down Expand Up @@ -90,9 +110,11 @@

/obj/item/device/professor_dummy_tablet/Topic(href, href_list)
if(..()) return FALSE
usr.set_interaction(src)

if (!is_adjacent_to_dummy(usr))
return FALSE

usr.set_interaction(src)

switch(href_list["operation"])
if ("brute_damage_organ")
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/carbon/human/human_attackhand.dm
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@
return held_weapon.afterattack(target,src)

var/disarm_chance = rand(1, 100)
var/attacker_skill_level = attacking_mob.skills ? skills.get_skill_level(SKILL_CQC) : SKILL_CQC_MAX // No skills, so assume max
var/attacker_skill_level = skills && attacking_mob.skills ? skills.get_skill_level(SKILL_CQC) : SKILL_CQC_MAX // No skills, so assume max
var/defender_skill_level = skills ? skills.get_skill_level(SKILL_CQC) : SKILL_CQC_MAX // No skills, so assume max
disarm_chance -= 5 * attacker_skill_level
disarm_chance += 5 * defender_skill_level
Expand Down

0 comments on commit fcef7ad

Please sign in to comment.