mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-25 22:19:30 +01:00
Fixes projectiles not hitting people resting, a bit of refactoring of how projectile target collision is done (#42241)
* Fixes projectiles not hitting mobs, some refactoring too * some stuff for projectile can hit target to work with not being ontop of an object * Yeah let's just refactor bullet_act while we're at it. * Yeah let's just refactor bullet_act while we're at it. * Yeah let's just refactor bullet_act while we're at it. * CanPass returns true to projectiles regardless of hit * snakecase?
This commit is contained in:
@@ -82,7 +82,7 @@
|
||||
|
||||
/mob/living/simple_animal/hostile/clockwork/marauder/bullet_act(obj/item/projectile/P)
|
||||
if(deflect_projectile(P))
|
||||
return
|
||||
return BULLET_ACT_BLOCK
|
||||
return ..()
|
||||
|
||||
/mob/living/simple_animal/hostile/clockwork/marauder/proc/deflect_projectile(obj/item/projectile/P)
|
||||
|
||||
@@ -244,13 +244,11 @@ GLOBAL_LIST_INIT(sand_recipes, list(\
|
||||
|
||||
/obj/item/twohanded/required/gibtonite/bullet_act(obj/item/projectile/P)
|
||||
GibtoniteReaction(P.firer)
|
||||
..()
|
||||
. = ..()
|
||||
|
||||
/obj/item/twohanded/required/gibtonite/ex_act()
|
||||
GibtoniteReaction(null, 1)
|
||||
|
||||
|
||||
|
||||
/obj/item/twohanded/required/gibtonite/proc/GibtoniteReaction(mob/user, triggered_by = 0)
|
||||
if(!primed)
|
||||
primed = TRUE
|
||||
|
||||
@@ -13,8 +13,9 @@
|
||||
|
||||
/obj/effect/dummy/phased_mob/slaughter/ex_act()
|
||||
return
|
||||
|
||||
/obj/effect/dummy/phased_mob/slaughter/bullet_act()
|
||||
return
|
||||
return BULLET_ACT_FORCE_PIERCE
|
||||
|
||||
/obj/effect/dummy/phased_mob/slaughter/singularity_act()
|
||||
return
|
||||
|
||||
@@ -80,9 +80,9 @@
|
||||
|
||||
if(check_shields(P, P.damage, "the [P.name]", PROJECTILE_ATTACK, P.armour_penetration))
|
||||
P.on_hit(src, 100, def_zone)
|
||||
return 2
|
||||
return BULLET_ACT_HIT
|
||||
|
||||
return (..(P , def_zone))
|
||||
return ..(P, def_zone)
|
||||
|
||||
/mob/living/carbon/human/proc/check_reflect(def_zone) //Reflection checks for anything in your l_hand, r_hand, or wear_suit based on the reflection chance of the object
|
||||
if(wear_suit)
|
||||
|
||||
@@ -399,7 +399,7 @@
|
||||
if((Proj.damage_type == BURN) || (Proj.damage_type == BRUTE))
|
||||
if(!Proj.nodamage && Proj.damage < src.health && isliving(Proj.firer))
|
||||
retaliate(Proj.firer)
|
||||
..()
|
||||
. = ..()
|
||||
|
||||
/mob/living/carbon/monkey/hitby(atom/movable/AM, skipcatch = FALSE, hitpush = TRUE, blocked = FALSE, datum/thrownthing/throwingdatum)
|
||||
if(istype(AM, /obj/item))
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
apply_damage(P.damage, P.damage_type, def_zone, armor)
|
||||
if(P.dismemberment)
|
||||
check_projectile_dismemberment(P, def_zone)
|
||||
return P.on_hit(src, armor)
|
||||
return P.on_hit(src, armor)? BULLET_ACT_HIT : BULLET_ACT_BLOCK
|
||||
|
||||
/mob/living/proc/check_projectile_dismemberment(obj/item/projectile/P, def_zone)
|
||||
return 0
|
||||
|
||||
@@ -2,6 +2,23 @@
|
||||
. = ..()
|
||||
update_turf_movespeed(loc)
|
||||
|
||||
/mob/living/CanPass(atom/movable/mover, turf/target)
|
||||
if((mover.pass_flags & PASSMOB))
|
||||
return TRUE
|
||||
if(istype(mover, /obj/item/projectile))
|
||||
var/obj/item/projectile/P = mover
|
||||
if(P.can_hit_target(src, P.permutated, src == P.original, TRUE))
|
||||
P.Bump(src)
|
||||
return TRUE
|
||||
if(mover.throwing)
|
||||
return (!density || !(mobility_flags & MOBILITY_STAND))
|
||||
if(buckled == mover)
|
||||
return TRUE
|
||||
if(ismob(mover))
|
||||
if(mover in buckled_mobs)
|
||||
return TRUE
|
||||
return (!mover.density || !density || !(mobility_flags & MOBILITY_STAND))
|
||||
|
||||
/mob/living/toggle_move_intent()
|
||||
. = ..()
|
||||
update_move_intent_slowdown()
|
||||
|
||||
@@ -48,9 +48,8 @@
|
||||
|
||||
|
||||
/mob/living/silicon/ai/bullet_act(obj/item/projectile/Proj)
|
||||
..(Proj)
|
||||
. = ..(Proj)
|
||||
updatehealth()
|
||||
return 2
|
||||
|
||||
/mob/living/silicon/ai/flash_act(intensity = 1, override_blindness_check = 0, affect_silicon = 0)
|
||||
return // no eyes, no flashing
|
||||
|
||||
@@ -178,8 +178,7 @@
|
||||
adjustBruteLoss(30)
|
||||
|
||||
/mob/living/silicon/robot/bullet_act(var/obj/item/projectile/Proj, def_zone)
|
||||
..()
|
||||
. = ..()
|
||||
updatehealth()
|
||||
if(prob(75) && Proj.damage > 0)
|
||||
spark_system.start()
|
||||
return 2
|
||||
|
||||
@@ -124,7 +124,7 @@
|
||||
unbuckle_mob(M)
|
||||
M.visible_message("<span class='boldwarning'>[M] is knocked off of [src] by the [Proj]!</span>")
|
||||
Proj.on_hit(src)
|
||||
return 2
|
||||
return BULLET_ACT_HIT
|
||||
|
||||
/mob/living/silicon/flash_act(intensity = 1, override_blindness_check = 0, affect_silicon = 0, visual = 0, type = /obj/screen/fullscreen/flash/static)
|
||||
if(affect_silicon)
|
||||
|
||||
@@ -105,11 +105,9 @@
|
||||
return TRUE
|
||||
|
||||
/mob/living/simple_animal/bullet_act(obj/item/projectile/Proj)
|
||||
if(!Proj)
|
||||
return
|
||||
apply_damage(Proj.damage, Proj.damage_type)
|
||||
Proj.on_hit(src)
|
||||
return 0
|
||||
return BULLET_ACT_HIT
|
||||
|
||||
/mob/living/simple_animal/ex_act(severity, target, origin)
|
||||
if(origin && istype(origin, /datum/spacevine_mutation) && isvineimmune(src))
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
/mob/living/simple_animal/bot/secbot/grievous/bullet_act(obj/item/projectile/P)
|
||||
visible_message("[src] deflects [P] with its energy swords!")
|
||||
playsound(src, 'sound/weapons/blade1.ogg', 50, TRUE)
|
||||
return FALSE
|
||||
return BULLET_ACT_BLOCK
|
||||
|
||||
/mob/living/simple_animal/bot/secbot/grievous/Crossed(atom/movable/AM)
|
||||
..()
|
||||
|
||||
@@ -210,7 +210,7 @@ Auto Patrol[]"},
|
||||
if((Proj.damage_type == BURN) || (Proj.damage_type == BRUTE))
|
||||
if(!Proj.nodamage && Proj.damage < src.health && ishuman(Proj.firer))
|
||||
retaliate(Proj.firer)
|
||||
..()
|
||||
return ..()
|
||||
|
||||
/mob/living/simple_animal/bot/ed209/handle_automated_action()
|
||||
if(!..())
|
||||
@@ -510,11 +510,11 @@ Auto Patrol[]"},
|
||||
spawn(100)
|
||||
disabled = 0
|
||||
icon_state = "[lasercolor]ed2091"
|
||||
return 1
|
||||
return BULLET_ACT_HIT
|
||||
else
|
||||
..(Proj)
|
||||
. = ..()
|
||||
else
|
||||
..(Proj)
|
||||
. = ..()
|
||||
|
||||
/mob/living/simple_animal/bot/ed209/bluetag
|
||||
lasercolor = "b"
|
||||
|
||||
@@ -138,7 +138,7 @@ Maintenance panel panel is [open ? "opened" : "closed"]"},
|
||||
/mob/living/simple_animal/bot/honkbot/bullet_act(obj/item/projectile/Proj)
|
||||
if((istype(Proj,/obj/item/projectile/beam)) || (istype(Proj,/obj/item/projectile/bullet) && (Proj.damage_type == BURN))||(Proj.damage_type == BRUTE) && (!Proj.nodamage && Proj.damage < health && ishuman(Proj.firer)))
|
||||
retaliate(Proj.firer)
|
||||
..()
|
||||
return ..()
|
||||
|
||||
/mob/living/simple_animal/bot/honkbot/UnarmedAttack(atom/A)
|
||||
if(!on)
|
||||
|
||||
@@ -149,7 +149,8 @@
|
||||
return
|
||||
|
||||
/mob/living/simple_animal/bot/mulebot/bullet_act(obj/item/projectile/Proj)
|
||||
if(..())
|
||||
. = ..()
|
||||
if(.)
|
||||
if(prob(50) && !isnull(load))
|
||||
unload(0)
|
||||
if(prob(25))
|
||||
|
||||
@@ -204,8 +204,7 @@ Auto Patrol: []"},
|
||||
if((Proj.damage_type == BURN) || (Proj.damage_type == BRUTE))
|
||||
if(!Proj.nodamage && Proj.damage < src.health && ishuman(Proj.firer))
|
||||
retaliate(Proj.firer)
|
||||
..()
|
||||
|
||||
return ..()
|
||||
|
||||
/mob/living/simple_animal/bot/secbot/UnarmedAttack(atom/A)
|
||||
if(!on)
|
||||
@@ -219,7 +218,6 @@ Auto Patrol: []"},
|
||||
else
|
||||
..()
|
||||
|
||||
|
||||
/mob/living/simple_animal/bot/secbot/hitby(atom/movable/AM, skipcatch = FALSE, hitpush = TRUE, blocked = FALSE, datum/thrownthing/throwingdatum)
|
||||
if(istype(AM, /obj/item))
|
||||
var/obj/item/I = AM
|
||||
@@ -228,7 +226,6 @@ Auto Patrol: []"},
|
||||
retaliate(H)
|
||||
..()
|
||||
|
||||
|
||||
/mob/living/simple_animal/bot/secbot/proc/cuff(mob/living/carbon/C)
|
||||
mode = BOT_ARREST
|
||||
playsound(src, 'sound/weapons/cablecuff.ogg', 30, TRUE, -2)
|
||||
|
||||
@@ -173,9 +173,7 @@
|
||||
|
||||
return -1 // complete projectile permutation
|
||||
|
||||
return (..(P))
|
||||
|
||||
|
||||
return ..()
|
||||
|
||||
////////////////////////Wraith/////////////////////////////////////////////
|
||||
/mob/living/simple_animal/hostile/construct/wraith
|
||||
|
||||
@@ -117,7 +117,7 @@ Difficulty: Very Hard
|
||||
|
||||
var/random_y = rand(0, 72)
|
||||
AT.pixel_y += random_y
|
||||
..()
|
||||
return ..()
|
||||
|
||||
/mob/living/simple_animal/hostile/megafauna/colossus/proc/enrage(mob/living/L)
|
||||
if(ishuman(L))
|
||||
@@ -395,7 +395,7 @@ Difficulty: Very Hard
|
||||
..()
|
||||
|
||||
/obj/machinery/anomalous_crystal/bullet_act(obj/item/projectile/P, def_zone)
|
||||
..()
|
||||
. = ..()
|
||||
if(istype(P, /obj/item/projectile/magic))
|
||||
ActivationReaction(P.firer, ACTIVATE_MAGIC, P.damage_type)
|
||||
return
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
|
||||
/mob/living/simple_animal/hostile/asteroid/goldgrub/bullet_act(obj/item/projectile/P)
|
||||
visible_message("<span class='danger'>The [P.name] was repelled by [name]'s girth!</span>")
|
||||
return
|
||||
return BULLET_ACT_BLOCK
|
||||
|
||||
/mob/living/simple_animal/hostile/asteroid/goldgrub/adjustHealth(amount, updating_health = TRUE, forced = FALSE)
|
||||
vision_range = 9
|
||||
|
||||
@@ -177,9 +177,10 @@
|
||||
if(T.throwforce)
|
||||
Bruise()
|
||||
|
||||
/mob/living/simple_animal/hostile/mushroom/bullet_act()
|
||||
..()
|
||||
Bruise()
|
||||
/mob/living/simple_animal/hostile/mushroom/bullet_act(obj/item/projectile/P)
|
||||
. = ..()
|
||||
if(P.nodamage)
|
||||
Bruise()
|
||||
|
||||
/mob/living/simple_animal/hostile/mushroom/harvest()
|
||||
var/counter
|
||||
|
||||
@@ -84,6 +84,7 @@
|
||||
attacktext = "slashes"
|
||||
attack_sound = 'sound/weapons/bladeslice.ogg'
|
||||
status_flags = 0
|
||||
var/projectile_deflect_chance = 50
|
||||
|
||||
/mob/living/simple_animal/hostile/syndicate/melee/space
|
||||
icon_state = "syndicate_space_knife"
|
||||
@@ -128,13 +129,11 @@
|
||||
return ..()
|
||||
|
||||
/mob/living/simple_animal/hostile/syndicate/melee/bullet_act(obj/item/projectile/Proj)
|
||||
if(!Proj)
|
||||
return
|
||||
if(prob(50))
|
||||
if(prob(projectile_deflect_chance))
|
||||
return ..()
|
||||
else
|
||||
visible_message("<span class='danger'>[src] blocks [Proj] with its shield!</span>")
|
||||
return 0
|
||||
return BULLET_ACT_BLOCK
|
||||
|
||||
/mob/living/simple_animal/hostile/syndicate/melee/sword/space
|
||||
icon_state = "syndicate_space_sword"
|
||||
|
||||
@@ -337,7 +337,7 @@
|
||||
|
||||
//Bullets
|
||||
/mob/living/simple_animal/parrot/bullet_act(obj/item/projectile/Proj)
|
||||
..()
|
||||
. = ..()
|
||||
if(!stat && !client)
|
||||
if(parrot_state == PARROT_PERCH)
|
||||
parrot_sleep_dur = parrot_sleep_max //Reset it's sleep timer if it was perched
|
||||
@@ -347,8 +347,6 @@
|
||||
//parrot_been_shot += 5
|
||||
icon_state = icon_living
|
||||
drop_held_item(0)
|
||||
return
|
||||
|
||||
|
||||
/*
|
||||
* AI - Not really intelligent, but I'm calling it AI anyway.
|
||||
|
||||
@@ -219,15 +219,13 @@
|
||||
return ..() //Heals them
|
||||
|
||||
/mob/living/simple_animal/slime/bullet_act(obj/item/projectile/Proj)
|
||||
if(!Proj)
|
||||
return
|
||||
attacked += 10
|
||||
if((Proj.damage_type == BURN))
|
||||
adjustBruteLoss(-abs(Proj.damage)) //fire projectiles heals slimes.
|
||||
Proj.on_hit(src)
|
||||
else
|
||||
..(Proj)
|
||||
return 0
|
||||
. = ..(Proj)
|
||||
. = . || BULLET_ACT_BLOCK
|
||||
|
||||
/mob/living/simple_animal/slime/emp_act(severity)
|
||||
. = ..()
|
||||
|
||||
@@ -1,18 +1,6 @@
|
||||
/mob/CanPass(atom/movable/mover, turf/target)
|
||||
return TRUE //There's almost no cases where non /living mobs should be used in game as actual mobs, other than ghosts.
|
||||
|
||||
/mob/living/CanPass(atom/movable/mover, turf/target)
|
||||
if((mover.pass_flags & PASSMOB))
|
||||
return TRUE
|
||||
if(istype(mover, /obj/item/projectile) || mover.throwing)
|
||||
return (!density || !(mobility_flags & MOBILITY_STAND))
|
||||
if(buckled == mover)
|
||||
return TRUE
|
||||
if(ismob(mover))
|
||||
if (mover in buckled_mobs)
|
||||
return TRUE
|
||||
return (!mover.density || !density || !(mobility_flags & MOBILITY_STAND))
|
||||
|
||||
//DO NOT USE THIS UNLESS YOU ABSOLUTELY HAVE TO. THIS IS BEING PHASED OUT FOR THE MOVESPEED MODIFICATION SYSTEM.
|
||||
//See mob_movespeed.dm
|
||||
/mob/proc/movement_delay() //update /living/movement_delay() if you change this
|
||||
|
||||
@@ -79,7 +79,7 @@
|
||||
addtimer(CALLBACK(GLOBAL_PROC, .proc/explosion, get_turf(src), 2, 3, 4, 8), 100) // Not a normal explosion.
|
||||
|
||||
/obj/machinery/power/rtg/abductor/bullet_act(obj/item/projectile/Proj)
|
||||
..()
|
||||
. = ..()
|
||||
if(!going_kaboom && istype(Proj) && !Proj.nodamage && ((Proj.damage_type == BURN) || (Proj.damage_type == BRUTE)))
|
||||
log_bomber(Proj.firer, "triggered a", src, "explosion via projectile")
|
||||
overload()
|
||||
|
||||
@@ -161,7 +161,7 @@ field_generator power level display
|
||||
if(Proj.flag != "bullet")
|
||||
power = min(power + Proj.damage, field_generator_max_power)
|
||||
check_power_level()
|
||||
..()
|
||||
. = ..()
|
||||
|
||||
|
||||
/obj/machinery/field/generator/Destroy()
|
||||
@@ -336,7 +336,7 @@ field_generator power level display
|
||||
message_admins("A singulo exists and a containment field has failed at [ADMIN_VERBOSEJMP(T)].")
|
||||
investigate_log("has <font color='red'>failed</font> whilst a singulo exists at [AREACOORD(T)].", INVESTIGATE_SINGULO)
|
||||
O.last_warning = world.time
|
||||
|
||||
|
||||
move_resist = initial(move_resist)
|
||||
|
||||
/obj/machinery/field/generator/shock(mob/living/user)
|
||||
|
||||
@@ -113,7 +113,8 @@
|
||||
|
||||
|
||||
/obj/singularity/bullet_act(obj/item/projectile/P)
|
||||
return 0 //Will there be an impact? Who knows. Will we see it? No.
|
||||
qdel(P)
|
||||
return BULLET_ACT_HIT //Will there be an impact? Who knows. Will we see it? No.
|
||||
|
||||
|
||||
/obj/singularity/Bump(atom/A)
|
||||
|
||||
@@ -489,7 +489,7 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
|
||||
has_been_powered = TRUE
|
||||
else if(takes_damage)
|
||||
damage += Proj.damage * config_bullet_energy
|
||||
return FALSE
|
||||
return BULLET_ACT_HIT
|
||||
|
||||
/obj/machinery/power/supermatter_crystal/singularity_act()
|
||||
var/gain = 100
|
||||
|
||||
@@ -219,6 +219,7 @@
|
||||
|
||||
/obj/item/projectile/Bump(atom/A)
|
||||
var/datum/point/pcache = trajectory.copy_to()
|
||||
var/turf/T = get_turf(A)
|
||||
if(check_ricochet(A) && check_ricochet_flag(A) && ricochets < ricochets_max)
|
||||
ricochets++
|
||||
if(A.handle_ricochet(src))
|
||||
@@ -233,11 +234,11 @@
|
||||
var/mob/checking = firer
|
||||
if((A == firer) || (((A in firer.buckled_mobs) || (istype(checking) && (A == checking.buckled))) && (A != original)) || (A == firer.loc && ismecha(A))) //cannot shoot yourself or your mech
|
||||
trajectory_ignore_forcemove = TRUE
|
||||
forceMove(get_turf(A))
|
||||
forceMove(T)
|
||||
trajectory_ignore_forcemove = FALSE
|
||||
return FALSE
|
||||
|
||||
var/distance = get_dist(get_turf(A), starting) // Get the distance between the turf shot from and the mob we hit and use that for the calculations.
|
||||
var/distance = get_dist(T, starting) // Get the distance between the turf shot from and the mob we hit and use that for the calculations.
|
||||
def_zone = ran_zone(def_zone, max(100-(7*distance), 5)) //Lower accurancy/longer range tradeoff. 7 is a balanced number to use.
|
||||
|
||||
if(isturf(A) && hitsound_wall)
|
||||
@@ -246,50 +247,66 @@
|
||||
volume = 5
|
||||
playsound(loc, hitsound_wall, volume, 1, -1)
|
||||
|
||||
if(!prehit(A))
|
||||
return FALSE
|
||||
return process_hit(T, select_target(T, A))
|
||||
|
||||
var/permutation = A.bullet_act(src, def_zone) // searches for return value, could be deleted after run so check A isn't null
|
||||
if(permutation == -1) // the bullet passes through a dense object!
|
||||
#define QDEL_SELF 1 //Delete if we're not UNSTOPPABLE flagged non-temporarily
|
||||
#define DO_NOT_QDEL 2 //Pass through.
|
||||
#define FORCE_QDEL 3 //Force deletion.
|
||||
|
||||
/obj/item/projectile/proc/process_hit(turf/T, atom/target, qdel_self, hit_something = FALSE) //probably needs to be reworked entirely when pixel movement is done.
|
||||
if(QDELETED(src) || !T || !target) //We're done, nothing's left.
|
||||
if((qdel_self == FORCE_QDEL) || ((qdel_self == QDEL_SELF) && !temporary_unstoppable_movement && !CHECK_BITFIELD(movement_type, UNSTOPPABLE)))
|
||||
qdel(src)
|
||||
return hit_something
|
||||
permutated |= target //Make sure we're never hitting it again. If we ever run into weirdness with piercing projectiles needing to hit something multiple times.. well.. that's a to-do.
|
||||
if(!prehit(target))
|
||||
return process_hit(T, select_target(T), qdel_self, hit_something) //Hit whatever else we can since that didn't work.
|
||||
var/result = target.bullet_act(src, def_zone)
|
||||
if(result == BULLET_ACT_FORCE_PIERCE)
|
||||
if(!CHECK_BITFIELD(movement_type, UNSTOPPABLE))
|
||||
temporary_unstoppable_movement = TRUE
|
||||
ENABLE_BITFIELD(movement_type, UNSTOPPABLE)
|
||||
if(A)
|
||||
permutated.Add(A)
|
||||
return FALSE
|
||||
else
|
||||
var/atom/alt = select_target(A)
|
||||
if(alt)
|
||||
if(!prehit(alt))
|
||||
return FALSE
|
||||
alt.bullet_act(src, def_zone)
|
||||
if(!CHECK_BITFIELD(movement_type, UNSTOPPABLE))
|
||||
return process_hit(T, select_target(T), qdel_self, TRUE) //Hit whatever else we can since we're piercing through but we're still on the same tile.
|
||||
else if(result == BULLET_ACT_TURF) //We hit the turf but instead we're going to also hit something else on it.
|
||||
return process_hit(T, select_target(T), QDEL_SELF, TRUE)
|
||||
else //Whether it hit or blocked, we're done!
|
||||
qdel_self = QDEL_SELF
|
||||
hit_something = TRUE
|
||||
if((qdel_self == FORCE_QDEL) || ((qdel_self == QDEL_SELF) && !temporary_unstoppable_movement && !CHECK_BITFIELD(movement_type, UNSTOPPABLE)))
|
||||
qdel(src)
|
||||
return TRUE
|
||||
return hit_something
|
||||
|
||||
/obj/item/projectile/Move()
|
||||
. = ..()
|
||||
if(temporary_unstoppable_movement)
|
||||
DISABLE_BITFIELD(movement_type, UNSTOPPABLE)
|
||||
#undef QDEL_SELF
|
||||
#undef DO_NOT_QDEL
|
||||
#undef FORCE_QDEL
|
||||
|
||||
/obj/item/projectile/proc/select_target(atom/A) //Selects another target from a wall if we hit a wall.
|
||||
if(!A || !A.density || (A.flags_1 & ON_BORDER_1) || ismob(A) || A == original) //if we hit a dense non-border obj or dense turf then we also hit one of the mobs or machines/structures on that tile.
|
||||
return
|
||||
var/turf/T = get_turf(A)
|
||||
if(original in T)
|
||||
/obj/item/projectile/proc/select_target(turf/T, atom/target) //Select a target from a turf.
|
||||
if((original in T) && can_hit_target(original, permutated, TRUE, TRUE))
|
||||
return original
|
||||
var/list/mob/living/possible_mobs = typecache_filter_list(T, GLOB.typecache_mob) - A
|
||||
if(target && can_hit_target(target, permutated, target == original, TRUE))
|
||||
return target
|
||||
var/list/mob/living/possible_mobs = typecache_filter_list(T, GLOB.typecache_mob)
|
||||
var/list/mob/mobs = list()
|
||||
for(var/mob/living/M in possible_mobs)
|
||||
if(!(M.mobility_flags & MOBILITY_STAND))
|
||||
if(!can_hit_target(M, permutated, M == original, TRUE))
|
||||
continue
|
||||
mobs += M
|
||||
var/mob/M = safepick(mobs)
|
||||
if(M)
|
||||
return M.lowest_buckled_mob()
|
||||
var/obj/O = safepick(typecache_filter_list(T, GLOB.typecache_machine_or_structure) - A)
|
||||
var/list/obj/possible_objs = typecache_filter_list(T, GLOB.typecache_machine_or_structure)
|
||||
var/list/obj/objs = list()
|
||||
for(var/obj/O in possible_objs)
|
||||
if(!can_hit_target(O, permutated, O == original, TRUE))
|
||||
continue
|
||||
objs += O
|
||||
var/obj/O = safepick(objs)
|
||||
if(O)
|
||||
return O
|
||||
//Nothing else is here that we can hit, hit the turf if we haven't.
|
||||
if(!(T in permutated) && can_hit_target(T, permutated, T == original, TRUE))
|
||||
return T
|
||||
//Returns null if nothing at all was found.
|
||||
|
||||
/obj/item/projectile/proc/check_ricochet()
|
||||
if(prob(ricochet_chance))
|
||||
@@ -480,8 +497,6 @@
|
||||
else if(T != loc)
|
||||
step_towards(src, T)
|
||||
hitscan_last = loc
|
||||
if(can_hit_target(original, permutated))
|
||||
Bump(original)
|
||||
if(!hitscanning && !forcemoved)
|
||||
pixel_x = trajectory.return_px() - trajectory.mpx * trajectory_multiplier * SSprojectiles.global_iterations_per_move
|
||||
pixel_y = trajectory.return_py() - trajectory.mpy * trajectory_multiplier * SSprojectiles.global_iterations_per_move
|
||||
@@ -510,8 +525,25 @@
|
||||
homing_offset_y = -homing_offset_y
|
||||
|
||||
//Returns true if the target atom is on our current turf and above the right layer
|
||||
/obj/item/projectile/proc/can_hit_target(atom/target, var/list/passthrough)
|
||||
return (target && ((target.layer >= PROJECTILE_HIT_THRESHHOLD_LAYER) || ismob(target)) && (loc == get_turf(target)) && (!(target in passthrough)))
|
||||
//If direct target is true it's the originally clicked target.
|
||||
/obj/item/projectile/proc/can_hit_target(atom/target, list/passthrough, direct_target = FALSE, ignore_loc = FALSE)
|
||||
if(QDELETED(target))
|
||||
return FALSE
|
||||
if(!ignore_loc && (loc != target.loc))
|
||||
return FALSE
|
||||
if(target in passthrough)
|
||||
return FALSE
|
||||
if(target.density) //This thing blocks projectiles, hit it regardless of layer/mob stuns/etc.
|
||||
return TRUE
|
||||
if(!isliving(target))
|
||||
if(target.layer < PROJECTILE_HIT_THRESHHOLD_LAYER)
|
||||
return FALSE
|
||||
else
|
||||
var/mob/living/L = target
|
||||
if(!direct_target)
|
||||
if(!CHECK_BITFIELD(L.mobility_flags, MOBILITY_USE | MOBILITY_STAND | MOBILITY_MOVE) || !(L.stat == CONSCIOUS)) //If they're able to 1. stand or 2. use items or 3. move, AND they are not softcrit, they are not stunned enough to dodge projectiles passing over.
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
//Spread is FORCED!
|
||||
/obj/item/projectile/proc/preparePixelProjectile(atom/target, atom/source, params, spread = 0)
|
||||
@@ -576,13 +608,17 @@
|
||||
. = ..()
|
||||
if(isliving(AM) && !(pass_flags & PASSMOB))
|
||||
var/mob/living/L = AM
|
||||
if(AM == original) //specific aiming for
|
||||
Bump(AM)
|
||||
if(AM.density) //blocks projectiles
|
||||
Bump(AM)
|
||||
if((L.mobility_flags & MOBILITY_USE|MOBILITY_STAND|MOBILITY_MOVE) & (MOBILITY_USE|MOBILITY_MOVE)) //If they're either able to move or use items, while crawling, they're not stunned enough to avoid projectiles.
|
||||
if(can_hit_target(L, permutated, (AM == original)))
|
||||
Bump(AM)
|
||||
|
||||
/obj/item/projectile/Move(atom/newloc, dir = NONE)
|
||||
. = ..()
|
||||
if(.)
|
||||
if(temporary_unstoppable_movement)
|
||||
DISABLE_BITFIELD(movement_type, UNSTOPPABLE)
|
||||
if(fired && can_hit_target(original, permutated, TRUE))
|
||||
Bump(original)
|
||||
|
||||
/obj/item/projectile/Destroy()
|
||||
if(hitscan)
|
||||
finalize_hitscan_and_generate_tracers()
|
||||
|
||||
@@ -81,7 +81,7 @@
|
||||
boom()
|
||||
|
||||
/obj/structure/reagent_dispensers/fueltank/bullet_act(obj/item/projectile/P)
|
||||
..()
|
||||
. = ..()
|
||||
if(!QDELETED(src)) //wasn't deleted by the projectile's effects.
|
||||
if(!P.nodamage && ((P.damage_type == BURN) || (P.damage_type == BRUTE)))
|
||||
log_bomber(P.firer, "detonated a", src, "via projectile")
|
||||
|
||||
@@ -99,5 +99,6 @@
|
||||
|
||||
/obj/effect/dummy/phased_mob/spell_jaunt/ex_act(blah)
|
||||
return
|
||||
|
||||
/obj/effect/dummy/phased_mob/spell_jaunt/bullet_act(blah)
|
||||
return
|
||||
return BULLET_ACT_FORCE_PIERCE
|
||||
|
||||
@@ -91,7 +91,7 @@
|
||||
return
|
||||
|
||||
/obj/effect/dummy/phased_mob/shadow/bullet_act()
|
||||
return
|
||||
return BULLET_ACT_FORCE_PIERCE
|
||||
|
||||
/obj/effect/dummy/phased_mob/shadow/singularity_act()
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user