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

Adds Combat mode, rclick functionality #11899

Merged
merged 151 commits into from
Feb 14, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
151 commits
Select commit Hold shift + click to select a range
cbec6f1
butchering fix
Tsar-Salat Nov 16, 2024
2060480
INITIAL DONE!
Tsar-Salat Nov 17, 2024
7a14abb
alt
Tsar-Salat Nov 17, 2024
0b9a4a6
renaming, add suit sensor interaction
Tsar-Salat Nov 17, 2024
4b4afa5
preattacksecondary
Tsar-Salat Nov 17, 2024
29f1ba5
attackhandsecondary
Tsar-Salat Nov 17, 2024
32930a8
fix pre_attack
Tsar-Salat Nov 17, 2024
bfc4fca
lazy access modifiers and ninja dash
Tsar-Salat Nov 17, 2024
c7c1c8f
secondary tool acts
Tsar-Salat Nov 17, 2024
aad7c4f
drones without drones (big toolact refactor)
Tsar-Salat Nov 17, 2024
8fdedee
right click reagent containers
Tsar-Salat Nov 17, 2024
3ec143c
redo rightclick priority
Tsar-Salat Nov 17, 2024
5901aa7
final touches on attack chain
Tsar-Salat Nov 17, 2024
1c70d7e
airlock welding rclick
Tsar-Salat Nov 17, 2024
5ea8731
reagent container unit test
Tsar-Salat Nov 17, 2024
dd8a87e
rightclick bottles
Tsar-Salat Nov 17, 2024
88d5c9b
ranged attack secondary
Tsar-Salat Nov 17, 2024
9042b6d
rcd rclick
Tsar-Salat Nov 17, 2024
a17ddd5
Merge remote-tracking branch 'BeeStation/master' into combatmodetake5
Tsar-Salat Nov 17, 2024
c42712d
medical rclick
Tsar-Salat Nov 17, 2024
d450efe
syringe rclick
Tsar-Salat Nov 17, 2024
7ecb99c
crowbar
Tsar-Salat Nov 17, 2024
f01c9bd
ctrlclick
Tsar-Salat Nov 17, 2024
886d61d
washing machine
Tsar-Salat Nov 17, 2024
69ac599
stack splitting rclick
Tsar-Salat Nov 17, 2024
5bc698e
fix ai attacks
Tsar-Salat Nov 17, 2024
2c1bb01
floortile airlock interaction
Tsar-Salat Nov 17, 2024
3fe51a3
fix borg hug
Tsar-Salat Nov 17, 2024
eef0cee
hook shotgun rclick(buff)
Tsar-Salat Nov 17, 2024
4cac0d2
rpd rclick
Tsar-Salat Nov 17, 2024
8261dc0
Revert "rpd rclick"
Tsar-Salat Nov 17, 2024
9fca848
window rclick
Tsar-Salat Nov 17, 2024
9819cd7
closet lock rclick
Tsar-Salat Nov 17, 2024
78a3709
microwave and circuit rclick
Tsar-Salat Nov 17, 2024
75bbe09
fix rclick storage stuff
Tsar-Salat Nov 17, 2024
8e5f61b
I swore I did this already lmao
Tsar-Salat Nov 17, 2024
4c91741
fix locker secndary. Again.
Tsar-Salat Nov 17, 2024
7d94da7
fixes monkeycode
Tsar-Salat Nov 17, 2024
e1d71e4
autolathe screwdriver rclick
Tsar-Salat Nov 17, 2024
0b2f6f7
space heater rclick
Tsar-Salat Nov 17, 2024
d278dba
girder construction rclick
Tsar-Salat Nov 17, 2024
4edaa7f
rclick wrench deconstruct
Tsar-Salat Nov 17, 2024
e404a8d
simplerotation lmb rmb
Tsar-Salat Nov 17, 2024
398ed14
wrench closets
Tsar-Salat Nov 17, 2024
38a4aef
kinetic crusher rclick
Tsar-Salat Nov 17, 2024
ea27114
fixes abandoned crates
Tsar-Salat Nov 17, 2024
71d3842
chem machine rclick
Tsar-Salat Nov 17, 2024
0b5e12a
ladders lmb rmb
Tsar-Salat Nov 17, 2024
c25c7df
cleanup clickon.
Tsar-Salat Nov 17, 2024
c28af9f
fixes
Tsar-Salat Nov 18, 2024
86c6b46
invert handcuff?
Tsar-Salat Nov 18, 2024
dedd64d
try this instead
Tsar-Salat Nov 18, 2024
378db70
variable weapon attack speed
Tsar-Salat Nov 18, 2024
de87409
guh
Tsar-Salat Nov 18, 2024
0874894
TGUI THIS SHIRT
Tsar-Salat Nov 18, 2024
eec1347
oops
Tsar-Salat Nov 18, 2024
7468c0b
Merge remote-tracking branch 'BeeStation/master' into combatmodetake5
Tsar-Salat Nov 18, 2024
96ca108
Merge remote-tracking branch 'BeeStation/master' into combatmodetake5
Tsar-Salat Nov 20, 2024
6e48064
misc fixes
Tsar-Salat Nov 23, 2024
1a5ff9d
add keybind
Tsar-Salat Nov 23, 2024
b7583a2
add custom cursors + shiftclick magnifier
Tsar-Salat Nov 23, 2024
05c6fdb
fix right click not updated
Tsar-Salat Nov 25, 2024
cde8681
Merge remote-tracking branch 'BeeStation/master' into combatmodetake5
Tsar-Salat Nov 28, 2024
a723eaa
Merge remote-tracking branch 'BeeStation/master' into combatmodetake5
Tsar-Salat Nov 30, 2024
95fb48a
fix modkit
Tsar-Salat Nov 30, 2024
13b4560
rclick modkits
Tsar-Salat Nov 30, 2024
563732b
minebots and cyborgs are still a little effed, this should work
Tsar-Salat Nov 30, 2024
e4436c4
fix
Tsar-Salat Dec 1, 2024
e14d601
wiremod adjustments
Tsar-Salat Dec 3, 2024
85d9e91
combat unit test
Tsar-Salat Dec 3, 2024
e2d8ab5
drop items
Tsar-Salat Dec 3, 2024
ed24bcb
Merge remote-tracking branch 'BeeStation/master' into combatmodetake5
Tsar-Salat Dec 8, 2024
b02352c
Merge remote-tracking branch 'BeeStation/master' into combatmodetake5
Tsar-Salat Jan 8, 2025
3d8f581
herrm
Tsar-Salat Jan 8, 2025
53941b1
Merge remote-tracking branch 'BeeStation/master' into combatmodetake5
Tsar-Salat Jan 19, 2025
b151fa6
CQC text fix
Tsar-Salat Jan 19, 2025
f201655
grab fixes (for humans)
Tsar-Salat Jan 20, 2025
779e998
monkeys dont hate you anymore
Tsar-Salat Jan 20, 2025
75e83d7
moving to grip code
Tsar-Salat Jan 20, 2025
cd6aebe
MARTIAL ARTS CODE IS ASSS
Tsar-Salat Jan 20, 2025
da99bc8
ctrl and more martials
Tsar-Salat Jan 20, 2025
a572d35
atomized CanUseTopic() refactor
Tsar-Salat Jan 20, 2025
1037c3c
cqc and sleeping carp
Tsar-Salat Jan 20, 2025
4573fbd
martial cleanup
Tsar-Salat Jan 20, 2025
d26f3ca
plasmafist
Tsar-Salat Jan 20, 2025
aafff88
Monkey Martial Arts
Tsar-Salat Jan 20, 2025
6bfabee
combo meter
Tsar-Salat Jan 20, 2025
7f3d07e
chisel it into stone
Tsar-Salat Jan 20, 2025
455e91a
fixes generic huds
Tsar-Salat Jan 20, 2025
9266ef8
ctrlclick fix
Tsar-Salat Jan 21, 2025
b6e2f27
pacifism martial arts
Tsar-Salat Jan 21, 2025
ca49575
cqc knockouts
Tsar-Salat Jan 21, 2025
ed730a5
make the combo menu show up for monkeys
Tsar-Salat Jan 21, 2025
82ed204
Merge remote-tracking branch 'BeeStation/master' into combatmodeatomi…
Tsar-Salat Jan 23, 2025
0a99fcb
Merge remote-tracking branch 'BeeStation/master' into martial-artspain
Tsar-Salat Jan 23, 2025
df5e3dc
.
Tsar-Salat Jan 23, 2025
951e3b7
Merge remote-tracking branch 'BeeStation/master' into martial-artspain
Tsar-Salat Jan 29, 2025
fae9a16
remove conflict
Tsar-Salat Jan 30, 2025
c1621ce
Merge remote-tracking branch 'BeeStation/master' into combatmodeatomi…
Tsar-Salat Jan 31, 2025
7ab4266
.
Tsar-Salat Jan 31, 2025
8864cbb
Merge remote-tracking branch 'BeeStation/master' into combatmodetake5
Tsar-Salat Feb 1, 2025
50aa7e1
Merge remote-tracking branch 'BeeStation/master' into martial-artspain
Tsar-Salat Feb 1, 2025
38a8fce
Merge branch 'martial-artspain' into combatmodetake5
Tsar-Salat Feb 1, 2025
105fad6
.
Tsar-Salat Feb 1, 2025
d387725
Merge remote-tracking branch 'BeeStation/master' into combatmodeatomi…
Tsar-Salat Feb 1, 2025
a1bd2b1
Merge branch 'combatmodeatomization-canusetopic' into combatmodetake5
Tsar-Salat Feb 1, 2025
ea2a05b
fix attack chain bug
Tsar-Salat Feb 1, 2025
304d19f
grrrr
Tsar-Salat Feb 1, 2025
bbc1130
Merge remote-tracking branch 'BeeStation/master' into combatmodetake5
Tsar-Salat Feb 1, 2025
547d170
trigger flags (not my issue)
Tsar-Salat Feb 1, 2025
c03a27c
fix combat mode toggle pref, firelocks
Tsar-Salat Feb 2, 2025
92c34cb
fix cyborg huds & throat slicing
Tsar-Salat Feb 2, 2025
af1d9be
fix stack splitting and health analyzer modes
Tsar-Salat Feb 3, 2025
7251f6e
move grabbing to carbon level
Tsar-Salat Feb 3, 2025
594ffa4
martial arts menu
Tsar-Salat Feb 4, 2025
f62f664
fix martial arts formatting
Tsar-Salat Feb 4, 2025
fda2d67
fix
Tsar-Salat Feb 4, 2025
4b6a378
move firedoor welding to rclick
Tsar-Salat Feb 4, 2025
d6cf144
fix cyborg action
Tsar-Salat Feb 5, 2025
41ba950
fix martials, again
Tsar-Salat Feb 5, 2025
3ba7b64
airlock icon update hotfix
Tsar-Salat Feb 5, 2025
2db2356
open na noor... open na noor!!!11!
Tsar-Salat Feb 5, 2025
a92bd7e
fix camera actions
Tsar-Salat Feb 5, 2025
32da1e3
Merge remote-tracking branch 'BeeStation/master' into combatmodetake5
Tsar-Salat Feb 6, 2025
307e120
fix piggybacking
Tsar-Salat Feb 6, 2025
f8dc9e0
fixes the combo once and for all
Tsar-Salat Feb 6, 2025
9e1359c
tribal claw combos
Tsar-Salat Feb 6, 2025
62b4f50
we all pass list modifiers. Always.
Tsar-Salat Feb 6, 2025
8cc294a
firealarm cleanup
Tsar-Salat Feb 7, 2025
a7faef1
fix supplypod launcher
Tsar-Salat Feb 8, 2025
5c65f42
Merge remote-tracking branch 'BeeStation/master' into combatmodetake5
Tsar-Salat Feb 8, 2025
69a35d6
Fixes ghosts needing to shift click
PowerfulBacon Feb 9, 2025
97df251
Merge branch 'master' into combatmodetake5
PowerfulBacon Feb 9, 2025
1fed9ed
rclick food storage
Tsar-Salat Feb 9, 2025
83be763
fix some mergeskewed huds
Tsar-Salat Feb 10, 2025
716ef7d
fix chem dispenser wrench act
Tsar-Salat Feb 11, 2025
e5ca146
fix heretic spells, adds support to rclick spells, makes mansus use r…
Tsar-Salat Feb 12, 2025
767bc76
fix bad attack chain, genericize crowbar-likes into actual crowbars, …
Tsar-Salat Feb 12, 2025
dc50fee
I like neckslicing
Tsar-Salat Feb 12, 2025
7c5a83d
hidden runechat fix
Tsar-Salat Feb 12, 2025
bc5c16a
work on zombies
Tsar-Salat Feb 12, 2025
f010e30
hm
Tsar-Salat Feb 12, 2025
9b18ace
Merge remote-tracking branch 'BeeStation/master' into combatmodetake5
Tsar-Salat Feb 12, 2025
b20d6c8
macro
Tsar-Salat Feb 12, 2025
e218e53
aggrograb
Tsar-Salat Feb 12, 2025
656f362
Merge remote-tracking branch 'BeeStation/master' into combatmodetake5
Tsar-Salat Feb 13, 2025
c272044
stunbaton cleanup, move stunshove to rclick
Tsar-Salat Feb 14, 2025
3b51651
fix your goddamn params, proc_holders!
Tsar-Salat Feb 14, 2025
be28b2b
mapedit
Tsar-Salat Feb 14, 2025
b906b34
tool_act fixes
Tsar-Salat Feb 14, 2025
64978af
Merge remote-tracking branch 'BeeStation/master' into combatmodetake5
Tsar-Salat Feb 14, 2025
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
Prev Previous commit
Next Next commit
syringe rclick
  • Loading branch information
