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

Shield on Backpack Slot Blocks Attacks & Blocking Issues #68

Open
EmilitiaEnnehrt opened this issue Aug 27, 2024 · 4 comments
Open

Shield on Backpack Slot Blocks Attacks & Blocking Issues #68

EmilitiaEnnehrt opened this issue Aug 27, 2024 · 4 comments
Labels
Bug Something isn't working

Comments

@EmilitiaEnnehrt
Copy link

Backpack Shield Blocks Attacks

As the title says. Many shields can be carried with you outside of your hand by putting it in the backpack slot. However, it still function somehow regardless of the direction it is facine (your face against attack and away from attack). So that it does not need to be carried on hand.

Funnily enough finding this because my character blocked the Church sceptor healing shots by stardustfox with the Church's shield on the character's back.

Behavior replicated and have been semi-known in Sojourn.

Additionally; Shields do not seem to block the following attacks;

  • Spiders will still inject spiderlings even if the attack was blocked. (confirmed present)
  • Mobs that deal cellular damage will still deal cellular damage, even if the attack was blocked. (confirmed present)
@SigDoesCode
Copy link

SigDoesCode commented Sep 1, 2024

Ok, let's look into this a bit. Shield directional checks are handled here.

Lines 159-163 are the ones that handle hits on the back. They are given below:

if(user.get_equipped_item(slot_back) == src)
	if(attack_dir & bad_arc && attack_dir)
		return TRUE
	else
		return FALSE

Here, attack_dir is a directional value depending on the direction of the attack and bad_arc is the directional value where attacks can't be blocked (think the opposite side the shield is held on).

bad_arc is defined a few lines above, on line 98, and is literally the shield user's direction but reversed. That's why we check if the attack direction is from the bad arc while using the shield. Theoretically, all we'd have to do is first check if the attack is coming from the user's facing direction, like so (thought this could probably be cleaned up in testing):

if(user.get_equipped_item(slot_back) == src)
        if(attack_dir == user.dir)
                return FALSE
	if(attack_dir & bad_arc && attack_dir)
		return TRUE
	else
		return FALSE

Regarding the last two, I think that's because of the order of attack effects applied.

The nurse spiders always have an egg inject chance because of the way the proc is written:

/mob/living/carbon/superior_animal/giant_spider/nurse/UnarmedAttack()
	..()
	var/atom/targetted_mob = (target_mob?.resolve())
	if(ishuman(targetted_mob))
		var/mob/living/carbon/human/H = targetted_mob
		if(prob(egg_inject_chance))
			var/obj/item/organ/external/O = safepick(H.organs)
			if(O && !BP_IS_ROBOTIC(O))
				src.visible_message(SPAN_DANGER("[src] injects something into the [O] of [H]!"))
				var/obj/effect/spider/eggcluster/minor/S = new()
				S.loc = O
				O.implants += S

(From Line139-152 of /code/modules/mob/living/carbon/superior_animal/giant_spider/nurse.dm.

Basically, this means that regardless of damage checks, an egg can be injected. All we'd need to do in there is add a check on the if(prob(egg_inject_chance)) to be an AND check with if the attack wasn't blocked by the shield. For example, turning it into if(prob(egg_inject_chance) && !check_shields(src, damage, damage_source, attacker, def_zone, attack_text)) (Not perfect, just a guess.)

I assume that cellular damage is similar.

@SigDoesCode SigDoesCode added the Bug Something isn't working label Sep 1, 2024
@EmilitiaEnnehrt
Copy link
Author

Making one more comment. Trilby says that this isn't supposed to happen, that prior testing was not giving these results and I haven't had more time to test.

Perhaps look at if this is only affected by "pierce through" projectiles from any direction (full negate) like xray if unable to replicate.

@SigDoesCode
Copy link

Do you remember what message you got when you were hit and the shield supposedly blocked the bullet?

@EmilitiaEnnehrt
Copy link
Author

It's a standard "shield negates x"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants