mirror of
https://github.com/goonstation/goonstation-2020.git
synced 2026-07-14 00:22:21 +01:00
036a29b765
includes a lot of small things + fixes. big ones are Simple Lights, New Grab stuff, Disorient Eye/Ear protection armor values, access reprogrammer and deconstruction device also added flabo to the list of contributors, we missed her on the first go! check changelog for full list, i merged that too
86 lines
2.1 KiB
Plaintext
86 lines
2.1 KiB
Plaintext
// AI (i.e. game AI, not the AI player) controlled bots
|
|
|
|
/obj/machinery/bot
|
|
icon = 'icons/obj/aibots.dmi'
|
|
layer = MOB_LAYER
|
|
event_handler_flags = USE_FLUID_ENTER | USE_CANPASS
|
|
object_flags = CAN_REPROGRAM_ACCESS
|
|
var/obj/item/card/id/botcard // ID card that the bot "holds".
|
|
var/access_lookup = "Captain" // For the get_access() proc. Defaults to all-access.
|
|
var/locked = null
|
|
var/on = 1
|
|
var/health = 25
|
|
var/muted = 0 // shut up omg shut up.
|
|
var/no_camera = 0
|
|
var/setup_camera_network = "Robots"
|
|
var/obj/machinery/camera/cam = null
|
|
var/emagged = 0
|
|
var/mob/emagger = null
|
|
var/text2speech = 0 // dectalk!
|
|
p_class = 2
|
|
|
|
power_change()
|
|
return
|
|
|
|
CanPass(atom/movable/mover, turf/target, height=0, air_group=0)
|
|
if (istype(mover, /obj/projectile))
|
|
return 0
|
|
return ..()
|
|
|
|
New()
|
|
..()
|
|
|
|
if(!no_camera)
|
|
src.cam = new /obj/machinery/camera(src)
|
|
src.cam.c_tag = src.name
|
|
src.cam.network = setup_camera_network
|
|
|
|
disposing()
|
|
botcard = null
|
|
cam = null
|
|
..()
|
|
|
|
attackby(obj/item/W as obj, mob/user as mob)
|
|
user.lastattacked = src
|
|
..()
|
|
|
|
// Generic default. Override for specific bots as needed.
|
|
bullet_act(var/obj/projectile/P)
|
|
if (!P || !istype(P))
|
|
return
|
|
|
|
var/damage = 0
|
|
damage = round(((P.power/4)*P.proj_data.ks_ratio), 1.0)
|
|
|
|
if (P.proj_data.damage_type == D_KINETIC)
|
|
src.health -= damage
|
|
else if (P.proj_data.damage_type == D_PIERCING)
|
|
src.health -= (damage*2)
|
|
else if (P.proj_data.damage_type == D_ENERGY)
|
|
src.health -= damage
|
|
|
|
if (src.health <= 0)
|
|
src.explode()
|
|
return
|
|
|
|
proc/explode()
|
|
return
|
|
|
|
proc/speak(var/message)
|
|
if (!src.on || !message || src.muted)
|
|
return
|
|
src.audible_message("<span class='game say'><span class='name'>[src]</span> beeps, \"[message]\"")
|
|
if (src.text2speech)
|
|
SPAWN_DBG(0)
|
|
var/audio = dectalk("\[:nk\][message]")
|
|
if (audio && audio["audio"])
|
|
for (var/mob/O in hearers(src, null))
|
|
if (!O.client)
|
|
continue
|
|
if (O.client.ignore_sound_flags & (SOUND_VOX | SOUND_ALL))
|
|
continue
|
|
ehjax.send(O.client, "browseroutput", list("dectalk" = audio["audio"]))
|
|
return 1
|
|
else
|
|
return 0
|