Tsar-Salat committed Nov 17, 2024
commit d450efe568252d2bfe1b0d5a0f1fa341580f272f
1 change: 1 addition & 0 deletions beestation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@
#include "code\__DEFINES\html_assistant.dm"
#include "code\__DEFINES\hud.dm"
#include "code\__DEFINES\icon_smoothing.dm"
#include "code\__DEFINES\injection.dm"
#include "code\__DEFINES\important_recursive_contents.dm"
#include "code\__DEFINES\instruments.dm"
#include "code\__DEFINES\interaction_flags.dm"
Expand Down
8 changes: 8 additions & 0 deletions code/__DEFINES/injection.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/// This injection can penetrate through thick clothing.
#define INJECT_CHECK_PENETRATE_THICK (1 << 0)

/// This injection bypasses species specific restrictions.
#define INJECT_CHECK_IGNORE_SPECIES (1 << 1)

/// When trying this injection, show an error message if it fails.
#define INJECT_TRY_SHOW_ERROR_MESSAGE (1 << 2)
2 changes: 1 addition & 1 deletion code/_onclick/item_attack.dm
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
attackby_result = target.attackby(src, user, params)
if (SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN)
return TRUE
if (SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN)
if (SECONDARY_ATTACK_CONTINUE_CHAIN)
// Normal behavior
else
CRASH("attackby_secondary must return an SECONDARY_ATTACK_* define, please consult code/__DEFINES/combat.dm")
Expand Down
4 changes: 2 additions & 2 deletions code/datums/components/embedded.dm
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@

