Skip to content

Commit

Permalink
makes secbots / ed209's not stupid as a fucking rock (#27087)
Browse files Browse the repository at this point in the history
* destupifies beepsky / ed209s

* make sure hands happen

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

Co-authored-by: Luc <[email protected]>
Signed-off-by: Qwertytoforty <[email protected]>

* lewcs stuff

---------

Signed-off-by: Qwertytoforty <[email protected]>
Co-authored-by: Luc <[email protected]>
  • Loading branch information
Qwertytoforty and lewcc authored Oct 22, 2024
1 parent 6818986 commit a243dae
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
2 changes: 2 additions & 0 deletions code/modules/mob/living/carbon/human/human_defense.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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()
10 changes: 8 additions & 2 deletions code/modules/mob/living/simple_animal/bot/ed209bot.dm
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -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)
Expand All @@ -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

Expand All @@ -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

Expand Down Expand Up @@ -582,3 +587,4 @@
back_to_idle()

#undef BATON_COOLDOWN
#undef BOT_REBATON_THRESHOLD
14 changes: 10 additions & 4 deletions code/modules/mob/living/simple_animal/bot/secbot.dm
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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.
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -470,3 +475,4 @@
..()

#undef BATON_COOLDOWN
#undef BOT_REBATON_THRESHOLD

0 comments on commit a243dae

Please sign in to comment.