mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 18:22:39 +00:00
Fixes #6575 and a few other issues
E-magging a bot, any bot, now produces adming logs. Now plays a sound when an ED-209 fires its laser. ED-209 no longer transform into Beepsky when attacking simple animals ED-209 can again use its laser.
This commit is contained in:
@@ -167,6 +167,7 @@
|
||||
#include "code\datums\spells\wizard.dm"
|
||||
#include "code\defines\obj.dm"
|
||||
#include "code\defines\obj\weapon.dm"
|
||||
#include "code\defines\procs\admin.dm"
|
||||
#include "code\defines\procs\announce.dm"
|
||||
#include "code\defines\procs\AStar.dm"
|
||||
#include "code\defines\procs\command_alert.dm"
|
||||
|
||||
3
code/defines/procs/admin.dm
Normal file
3
code/defines/procs/admin.dm
Normal file
@@ -0,0 +1,3 @@
|
||||
proc/log_and_message_admins(var/message as text)
|
||||
log_admin("[usr]([usr.ckey]) " + message)
|
||||
message_admins("[usr]([usr.ckey]) " + message)
|
||||
@@ -38,8 +38,10 @@
|
||||
locked = 0
|
||||
emagged = 1
|
||||
user << "<span class='warning'>You short out [src]'s maintenance hatch lock.</span>"
|
||||
log_and_message_admins("emagged [src]'s maintenance hatch lock")
|
||||
if(!locked && open)
|
||||
emagged = 2
|
||||
log_and_message_admins("emagged [src]'s inner circuits")
|
||||
|
||||
/obj/machinery/bot/examine()
|
||||
set src in view()
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
bot_version = "2.5"
|
||||
search_range = 12
|
||||
has_laser = 1
|
||||
|
||||
preparing_arrest_sounds = new()
|
||||
secbot_assembly = /obj/item/weapon/secbot_assembly/ed209_assembly
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
var/arrest_type = 0 //If true, don't handcuff
|
||||
var/declare_arrests = 0 //When making an arrest, should it notify everyone wearing sechuds?
|
||||
|
||||
var/has_laser = 0
|
||||
var/next_harm_time = 0
|
||||
var/lastfired = 0
|
||||
var/shot_delay = 3 //.3 seconds between shots
|
||||
@@ -249,9 +250,6 @@ Auto Patrol: []"},
|
||||
mode = SECBOT_START_PATROL // switch to patrol mode
|
||||
|
||||
if(SECBOT_HUNT) // hunting for perp
|
||||
if(src.lasercolor)//Lasertag bots do not tase or arrest anyone, just patrol and shoot and whatnot
|
||||
mode = SECBOT_IDLE
|
||||
return
|
||||
// if can't reach perp for long enough, go idle
|
||||
if(src.frustration >= 8)
|
||||
// for(var/mob/O in hearers(src, null))
|
||||
@@ -263,7 +261,7 @@ Auto Patrol: []"},
|
||||
walk_to(src,0)
|
||||
|
||||
if(target) // make sure target exists
|
||||
if(Adjacent(target)) // if right next to perp
|
||||
if(!lasercolor && Adjacent(target)) // If right next to perp. Lasertag bots do not arrest anyone, just patrol and shoot and whatnot
|
||||
if(istype(src.target,/mob/living/carbon))
|
||||
playsound(src.loc, 'sound/weapons/Egloves.ogg', 50, 1, -1)
|
||||
is_attacking = 1
|
||||
@@ -301,19 +299,22 @@ Auto Patrol: []"},
|
||||
next_harm_time = world.time + 15
|
||||
playsound(src.loc, 'sound/weapons/Egloves.ogg', 50, 1, -1)
|
||||
visible_message("\red <B>[src] beats [src.target] with the stun baton!</B>")
|
||||
src.icon_state = "secbot-c"
|
||||
update_icon()
|
||||
spawn(2)
|
||||
src.icon_state = "secbot[src.on]"
|
||||
is_attacking = 0
|
||||
update_icon()
|
||||
|
||||
var/mob/living/simple_animal/S = src.target
|
||||
S.AdjustStunned(10)
|
||||
S.adjustBruteLoss(15)
|
||||
if(S.stat)
|
||||
src.frustration = 8
|
||||
playsound(src.loc, pick('sound/voice/bgod.ogg', 'sound/voice/biamthelaw.ogg', 'sound/voice/bsecureday.ogg', 'sound/voice/bradio.ogg', 'sound/voice/bcreep.ogg'), 50, 0)
|
||||
if(preparing_arrest_sounds.len > 0)
|
||||
playsound(src.loc, pick(preparing_arrest_sounds), 50, 0)
|
||||
else // not next to perp
|
||||
var/turf/olddist = get_dist(src, src.target)
|
||||
walk_to(src, src.target,1,4)
|
||||
walk_to(src, target,1,4)
|
||||
shootAt(target)
|
||||
if((get_dist(src, src.target)) >= (olddist))
|
||||
src.frustration++
|
||||
else
|
||||
@@ -632,13 +633,13 @@ Auto Patrol: []"},
|
||||
for(var/mob/living/M in view(search_range,src)) //Let's find us a criminal
|
||||
if(istype(M, /mob/living/carbon))
|
||||
var/mob/living/carbon/C = M
|
||||
if((C.stat) || (C.handcuffed))
|
||||
if(C.stat || C.handcuffed)
|
||||
continue
|
||||
|
||||
if((src.lasercolor) && (C.lying))
|
||||
if(src.lasercolor && C.lying)
|
||||
continue//Does not shoot at people lying down when in lasertag mode, because it's just annoying, and they can fire once they get up.
|
||||
|
||||
if((C.name == src.oldtarget_name) && (world.time < src.last_found + 100))
|
||||
if(C.name == src.oldtarget_name && world.time < src.last_found + 100)
|
||||
continue
|
||||
|
||||
if(istype(C, /mob/living/carbon/human))
|
||||
@@ -653,13 +654,14 @@ Auto Patrol: []"},
|
||||
if(!src.threatlevel)
|
||||
continue
|
||||
|
||||
else if(src.threatlevel >= 4)
|
||||
else if(M.stat != DEAD && src.threatlevel >= 4)
|
||||
src.target = M
|
||||
src.oldtarget_name = M.name
|
||||
src.speak("Level [src.threatlevel] infraction alert!")
|
||||
if(!src.lasercolor && threat_found_sounds.len > 0)
|
||||
playsound(src.loc, pick(threat_found_sounds), 50, 0)
|
||||
src.visible_message("<b>[src]</b> points at [M.name]!")
|
||||
|
||||
mode = SECBOT_HUNT
|
||||
spawn(0)
|
||||
process() // ensure bot quickly responds to a perp
|
||||
@@ -672,6 +674,9 @@ Auto Patrol: []"},
|
||||
/obj/machinery/bot/secbot/proc/assess_perp(mob/living/carbon/human/perp as mob)
|
||||
var/threatcount = 0
|
||||
|
||||
if(perp.stat == DEAD)
|
||||
return 0
|
||||
|
||||
if(src.emagged == 2) return 10 //Everyone is a criminal!
|
||||
|
||||
if(src.idcheck && !src.allowed(perp))
|
||||
@@ -858,7 +863,7 @@ Auto Patrol: []"},
|
||||
src.created_name = t
|
||||
|
||||
/obj/machinery/bot/secbot/proc/shootAt(var/mob/target)
|
||||
if(lastfired && world.time - lastfired < shot_delay)
|
||||
if(!has_laser || (lastfired && world.time - lastfired < shot_delay))
|
||||
return
|
||||
lastfired = world.time
|
||||
var/turf/T = loc
|
||||
@@ -870,9 +875,6 @@ Auto Patrol: []"},
|
||||
if(!( istype(T, /turf) ))
|
||||
return
|
||||
|
||||
//if(lastfired && world.time - lastfired < 100)
|
||||
// playsound(src.loc, 'ed209_shoot.ogg', 50, 0)
|
||||
|
||||
if(!projectile)
|
||||
if(!lasercolor)
|
||||
if(src.emagged == 2)
|
||||
@@ -892,6 +894,8 @@ Auto Patrol: []"},
|
||||
|
||||
if(!( istype(U, /turf) ))
|
||||
return
|
||||
|
||||
playsound(src.loc, src.emagged == 2 ? 'sound/weapons/Laser.ogg' : 'sound/weapons/Taser.ogg', 50, 1)
|
||||
var/obj/item/projectile/A = new projectile (loc)
|
||||
A.current = U
|
||||
A.yo = U.y - T.y
|
||||
|
||||
Reference in New Issue
Block a user