diff --git a/ModularTegustation/tegu_mobs/apocalypse_bird.dm b/ModularTegustation/tegu_mobs/apocalypse_bird.dm index c81100c82791..3c77376d6e8a 100644 --- a/ModularTegustation/tegu_mobs/apocalypse_bird.dm +++ b/ModularTegustation/tegu_mobs/apocalypse_bird.dm @@ -24,6 +24,7 @@ occupied_tiles_left = 3 occupied_tiles_right = 3 occupied_tiles_up = 2 + damage_effect_scale = 1.25 blood_volume = BLOOD_VOLUME_NORMAL del_on_death = TRUE death_message = "finally stops moving, falling to the ground." diff --git a/code/__HELPERS/game.dm b/code/__HELPERS/game.dm index e41ead876a45..ba6423ae92da 100644 --- a/code/__HELPERS/game.dm +++ b/code/__HELPERS/game.dm @@ -136,6 +136,9 @@ return dist +/proc/get_dist_manhattan(atom/Loc1, atom/Loc2) + return abs(Loc1.x - Loc2.x) + abs(Loc1.y - Loc2.y) + /proc/circlerangeturfs(center=usr,radius=3) var/turf/centerturf = get_turf(center) diff --git a/code/_onclick/click.dm b/code/_onclick/click.dm index 4c9aa2080766..50648489ec98 100644 --- a/code/_onclick/click.dm +++ b/code/_onclick/click.dm @@ -145,9 +145,12 @@ if(CanReach(A,W)) if(W) var/atom/target_thing = A - if((isturf(A) || iseffect(A)) && W.force > 10) + if(a_intent != INTENT_HARM && (isturf(A) || iseffect(A)) && W.force > 10) var/turf/T = get_turf(A) for(var/mob/living/L in T) + if(istype(L, /mob/living/simple_animal/projectile_blocker_dummy)) + var/mob/living/simple_animal/projectile_blocker_dummy/pbd = L + L = pbd.parent if(L.invisibility > see_invisible) continue if(L.stat != DEAD) diff --git a/code/_onclick/item_attack.dm b/code/_onclick/item_attack.dm index 25457cf896e0..23b1af124560 100644 --- a/code/_onclick/item_attack.dm +++ b/code/_onclick/item_attack.dm @@ -84,6 +84,9 @@ for(var/turf/T in hit_turfs) for(var/mob/M in T) + if(istype(M, /mob/living/simple_animal/projectile_blocker_dummy)) + var/mob/living/simple_animal/projectile_blocker_dummy/pbd = M + M = pbd.parent potential_targets |= M potential_targets -= user @@ -292,6 +295,7 @@ /mob/living/simple_animal/attacked_by(obj/item/I, mob/living/user) if(!attack_threshold_check(I.force, I.damtype, FALSE)) playsound(loc, 'sound/weapons/tap.ogg', I.get_clamped_volume(), TRUE, -1) + DamageEffect(0, I.damtype) else return ..() diff --git a/code/_onclick/other_mobs.dm b/code/_onclick/other_mobs.dm index 6c573094f717..aa00ea7509ad 100644 --- a/code/_onclick/other_mobs.dm +++ b/code/_onclick/other_mobs.dm @@ -209,6 +209,9 @@ if(isturf(A) || iseffect(A)) var/turf/T = get_turf(A) for(var/mob/living/L in T) + if(istype(L, /mob/living/simple_animal/projectile_blocker_dummy)) + var/mob/living/simple_animal/projectile_blocker_dummy/pbd = L + L = pbd.parent if(L.invisibility > see_invisible) continue if(L.stat != DEAD) diff --git a/code/modules/mob/living/carbon/human/damage_procs.dm b/code/modules/mob/living/carbon/human/damage_procs.dm index 6122c3434f97..cff4e8777f96 100644 --- a/code/modules/mob/living/carbon/human/damage_procs.dm +++ b/code/modules/mob/living/carbon/human/damage_procs.dm @@ -6,18 +6,17 @@ //// Damage Effects /mob/living/carbon/human/adjustRedLoss(amount, updating_health = TRUE, forced = FALSE) + if(stat != DEAD) + DamageEffect(amount, RED_DAMAGE) . = ..() - //Failsafe - if(. && !forced) - if(. > 0) - new /obj/effect/temp_visual/damage_effect/red(get_turf(src)) + /mob/living/carbon/human/adjustWhiteLoss(amount, updating_health = TRUE, forced = FALSE, white_healable = FALSE) var/damage_amt = amount if(sanity_lost && white_healable) // Heal sanity instead. damage_amt *= -1 - if(damage_amt > 0 && !forced) - new /obj/effect/temp_visual/damage_effect/white(get_turf(src)) + if(stat != DEAD) + DamageEffect(damage_amt, WHITE_DAMAGE) adjustSanityLoss(damage_amt, forced) if(updating_health) updatehealth() @@ -27,29 +26,26 @@ var/damage_amt = amount if(sanity_lost && white_healable) // Heal sanity instead. damage_amt *= -1 - if(amount > 0 && !forced) - new /obj/effect/temp_visual/damage_effect/black(get_turf(src)) + if(stat != DEAD) + DamageEffect(amount, BLACK_DAMAGE) adjustBruteLoss(amount, forced = forced) adjustSanityLoss(damage_amt, forced = forced) return damage_amt /mob/living/carbon/human/adjustPaleLoss(amount, updating_health = TRUE, forced = FALSE) + if(stat != DEAD) + DamageEffect(amount, PALE_DAMAGE) . = ..() - if(. && !forced) - if(. > 0) - new /obj/effect/temp_visual/damage_effect/pale(get_turf(src)) /mob/living/carbon/human/adjustToxLoss(amount, updating_health = TRUE, forced = FALSE) + if(stat != DEAD) + DamageEffect(amount, TOX) . = ..() - if(. && !forced) - if(. > 0) - new /obj/effect/temp_visual/damage_effect/tox(get_turf(src)) /mob/living/carbon/human/adjustFireLoss(amount, updating_health = TRUE, forced = FALSE, required_status) + if(stat != DEAD) + DamageEffect(amount, BURN) . = ..() - if(. && !forced) - if(. > 0) - new /obj/effect/temp_visual/damage_effect/burn(get_turf(src)) // diff --git a/code/modules/mob/living/simple_animal/abnormality/waw/greed_king.dm b/code/modules/mob/living/simple_animal/abnormality/waw/greed_king.dm index f6e25e918c58..b1d417a7947e 100644 --- a/code/modules/mob/living/simple_animal/abnormality/waw/greed_king.dm +++ b/code/modules/mob/living/simple_animal/abnormality/waw/greed_king.dm @@ -133,6 +133,7 @@ offsets_pixel_y = list("south" = -8, "north" = -8, "west" = -8, "east" = -8) transform = matrix(1.5, MATRIX_SCALE) SetOccupiedTiles(1, 1, 1, 1) + damage_effect_scale = 1.2 startTeleport() //Let's Spaghettioodle out of here /mob/living/simple_animal/hostile/abnormality/greed_king/proc/startTeleport() diff --git a/code/modules/mob/living/simple_animal/abnormality/waw/warden.dm b/code/modules/mob/living/simple_animal/abnormality/waw/warden.dm index a38b22cdd280..812b74f02383 100644 --- a/code/modules/mob/living/simple_animal/abnormality/waw/warden.dm +++ b/code/modules/mob/living/simple_animal/abnormality/waw/warden.dm @@ -152,4 +152,5 @@ /mob/living/simple_animal/hostile/abnormality/warden/bullet_act(obj/projectile/P) visible_message(span_userdanger("[src] is unfazed by \the [P]!")) + new /obj/effect/temp_visual/healing/no_dam(get_turf(src)) P.Destroy() diff --git a/code/modules/mob/living/simple_animal/hostile/hostile.dm b/code/modules/mob/living/simple_animal/hostile/hostile.dm index 01da7bfb9c10..b761fa37cb81 100644 --- a/code/modules/mob/living/simple_animal/hostile/hostile.dm +++ b/code/modules/mob/living/simple_animal/hostile/hostile.dm @@ -83,6 +83,8 @@ /// How willing a mob is to switch targets. More resistance means more aggro is required var/target_switch_resistance + var/damage_effect_scale = 1 + /mob/living/simple_animal/hostile/Initialize() /*Update Speed overrides set speed and sets it to the equivilent of move_to_delay. Basically @@ -201,7 +203,6 @@ //register the attacker in our memory. if(P.firer) RegisterAggroValue(P.firer, P.damage, P.damage_type) - DamageEffect(P.damage, P.damage_type) return ..() /mob/living/simple_animal/hostile/attack_animal(mob/living/simple_animal/M, damage) @@ -280,42 +281,93 @@ /*-------------------\ |Damage Visual Effect| \-------------------*/ - -/mob/living/simple_animal/hostile/attack_threshold_check(damage, damagetype = BRUTE, armorcheck = MELEE, actuallydamage = TRUE) - //This used to also check actually damage but turns out melee weapons in item_attack.dm dont call actually damage. - if(stat != DEAD && (damagetype in list(RED_DAMAGE, WHITE_DAMAGE, BLACK_DAMAGE, PALE_DAMAGE))) - //To simplify things, if you bash a abnormality with a wrench it wont show any effect. --uhh it will though - DamageEffect(damagetype) - return ..() - -/mob/living/simple_animal/hostile/proc/DamageEffect(damtype) - //Code stolen from attack_threshold_check() in animal_defense.dm - var/damage_modifier - if(islist(damage_coeff)) - damage_modifier = damage_coeff[damtype] - else - damage_modifier = damage_coeff.getCoeff(damtype) - - if(damage_modifier == 0) - //Visual Effect for immunity. - return new /obj/effect/temp_visual/healing/no_dam(get_turf(src)) - if(damage_modifier < 0) - //Visual Effect for healing. - return new /obj/effect/temp_visual/healing(get_turf(src)) - +/mob/living/proc/DamageEffect(damage, damtype) + if(damage > 0) + switch(damtype) + if(RED_DAMAGE) + return new /obj/effect/temp_visual/damage_effect/red(get_turf(src)) + if(WHITE_DAMAGE) + return new /obj/effect/temp_visual/damage_effect/white(get_turf(src)) + if(BLACK_DAMAGE) + return new /obj/effect/temp_visual/damage_effect/black(get_turf(src)) + if(PALE_DAMAGE) + return new /obj/effect/temp_visual/damage_effect/pale(get_turf(src)) + if(BURN) + return new /obj/effect/temp_visual/damage_effect/burn(get_turf(src)) + if(TOX) + return new /obj/effect/temp_visual/damage_effect/tox(get_turf(src)) + else + return null + +/mob/living/simple_animal/hostile/DamageEffect(damage, damtype) + var/obj/effect/dam_effect = null + if(!damage) + dam_effect = new /obj/effect/temp_visual/healing/no_dam(get_turf(src)) + if(damage_effect_scale != 1) + dam_effect.transform *= damage_effect_scale + return dam_effect + if(damage < 0) + dam_effect = new /obj/effect/temp_visual/healing(get_turf(src)) + if(damage_effect_scale != 1) + dam_effect.transform *= damage_effect_scale + return dam_effect switch(damtype) if(RED_DAMAGE) - return new /obj/effect/temp_visual/damage_effect/red(get_turf(src)) + dam_effect = new /obj/effect/temp_visual/damage_effect/red(get_turf(src)) if(WHITE_DAMAGE) - return new /obj/effect/temp_visual/damage_effect/white(get_turf(src)) + dam_effect = new /obj/effect/temp_visual/damage_effect/white(get_turf(src)) if(BLACK_DAMAGE) - return new /obj/effect/temp_visual/damage_effect/black(get_turf(src)) + dam_effect = new /obj/effect/temp_visual/damage_effect/black(get_turf(src)) if(PALE_DAMAGE) - return new /obj/effect/temp_visual/damage_effect/pale(get_turf(src)) + dam_effect = new /obj/effect/temp_visual/damage_effect/pale(get_turf(src)) if(BURN) - return new /obj/effect/temp_visual/damage_effect/burn(get_turf(src)) + dam_effect = new /obj/effect/temp_visual/damage_effect/burn(get_turf(src)) if(TOX) - return new /obj/effect/temp_visual/damage_effect/tox(get_turf(src)) + dam_effect = new /obj/effect/temp_visual/damage_effect/tox(get_turf(src)) + else + return null + if(damage_effect_scale != 1) + dam_effect.transform *= damage_effect_scale + if(length(projectile_blockers) > 0) + dam_effect.pixel_x += rand(-occupied_tiles_left_current * 32, occupied_tiles_right_current * 32) + dam_effect.pixel_y += rand(-occupied_tiles_down_current * 32, occupied_tiles_up_current * 32) + return dam_effect + +/mob/living/simple_animal/hostile/adjustRedLoss(amount, updating_health, forced) + var/was_alive = stat != DEAD + . = ..() + if(was_alive) + DamageEffect(., RED_DAMAGE) + +/mob/living/simple_animal/hostile/adjustWhiteLoss(amount, updating_health, forced, white_healable) + var/was_alive = stat != DEAD + . = ..() + if(was_alive) + DamageEffect(., WHITE_DAMAGE) + +/mob/living/simple_animal/hostile/adjustBlackLoss(amount, updating_health, forced, white_healable) + var/was_alive = stat != DEAD + . = ..() + if(was_alive) + DamageEffect(., BLACK_DAMAGE) + +/mob/living/simple_animal/hostile/adjustPaleLoss(amount, updating_health, forced) + var/was_alive = stat != DEAD + . = ..() + if(was_alive) + DamageEffect(., PALE_DAMAGE) + +/mob/living/simple_animal/hostile/adjustFireLoss(amount, updating_health, forced) + var/was_alive = stat != DEAD + . = ..() + if(was_alive) + DamageEffect(., BURN) + +/mob/living/simple_animal/hostile/adjustToxLoss(amount, updating_health, forced) + var/was_alive = stat != DEAD + . = ..() + if(was_alive) + DamageEffect(., TOX) /*Used in LC13 abnormality calculations. Moved here so we can use it for all hostiles. diff --git a/code/modules/mob/living/simple_animal/hostile/ordeal/amber.dm b/code/modules/mob/living/simple_animal/hostile/ordeal/amber.dm index 1a2a3de686b4..b58de9d8d14e 100644 --- a/code/modules/mob/living/simple_animal/hostile/ordeal/amber.dm +++ b/code/modules/mob/living/simple_animal/hostile/ordeal/amber.dm @@ -192,6 +192,7 @@ should_projectile_blockers_change_orientation = TRUE occupied_tiles_up = 1 offsets_pixel_x = list("south" = -16, "north" = -16, "west" = 0, "east" = -32) + offsets_pixel_y = list("south" = 9, "north" = -20, "west" = 0, "east" = 0) /// This cooldown responds for both the burrowing and spawning in the dawns var/burrow_cooldown @@ -226,10 +227,25 @@ /mob/living/simple_animal/hostile/ordeal/amber_dusk/Initialize() . = ..() + setDir(WEST) soundloop = new(list(src), TRUE) if(LAZYLEN(butcher_results)) addtimer(CALLBACK(src, PROC_REF(BurrowOut), get_turf(src))) +/mob/living/simple_animal/hostile/ordeal/amber_dusk/OnDirChange(atom/thing, dir, newdir) + . = ..() + if(stat == DEAD) + return + var/static/matrix/add_vertical_transform = matrix(0.8, 1.4, MATRIX_SCALE) + var/static/south_north = SOUTH | NORTH + var/static/east_west = EAST | WEST + var/combined = dir | newdir + if((combined & south_north) && (combined & east_west)) + if(newdir & south_north) + transform = add_vertical_transform + else + transform = matrix() + /mob/living/simple_animal/hostile/ordeal/amber_dusk/Destroy() QDEL_NULL(soundloop) for(var/mob/living/simple_animal/hostile/ordeal/amber_bug/spawned/bug as anything in spawned_mobs) @@ -249,6 +265,8 @@ if(LAZYLEN(butcher_results)) alpha = 255 offsets_pixel_x = list("south" = -16, "north" = -16, "west" = -16, "east" = -16) + offsets_pixel_y = list("south" = 0, "north" = 0, "west" = 0, "east" = 0) + transform = matrix() soundloop.stop() for(var/mob/living/simple_animal/hostile/ordeal/amber_bug/bug in spawned_mobs) bug.can_burrow_solo = TRUE @@ -257,6 +275,8 @@ /mob/living/simple_animal/hostile/ordeal/amber_dusk/revive(full_heal, admin_revive) . = ..() offsets_pixel_x = list("south" = -16, "north" = -16, "west" = 0, "east" = -32) + offsets_pixel_y = list("south" = 9, "north" = -20, "west" = 0, "east" = 0) + density = TRUE /mob/living/simple_animal/hostile/ordeal/amber_dusk/proc/AttemptBirth() var/max_spawn = clamp(length(GLOB.clients) * 2, 4, 8) @@ -368,6 +388,7 @@ occupied_tiles_up = 2 offsets_pixel_x = list("south" = -96, "north" = -96, "west" = -96, "east" = -96) offsets_pixel_y = list("south" = -16, "north" = -16, "west" = -16, "east" = -16) + damage_effect_scale = 1.25 blood_volume = BLOOD_VOLUME_NORMAL death_sound = 'sound/effects/ordeals/amber/midnight_dead.ogg' diff --git a/code/modules/mob/living/simple_animal/hostile/ordeal/green.dm b/code/modules/mob/living/simple_animal/hostile/ordeal/green.dm index 902563287382..d8a730d85a39 100644 --- a/code/modules/mob/living/simple_animal/hostile/ordeal/green.dm +++ b/code/modules/mob/living/simple_animal/hostile/ordeal/green.dm @@ -275,6 +275,7 @@ guaranteed_butcher_results = list(/obj/item/food/meat/slab/robot = 16) death_sound = 'sound/effects/ordeals/green/midnight_dead.ogg' offsets_pixel_x = list("south" = -96, "north" = -96, "west" = -96, "east" = -96) + damage_effect_scale = 1.25 var/laser_cooldown var/laser_cooldown_time = 20 SECONDS diff --git a/code/modules/mob/living/simple_animal/projectile_blocker.dm b/code/modules/mob/living/simple_animal/projectile_blocker.dm index 631618fb0232..7e9c7645270b 100644 --- a/code/modules/mob/living/simple_animal/projectile_blocker.dm +++ b/code/modules/mob/living/simple_animal/projectile_blocker.dm @@ -47,7 +47,7 @@ return TRUE if(!isturf(parent.loc)) return TRUE - if(parent.CanPassThroughBlocker(mover, target)) + if(parent.CanPassThroughBlocker(mover, target, get_turf(src))) return TRUE return parent.CanPass(mover, target) @@ -126,10 +126,12 @@ moveToNullspace() ///For letting some mobs walk through the blockers -/mob/living/simple_animal/proc/CanPassThroughBlocker(atom/movable/mover, turf/target) +/mob/living/simple_animal/proc/CanPassThroughBlocker(atom/movable/mover, turf/start, turf/destination) return FALSE -/mob/living/simple_animal/hostile/CanPassThroughBlocker(atom/movable/mover, turf/target) +/mob/living/simple_animal/hostile/CanPassThroughBlocker(atom/movable/mover, turf/start, turf/destination) if(isliving(mover) && faction_check_mob(mover)) return TRUE + if(isliving(mover) && get_dist_manhattan(get_turf(src), destination) > get_dist_manhattan(get_turf(src), start)) + return TRUE return FALSE