Skip to content

Commit

Permalink
Explosive barricade upgrade buff (cmss13-devs#3584)
Browse files Browse the repository at this point in the history
# About the pull request

Explosive barricade upgrade is renamed to composite upgrade, explosion
damage taken is now modified by 0.5 (was 0.75), added 0.5
anti-projectile modifier (brute barricade upgrade basically has 0.75).
Latest only applies to brute projectiles, so acid damage stays the same.
Also added 0.5 anti-fire modifier (acid barricade upgrade basically has
0.75 as well).

# Explain why it's good for the game

The explosive upgrade is almost never used because it is useless. This
is a very weak insurance in case of a very bad situation, like an
explosion inside the cades. Now it will be more like a dedicated anti-FF
upgrade, so smartgunners or flamethrowers, for example, won't be
grinding down cades so fast. Xenos won't be affected much because the
only brute projectile they have is bone shards and those are not used
much against cades.

# 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: ihatethisengine
balance: explosive barricade upgrade provides better protection against
explosions (25% to 50%)
balance: explosive barricade upgrade provides strong protection against
brute-based projectiles (50%)
balance: explosive barricade upgrade provides strong protection against
fire (50%)
/:cl:

---------

Co-authored-by: ihatethisengine <[email protected]>
  • Loading branch information
ihatethisengine and ihatethisengine authored Jun 27, 2023
1 parent 80aea06 commit e33aacf
Show file tree
Hide file tree
Showing 3 changed files with 120 additions and 108 deletions.
2 changes: 1 addition & 1 deletion code/__DEFINES/defenses.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// Defines for barricade upgrades
#define BARRICADE_UPGRADE_BURN "Biohazard Upgrade (+Burn)"
#define BARRICADE_UPGRADE_BRUTE "Reinforced Upgrade (+Brute)"
#define BARRICADE_UPGRADE_EXPLOSIVE "Explosive Upgrade (+Explosive)"
#define BARRICADE_UPGRADE_ANTIFF "Composite Upgrade (++Explosive, ++Projectile, ++Fire)"

// Defines for defense stats
#define DEFENSE_FUNCTIONAL 0
Expand Down
144 changes: 73 additions & 71 deletions code/game/objects/structures/barricade/barricade.dm
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
var/brute_multiplier = 1
var/burn_multiplier = 1
var/explosive_multiplier = 1
var/brute_projectile_multiplier = 1
var/burn_flame_multiplier = 1
var/repair_materials = list()
var/metallic = TRUE

Expand All @@ -42,12 +44,12 @@
addtimer(CALLBACK(src, PROC_REF(update_icon)), 0)
starting_maxhealth = maxhealth

/obj/structure/barricade/initialize_pass_flags(datum/pass_flags_container/PF)
/obj/structure/barricade/initialize_pass_flags(datum/pass_flags_container/pass_flags)
..()
if (PF)
PF.flags_can_pass_all = NONE
PF.flags_can_pass_front = NONE
PF.flags_can_pass_behind = PASS_OVER^(PASS_OVER_ACID_SPRAY|PASS_OVER_THROW_MOB)
if (pass_flags)
pass_flags.flags_can_pass_all = NONE
pass_flags.flags_can_pass_front = NONE
pass_flags.flags_can_pass_behind = PASS_OVER^(PASS_OVER_ACID_SPRAY|PASS_OVER_THROW_MOB)
flags_can_pass_front_temp = PASS_OVER_THROW_MOB
flags_can_pass_behind_temp = PASS_OVER_THROW_MOB

Expand Down Expand Up @@ -95,7 +97,7 @@
overlays += image('icons/obj/structures/barricades.dmi', icon_state = "+burn_upgrade_[damage_state]")
if(BARRICADE_UPGRADE_BRUTE)
overlays += image('icons/obj/structures/barricades.dmi', icon_state = "+brute_upgrade_[damage_state]")
if(BARRICADE_UPGRADE_EXPLOSIVE)
if(BARRICADE_UPGRADE_ANTIFF)
overlays += image('icons/obj/structures/barricades.dmi', icon_state = "+explosive_upgrade_[damage_state]")

if(is_wired)
Expand All @@ -106,34 +108,34 @@

..()

/obj/structure/barricade/hitby(atom/movable/AM)
if(AM.throwing && is_wired)
if(iscarbon(AM))
var/mob/living/carbon/C = AM
if(C.mob_size <= MOB_SIZE_XENO)
C.visible_message(SPAN_DANGER("The barbed wire slices into [C]!"),
/obj/structure/barricade/hitby(atom/movable/atom_movable)
if(atom_movable.throwing && is_wired)
if(iscarbon(atom_movable))
var/mob/living/carbon/living_carbon = atom_movable
if(living_carbon.mob_size <= MOB_SIZE_XENO)
living_carbon.visible_message(SPAN_DANGER("The barbed wire slices into [living_carbon]!"),
SPAN_DANGER("The barbed wire slices into you!"))
C.apply_damage(10)
C.apply_effect(2, WEAKEN) //Leaping into barbed wire is VERY bad
playsound(C, "bonk", 75, FALSE)
living_carbon.apply_damage(10)
living_carbon.apply_effect(2, WEAKEN) //Leaping into barbed wire is VERY bad
playsound(living_carbon, "bonk", 75, FALSE)
..()

/obj/structure/barricade/Collided(atom/movable/AM)
/obj/structure/barricade/Collided(atom/movable/atom_movable)
..()

if(istype(AM, /mob/living/carbon/xenomorph/crusher))
var/mob/living/carbon/xenomorph/crusher/C = AM
if(istype(atom_movable, /mob/living/carbon/xenomorph/crusher))
var/mob/living/carbon/xenomorph/crusher/living_carbon = atom_movable

if (!C.throwing)
if (!living_carbon.throwing)
return

if(crusher_resistant)
visible_message(SPAN_DANGER("[C] smashes into [src]!"))
visible_message(SPAN_DANGER("[living_carbon] smashes into [src]!"))
take_damage(150)
playsound(src, barricade_hitsound, 25, TRUE)

else if(!C.stat)
visible_message(SPAN_DANGER("[C] smashes through [src]!"))
else if(!living_carbon.stat)
visible_message(SPAN_DANGER("[living_carbon] smashes through [src]!"))
deconstruct(FALSE)
playsound(src, barricade_hitsound, 25, TRUE)

Expand Down Expand Up @@ -163,8 +165,8 @@
if(closed)
return NO_BLOCKED_MOVEMENT

var/obj/structure/S = locate(/obj/structure) in get_turf(mover)
if(S && S.climbable && !(S.flags_atom & ON_BORDER) && climbable && isliving(mover)) //Climbable objects allow you to universally climb over others
var/obj/structure/structure = locate(/obj/structure) in get_turf(mover)
if(structure && structure.climbable && !(structure.flags_atom & ON_BORDER) && climbable && isliving(mover)) //Climbable objects allow you to universally climb over others
return NO_BLOCKED_MOVEMENT

return ..()
Expand All @@ -180,33 +182,33 @@
/obj/structure/barricade/attack_animal(mob/user as mob)
return attack_alien(user)

/obj/structure/barricade/attackby(obj/item/W, mob/user)
if(istype(W, /obj/item/weapon/zombie_claws))
/obj/structure/barricade/attackby(obj/item/item, mob/user)
if(istype(item, /obj/item/weapon/zombie_claws))
user.visible_message(SPAN_DANGER("The zombie smashed at the [src.barricade_type] barricade!"),
SPAN_DANGER("You smack the [src.barricade_type] barricade!"))
if(barricade_hitsound)
playsound(src, barricade_hitsound, 35, 1)
hit_barricade(W)
hit_barricade(item)
return

for(var/obj/effect/xenomorph/acid/A in src.loc)
if(A.acid_t == src)
for(var/obj/effect/xenomorph/acid/acid in src.loc)
if(acid.acid_t == src)
to_chat(user, "You can't get near that, it's melting!")
return

if(istype(W, /obj/item/stack/barbed_wire))
var/obj/item/stack/barbed_wire/B = W
if(istype(item, /obj/item/stack/barbed_wire))
var/obj/item/stack/barbed_wire/barbed_wire = item
if(can_wire)
user.visible_message(SPAN_NOTICE("[user] starts setting up [W.name] on [src]."),
SPAN_NOTICE("You start setting up [W.name] on [src]."))
user.visible_message(SPAN_NOTICE("[user] starts setting up [item.name] on [src]."),
SPAN_NOTICE("You start setting up [item.name] on [src]."))
if(do_after(user, 20, INTERRUPT_NO_NEEDHAND|BEHAVIOR_IMMOBILE, BUSY_ICON_BUILD, src) && can_wire)
// Make sure there's still enough wire in the stack
if(!B.use(1))
if(!barbed_wire.use(1))
return

playsound(src.loc, 'sound/effects/barbed_wire_movement.ogg', 25, 1)
user.visible_message(SPAN_NOTICE("[user] sets up [W.name] on [src]."),
SPAN_NOTICE("You set up [W.name] on [src]."))
user.visible_message(SPAN_NOTICE("[user] sets up [item.name] on [src]."),
SPAN_NOTICE("You set up [item.name] on [src]."))

maxhealth += 50
update_health(-50)
Expand All @@ -218,7 +220,7 @@
update_icon()
return

if(HAS_TRAIT(W, TRAIT_TOOL_WIRECUTTERS))
if(HAS_TRAIT(item, TRAIT_TOOL_WIRECUTTERS))
if(is_wired)
user.visible_message(SPAN_NOTICE("[user] begin removing the barbed wire on [src]."),
SPAN_NOTICE("You begin removing the barbed wire on [src]."))
Expand All @@ -240,27 +242,27 @@
new/obj/item/stack/barbed_wire( src.loc )
return

if(W.force > force_level_absorption)
if(item.force > force_level_absorption)
..()
if(barricade_hitsound)
playsound(src, barricade_hitsound, 35, 1)
hit_barricade(W)
hit_barricade(item)

/obj/structure/barricade/bullet_act(obj/item/projectile/P)
bullet_ping(P)
/obj/structure/barricade/bullet_act(obj/item/projectile/bullet)
bullet_ping(bullet)

if(P.ammo.damage_type == BURN)
P.damage = P.damage * burn_multiplier
if(bullet.ammo.damage_type == BURN)
bullet.damage = bullet.damage * burn_multiplier
else
P.damage = P.damage * brute_multiplier
bullet.damage = bullet.damage * brute_projectile_multiplier

if(istype(P.ammo, /datum/ammo/xeno/boiler_gas))
if(istype(bullet.ammo, /datum/ammo/xeno/boiler_gas))
take_damage(round(50 * burn_multiplier))

else if(P.ammo.flags_ammo_behavior & AMMO_ANTISTRUCT)
take_damage(P.damage * ANTISTRUCT_DMG_MULT_BARRICADES)
else if(bullet.ammo.flags_ammo_behavior & AMMO_ANTISTRUCT)
take_damage(bullet.damage * ANTISTRUCT_DMG_MULT_BARRICADES)

take_damage(P.damage)
take_damage(bullet.damage)

return TRUE

Expand All @@ -282,11 +284,11 @@


/obj/structure/barricade/ex_act(severity, direction, cause_data)
for(var/obj/structure/barricade/B in get_step(src,dir)) //discourage double-stacking barricades by removing health from opposing barricade
if(B.dir == reverse_direction(dir))
for(var/obj/structure/barricade/barricade in get_step(src,dir)) //discourage double-stacking barricades by removing health from opposing barricade
if(barricade.dir == reverse_direction(dir))
spawn(1)
if(B)
B.ex_act(severity, direction)
if(barricade)
barricade.ex_act(severity, direction)
if(health <= 0)
var/location = get_turf(src)
handle_debris(severity, direction)
Expand Down Expand Up @@ -321,15 +323,15 @@
new /datum/effects/acid(src, null, null)

/obj/structure/barricade/flamer_fire_act(dam = BURN_LEVEL_TIER_1)
take_damage(dam * burn_multiplier)
take_damage(dam * burn_flame_multiplier)

/obj/structure/barricade/proc/hit_barricade(obj/item/I)
take_damage(I.force * 0.5 * brute_multiplier)
/obj/structure/barricade/proc/hit_barricade(obj/item/item)
take_damage(item.force * 0.5 * brute_multiplier)

/obj/structure/barricade/proc/take_damage(damage)
for(var/obj/structure/barricade/B in get_step(src,dir)) //discourage double-stacking barricades by removing health from opposing barricade
if(B.dir == reverse_direction(dir))
B.update_health(damage)
for(var/obj/structure/barricade/barricade in get_step(src,dir)) //discourage double-stacking barricades by removing health from opposing barricade
if(barricade.dir == reverse_direction(dir))
barricade.update_health(damage)

update_health(damage)

Expand Down Expand Up @@ -357,12 +359,12 @@
if(50 to 75) damage_state = BARRICADE_DMG_SLIGHT
if(75 to INFINITY) damage_state = BARRICADE_DMG_NONE

/obj/structure/barricade/proc/weld_cade(obj/item/tool/weldingtool/WT, mob/user)
/obj/structure/barricade/proc/weld_cade(obj/item/tool/weldingtool/welder, mob/user)
if(!metallic)
user.visible_message(SPAN_WARNING("You can't weld \the [src]!"))
return FALSE

if(!(WT.remove_fuel(2, user)))
if(!(welder.remove_fuel(2, user)))
return FALSE

user.visible_message(SPAN_NOTICE("[user] begins repairing damage to [src]."),
Expand Down Expand Up @@ -413,20 +415,20 @@

return ..()

/obj/structure/barricade/proc/try_nailgun_usage(obj/item/W, mob/user)
if(length(repair_materials) == 0 || health >= maxhealth || !istype(W, /obj/item/weapon/gun/smg/nailgun))
/obj/structure/barricade/proc/try_nailgun_usage(obj/item/item, mob/user)
if(length(repair_materials) == 0 || health >= maxhealth || !istype(item, /obj/item/weapon/gun/smg/nailgun))
return FALSE

var/obj/item/weapon/gun/smg/nailgun/NG = W
var/obj/item/weapon/gun/smg/nailgun/nailgun = item

if(!NG.in_chamber || !NG.current_mag || NG.current_mag.current_rounds < 3)
if(!nailgun.in_chamber || !nailgun.current_mag || nailgun.current_mag.current_rounds < 3)
to_chat(user, SPAN_WARNING("You require at least 4 nails to complete this task!"))
return FALSE

// Check if either hand has a metal stack by checking the weapon offhand
// Presume the material is a sheet until proven otherwise.
var/obj/item/stack/sheet/material = null
if(user.l_hand == NG)
if(user.l_hand == nailgun)
material = user.r_hand
else
material = user.l_hand
Expand All @@ -445,24 +447,24 @@
to_chat(user, SPAN_WARNING("You'll need some adequate repair material in your other hand to patch up [src]!"))
return FALSE

var/soundchannel = playsound(src, NG.repair_sound, 25, 1)
if(!do_after(user, NG.nailing_speed, INTERRUPT_ALL, BUSY_ICON_FRIENDLY, src))
var/soundchannel = playsound(src, nailgun.repair_sound, 25, 1)
if(!do_after(user, nailgun.nailing_speed, INTERRUPT_ALL, BUSY_ICON_FRIENDLY, src))
playsound(src, null, channel = soundchannel)
return FALSE

if(!material || (material != user.l_hand && material != user.r_hand) || material.amount <= 0)
to_chat(user, SPAN_WARNING("You seems to have misplaced the repair material!"))
return FALSE

if(!NG.in_chamber || !NG.current_mag || NG.current_mag.current_rounds < 3)
if(!nailgun.in_chamber || !nailgun.current_mag || nailgun.current_mag.current_rounds < 3)
to_chat(user, SPAN_WARNING("You require at least 4 nails to complete this task!"))
return FALSE

update_health(-repair_value*maxhealth)
to_chat(user, SPAN_WARNING("You nail [material] to [src], restoring some of its integrity!"))
update_damage_state()
material.use(1)
NG.current_mag.current_rounds -= 3
NG.in_chamber = null
NG.load_into_chamber()
nailgun.current_mag.current_rounds -= 3
nailgun.in_chamber = null
nailgun.load_into_chamber()
return TRUE
Loading

0 comments on commit e33aacf

Please sign in to comment.