Skip to content

Commit

Permalink
attachment obliteration (#4217)
Browse files Browse the repository at this point in the history
# About the pull request

<!-- 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.
-->
fixes #4194 
Fixes weird behaviour with underbarrel fire extinguisher being able to
be used one handed on some weapons but not on others

All attachable weapons will now require you to hold them with both hands
in order to be used. (( added an exception flag for future attachies
that may need it))

standarized error message you receive when you are not wielding an
attachment.

# Explain why it's good for the game
realism and standarized behaviour for all attachments 

# 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:
balance: Masterkey and underbarrel extinguisher now must be wielded in
order to be used.
fix: Underbarrel extinguisher no longer bypass wielding restrictions on
flamers.
/:cl:
  • Loading branch information
Diegoflores31 committed Aug 25, 2023
1 parent e3fc4ff commit 7051fa8
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
2 changes: 2 additions & 0 deletions code/__DEFINES/conflict.dm
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@
#define ATTACH_IGNORE_EMPTY (1<<5)
/// This attachment should activate if you attack() with it attached.
#define ATTACH_MELEE (1<<6)
/// Override for attachies so you can fire them with a single hand . ONLY FOR PROJECTILES!!
#define ATTACH_WIELD_OVERRIDE (1<<7)

//Ammo magazine defines, for flags_magazine

Expand Down
17 changes: 10 additions & 7 deletions code/modules/projectiles/gun.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1343,11 +1343,10 @@ and you're good to go.

//The following relating to bursts was borrowed from Fire code.
var/check_for_attachment_fire = FALSE
if(active_attachable)
if(active_attachable.flags_attach_features & ATTACH_PROJECTILE)
check_for_attachment_fire = TRUE
else
active_attachable.activate_attachment(src, null, TRUE)//No way.
if(active_attachable?.flags_attach_features & ATTACH_PROJECTILE)
check_for_attachment_fire = TRUE
else
active_attachable.activate_attachment(src, null, TRUE)//No way.


var/bullets_to_fire = 1
Expand Down Expand Up @@ -1512,8 +1511,12 @@ not all weapons use normal magazines etc. load_into_chamber() itself is designed
if(flags_gun_features & GUN_TRIGGER_SAFETY)
to_chat(user, SPAN_WARNING("The safety is on!"))
return

if((flags_gun_features & GUN_WIELDED_FIRING_ONLY) && !(flags_item & WIELDED)) //If we're not holding the weapon with both hands when we should.
if(active_attachable)
if(active_attachable.flags_attach_features & ATTACH_PROJECTILE)
if(!(active_attachable.flags_attach_features & ATTACH_WIELD_OVERRIDE) && !(flags_item & WIELDED))
to_chat(user, SPAN_WARNING("You must wield [src] to fire [active_attachable]!"))
return
if((flags_gun_features & GUN_WIELDED_FIRING_ONLY) && !(flags_item & WIELDED) && !active_attachable) //If we're not holding the weapon with both hands when we should.
to_chat(user, SPAN_WARNING("You need a more secure grip to fire this weapon!"))
return

Expand Down
7 changes: 5 additions & 2 deletions code/modules/projectiles/gun_attachables.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2363,7 +2363,7 @@ Defined in conflicts.dm of the #defines folder.
var/obj/item/weapon/gun/attached_gun = loc

if(!(attached_gun.flags_item & WIELDED))
to_chat(user, SPAN_WARNING("You must wield \the [attached_gun] to fire \the [src]!"))
to_chat(user, SPAN_WARNING("You must wield [attached_gun] to fire [src]!"))
return

if(current_rounds > round_usage_per_tile && ..())
Expand Down Expand Up @@ -2509,6 +2509,9 @@ Defined in conflicts.dm of the #defines folder.
/obj/item/attachable/attached_gun/extinguisher/fire_attachment(atom/target, obj/item/weapon/gun/gun, mob/living/user)
if(!internal_extinguisher)
return
if(!(gun.flags_item & WIELDED))
to_chat(user, SPAN_WARNING("You must wield [gun] to fire [src]!"))
return
if(..())
return internal_extinguisher.afterattack(target, user)

Expand Down Expand Up @@ -2569,7 +2572,7 @@ Defined in conflicts.dm of the #defines folder.
return

if((gun.flags_gun_features & GUN_WIELDED_FIRING_ONLY) && !(gun.flags_item & WIELDED))
to_chat(user, SPAN_WARNING("You need a more secure grip to fire this weapon!"))
to_chat(user, SPAN_WARNING("You must wield [gun] to fire [src]!"))
return

if(gun.flags_gun_features & GUN_TRIGGER_SAFETY)
Expand Down

0 comments on commit 7051fa8

Please sign in to comment.