Fixes vehicles granting projectile immunity and YET AGAIN reworks projectile targetting priorities (#31660)
* Update projectile.dm * fixes projectiles
This commit is contained in:
committed by
CitadelStationBot
parent
cc96777b6b
commit
87b84cedf0
@@ -6,8 +6,13 @@
|
||||
|
||||
/mob/living/carbon/isloyal()
|
||||
for(var/obj/item/implant/mindshield/L in implants)
|
||||
return 1
|
||||
return TRUE
|
||||
|
||||
/mob/proc/lowest_buckled_mob()
|
||||
. = src
|
||||
if(buckled && ismob(buckled))
|
||||
var/mob/Buckled = buckled
|
||||
. = Buckled.lowest_buckled_mob()
|
||||
|
||||
/proc/check_zone(zone)
|
||||
if(!zone)
|
||||
|
||||
@@ -187,41 +187,42 @@
|
||||
if(forcedodge)
|
||||
loc = target_turf
|
||||
return FALSE
|
||||
var/permutation = select_target(A,target_turf) // searches for return value, could be deleted after run so check A isn't null
|
||||
|
||||
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 || forcedodge)// the bullet passes through a dense object!
|
||||
loc = target_turf
|
||||
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)
|
||||
qdel(src)
|
||||
return TRUE
|
||||
|
||||
/obj/item/projectile/proc/select_target(atom/A,target_turf)
|
||||
if((A && A.density && !(A.flags_1 & ON_BORDER_1)) && (istype(A,/obj/machinery) || isturf(A))) //if we hit a dense non-border obj or dense turf then we also hit one of the mobs on that tile.
|
||||
var/list/mobs_list = list()
|
||||
var/list/machine_list = list()
|
||||
for(var/mob/living/L in target_turf)
|
||||
mobs_list += L
|
||||
for(var/obj/machinery/m in target_turf)
|
||||
if(m.density)
|
||||
machine_list += m
|
||||
var/permutationbackup
|
||||
if(isturf(A))
|
||||
permutationbackup = A.bullet_act(src, def_zone) // Just in case the turf can deflect bullets
|
||||
if(mobs_list.len || machine_list.len)
|
||||
var/atom/movable/selected_target
|
||||
if(mobs_list.Find(original) || machine_list.Find(original))
|
||||
selected_target = original
|
||||
else if(mobs_list.len)
|
||||
selected_target = pick(mobs_list)
|
||||
else
|
||||
selected_target = pick(machine_list)
|
||||
if(!prehit(selected_target))
|
||||
return FALSE
|
||||
return selected_target.bullet_act(src, def_zone)
|
||||
return permutationbackup
|
||||
else
|
||||
return A.bullet_act(src, def_zone)
|
||||
|
||||
/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)) //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
|
||||
if(A == original || original in A)
|
||||
return original
|
||||
var/list/mob/possible_mobs = typecache_filter_list(A, GLOB.typecache_mob)
|
||||
var/list/mob/mobs = list()
|
||||
for(var/i in possible_mobs)
|
||||
var/mob/M = i
|
||||
if(M.lying)
|
||||
continue
|
||||
mobs += M
|
||||
var/mob/M = safepick(mobs)
|
||||
if(M)
|
||||
return M.lowest_buckled_mob()
|
||||
var/obj/O = safepick(typecache_filter_list(A, GLOB.typecache_machine_or_structure))
|
||||
if(O)
|
||||
return O
|
||||
return A
|
||||
|
||||
/obj/item/projectile/proc/check_ricochet()
|
||||
if(prob(ricochet_chance))
|
||||
|
||||
Reference in New Issue
Block a user