From b9afbeb6748b9056cc01d03009acaf103bdcecac Mon Sep 17 00:00:00 2001 From: Matt Atlas Date: Sun, 31 Aug 2025 00:11:46 +0200 Subject: [PATCH] Fixes energy shields and energy swords blocking everything regardless of block chance. (#21278) 1. When a human is hit by a bullet, check_shields() is called. If a value different from BULLET_ACT_HIT is returned, the shield will void the bullet. 2. In turn, check_shield() calls handle_shield() on the held shield. 3. whoever coded this shit forgot to add a default return value so the held shield returns null when it fails to block meaning that the game voids the bullet lol Co-authored-by: Matt Atlas --- .../objects/items/weapons/melee/energy.dm | 2 + code/game/objects/items/weapons/shields.dm | 3 +- html/changelogs/mattatlas-eshields.yml | 58 +++++++++++++++++++ 3 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 html/changelogs/mattatlas-eshields.yml diff --git a/code/game/objects/items/weapons/melee/energy.dm b/code/game/objects/items/weapons/melee/energy.dm index bde61b2be01..35b27235b08 100644 --- a/code/game/objects/items/weapons/melee/energy.dm +++ b/code/game/objects/items/weapons/melee/energy.dm @@ -118,6 +118,8 @@ if(prob(reflectchance)) user.visible_message(SPAN_DANGER("\The [user] blocks [attack_text] with \the [src]!")) return BULLET_ACT_BLOCK + else + return BULLET_ACT_HIT /obj/item/melee/energy/get_print_info() . = ..() diff --git a/code/game/objects/items/weapons/shields.dm b/code/game/objects/items/weapons/shields.dm index 8d5b72e6a95..10e0e440130 100644 --- a/code/game/objects/items/weapons/shields.dm +++ b/code/game/objects/items/weapons/shields.dm @@ -221,7 +221,8 @@ else user.visible_message(SPAN_DANGER("\The [user] blocks [attack_text] with \the [src]!")) return BULLET_ACT_BLOCK - + else + return BULLET_ACT_HIT /obj/item/shield/energy/get_block_chance(mob/user, damage, atom/damage_source = null, mob/attacker = null) if(isprojectile(damage_source)) diff --git a/html/changelogs/mattatlas-eshields.yml b/html/changelogs/mattatlas-eshields.yml new file mode 100644 index 00000000000..5a7ac30d7f8 --- /dev/null +++ b/html/changelogs/mattatlas-eshields.yml @@ -0,0 +1,58 @@ +################################ +# Example Changelog File +# +# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb. +# +# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.) +# When it is, any changes listed below will disappear. +# +# Valid Prefixes: +# bugfix +# - (fixes bugs) +# wip +# - (work in progress) +# qol +# - (quality of life) +# soundadd +# - (adds a sound) +# sounddel +# - (removes a sound) +# rscadd +# - (adds a feature) +# rscdel +# - (removes a feature) +# imageadd +# - (adds an image or sprite) +# imagedel +# - (removes an image or sprite) +# spellcheck +# - (fixes spelling or grammar) +# experiment +# - (experimental change) +# balance +# - (balance changes) +# code_imp +# - (misc internal code change) +# refactor +# - (refactors code) +# config +# - (makes a change to the config files) +# admin +# - (makes changes to administrator tools) +# server +# - (miscellaneous changes to server) +################################# + +# Your name. +author: MattAtlas + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, this gets changed to [] after reading. Just remove the brackets when you add new shit. +# Please surround your changes in double quotes ("). It works without them, but if you use certain characters it screws up compiling. The quotes will not show up in the changelog. +changes: + - bugfix: "Fixes energy shields and energy swords blocking everything regardless of block chance."