Skip to content

Commit

Permalink
Merge pull request #7 from She-Is-Trying-To-Form-Her-First-Thought/do…
Browse files Browse the repository at this point in the history
…or-kicker

Door Kicker - Also fixes stuff like bullets doing double damage
  • Loading branch information
Paxilmaniac authored Nov 19, 2024
2 parents 1cbf013 + c48ecba commit 7eea677
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 38 deletions.
2 changes: 1 addition & 1 deletion code/__DEFINES/combat.dm
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ GLOBAL_LIST_INIT(leg_zones, list(BODY_ZONE_R_LEG, BODY_ZONE_L_LEG))
/// IF an object is weak against armor, this is the value that any present armor is multiplied by
#define ARMOR_WEAKENED_MULTIPLIER 2
/// Armor can't block more than this as a percentage
#define ARMOR_MAX_BLOCK 90
#define ARMOR_MAX_BLOCK 75 // DOPPLETHAL EDIT - #define ARMOR_MAX_BLOCK 90
/// Calculates the new armour value after armour penetration. Can return negative values, and those must be caught.
#define PENETRATE_ARMOUR(armour, penetration) (penetration == 100 ? 0 : 100 * (armour - penetration) / (100 - penetration))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,58 +20,51 @@

return FALSE

// Override of living bullet_act that also damages the armor someone is wearing
// Override of living apply_projectile_effects that also damages the armor someone is wearing

/mob/living/bullet_act(obj/projectile/hitting_projectile, def_zone, piercing_hit = FALSE)
. = ..()
if(. != BULLET_ACT_HIT)
return .
if(!hitting_projectile.is_hostile_projectile())
return BULLET_ACT_HIT

// we need a second, silent armor check to actually know how much to reduce damage taken, as opposed to
// on [/atom/proc/bullet_act] where it's just to pass it to the projectile's on_hit().
var/armor_check = check_projectile_armor(def_zone, hitting_projectile, is_silent = TRUE)

var/flat_reduction = (getarmor(def_zone, hitting_projectile.armor_flag) / 5) * ((100 - hitting_projectile.armour_penetration) / 100)
var/armor_damage = hitting_projectile.damage - (hitting_projectile.damage - flat_reduction)
/mob/living/apply_projectile_effects(obj/projectile/proj, def_zone, armor_check)
var/flat_reduction = (getarmor(def_zone, proj.armor_flag) / 5) * ((100 - proj.armour_penetration) / 100)
var/armor_damage = proj.damage - (proj.damage - flat_reduction)

apply_damage(
damage = max(0, hitting_projectile.damage - flat_reduction),
damagetype = hitting_projectile.damage_type,
damage = max(0, proj.damage - flat_reduction),
damagetype = proj.damage_type,
def_zone = def_zone,
blocked = min(ARMOR_MAX_BLOCK, armor_check - armor_damage), //cap damage reduction at 90%
wound_bonus = hitting_projectile.wound_bonus,
bare_wound_bonus = hitting_projectile.bare_wound_bonus,
sharpness = hitting_projectile.sharpness,
attack_direction = get_dir(hitting_projectile.starting, src),
wound_bonus = proj.wound_bonus,
bare_wound_bonus = proj.bare_wound_bonus,
sharpness = proj.sharpness,
attack_direction = get_dir(proj.starting, src),
)

apply_effects(
stun = hitting_projectile.stun,
knockdown = hitting_projectile.knockdown,
unconscious = hitting_projectile.unconscious,
slur = (mob_biotypes & MOB_ROBOTIC) ? 0 SECONDS : hitting_projectile.slur, // Don't want your cyborgs to slur from being ebow'd
stutter = (mob_biotypes & MOB_ROBOTIC) ? 0 SECONDS : hitting_projectile.stutter, // Don't want your cyborgs to stutter from being tazed
eyeblur = hitting_projectile.eyeblur,
drowsy = hitting_projectile.drowsy,
stun = proj.stun,
knockdown = proj.knockdown,
unconscious = proj.unconscious,
slur = (mob_biotypes & MOB_ROBOTIC) ? 0 SECONDS : proj.slur, // Don't want your cyborgs to slur from being ebow'd
stutter = (mob_biotypes & MOB_ROBOTIC) ? 0 SECONDS : proj.stutter, // Don't want your cyborgs to stutter from being tazed
eyeblur = proj.eyeblur,
drowsy = proj.drowsy,
blocked = armor_check,
stamina = hitting_projectile.stamina,
jitter = (mob_biotypes & MOB_ROBOTIC) ? 0 SECONDS : hitting_projectile.jitter, // Cyborgs can jitter but not from being shot
paralyze = hitting_projectile.paralyze,
immobilize = hitting_projectile.immobilize,
stamina = proj.stamina,
jitter = (mob_biotypes & MOB_ROBOTIC) ? 0 SECONDS : proj.jitter, // Cyborgs can jitter but not from being shot
paralyze = proj.paralyze,
immobilize = proj.immobilize,
)

