Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moves ED209 / security bots to stamina batons #18232

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 17 additions & 9 deletions code/modules/mob/living/simple_animal/bot/ed209bot.dm
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
#define BATON_COOLDOWN 3.5 SECONDS

/mob/living/simple_animal/bot/ed209
name = "\improper ED-209 Security Robot"
desc = "A security robot. He looks less than thrilled."
icon = 'icons/obj/aibots.dmi'
icon_state = "ed2090"
density = 1
anchored = 0
health = 100
maxHealth = 100
health = 150
maxHealth = 150
damage_coeff = list(BRUTE = 0.5, BURN = 0.7, TOX = 0, CLONE = 0, STAMINA = 0, OXY = 0)
obj_damage = 60
environment_smash = 2 //Walls can't stop THE LAW
environment_smash = ENVIRONMENT_SMASH_WALLS //Walls can't stop THE LAW
mob_size = MOB_SIZE_LARGE

radio_channel = "Security"
Expand Down Expand Up @@ -42,6 +44,7 @@
var/arrest_type = 0 //If true, don't handcuff
var/projectile = /obj/item/projectile/beam/disabler //Holder for projectile type
var/shoot_sound = 'sound/weapons/taser.ogg'
var/baton_delayed = FALSE


/mob/living/simple_animal/bot/ed209/New(loc, created_name, created_lasercolor)
Expand Down Expand Up @@ -260,7 +263,7 @@
back_to_idle()

if(target) // make sure target exists
if(Adjacent(target) && isturf(target.loc)) // if right next to perp
if(Adjacent(target) && isturf(target.loc) && !baton_delayed) // if right next to perp
stun_attack(target)
if(!lasercolor)
mode = BOT_PREP_ARREST
Expand All @@ -286,7 +289,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) || target.AmountWeakened() < 4 SECONDS)
if(!Adjacent(target) || !isturf(target.loc) || world.time - target.stam_regen_start_time < 4 SECONDS && target.getStaminaLoss() <= 100)
back_to_hunt()
return

Expand All @@ -313,7 +316,7 @@
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 && 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.
back_to_hunt()
return
else
Expand Down Expand Up @@ -547,7 +550,7 @@
return
if(iscarbon(A))
var/mob/living/carbon/C = A
if(!C.IsStunned() || arrest_type)
if(!C.IsStunned() || arrest_type && !baton_delayed)
stun_attack(A)
else if(C.canBeHandcuffed() && !C.handcuffed)
cuff(A)
Expand All @@ -574,8 +577,11 @@
icon_state = "[lasercolor]ed209[on]"
var/threat = C.assess_threat(src)
C.SetStuttering(10 SECONDS)
C.Weaken(10 SECONDS)
add_attack_logs(src, C, "stunned")
C.adjustStaminaLoss(60)
baton_delayed = TRUE
addtimer(CALLBACK(C, .proc/KnockDown, 10 SECONDS), 2.5 SECONDS)
addtimer(VARSET_CALLBACK(src, baton_delayed, FALSE), BATON_COOLDOWN)
add_attack_logs(src, C, "batoned")
if(declare_arrests)
var/area/location = get_area(src)
speak("[arrest_type ? "Detaining" : "Arresting"] level [threat] scumbag <b>[C]</b> in [location].", radio_channel)
Expand All @@ -595,3 +601,5 @@
C.handcuffed = new /obj/item/restraints/handcuffs/cable/zipties/used(C)
C.update_handcuffed()
back_to_idle()

#undef BATON_COOLDOWN
29 changes: 21 additions & 8 deletions code/modules/mob/living/simple_animal/bot/secbot.dm
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
#define BATON_COOLDOWN 3.5 SECONDS

/mob/living/simple_animal/bot/secbot
name = "\improper Securitron"
desc = "A little security robot. He looks less than thrilled."
icon = 'icons/obj/aibots.dmi'
icon_state = "secbot0"
density = 0
anchored = 0
health = 25
maxHealth = 25
health = 60
maxHealth = 60
damage_coeff = list(BRUTE = 0.5, BURN = 0.7, TOX = 0, CLONE = 0, STAMINA = 0, OXY = 0)
pass_flags = PASSMOB

Expand Down Expand Up @@ -34,6 +36,7 @@
var/arrest_type = 0 //If true, don't handcuff
var/harmbaton = 0 //If true, beat instead of stun
var/flashing_lights = 0 //If true, flash lights
var/baton_delayed = FALSE
var/prev_flashing_lights = 0
allow_pai = 0

Expand Down Expand Up @@ -76,7 +79,8 @@

/mob/living/simple_animal/bot/secbot/armsky
name = "Sergeant-at-Armsky"
health = 45
health = 100
maxHealth = 100
idcheck = 1
arrest_type = 1
weaponscheck = 1
Expand Down Expand Up @@ -213,13 +217,16 @@
retaliate(Proj.firer)
..()

/mob/living/simple_animal/bot/secbot/projectile_hit_check(obj/item/projectile/P)
return FALSE


/mob/living/simple_animal/bot/secbot/UnarmedAttack(atom/A)
if(!on)
return
if(iscarbon(A))
var/mob/living/carbon/C = A
if(!C.IsStunned() || arrest_type)
if((!C.IsWeakened() || arrest_type) && !baton_delayed)
stun_attack(A)
else if(C.canBeHandcuffed() && !C.handcuffed)
cuff(A)
Expand Down Expand Up @@ -263,8 +270,11 @@
if(ishuman(C) && harmbaton) // Bots with harmbaton enabled become shitcurity. - Dave
C.apply_damage(10, BRUTE)
C.SetStuttering(10 SECONDS)
C.Weaken(10 SECONDS)
add_attack_logs(src, C, "stunned")
C.adjustStaminaLoss(60)
baton_delayed = TRUE
addtimer(CALLBACK(C, .proc/KnockDown, 10 SECONDS), 2.5 SECONDS)
addtimer(VARSET_CALLBACK(src, baton_delayed, FALSE), BATON_COOLDOWN)
add_attack_logs(src, C, "batoned")
if(declare_arrests)
var/area/location = get_area(src)
speak("[arrest_type ? "Detaining" : "Arresting"] level [threat] scumbag <b>[C]</b> in [location].", radio_channel)
Expand Down Expand Up @@ -314,7 +324,7 @@
return

if(target) // make sure target exists
if(Adjacent(target) && isturf(target.loc)) // if right next to perp
if(Adjacent(target) && isturf(target.loc) && !baton_delayed) // if right next to perp
stun_attack(target)

mode = BOT_PREP_ARREST
Expand All @@ -334,7 +344,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) || target.AmountWeakened() < 4 SECONDS)
if( !Adjacent(target) || !isturf(target.loc) || world.time - target.stam_regen_start_time < 4 SECONDS && target.getStaminaLoss() <= 100)
back_to_hunt()
return

Expand Down Expand Up @@ -427,6 +437,7 @@
return 1
return 0


/mob/living/simple_animal/bot/secbot/explode()
walk_to(src,0)
visible_message("<span class='userdanger'>[src] blows apart!</span>")
Expand Down Expand Up @@ -467,3 +478,5 @@

/obj/machinery/bot_core/secbot
req_access = list(ACCESS_SECURITY)

#undef BATON_COOLDOWN