Syndicate turrets (and other machines in walls) can now be hit by projectiles. Also reworks target priorities. (#31012)
* Projectile code additions * Adds !prehit checks and corrects the check for energy cannon spam * Adds checks for machines and structures to stop double hitting * JJRcop Requesting Fixes #1 * JJRcop Requested Fixes #2 * Fixes projectiles unable to hit mobs in machines * Adds in a new proc select_target, and rewrites some bits Fixes projectiles double hitting when targetting machines with mobs on them, also makes it so weapons with forcedodge can hit targets inside walls. * AnturK requested fix #1
This commit is contained in:
committed by
CitadelStationBot
parent
eb9737912c
commit
9050cc63ca
@@ -161,27 +161,42 @@
|
||||
if(forcedodge)
|
||||
loc = target_turf
|
||||
return FALSE
|
||||
var/permutation = A.bullet_act(src, def_zone) // searches for return value, could be deleted after run so check A isn't null
|
||||
var/permutation = select_target(A,target_turf) // 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
|
||||
if(A && A.density && !ismob(A) && !(A.flags_1 & ON_BORDER_1)) //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()
|
||||
for(var/mob/living/L in target_turf)
|
||||
mobs_list += L
|
||||
if(mobs_list.len)
|
||||
var/mob/living/picked_mob = pick(mobs_list)
|
||||
if(!prehit(picked_mob))
|
||||
return FALSE
|
||||
if(ismob(picked_mob.buckled))
|
||||
picked_mob = picked_mob.buckled
|
||||
picked_mob.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/check_ricochet()
|
||||
if(prob(ricochet_chance))
|
||||
return TRUE
|
||||
|
||||
Reference in New Issue
Block a user