/obj/item/device/flash name = "flash" desc = "Used for blinding and being an asshole." icon_state = "flash" item_state = "flashbang" //looks exactly like a flash (and nothing like a flashbang) throwforce = 5 w_class = 1.0 throw_speed = 4 throw_range = 10 flags = FPRINT | TABLEPASS| CONDUCT origin_tech = "magnets=2;combat=1" var/times_used = 0 //Number of times it's been used. var/broken = 0 //Is the flash burnt out? var/last_used = 0 //last world.time it was used. var/flashready = 0 //overcharge flashes var/overcharge = 0 //overcharge check /obj/item/device/flash/proc/clown_check(var/mob/user) if(user && (CLUMSY in user.mutations) && prob(50)) user << "\red \The [src] slips out of your hand." user.drop_item() return 0 return 1 /obj/item/device/flash/proc/flash_recharge() //capacitor recharges over time for(var/i=0, i<3, i++) if(last_used+600 > world.time) break last_used += 600 times_used -= 2 last_used = world.time times_used = max(0,round(times_used)) //sanity /obj/item/device/flash/attack(mob/living/M as mob, mob/user as mob) if(!user || !M) return //sanity M.attack_log += text("\[[time_stamp()]\] Has been flashed (attempt) with [src.name] by [user.name] ([user.ckey])") user.attack_log += text("\[[time_stamp()]\] Used the [src.name] to flash [M.name] ([M.ckey])") msg_admin_attack("[key_name_admin(user)] Used the [src.name] to flash [key_name_admin(M)] (JMP)") if(!clown_check(user)) return if(broken) user << "\The [src] is broken." return flash_recharge() //spamming the flash before it's fully charged (60seconds) increases the chance of it breaking //It will never break on the first use. switch(times_used) if(0 to 5) last_used = world.time if(overcharge == 1) icon_state = "cellflashburnt" broken = 1 user << "The bulb has burnt out!" else if(prob(times_used)) //if you use it 5 times in a minute it has a 10% chance to break! broken = 1 user << "The bulb has burnt out!" icon_state = "flashburnt" return times_used++ else //can only use it 5 times a minute user << "*click* *click*" return playsound(src.loc, 'sound/weapons/flash.ogg', 100, 1) var/flashfail = 0 if(iscarbon(M)) var/safety = M:eyecheck() if(overcharge == 1) M.adjust_fire_stacks(5) M.IgniteMob() user.visible_message("[user]'s supercharged flash ignites [M]!") if(prob(60)) var/mob/living/ur = user var/LIMB if(ur.hand) LIMB = "l_hand" else LIMB = "r_hand" ur.apply_damage(45, BURN, LIMB) user << "You burn your hand as the flash goes off" // broken = 1 // if(overcharge == 1) // icon_state = "cellflashburnt" if(safety <= 0) M.Weaken(10) flick("e_flash", M.flash) //Vaurca damage 18-09-15 var/mob/living/carbon/human/H = M if(H.species.flags & IS_BUG) var/datum/organ/internal/eyes/E = H.internal_organs_by_name["eyes"] if(!E) return //Reworked damage 19/09/15 usr << "\red Your eyes burn with the intense light of the flash!." E.damage += rand(10, 11) if(E.damage > 12) M.eye_blurry += rand(3,6) if (E.damage >= E.min_broken_damage) M.sdisabilities |= BLIND else if (E.damage >= E.min_bruised_damage) M.eye_blind = 5 M.eye_blurry = 5 M.disabilities |= NEARSIGHTED spawn(100) M.disabilities &= ~NEARSIGHTED if(ishuman(M) && ishuman(user) && M.stat!=DEAD) if(user.mind && user.mind in ticker.mode.head_revolutionaries && ticker.mode.name == "revolution") var/revsafe = 0 for(var/obj/item/weapon/implant/loyalty/L in M) if(L && L.implanted) revsafe = 1 break M.mind_initialize() //give them a mind datum if they don't have one. if(M.mind.has_been_rev) revsafe = 2 if(!revsafe) M.mind.has_been_rev = 1 ticker.mode.add_revolutionary(M.mind) else if(revsafe == 1) user << "Something seems to be blocking the flash!" else user << "This mind seems resistant to the flash!" else flashfail = 1 else if(issilicon(M)) M.Weaken(10) //why are robots more resistant to flashes than humans when it is their only weakness. besides ion rifles. used to be rand(5,10). changed to 10. if(overcharge == 1) M.adjust_fire_stacks(5) M.IgniteMob() user.visible_message("[user]'s supercharged flash ignites [M]!") if(prob(60)) var/mob/living/ur = user var/LIMB if(ur.hand) LIMB = "l_hand" else LIMB = "r_hand" ur.apply_damage(45, BURN, LIMB) user << "You burn your hand as the flash goes off" else flashfail = 1 if(isrobot(user)) spawn(0) var/atom/movable/overlay/animation = new(user.loc) animation.layer = user.layer + 1 animation.icon_state = "blank" animation.icon = 'icons/mob/mob.dmi' animation.master = user flick("blspell", animation) sleep(5) del(animation) if(!flashfail) if(overcharge == 0) flick("flash2", src) else if(overcharge == 1) flick("cellflash2", src) if(!issilicon(M)) user.visible_message("[user] blinds [M] with the flash!") else user.visible_message("[user] overloads [M]'s sensors with the flash!") else user.visible_message("[user] fails to blind [M] with the flash!") return /obj/item/device/flash/attack_self(mob/living/carbon/user as mob, flag = 0, emp = 0) if(!user || !clown_check(user)) return if(broken) user.show_message("The [src.name] is broken", 2) return flash_recharge() //spamming the flash before it's fully charged (60seconds) increases the chance of it breaking //It will never break on the first use. switch(times_used) if(0 to 5) if(overcharge == 1) icon_state = "cellflashburnt" broken = 1 user << "The bulb has burnt out!" else if(prob(2*times_used)) //if you use it 5 times in a minute it has a 10% chance to break! broken = 1 user << "The bulb has burnt out!" icon_state = "flashburnt" return times_used++ else //can only use it 5 times a minute user.show_message("*click* *click*", 2) return playsound(src.loc, 'sound/weapons/flash.ogg', 100, 1) if(overcharge == 0) flick("flash2", src) else if(overcharge == 1) flick("cellflash2", src) if(user && isrobot(user)) spawn(0) var/atom/movable/overlay/animation = new(user.loc) animation.layer = user.layer + 1 animation.icon_state = "blank" animation.icon = 'icons/mob/mob.dmi' animation.master = user flick("blspell", animation) sleep(5) del(animation) for(var/mob/living/carbon/M in oviewers(3, null)) if(prob(50)) if (locate(/obj/item/weapon/cloaking_device, M)) for(var/obj/item/weapon/cloaking_device/S in M) S.active = 0 S.icon_state = "shield0" var/safety = M:eyecheck() if(!safety) if(!M.blinded) flick("flash", M.flash) return /obj/item/device/flash/emp_act(severity) if(broken) return flash_recharge() switch(times_used) if(0 to 5) if(prob(2*times_used)) broken = 1 if(overcharge == 1) icon_state = "cellflashburnt" else if(overcharge == 0) icon_state = "flashburnt" return times_used++ if(istype(loc, /mob/living/carbon)) var/mob/living/carbon/M = loc var/safety = M.eyecheck() if(safety <= 0) M.Weaken(10) flick("e_flash", M.flash) for(var/mob/O in viewers(M, null)) O.show_message("[M] is blinded by the flash!") ..() /obj/item/device/flash/synthetic name = "synthetic flash" desc = "When a problem arises, SCIENCE is the solution." icon_state = "sflash" origin_tech = "magnets=2;combat=1" var/construction_cost = list("metal"=750,"glass"=750) var/construction_time=100 /obj/item/device/flash/synthetic/attack(mob/living/M as mob, mob/user as mob) ..() if(!broken) broken = 1 user << "\red The bulb has burnt out!" if(overcharge == 0) icon_state = "flashburnt" else if(overcharge == 1) icon_state = "cellflashburnt" /obj/item/device/flash/synthetic/attack_self(mob/living/carbon/user as mob, flag = 0, emp = 0) ..() if(!broken) broken = 1 user << "\red The bulb has burnt out!" if(overcharge == 0) icon_state = "flashburnt" else if(overcharge == 1) icon_state = "cellflashburnt" /obj/item/device/flash/attackby(obj/item/W, mob/user) if(istype(W,/obj/item/weapon/cell)) if(flashready == 1 && overcharge == 0) del(W) overcharge = 1 icon_state = "cellflash" user << "\red You attach the cell to the flash." name = "cell/flash assembly" desc = "When blinding and being an asshole just isn't enough." else if(overcharge == 1) user << "\red This flash already has a cell attached!" else if(istype(W, /obj/item/weapon/screwdriver)) if(overcharge == 0) user << "\red You ready the flash for modification." flashready = 1 else if(flashready == 1) user << "\red This flash has already been modified!."