Merge pull request #13398 from AnturK/morebotfix

More Bot Fixes
This commit is contained in:
Jordie
2015-12-06 17:13:10 +11:00
6 changed files with 47 additions and 39 deletions
@@ -280,7 +280,7 @@
text_dehack_fail = "You fail to reset [name]."
/mob/living/simple_animal/bot/attack_ai(mob/user as mob)
attack_hand(user)
show_controls(user)
/mob/living/simple_animal/bot/proc/speak(message,channel) //Pass a message to have the bot say() it. Pass a frequency to say it on the radio.
if((!on) || (!message))
@@ -709,13 +709,12 @@ Pass a positive integer as an argument to override a bot's default speed.
//No ..() to prevent strip panel showing up - Todo: make that saner
if(topic_denied(usr))
usr << "<span class='warning'>[src]'s interface is not responding!</span>"
href_list = list()
return
return 1
add_fingerprint(usr)
if(href_list["close"])// HUE HUE
if(usr in users)
users.Remove(usr)
return
return 1
if((href_list["power"]) && (bot_core.allowed(usr) || !locked))
if (on)
turn_off()
@@ -761,12 +760,11 @@ Pass a positive integer as an argument to override a bot's default speed.
/mob/living/simple_animal/bot/proc/topic_denied(mob/user) //Access check proc for bot topics! Remember to place in a bot's individual Topic if desired.
// 0 for access, 1 for denied.
if(emagged == 2) //An emagged bot cannot be controlled by humans, silicons can if one hacked it.
if(hacked) //Manually emagged by a human - access denied to all.
if(!hacked) //Manually emagged by a human - access denied to all.
return 1
else if(!issilicon(user)) //Bot is hacked, so only silicons are allowed access.
return 1
else
return 0
return 0
/mob/living/simple_animal/bot/proc/hack(mob/user)
var/hack
@@ -231,7 +231,8 @@ text("<A href='?src=\ref[src];power=1'>[on ? "On" : "Off"]</A>"))
return dat
/mob/living/simple_animal/bot/cleanbot/Topic(href, href_list)
..()
if(..())
return 1
switch(href_list["operation"])
if("blood")
blood =!blood
@@ -130,7 +130,8 @@ Auto Patrol[]"},
return
else if((lasercolor == "r") && (istype(H.wear_suit, /obj/item/clothing/suit/bluetag)))
return
..()
if(..())
return 1
switch(href_list["operation"])
if ("idcheck")
@@ -149,19 +150,27 @@ Auto Patrol[]"},
declare_arrests = !declare_arrests
update_controls()
/mob/living/simple_animal/bot/ed209/proc/retaliate(mob/living/carbon/human/H)
threatlevel = H.assess_threat(src)
threatlevel += 6
if(threatlevel >= 4)
target = H
mode = BOT_HUNT
/mob/living/simple_animal/bot/ed209/attack_hand(mob/living/carbon/human/H)
if(H.a_intent == "harm")
retaliate(H)
return ..()
/mob/living/simple_animal/bot/ed209/attackby(obj/item/weapon/W, mob/user, params)
..()
if(istype(W, /obj/item/weapon/weldingtool) && user.a_intent != "harm") // Any intent but harm will heal, so we shouldn't get angry.
return
if (!istype(W, /obj/item/weapon/screwdriver) && (!target)) // Added check for welding tool to fix #2432. Welding tool behavior is handled in superclass.
if(W.force && W.damtype != STAMINA)//If force is non-zero and damage type isn't stamina.
threatlevel = user.assess_threat(src)
threatlevel += 6
if(threatlevel >= 4)
target = user
if(lasercolor)//To make up for the fact that lasertag bots don't hunt
shootAt(user)
mode = BOT_HUNT
retaliate(user)
if(lasercolor)//To make up for the fact that lasertag bots don't hunt
shootAt(user)
/mob/living/simple_animal/bot/ed209/Emag(mob/user)
..()
@@ -178,11 +187,7 @@ Auto Patrol[]"},
if(istype(Proj ,/obj/item/projectile/beam)||istype(Proj,/obj/item/projectile/bullet))
if((Proj.damage_type == BURN) || (Proj.damage_type == BRUTE))
if (!Proj.nodamage && Proj.damage < src.health)
threatlevel = Proj.firer.assess_threat(src)
threatlevel += 6
if(threatlevel >= 4)
target = Proj.firer
mode = BOT_HUNT
retaliate(Proj.firer)
..()
/mob/living/simple_animal/bot/ed209/handle_automated_action()
@@ -522,10 +527,7 @@ Auto Patrol[]"},
/mob/living/simple_animal/bot/ed209/RangedAttack(atom/A)
if(!on)
return
if(ismob(A))
shootAt(A)
else
..()
shootAt(A)
/mob/living/simple_animal/bot/ed209/proc/stun_attack(mob/living/carbon/C)
playsound(loc, 'sound/weapons/Egloves.ogg', 50, 1, -1)
@@ -118,7 +118,9 @@
user << "<span class='danger'>[src] buzzes and beeps.</span>"
/mob/living/simple_animal/bot/floorbot/Topic(href, href_list)
..()
if(..())
return 1
switch(href_list["operation"])
if("replace")
replacetiles = !replacetiles
@@ -157,7 +157,8 @@
return dat
/mob/living/simple_animal/bot/medbot/Topic(href, href_list)
..()
if(..())
return 1
if(href_list["adj_threshold"])
var/adjust_num = text2num(href_list["adj_threshold"])
@@ -106,8 +106,8 @@ Auto Patrol: []"},
return dat
/mob/living/simple_animal/bot/secbot/Topic(href, href_list)
..()
if(..())
return 1
switch(href_list["operation"])
if("idcheck")
@@ -126,16 +126,24 @@ Auto Patrol: []"},
declare_arrests = !declare_arrests
update_controls()
/mob/living/simple_animal/bot/secbot/proc/retaliate(mob/living/carbon/human/H)
threatlevel = H.assess_threat(src)
threatlevel += 6
if(threatlevel >= 4)
target = H
mode = BOT_HUNT
/mob/living/simple_animal/bot/secbot/attack_hand(mob/living/carbon/human/H)
if(H.a_intent == "harm")
retaliate(H)
return ..()
/mob/living/simple_animal/bot/secbot/attackby(obj/item/weapon/W, mob/user, params)
..()
if(istype(W, /obj/item/weapon/weldingtool) && user.a_intent != "harm") // Any intent but harm will heal, so we shouldn't get angry.
return
if(!istype(W, /obj/item/weapon/screwdriver) && (W.force) && (!target) && (W.damtype != STAMINA) ) // Added check for welding tool to fix #2432. Welding tool behavior is handled in superclass.
threatlevel = user.assess_threat(src)
threatlevel += 6
if(threatlevel >= 4)
target = user
mode = BOT_HUNT
retaliate(user)
/mob/living/simple_animal/bot/secbot/Emag(mob/user)
..()
@@ -152,11 +160,7 @@ Auto Patrol: []"},
if(istype(Proj ,/obj/item/projectile/beam)||istype(Proj,/obj/item/projectile/bullet))
if((Proj.damage_type == BURN) || (Proj.damage_type == BRUTE))
if (!Proj.nodamage && Proj.damage < src.health)
threatlevel = Proj.firer.assess_threat(src)
threatlevel += 6
if(threatlevel >= 4)
target = Proj.firer
mode = BOT_HUNT
retaliate(Proj.firer)
..()