removing unnecesary code from beepsky

This commit is contained in:
Nicaragua
2019-01-25 04:48:04 -03:00
parent 4fb7083be7
commit a5bd5875cb
4 changed files with 75 additions and 205 deletions

View File

@@ -5,8 +5,9 @@
icon_state = "griefsky0"
density = 0
anchored = 0
health = 25
maxHealth = 25
health = 150
maxHealth = 150
base_speed = 4 //he's a fast fucker
damage_coeff = list(BRUTE = 0.5, BURN = 0.7, TOX = 0, CLONE = 0, STAMINA = 0, OXY = 0)
pass_flags = PASSMOB
@@ -22,6 +23,9 @@
data_hud_type = DATA_HUD_SECURITY_ADVANCED
allow_pai = 0
var/spin_icon = "griefsky-c" // griefsky and griefsky junior have dif icons
var/dmg = 30
var/spam_flag = FALSE
var/base_icon = "griefsky"
var/mob/living/carbon/target
var/oldtarget_name
@@ -29,7 +33,7 @@
var/target_lastloc //Loc of target when arrested.
var/last_found //There's a delay
var/declare_arrests = 1 //When making an arrest, should it notify everyone on the security channel?
//var/idcheck = 0 //If true, arrest people with no IDs
var/idcheck = 0 //If true, arrest people with no IDs
var/weaponscheck = 0 //If true, arrest people for weapons if they lack access
var/check_records = 1 //Does it check security records?
var/arrest_type = 0 //If true, don't handcuff
@@ -38,40 +42,13 @@
var/prev_flashing_lights = 0 //REMOVE VARS WHEN DONE!!!!!!!!!!!!!PLEASE SACALAS >:/, ya estna en beepsky
var/onetime = 0
var/baton_type = /obj/item/melee/baton
/mob/living/simple_animal/bot/griefsky/proc/spam_flag_false() //used for addtimer to not spam comms
spam_flag = FALSE
/mob/living/simple_animal/bot/secbot/grievous/Initialize()
. = ..()
weapon = new baton_type(src)
weapon.attack_self(src)
/mob/living/simple_animal/bot/secbot/grievous/stun_attack(mob/living/carbon/C) //Criminals don't deserve to live
weapon.attack(C, src)
playsound(src, 'sound/weapons/blade1.ogg', 50, TRUE, -1)
if(C.stat == DEAD)
addtimer(CALLBACK(src, .proc/update_icon), 2)
back_to_idle()
/mob/living/simple_animal/bot/griefsky/explode()
/*/mob/living/simple_animal/bot/griefsky/explode()
var/turf/Tsec = get_turf(src)
new /obj/item/stock_parts/cell/potato(Tsec)
var/obj/item/reagent_containers/food/drinks/drinkingglass/S = new(Tsec)
S.reagents.add_reagent("whiskey", 15)
S.on_reagent_change()
..()
new /obj/item/melee/energy/sword(Tsec)
..() */
/mob/living/simple_animal/bot/griefsky/New()
..()
@@ -86,6 +63,12 @@ weapon.attack_self(src)
secsensor.add_hud_to(src)
permanent_huds |= secsensor
/mob/living/simple_animal/bot/griefsky/jgriefsky // cheaper griefsky less damage
name = "General griefsky"
desc = "It's Prison Ofitser! ."
dmg = 15
spin_icon = "griefskyj-c"
/mob/living/simple_animal/bot/griefsky/turn_on()
..()
icon_state = "[base_icon][on]"
@@ -113,7 +96,7 @@ weapon.attack_self(src)
dat += hack(user)
dat += showpai(user)
dat += text({"
<TT><B>Securitron v1.6 controls</B></TT><BR><BR>
<TT><B>Securitron v9.0 controls</B></TT><BR><BR>
Status: []<BR>
Behaviour controls are [locked ? "locked" : "unlocked"]<BR>
Maintenance panel panel is [open ? "opened" : "closed"]"},
@@ -159,8 +142,6 @@ Auto Patrol: []"},
declare_arrests = !declare_arrests
update_controls()
/*
/mob/living/simple_animal/bot/griefsky/proc/retaliate(mob/living/carbon/human/H)
threatlevel = H.assess_threat(src)
threatlevel += 6
@@ -190,28 +171,22 @@ Auto Patrol: []"},
declare_arrests = 0
icon_state = "[base_icon][on]"
/mob/living/simple_animal/bot/griefsky/bullet_act(obj/item/projectile/Proj)
/mob/living/simple_animal/bot/griefsky/bullet_act(obj/item/projectile/Proj) //if you fire him it will increase your threat level
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)
retaliate(Proj.firer)
..()
/mob/living/simple_animal/bot/griefsky/UnarmedAttack(atom/A)
/mob/living/simple_animal/bot/griefsky/UnarmedAttack(atom/A) //when controlled by a player
if(!on)
return
if(iscarbon(A))
var/mob/living/carbon/C = A
if(!C.stunned || arrest_type)
stun_attack(A)
else if(C.canBeHandcuffed() && !C.handcuffed)
cuff(A)
sword_attack(A)
else
..()
/mob/living/simple_animal/bot/griefsky/hitby(atom/movable/AM, skipcatch = 0, hitpush = 1, blocked = 0)
/mob/living/simple_animal/bot/griefsky/hitby(atom/movable/AM, skipcatch = 0, hitpush = 1, blocked = 0) //if you throw him something
if(istype(AM, /obj/item))
var/obj/item/I = AM
if(I.throwforce < src.health && I.thrownby && ishuman(I.thrownby))
@@ -220,7 +195,7 @@ Auto Patrol: []"},
..()
/mob/living/simple_animal/bot/griefsky/proc/cuff(mob/living/carbon/C)
/*/mob/living/simple_animal/bot/griefsky/proc/cuff(mob/living/carbon/C)
mode = BOT_ARREST
playsound(loc, 'sound/weapons/cablecuff.ogg', 30, 1, -2)
C.visible_message("<span class='danger'>[src] is trying to put zipties on [C]!</span>",\
@@ -232,24 +207,25 @@ Auto Patrol: []"},
C.handcuffed = new /obj/item/restraints/handcuffs/cable/zipties/used(C)
C.update_handcuffed()
playsound(loc, pick('sound/voice/bgod.ogg', 'sound/voice/biamthelaw.ogg', 'sound/voice/bsecureday.ogg', 'sound/voice/bradio.ogg', 'sound/voice/binsult.ogg', 'sound/voice/bcreep.ogg'), 50, 0)
back_to_idle()
back_to_idle() */
/mob/living/simple_animal/bot/griefsky/proc/stun_attack(mob/living/carbon/C)
playsound(loc, 'sound/weapons/Egloves.ogg', 50, 1, -1)
if(harmbaton)
playsound(loc, 'sound/weapons/genhit1.ogg', 50, 1, -1)
/mob/living/simple_animal/bot/griefsky/proc/sword_attack(mob/living/carbon/C) // esword attack
src.do_attack_animation(C)
playsound(loc, 'sound/weapons/blade1.ogg', 50, 1, -1)
spawn(2)
icon_state = "[base_icon][on]"
icon_state = spin_icon
var/threat = C.assess_threat(src)
if(ishuman(C) && harmbaton) // Bots with harmbaton enabled become shitcurity. - Dave
C.apply_damage(10, BRUTE)
C.SetStuttering(5)
C.Stun(5)
C.Weaken(5)
add_attack_logs(src, C, "stunned")
if(ishuman(C))
C.apply_damage(dmg, BRUTE)
if(prob(50))
C.Weaken(5)
add_attack_logs(src, C, "sliced")
if(declare_arrests)
var/area/location = get_area(src)
speak("[arrest_type ? "Detaining" : "Arresting"] level [threat] scumbag <b>[C]</b> in [location].", radio_channel)
if(!spam_flag)
speak("[arrest_type ? "Detaining" : "Arresting"] level [threat] scumbag <b>[C]</b> in [location].", radio_channel)
spam_flag = TRUE
addtimer(CALLBACK(src, .proc/spam_flag_false), 150) //to avoid spamming comms of sec for each hit
C.visible_message("<span class='danger'>[src] has [harmbaton ? "beaten" : "stunned"] [C]!</span>",\
"<span class='userdanger'>[src] has [harmbaton ? "beaten" : "stunned"] you!</span>")
@@ -290,32 +266,35 @@ Auto Patrol: []"},
if(BOT_HUNT) // hunting for perp
// if can't reach perp for long enough, go idle
icon_state = spin_icon
playsound(src,'sound/effects/spinsabre.ogg',100,TRUE,-1)
if(frustration >= 8)
walk_to(src,0)
back_to_idle()
return
if(target) // make sure target exists
if(Adjacent(target) && isturf(target.loc)) // if right next to perp
stun_attack(target)
if(target.stat == !DEAD)
if(Adjacent(target) && isturf(target.loc)) // if right next to perp
sword_attack(target)
mode = BOT_PREP_ARREST
anchored = 1
target_lastloc = target.loc
return
// mode = BOT_PREP_ARREST
anchored = 1
target_lastloc = target.loc
return
else // not next to perp
var/turf/olddist = get_dist(src, target)
walk_to(src, target,1,4)
if((get_dist(src, target)) >= (olddist))
frustration++
else
frustration = 0
else
back_to_idle()
else // not next to perp
var/turf/olddist = get_dist(src, target)
walk_to(src, target,1,4)
if((get_dist(src, target)) >= (olddist))
frustration++
else
frustration = 0
else
back_to_idle()
if(BOT_PREP_ARREST) // preparing to arrest target
icon_state = "griefsky-c"
// 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.weakened < 2 )
back_to_hunt()
@@ -324,7 +303,7 @@ Auto Patrol: []"},
if(iscarbon(target) && target.canBeHandcuffed())
if(!arrest_type)
if(!target.handcuffed) //he's not cuffed? Try to cuff him!
cuff(target)
//cuff(target)
else
back_to_idle()
return
@@ -332,7 +311,7 @@ Auto Patrol: []"},
back_to_idle()
return
if(BOT_ARREST)
/* if(BOT_ARREST)
if(!target)
anchored = 0
mode = BOT_IDLE
@@ -349,17 +328,16 @@ Auto Patrol: []"},
return
else //Try arresting again if the target escapes.
mode = BOT_PREP_ARREST
anchored = 0
anchored = 0 */
if(BOT_START_PATROL)
look_for_perp()
start_patrol()
if(BOT_PATROL)
icon_state = "griefsky1"
look_for_perp()
bot_patrol()
return
/mob/living/simple_animal/bot/griefsky/proc/back_to_idle()
@@ -399,8 +377,8 @@ Auto Patrol: []"},
speak("Level [threatlevel] infraction alert!")
playsound(loc, pick('sound/voice/bcriminal.ogg', 'sound/voice/bjustice.ogg', 'sound/voice/bfreeze.ogg'), 50, 0)
visible_message("<b>[src]</b> points at [C.name]!")
playsound(loc, 'sound/weapons/saberon.ogg', 50, 1, -1)
mode = BOT_HUNT
icon_state = "griefsky-c"
spawn(0)
handle_automated_action() // ensure bot quickly responds to a perp
break
@@ -411,26 +389,17 @@ Auto Patrol: []"},
return 1
return 0
/*/mob/living/simple_animal/bot/griefsky/explode()
/mob/living/simple_animal/bot/griefsky/explode()
walk_to(src,0)
visible_message("<span class='userdanger'>[src] blows apart!</span>")
var/turf/Tsec = get_turf(src)
var/obj/item/griefsky_assembly/Sa = new /obj/item/griefsky_assembly(Tsec)
Sa.build_step = 1
Sa.overlays += "hs_hole"
Sa.created_name = name
visible_message("<span class='boldannounce'>[src] lets out a huge cough as it blows apart!</span>")
var/atom/Tsec = drop_location()
new /obj/item/assembly/prox_sensor(Tsec)
new /obj/item/melee/baton(Tsec)
if(prob(50))
new /obj/item/robot_parts/l_arm(Tsec)
do_sparks(3, 1, src)
new /obj/item/robot_parts/r_arm(Tsec)
if(prob(75))
new /obj/item/melee/energy/sword(Tsec)
do_sparks(3, TRUE, src)
new /obj/effect/decal/cleanable/blood/oil(loc)
..()*/
/mob/living/simple_animal/bot/griefsky/attack_alien(var/mob/living/carbon/alien/user as mob)
..()
@@ -452,111 +421,12 @@ Auto Patrol: []"},
"[C] leaps out of [src]'s way!")]</span>")
C.Weaken(2)
return
..() */
..()
/mob/living/simple_animal/bot/secbot/griefsky/Crossed(atom/movable/AM)
..()
if(ismob(AM) && AM == target)
visible_message("[src] flails his swords and cuts [AM]!")
playsound(src,'sound/effects/beepskyspinsabre.ogg',100,TRUE,-1)
stun_attack(AM)
/mob/living/simple_animal/bot/secbot/griefsky/Initialize()
. = ..()
weapon = new baton_type(src)
weapon.attack_self(src)
/mob/living/simple_animal/bot/secbot/griefsky/Destroy()
QDEL_NULL(weapon)
return ..()
/mob/living/simple_animal/bot/secbot/griefsky/special_retaliate_after_attack(mob/user)
if(mode != BOT_HUNT)
return
if(prob(block_chance))
visible_message("[src] deflects [user]'s attack with his energy swords!")
playsound(src, 'sound/weapons/blade1.ogg', 50, TRUE, -1)
return TRUE
/mob/living/simple_animal/bot/secbot/griefsky/stun_attack(mob/living/carbon/C) //Criminals don't deserve to live
weapon.attack(C, src)
playsound(src, 'sound/weapons/blade1.ogg', 50, TRUE, -1)
if(C.stat == DEAD)
addtimer(CALLBACK(src, .proc/update_icon), 2)
back_to_idle()
/mob/living/simple_animal/bot/secbot/griefsky/handle_automated_action()
if(!on)
return
switch(mode)
if(BOT_IDLE) // idle
update_icon()
walk_to(src,0)
look_for_perp() // see if any criminals are in range
if(!mode && auto_patrol) // still idle, and set to patrol
mode = BOT_START_PATROL // switch to patrol mode
if(BOT_HUNT) // hunting for perp
update_icon()
playsound(src,'sound/effects/beepskyspinsabre.ogg',100,TRUE,-1)
// general beepsky doesn't give up so easily, jedi scum
if(frustration >= 20)
walk_to(src,0)
back_to_idle()
return
if(target) // make sure target exists
if(Adjacent(target) && isturf(target.loc)) // if right next to perp
target_lastloc = target.loc //stun_attack() can clear the target if they're dead, so this needs to be set first
stun_attack(target)
anchored = TRUE
return
else // not next to perp
var/turf/olddist = get_dist(src, target)
walk_to(src, target,1,4)
if((get_dist(src, target)) >= (olddist))
frustration++
else
frustration = 0
else
back_to_idle()
if(BOT_START_PATROL)
look_for_perp()
start_patrol()
if(BOT_PATROL)
look_for_perp()
bot_patrol()
/mob/living/simple_animal/bot/secbot/griefsky/look_for_perp()
anchored = FALSE
var/judgement_criteria = judgement_criteria()
for (var/mob/living/carbon/C in view(7,src)) //Let's find us a criminal
if((C.stat) || (C.handcuffed))
continue
if((C.name == oldtarget_name) && (world.time < last_found + 100))
continue
threatlevel = C.assess_threat(judgement_criteria, weaponcheck=CALLBACK(src, .proc/check_for_weapons))
if(!threatlevel)
continue
else if(threatlevel >= 4)
target = C
oldtarget_name = C.name
speak("Level [threatlevel] infraction alert!")
playsound(src, pick('sound/voice/beepsky/criminal.ogg', 'sound/voice/beepsky/justice.ogg', 'sound/voice/beepsky/freeze.ogg'), 50, FALSE)
playsound(src,'sound/weapons/saberon.ogg',50,TRUE,-1)
visible_message("[src] ignites his energy swords!")
icon_state = "griefsky-c"
visible_message("<b>[src]</b> points at [C.name]!")
mode = BOT_HUNT
INVOKE_ASYNC(src, .proc/handle_automated_action)
break
else
continue
/mob/living/simple_animal/bot/griefsky/bullet_act(obj/item/projectile/P)
visible_message("[src] deflects [P] with its energy swords!")
playsound(loc, 'sound/weapons/blade1.ogg', 50, 1, FALSE)
return FALSE
/obj/machinery/bot_core/secbot
req_access = list(access_security)