//replaces our stun baton code with /tg/station's code /obj/item/weapon/melee/baton name = "stunbaton" desc = "A stun baton for incapacitating people with." icon_state = "stunbaton" item_state = "baton" slot_flags = SLOT_BELT force = 15 sharp = 0 edge = 0 throwforce = 7 w_class = 3 origin_tech = list(TECH_COMBAT = 2) attack_verb = list("beaten") var/stunforce = 0 var/agonyforce = 60 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. /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.checked_use(chrgdeductamt)) return 1 else status = 0 update_icon() return 0 return null /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)]" if(icon_state == "[initial(name)]_active") set_light(1.5, 1, "#FF6A00") else set_light(0) /obj/item/weapon/melee/baton/examine(mob/user) if(!..(user, 1)) return if(bcell) user <<"The baton is [round(bcell.percent())]% charged." if(!bcell) user <<"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.update_icon() 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 return ..() /obj/item/weapon/melee/baton/apply_hit_effect(mob/living/target, mob/living/user, var/hit_zone) if(isrobot(target)) return ..() var/agony = agonyforce var/stun = stunforce var/obj/item/organ/external/affecting = null if(ishuman(target)) var/mob/living/carbon/human/H = target affecting = H.get_organ(hit_zone) if(user.a_intent == I_HURT) . = ..() //whacking someone causes a much poorer electrical contact than deliberately prodding them. agony *= 0.5 stun *= 0.5 //we can't really extract the actual hit zone from ..(), unfortunately. Just act like they attacked the area they intended to. else if(!status) if(affecting) target.visible_message("[target] has been prodded in the [affecting.name] with [src] by [user]. Luckily it was off.") else target.visible_message("[target] has been prodded with [src] by [user]. Luckily it was off.") else if(affecting) target.visible_message("[target] has been prodded in the [affecting.name] with [src] by [user]!") else target.visible_message("[target] has been prodded with [src] by [user]!") playsound(loc, 'sound/weapons/Egloves.ogg', 50, 1, -1) //stun effects if(status) target.stun_effect_act(stun, agony, hit_zone, src) msg_admin_attack("[key_name(user)] stunned [key_name(target)] with the [src].") deductcharge(hitcost) if(ishuman(target)) var/mob/living/carbon/human/H = target H.forcesay(hit_appends) /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 //Makeshift stun baton. Replacement for stun gloves. /obj/item/weapon/melee/baton/cattleprod name = "stunprod" desc = "An improvised stun baton." icon_state = "stunprod_nocell" item_state = "prod" force = 3 throwforce = 5 stunforce = 0 agonyforce = 60 //same force as a stunbaton, but uses way more charge. hitcost = 2500 attack_verb = list("poked") slot_flags = null