Skip to content

Commit

Permalink
Merge branch 'shieldbash-for-everyone'
Browse files Browse the repository at this point in the history
  • Loading branch information
Singul0 committed Mar 7, 2024
2 parents 532852d + c35a590 commit 0cf9037
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions code/game/objects/items/shields.dm
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
var/shield_break_sound = 'sound/effects/bang.ogg'
/// baton bash cooldown
COOLDOWN_DECLARE(baton_bash)
/// is shield bashable?
var/is_bashable = TRUE

/datum/armor/item_shield
melee = 50
Expand Down Expand Up @@ -61,6 +63,16 @@
if(0 to 25)
. += span_warning("It's falling apart!")

/obj/item/shield/attackby(obj/item/attackby_item, mob/user, params)
. = ..()
if(istype(attackby_item, /obj/item/melee/baton) && is_bashable)
if(!COOLDOWN_FINISHED(src, baton_bash))
return
user.visible_message(span_warning("[user] bashes [src] with [attackby_item]!"))
playsound(user.loc, 'sound/effects/shieldbash.ogg', 50, TRUE)
COOLDOWN_START(src, baton_bash, BATON_BASH_COOLDOWN)
return

/obj/item/shield/proc/on_shield_block(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", damage = 0, attack_type = MELEE_ATTACK, damage_type = BRUTE)
if(!breakable_by_damage || (damage_type != BRUTE && damage_type != BURN))
return TRUE
Expand Down Expand Up @@ -142,13 +154,6 @@
)

/obj/item/shield/riot/attackby(obj/item/attackby_item, mob/user, params)
if(istype(attackby_item, /obj/item/melee/baton))
if(!COOLDOWN_FINISHED(src, baton_bash))
return
user.visible_message(span_warning("[user] bashes [src] with [attackby_item]!"))
playsound(user.loc, 'sound/effects/shieldbash.ogg', 50, TRUE)
COOLDOWN_START(src, baton_bash, BATON_BASH_COOLDOWN)
return
if(istype(attackby_item, /obj/item/stack/sheet/mineral/titanium))
if (atom_integrity >= max_integrity)
to_chat(user, span_warning("[src] is already in perfect condition."))
Expand Down Expand Up @@ -276,6 +281,7 @@
throw_speed = 3
breakable_by_damage = FALSE
block_sound = 'sound/weapons/block_blade.ogg'
is_bashable = FALSE
/// Force of the shield when active.
var/active_force = 10
/// Throwforce of the shield when active.
Expand Down Expand Up @@ -324,6 +330,7 @@
if(user)
balloon_alert(user, active ? "activated" : "deactivated")
playsound(src, active ? 'sound/weapons/saberon.ogg' : 'sound/weapons/saberoff.ogg', 35, TRUE)
is_bashable = !is_bashable
return COMPONENT_NO_DEFAULT_MESSAGE

/obj/item/shield/energy/proc/can_disarm_attack(datum/source, mob/living/victim, mob/living/user, send_message = TRUE)
Expand Down

0 comments on commit 0cf9037

Please sign in to comment.