if(ishuman(victim)) // check to see if the limb is actually exposed
var/mob/living/carbon/human/victim_human = victim
if(!victim_human.can_inject(user, TRUE, limb.body_zone, penetrate_thick = FALSE))
if(!victim_human.try_inject(user, limb.body_zone, INJECT_CHECK_IGNORE_SPECIES | INJECT_TRY_SHOW_ERROR_MESSAGE))
return TRUE

if(weapon.w_class <= WEIGHT_CLASS_SMALL)
Expand Down Expand Up @@ -282,7 +282,7 @@

if(ishuman(victim)) // check to see if the limb is actually exposed
var/mob/living/carbon/human/victim_human = victim
if(!victim_human.can_inject(user, TRUE, limb.body_zone, penetrate_thick = FALSE))
if(!victim_human.try_inject(user, limb.body_zone, INJECT_CHECK_IGNORE_SPECIES | INJECT_TRY_SHOW_ERROR_MESSAGE))
return TRUE

INVOKE_ASYNC(src, PROC_REF(pluckOut), user, damage_multiplier, max(damage_multiplier, 0.2), remove_verb)
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/devices/scanners.dm
Original file line number Diff line number Diff line change
Expand Up @@ -505,8 +505,8 @@ GENE SCANNER
if(user.incapacitated())
return

