makes secbots / ed209's not stupid as a fucking rock (#27087)

* destupifies beepsky / ed209s

* make sure hands happen

* Update code/modules/mob/living/carbon/human/human_defense.dm

Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com>
Signed-off-by: Qwertytoforty <52090703+Qwertytoforty@users.noreply.github.com>

* lewcs stuff

---------

Signed-off-by: Qwertytoforty <52090703+Qwertytoforty@users.noreply.github.com>
Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com>
This commit is contained in:
Qwertytoforty
2024-10-22 01:31:31 +00:00
committed by GitHub
co-authored by Luc
parent 6818986fcb
commit a243dae3d4
3 changed files with 20 additions and 6 deletions
@@ -840,3 +840,5 @@ emp_act
/mob/living/carbon/human/projectile_hit_check(obj/item/projectile/P)
return (HAS_TRAIT(src, TRAIT_FLOORED) || HAS_TRAIT(src, TRAIT_NOKNOCKDOWNSLOWDOWN)) && !density // hit mobs that are intentionally lying down to prevent combat crawling.
/mob/living/carbon/human/canBeHandcuffed()
return has_left_hand() || has_right_hand()
@@ -1,4 +1,5 @@
#define BATON_COOLDOWN 3.5 SECONDS
#define BOT_REBATON_THRESHOLD 5 SECONDS
/mob/living/simple_animal/bot/ed209
name = "\improper ED-209 Security Robot"
@@ -279,6 +280,10 @@
back_to_idle()
return
if(target.stat == DEAD)
back_to_idle() // Stop beating up the dead guy
return
if(Adjacent(target) && isturf(target.loc) && !baton_delayed) // if right next to perp
stun_attack(target)
if(!lasercolor)
@@ -296,7 +301,7 @@
if(BOT_PREP_ARREST) // preparing to arrest target
// see if he got away. If he's no no longer adjacent or inside a closet or about to get up, we hunt again.
if(!Adjacent(target) || !isturf(target.loc) || world.time - target.stam_regen_start_time < 4 SECONDS && target.getStaminaLoss() <= 100)
if(!Adjacent(target) || !isturf(target.loc) || target.stam_regen_start_time - world.time <= BOT_REBATON_THRESHOLD || target.getStaminaLoss() <= 100)
back_to_hunt()
return
@@ -321,7 +326,7 @@
back_to_idle()
return
if(!Adjacent(target) || !isturf(target.loc) || (target.loc != target_lastloc && world.time - target.stam_regen_start_time < 4 SECONDS && target.getStaminaLoss() <= 100)) //if he's changed loc and about to get up or not adjacent or got into a closet, we prep arrest again.
if(!Adjacent(target) || !isturf(target.loc) || (target.loc != target_lastloc && target.stam_regen_start_time - world.time <= BOT_REBATON_THRESHOLD || target.getStaminaLoss() <= 100)) //if he's changed loc and about to get up or not adjacent or got into a closet, we prep arrest again.
back_to_hunt()
return
@@ -582,3 +587,4 @@
back_to_idle()
#undef BATON_COOLDOWN
#undef BOT_REBATON_THRESHOLD
@@ -1,4 +1,5 @@
#define BATON_COOLDOWN 3.5 SECONDS
#define BOT_REBATON_THRESHOLD 5 SECONDS
/mob/living/simple_animal/bot/secbot
name = "\improper Securitron"
@@ -330,6 +331,10 @@
back_to_idle()
return
if(target.stat == DEAD)
back_to_idle() // Stop beating up the dead guy
return
if(Adjacent(target) && isturf(target.loc) && !baton_delayed) // if right next to perp
stun_attack(target)
mode = BOT_PREP_ARREST
@@ -341,7 +346,7 @@
if(BOT_PREP_ARREST) // preparing to arrest target
// see if he got away. If he's no no longer adjacent or inside a closet or about to get up, we hunt again.
if(!Adjacent(target) || !isturf(target.loc) || world.time - target.stam_regen_start_time < 4 SECONDS && target.getStaminaLoss() <= 100)
if(!Adjacent(target) || !isturf(target.loc) || target.stam_regen_start_time - world.time <= BOT_REBATON_THRESHOLD|| target.getStaminaLoss() <= 100)
back_to_hunt()
return
// target is stunned and nearby
@@ -362,12 +367,12 @@
back_to_idle()
if(BOT_ARREST)
if(BOT_ARREST) // Fun fact: This is not called
if(!target || target.handcuffed)
back_to_idle()
return
if(!Adjacent(target) || !isturf(target.loc) || (target.loc != target_lastloc && target.AmountWeakened() < 4 SECONDS)) //if he's changed loc and about to get up or not adjacent or got into a closet, we prep arrest again.
if(!Adjacent(target) || !isturf(target.loc) || (target.loc != target_lastloc && target.stam_regen_start_time - world.time <= BOT_REBATON_THRESHOLD || target.getStaminaLoss() <= 100)) //if he's changed loc and about to get up or not adjacent or got into a closet, we prep arrest again.
back_to_hunt()
return
//Try arresting again if the target escapes.
@@ -407,7 +412,7 @@
if((C.stat) || (C.handcuffed))
continue
if((C.name == oldtarget_name) && (world.time < last_found + 100))
if((C.name == oldtarget_name) && (world.time < last_found + 5 SECONDS))
continue
threatlevel = C.assess_threat(src)
@@ -470,3 +475,4 @@
..()
#undef BATON_COOLDOWN
#undef BOT_REBATON_THRESHOLD