// If the damage type isn't one of the types that already does clothing damage, then we damage armor
if(hitting_projectile.damage_type != BURN)
if(proj.damage_type != BURN)
damage_armor(
armor_damage,
hitting_projectile.damage_type,
proj.damage_type,
def_zone,
)

if(hitting_projectile.dismemberment)
check_projectile_dismemberment(hitting_projectile, def_zone)
return BULLET_ACT_HIT
if(proj.dismemberment)
check_projectile_dismemberment(proj, def_zone)

if (proj.damage && armor_check < 100)
create_projectile_hit_effects(proj, def_zone, armor_check)

// Override take_damage_zone to allow stuff with only one covered zone to take damage
/obj/item/clothing/proc/take_damage_zone(def_zone, damage_amount, damage_type, armour_penetration)
Expand Down
50 changes: 50 additions & 0 deletions modular_lethal_doppler/wallem/code/super_doors.dm
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,16 @@
var/kick_success_sound = 'modular_lethal_doppler/wallem/sounds/door_kick_w.ogg'
/// What chance do you have to kick this door open every attempt?
var/door_kick_chance = 60
/// Overlay we display when a door is being kicked in
var/mutable_appearance/telegraph_overlay

/obj/structure/mineral_door/lethal/Initialize(mapload)
. = ..()
telegraph_overlay = mutable_appearance('icons/mob/telegraphing/telegraph_holographic.dmi', "target_box")

/obj/structure/mineral_door/lethal/Destroy()
telegraph_overlay = null
return ..()

/obj/structure/mineral_door/lethal/examine(mob/user)
. = ..()
Expand All @@ -37,15 +47,55 @@
return
if(door_opened)
return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN
var/turf/telegraph_turf = telegraph_kick(user)
if(!do_after(user, 0.5 SECONDS, src))
stop_telegraph(telegraph_turf)
return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN
if(!prob(door_kick_chance))
playsound(src, kick_fail_sound, 100, TRUE, 3)
stop_telegraph(telegraph_turf)
return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN
else
Open(TRUE)
chief_kickabitch_from_the_casino(user, telegraph_turf)
return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN

/// Warns people on the other side of a door that it's about to be kicked open (and dangerous)
/obj/structure/mineral_door/lethal/proc/telegraph_kick(mob/user)
var/turf/turf_to_telegraph = get_step(src, get_dir(user, src))
if(!turf_to_telegraph)
message_admins("[src] tried to telegraph a door kick but had no target turf, this is wrong.")
return
turf_to_telegraph.add_overlay(telegraph_overlay)
return turf_to_telegraph

/// Finds everyone in the telegraph turf and throws them across the room
/obj/structure/mineral_door/lethal/proc/chief_kickabitch_from_the_casino(mob/user, turf/telegraph_turf)
var/turf/throwtarget = get_edge_target_turf(src, get_dir(src, telegraph_turf))
for(var/atom/movable/kicked_thing as anything in telegraph_turf.contents)
if(isturf(kicked_thing))
continue
if(kicked_thing.anchored)
continue
if(isliving(kicked_thing))
var/mob/living/kicked_mob = kicked_thing
kicked_mob.Knockdown(3 SECONDS)
to_chat(kicked_mob, span_userdanger("[src] slams into you, throwing you back!"))
kicked_thing.safe_throw_at(
target = throwtarget,
range = 3,
speed = 2,
thrower = user,
force = MOVE_FORCE_STRONG,
)
stop_telegraph(telegraph_turf)

/// Removes a telegraph overlay if there is one from the given turf, if there is one
/obj/structure/mineral_door/lethal/proc/stop_telegraph(turf/telegraph_turf)
if(!telegraph_turf)
return
telegraph_turf.cut_overlay(telegraph_overlay)

/obj/structure/mineral_door/lethal/TryToSwitchState(atom/user)
if(isliving(user))
if(!can_interact(user))
Expand Down
2 changes: 1 addition & 1 deletion modular_lethal_doppler/wallem/code/wall_cladding.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
icon = 'modular_lethal_doppler/wallem/icons/cladding.dmi'
icon_state = "basic_big"
SET_BASE_PIXEL(0, 22)
layer = ABOVE_WINDOW_LAYER + 0.01
layer = ABOVE_WINDOW_LAYER
anchored = TRUE
density = FALSE
max_integrity = 200
Expand Down
1 change: 1 addition & 0 deletions modular_lethal_doppler/wallem/code/windows.dm
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
alpha = 200
base_icon_state = "window"
icon = 'modular_lethal_doppler/wallem/icons/normal_thindow.dmi'
layer = 3.3
smoothing_flags = SMOOTH_BITMASK|SMOOTH_BORDER_OBJECT|SMOOTH_OBJ
canSmoothWith = SMOOTH_GROUP_WINDOW_DIRECIONAL
smoothing_groups = SMOOTH_GROUP_WINDOW_DIRECIONAL + SMOOTH_GROUP_CLOSED_TURFS
Expand Down

0 comments on commit 7eea677

Please sign in to comment.