var/message = list()
if(istype(M) && M.reagents)
var/message = list()
if(M.reagents.reagent_list.len)
message += "<span class='notice'>Subject contains the following reagents:</span>"
for(var/datum/reagent/R in M.reagents.reagent_list)
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/dna_injector.dm
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
if(used)
to_chat(user, "<span class='warning'>This injector is used up!</span>")
return
if(!target.can_inject(user, TRUE))
if(!target.try_inject(user, injection_flags = INJECT_TRY_SHOW_ERROR_MESSAGE))
return
log_combat(user, target, "attempted to inject", src)

Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/stacks/medical.dm
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ CREATION_TEST_IGNORE_SUBTYPES(/obj/item/stack/medical)
reagents.add_reagent_list(reagent)

/obj/item/stack/medical/attack(mob/living/M, mob/user)
if(!M || !user || (isliving(M) && !M.can_inject(user, TRUE))) //If no mob, user and if we can't inject the mob just return
if(!M || !user || (isliving(M) && !M.try_inject(user, injection_flags = INJECT_TRY_SHOW_ERROR_MESSAGE))) //If no mob, user and if we can't inject the mob just return
return

if(M.stat == DEAD && !stop_bleeding)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/holoparasite/holoparasite_damage.dm
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@
/**
* Holoparasites are NOT physically soft like flesh.
*/
/mob/living/simple_animal/hostile/holoparasite/can_inject(mob/user, error_msg, target_zone, penetrate_thick = FALSE)
/mob/living/simple_animal/hostile/holoparasite/can_inject(mob/user, target_zone, injection_flags)
return FALSE

