fix some runtimes and an overlay overflow (#15915)

* fix some runtimes and memleaks

* .
This commit is contained in:
Kashargul
2024-04-11 09:08:39 +10:00
committed by GitHub
parent 029cae3d27
commit 4c90f3953d
7 changed files with 29 additions and 23 deletions
+7 -9
View File
@@ -3,11 +3,11 @@
// Used when a target is out of sight or invisible.
/datum/ai_holder/proc/engage_unseen_enemy()
ai_log("engage_unseen_enemy() : Entering.", AI_LOG_TRACE)
// Also handled in strategic updates but handling it here allows for more fine resolution timeouts
if((lose_target_time+lose_target_timeout) <= world.time)
return find_target()
// Lets do some last things before giving up.
if(conserve_ammo || !holder.ICheckRangedAttack(target_last_seen_turf))
// We conserve ammo (or can't shoot) so walk closer
@@ -29,7 +29,7 @@
on_engagement(T)
if(firing_lanes && !test_projectile_safety(T))
step_rand(holder)
holder.face_atom(T)
holder?.face_atom(T)
return ATTACK_FAILED
return ranged_attack(T)
@@ -60,7 +60,7 @@
/obj/structure/stairs/top,
/obj/structure/stairs/bottom
)
if(intelligence_level >= AI_SMART)
possible_escape_types += /obj/structure/ladder
@@ -69,18 +69,18 @@
continue // Not something they could have escaped through
if(turn(holder.dir, 180) & get_dir(get_turf(holder), get_turf(A)))
continue // Surely, they couldn't have escaped *behind* us!
if(istype(A, /obj/machinery/door))
var/obj/machinery/door/D = A
if(D.glass) // Surely, they couldn't hide behind a transparent door!
continue
if(D.density && intelligence_level < AI_SMART) // Surely, they couldn't have escaped through a *closed* door
continue
var/dist = get_dist(holder, A)
if(dist == closest_dist)
closest_escape += A
else if(dist < closest_dist)
closest_escape.Cut()
closest_escape += A
@@ -89,5 +89,3 @@
if(closest_escape.len)
return pick(closest_escape)
return null
+5 -1
View File
@@ -18,6 +18,8 @@
else
ammo = projectile_gun.contents[1]
P = ammo.BB
if(!P)
return "no"
switch(P.damage)
if(0)
return "no"
@@ -57,6 +59,8 @@
else
ammo = projectile_gun.contents[1]
P = ammo.BB
if(!P)
return "no"
switch(P.armor_penetration)
if(0)
return "cannot pierce armor"
@@ -149,4 +153,4 @@
if(reach > 1)
weapon_stats += "\nIt can attack targets up to [reach] tiles away, and can attack over certain objects."
return weapon_stats
return weapon_stats
+2 -2
View File
@@ -140,7 +140,7 @@
if(affecting)
to_chat(target, "<span class='danger'>\The [fruit]'s thorns pierce your [affecting.name] greedily!</span>")
target.apply_damage(damage, BRUTE, target_limb, blocked, soaked, "Thorns", sharp = TRUE, edge=has_edge)
target.apply_damage(damage, BRUTE, target_limb, blocked, soaked, TRUE, has_edge, "Thorns")
else
to_chat(target, "<span class='danger'>\The [fruit]'s thorns pierce your flesh greedily!</span>")
target.adjustBruteLoss(damage)
@@ -149,7 +149,7 @@
has_edge = prob(get_trait(TRAIT_POTENCY)/5)
if(affecting)
to_chat(target, "<span class='danger'>\The [fruit]'s thorns dig deeply into your [affecting.name]!</span>")
target.apply_damage(damage, BRUTE, target_limb, blocked, "Thorns", sharp = TRUE, edge=has_edge)
target.apply_damage(damage, BRUTE, target_limb, blocked, soaked, TRUE, has_edge, "Thorns")
else
to_chat(target, "<span class='danger'>\The [fruit]'s thorns dig deeply into your flesh!</span>")
target.adjustBruteLoss(damage)
+5 -1
View File
@@ -336,6 +336,8 @@
// PERSON BEING HIT: CAN BE DROP PRED, ALLOWS THROW VORE.
// PERSON BEING THROWN: DEVOURABLE, ALLOWS THROW VORE, CAN BE DROP PREY.
if((can_be_drop_pred && throw_vore) && (thrown_mob.devourable && thrown_mob.throw_vore && thrown_mob.can_be_drop_prey)) //Prey thrown into pred.
if(!vore_selected)
return
vore_selected.nom_mob(thrown_mob) //Eat them!!!
visible_message("<span class='vwarning'>[thrown_mob] is thrown right into [src]'s [lowertext(vore_selected.name)]!</span>")
if(thrown_mob.loc != vore_selected)
@@ -346,7 +348,9 @@
// PERSON BEING HIT: CAN BE DROP PREY, ALLOWS THROW VORE, AND IS DEVOURABLE.
// PERSON BEING THROWN: CAN BE DROP PRED, ALLOWS THROW VORE.
else if((can_be_drop_prey && throw_vore && devourable) && (thrown_mob.can_be_drop_pred && thrown_mob.throw_vore)) //Pred thrown into prey.
else if((can_be_drop_prey && throw_vore && devourable) && (thrown_mob.can_be_drop_pred && thrown_mob.throw_vore) && thrown_mob.vore_selected) //Pred thrown into prey.
if(!thrown_mob.vore_selected)
return
visible_message("<span class='vwarning'>[src] suddenly slips inside of [thrown_mob]'s [lowertext(thrown_mob.vore_selected.name)] as [thrown_mob] flies into them!</span>")
thrown_mob.vore_selected.nom_mob(src) //Eat them!!!
if(src.loc != thrown_mob.vore_selected)
+2
View File
@@ -163,6 +163,8 @@
page--
playsound(src, "pageturn", 50, 1)
if(href_list["remove"])
if(!pages.len)
return
var/obj/item/weapon/W = pages[page]
usr.put_in_hands(W)
pages.Remove(pages[page])
@@ -237,7 +237,7 @@
cut_overlays()
if(!hose_overlay)
hose_overlay = new icon(icon, "[icon_state]+hose")
hose_overlay = new/icon(icon, "[icon_state]+hose")
if(InputSocket.get_pairing())
add_overlay(hose_overlay)