/obj/item/weapon/melee/baton name = "stunbaton" desc = "A stun baton for incapacitating people with." icon_state = "stunbaton" item_state = "baton" flags = FPRINT | TABLEPASS slot_flags = SLOT_BELT force = 15 sharp = 0 edge = 0 throwforce = 7 w_class = 3 origin_tech = "combat=2" attack_verb = list("beaten") var/status = 0 //whether the thing is on or not var/obj/item/weapon/cell/bcell = null var/hitcost = 1000 //oh god why do power cells carry so much charge? We probably need to make a distinction between "industrial" sized power cells for APCs and power cells for everything else. var/mob/foundmob = "" //Throwing! And proc. /obj/item/weapon/melee/baton/suicide_act(mob/user) user.visible_message("[user] is putting the live [name] in \his mouth! It looks like \he's trying to commit suicide.") return (FIRELOSS) /obj/item/weapon/melee/baton/New() ..() update_icon() return /obj/item/weapon/melee/baton/loaded/New() //this one starts with a cell pre-installed. ..() bcell = new/obj/item/weapon/cell/high(src) update_icon() return /obj/item/weapon/melee/baton/proc/deductcharge(var/chrgdeductamt) if(bcell) if(bcell.use(chrgdeductamt)) return 1 else status = 0 update_icon() return 0 /obj/item/weapon/melee/baton/update_icon() if(status) icon_state = "[initial(name)]_active" else if(!bcell) icon_state = "[initial(name)]_nocell" else icon_state = "[initial(name)]" /obj/item/weapon/melee/baton/examine() set src in view(1) ..() if(bcell) usr <<"The baton is [round(bcell.percent())]% charged." if(!bcell) usr <<"The baton does not have a power source installed." /obj/item/weapon/melee/baton/attackby(obj/item/weapon/W, mob/user) if(istype(W, /obj/item/weapon/cell)) if(!bcell) user.drop_item() W.loc = src bcell = W user << "You install a cell in [src]." update_icon() else user << "[src] already has a cell." else if(istype(W, /obj/item/weapon/screwdriver)) if(bcell) bcell.updateicon() bcell.loc = get_turf(src.loc) bcell = null user << "You remove the cell from the [src]." status = 0 update_icon() return ..() return /obj/item/weapon/melee/baton/attack_self(mob/user) if(bcell && bcell.charge > hitcost) status = !status user << "[src] is now [status ? "on" : "off"]." playsound(loc, "sparks", 75, 1, -1) update_icon() else status = 0 if(!bcell) user << "[src] does not have a power source!" else user << "[src] is out of charge." add_fingerprint(user) /obj/item/weapon/melee/baton/attack(mob/M, mob/user) if(status && (CLUMSY in user.mutations) && prob(50)) user << "You accidentally hit yourself with the [src]!" user.Weaken(30) deductcharge(hitcost) return var/mob/living/carbon/human/H = M if(isrobot(M)) ..() return if(user.a_intent == "hurt") if(!..()) return //H.apply_effect(5, WEAKEN, 0) M.visible_message("[M] has been beaten with the [src] by [user]!") user.attack_log += "\[[time_stamp()]\] Beat [M.name] ([M.ckey]) with [src.name]" M.attack_log += "\[[time_stamp()]\] Beaten by [user.name] ([user.ckey]) with [src.name]" msg_admin_attack("[key_name_admin(user)] beat [key_name_admin(M)] with [src.name] (JMP)") playsound(loc, "swing_hit", 50, 1, -1) else if(!status) M.visible_message("[M] has been prodded with the [src] by [user]. Luckily it was off.") return if(status) H.apply_effect(10, STUN, 0) H.apply_effect(10, WEAKEN, 0) H.apply_effect(10, STUTTER, 0) user.lastattacked = M M.lastattacker = user if(isrobot(src.loc)) var/mob/living/silicon/robot/R = src.loc if(R && R.cell) R.cell.use(50) else deductcharge(hitcost) M.visible_message("[M] has been stunned with the [src] by [user]!") user.attack_log += "\[[time_stamp()]\] Stunned [M.name] ([M.ckey]) with [src.name]" M.attack_log += "\[[time_stamp()]\] Stunned by [user.name] ([user.ckey]) with [src.name]" msg_admin_attack("[key_name_admin(user)] stunned [key_name_admin(M)] with [src.name] - JMP") playsound(src.loc, 'sound/weapons/Egloves.ogg', 50, 1, -1) if(bcell && bcell.charge < hitcost) status = 0 update_icon() add_fingerprint(user) /obj/item/weapon/melee/baton/throw_impact(atom/hit_atom) . = ..() if (prob(50)) if(istype(hit_atom, /mob/living)) var/mob/living/carbon/human/H = hit_atom if(status) H.apply_effect(10, STUN, 0) H.apply_effect(10, WEAKEN, 0) H.apply_effect(10, STUTTER, 0) deductcharge(hitcost) for(var/mob/M in player_list) if(M.key == src.fingerprintslast) foundmob = M break H.visible_message("[src], thrown by [foundmob.name], strikes [H] and stuns them!") H.attack_log += "\[[time_stamp()]\] Stunned by thrown [src.name] last touched by ([src.fingerprintslast])" msg_admin_attack("Flying [src.name], last touched by ([src.fingerprintslast]) stunned [key_name_admin(H)] - JMP" ) /obj/item/weapon/melee/baton/emp_act(severity) if(bcell) bcell.emp_act(severity) //let's not duplicate code everywhere if we don't have to please. ..() //secborg stun baton module /obj/item/weapon/melee/baton/robot/attack_self(mob/user) //try to find our power cell var/mob/living/silicon/robot/R = loc if (istype(R)) bcell = R.cell return ..() /obj/item/weapon/melee/baton/robot/attackby(obj/item/weapon/W, mob/user) return /* *Stun Rod */ /obj/item/weapon/melee/baton/stunrod name = "stunrod" desc = "A more-than-lethal weapon used to deal with high threat situations." icon_state = "stunrod" item_state = "stunrod" flags = FPRINT | TABLEPASS slot_flags = SLOT_BELT force = 15 throwforce = 8 w_class = 3 origin_tech = "combat=4,illegal=2" /obj/item/weapon/melee/baton/stunrod/loaded/New() //this one starts with a cell pre-installed. ..() bcell = new/obj/item/weapon/cell/high(src) update_icon() return /* *Cattleprod */ /obj/item/weapon/melee/baton/cattleprod name = "stunprod" desc = "An improvised stun baton." icon_state = "stunprod_nocell" item_state = "prod" force = 3 throwforce = 5 hitcost = 2500 attack_verb = list("poked") slot_flags = null