/mob/living/simple_animal/hostile/holoparasite/ex_act(severity, target)
Expand Down
14 changes: 6 additions & 8 deletions code/modules/hydroponics/hydroponics.dm
Original file line number Diff line number Diff line change
Expand Up @@ -715,12 +715,6 @@
if(IS_EDIBLE(O) || istype(O, /obj/item/reagent_containers)) // Syringe stuff (and other reagent containers now too)
var/obj/item/reagent_containers/reagent_source = O

if(istype(reagent_source, /obj/item/reagent_containers/syringe))
var/obj/item/reagent_containers/syringe/syr = reagent_source
if(syr.mode != 1)
to_chat(user, "<span class='warning'>You can't get any extract out of this plant.</span>")
return

if(!reagent_source.reagents.total_volume)
to_chat(user, "<span class='notice'>[reagent_source] is empty.</span>")
return 1
Expand All @@ -740,8 +734,6 @@
if(istype(reagent_source, /obj/item/reagent_containers/syringe/))
var/obj/item/reagent_containers/syringe/syr = reagent_source
visi_msg="[user] injects [target] with [syr]"
if(syr.reagents.total_volume <= syr.amount_per_transfer_from_this)
syr.mode = 0
else if(istype(reagent_source, /obj/item/reagent_containers/spray/))
visi_msg="[user] sprays [target] with [reagent_source]"
playsound(loc, 'sound/effects/spray3.ogg', 50, 1, -6)
Expand Down Expand Up @@ -867,6 +859,12 @@
else
return ..()

/obj/machinery/hydroponics/attackby_secondary(obj/item/weapon, mob/user, params)
if (istype(weapon, /obj/item/reagent_containers/syringe))
to_chat(user, "<span class='warning'>You can't get any extract out of this plant.</span>")
return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN
return SECONDARY_ATTACK_CALL_NORMAL

/obj/machinery/hydroponics/can_be_unfasten_wrench(mob/user, silent)
if (!unwrenchable) // case also covered by NODECONSTRUCT checks in default_unfasten_wrench
return CANT_UNFASTEN
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/carbon/alien/humanoid/queen.dm
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
var/alt_inhands_file = 'icons/mob/alienqueen.dmi'
var/game_end_timer

/mob/living/carbon/alien/humanoid/royal/can_inject(mob/user, error_msg, target_zone, penetrate_thick = FALSE)
/mob/living/carbon/alien/humanoid/royal/can_inject(mob/user, target_zone, injection_flags)
return FALSE

/mob/living/carbon/alien/humanoid/royal/queen/proc/maidify()
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/carbon/carbon_defense.dm
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@

/mob/living/carbon/attack_paw(mob/living/carbon/human/M, modifiers)

if(can_inject(M, TRUE))
if(try_inject(M, injection_flags = INJECT_TRY_SHOW_ERROR_MESSAGE))
for(var/thing in diseases)
var/datum/disease/D = thing
if((D.spread_flags & DISEASE_SPREAD_CONTACT_SKIN) && prob(85))
Expand Down
65 changes: 23 additions & 42 deletions code/modules/mob/living/carbon/human/human.dm
Original file line number Diff line number Diff line change
Expand Up @@ -413,49 +413,30 @@
/mob/living/carbon/human/proc/canUseHUD()
return (mobility_flags & MOBILITY_USE)

/mob/living/carbon/human/can_inject(mob/user, error_msg, target_zone, penetrate_thick = FALSE)
if(HAS_TRAIT(src, TRAIT_PIERCEIMMUNE))
return FALSE
if(penetrate_thick)
return TRUE
/mob/living/carbon/human/can_inject(mob/user, target_zone, injection_flags)
. = TRUE // Default to returning true.
if(user && !target_zone)
target_zone = user.get_combat_bodyzone()
// we may choose to ignore species trait pierce immunity in case we still want to check skellies for thick clothing without insta failing them (wounds)
if(injection_flags & INJECT_CHECK_IGNORE_SPECIES)
if(HAS_TRAIT_NOT_FROM(src, TRAIT_PIERCEIMMUNE, SPECIES_TRAIT))
. = FALSE
else if(HAS_TRAIT(src, TRAIT_PIERCEIMMUNE))
. = FALSE
var/obj/item/bodypart/the_part = get_bodypart(target_zone) || get_bodypart(BODY_ZONE_CHEST)
// Loop through the clothing covering this bodypart and see if there's any thiccmaterials
if(!(injection_flags & INJECT_CHECK_PENETRATE_THICK))
for(var/obj/item/clothing/iter_clothing in clothingonpart(the_part))
if(iter_clothing.clothing_flags & THICKMATERIAL)
. = FALSE
break

/mob/living/carbon/human/try_inject(mob/user, target_zone, injection_flags)
. = ..()
if(!. && (injection_flags & INJECT_TRY_SHOW_ERROR_MESSAGE) && user)
var/obj/item/bodypart/the_part = get_bodypart(target_zone) || get_bodypart(BODY_ZONE_CHEST)

if(!target_zone)
if(user)
target_zone = user.get_combat_bodyzone(src, FALSE, BODYZONE_CONTEXT_INJECTION)
else
target_zone = BODY_ZONE_CHEST
// If targeting the head, see if the head item is thin enough.
// If targeting anything else, see if the wear suit is thin enough.
if(above_neck(target_zone))
if(!head || !isclothing(head))
return TRUE
var/obj/item/clothing/head/CH = head
if(CH.clothing_flags & THICKMATERIAL)
balloon_alert(user, "There is no exposed flesh on [p_their()] head.")
return FALSE
return TRUE
if(!wear_suit || !isclothing(wear_suit))
return TRUE
var/obj/item/clothing/suit/CS = wear_suit
if(CS.clothing_flags & THICKMATERIAL)
switch(target_zone)
if(BODY_ZONE_CHEST)
if(CS.body_parts_covered & CHEST)
balloon_alert(user, "There is no exposed flesh on [p_their()] chest.")
return FALSE
if(BODY_ZONE_PRECISE_GROIN)
if(CS.body_parts_covered & GROIN)
balloon_alert(user, "There is no exposed flesh on [p_their()] groin.")
return FALSE
if(BODY_ZONE_L_ARM, BODY_ZONE_R_ARM)
if(CS.body_parts_covered & ARMS)
balloon_alert(user, "There is no exposed flesh on [p_their()] arms.")
return FALSE
if(BODY_ZONE_L_LEG, BODY_ZONE_R_LEG)
if(CS.body_parts_covered & LEGS)
balloon_alert(user, "There is no exposed flesh on [p_their()] legs.")
return FALSE
return TRUE
to_chat(user, "<span class='alert'>There is no exposed flesh or thin material on [p_their()] [the_part.name].</span>")

/mob/living/carbon/human/assess_threat(judgment_criteria, lasercolor = "", datum/callback/weaponcheck=null)
if(judgment_criteria & JUDGE_EMAGGED)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/carbon/human/human_defense.dm
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@
if(M.limb_destroyer)
dismembering_strike(M, affecting.body_zone)

if(can_inject(M, 1, affecting))//Thick suits can stop monkey bites.
if(try_inject(M, affecting, injection_flags = INJECT_TRY_SHOW_ERROR_MESSAGE))//Thick suits can stop monkey bites.
if(..()) //successful monkey bite, this handles disease contraction.
var/damage = rand(1, 3)
if(stat != DEAD)
Expand Down
24 changes: 22 additions & 2 deletions code/modules/mob/living/living.dm
Original file line number Diff line number Diff line change
Expand Up @@ -618,10 +618,30 @@
return TRUE
return FALSE

// Living mobs use can_inject() to make sure that the mob is not syringe-proof in general.
/mob/living/proc/can_inject(mob/user, error_msg, target_zone, penetrate_thick = FALSE)
/**
* Returns whether or not the mob can be injected. Should not perform any side effects.
*
* Arguments:
* * user - The user trying to inject the mob.
* * target_zone - The zone being targeted.
* * injection_flags - A bitflag for extra properties to check.
* Check __DEFINES/injection.dm for more details, specifically the ones prefixed INJECT_CHECK_*.
*/
/mob/living/proc/can_inject(mob/user, target_zone, injection_flags)
return TRUE

/**
* Like can_inject, but it can perform side effects.
*
* Arguments:
* * user - The user trying to inject the mob.
* * target_zone - The zone being targeted.
* * injection_flags - A bitflag for extra properties to check. Check __DEFINES/injection.dm for more details.
* Check __DEFINES/injection.dm for more details. Unlike can_inject, the INJECT_TRY_* defines will behave differently.
*/
/mob/living/proc/try_inject(mob/user, target_zone, injection_flags)
return can_inject(user, target_zone, injection_flags)

/mob/living/is_injectable(mob/user, allowmobs = TRUE)
return (allowmobs && reagents && can_inject(user))

Expand Down
9 changes: 6 additions & 3 deletions code/modules/mob/living/silicon/silicon.dm
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,14 @@
for(var/key in alarm_types_clear)
alarm_types_clear[key] = 0

/mob/living/silicon/can_inject(mob/user, error_msg, target_zone, penetrate_thick = FALSE)
if(error_msg)
to_chat(user, "<span class='alert'>[p_their(TRUE)] outer shell is too tough.</span>")
/mob/living/silicon/can_inject(mob/user, target_zone, injection_flags)
return FALSE

/mob/living/silicon/try_inject(mob/user, target_zone, injection_flags)
. = ..()
if(!. && (injection_flags & INJECT_TRY_SHOW_ERROR_MESSAGE))
to_chat(user, "<span class='alert'>[p_their(TRUE)] outer shell is too tough.</span>")

/mob/living/silicon/IsAdvancedToolUser()
return TRUE

Expand Down
2 changes: 1 addition & 1 deletion code/modules/paperwork/pen.dm
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@
return

if(!force)
if(M.can_inject(user, 1))
if(M.try_inject(user, injection_flags = INJECT_TRY_SHOW_ERROR_MESSAGE))
to_chat(user, "<span class='warning'>You stab [M] with the pen.</span>")
if(!stealth)
to_chat(M, "<span class='danger'>You feel a tiny prick!</span>")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
if(iscarbon(target))
var/mob/living/carbon/M = target
if(blocked != 100) // not completely blocked
if(M.can_inject(null, FALSE, def_zone) && !HAS_TRAIT(M, TRAIT_BEEFRIEND))
if(M.can_inject(target_zone = def_zone) && !HAS_TRAIT(M, TRAIT_BEEFRIEND))
var/mob/living/simple_animal/hostile/poison/bees/B = new(src.loc)
for(var/datum/reagent/R in reagents.reagent_list)
B.assign_reagent(GLOB.chemical_reagents_list[R.type])
Expand Down
2 changes: 1 addition & 1 deletion code/modules/projectiles/projectile/bullets/dnainjector.dm
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
if(iscarbon(target))
var/mob/living/carbon/M = target
if(blocked != 100)
if(M.can_inject(null, FALSE, def_zone, FALSE))
if(M.can_inject(target_zone = def_zone))
if(injector.inject(M, firer))
QDEL_NULL(injector)
return BULLET_ACT_HIT
Expand Down
2 changes: 1 addition & 1 deletion code/modules/reagents/reagent_containers/borghydro.dm
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ Borg Hypospray
return
if(!istype(M))
return
if(R.total_volume && M.can_inject(user, 1, user.get_combat_bodyzone(M, zone_context = BODYZONE_CONTEXT_INJECTION), bypass_protection))
if(R.total_volume && M.try_inject(user, user.get_combat_bodyzone(M, zone_context = BODYZONE_CONTEXT_INJECTION), injection_flags = INJECT_TRY_SHOW_ERROR_MESSAGE | (bypass_protection ? INJECT_CHECK_PENETRATE_THICK : 0)))
to_chat(M, "<span class='warning'>You feel a tiny prick!</span>")
to_chat(user, "<span class='notice'>You inject [M] with the injector.</span>")
var/fraction = min(amount_per_transfer_from_this/R.total_volume, 1)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/reagents/reagent_containers/hypospray.dm
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
var/contained = english_list(injected)
log_combat(user, M, "attempted to inject", src, "([contained])")

if(reagents.total_volume && (ignore_flags || M.can_inject(user, 1))) // Ignore flag should be checked first or there will be an error message.
if(reagents.total_volume && (ignore_flags || M.try_inject(user, injection_flags = INJECT_TRY_SHOW_ERROR_MESSAGE))) // Ignore flag should be checked first or there will be an error message.
to_chat(M, "<span class='warning'>You feel a tiny prick!</span>")
to_chat(user, "<span class='notice'>You inject [M] with [src].</span>")
playsound(loc, pick('sound/items/hypospray.ogg','sound/items/hypospray2.ogg'), 50, TRUE)
Expand Down
Loading