mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 10:12:45 +00:00
[MIRROR] Revamps flash code (#11975)
Co-authored-by: Cameron Lennox <killer65311@gmail.com>
This commit is contained in:
committed by
GitHub
parent
927496ed84
commit
63993e2e74
@@ -10,16 +10,23 @@
|
||||
throw_range = 10
|
||||
origin_tech = list(TECH_MAGNET = 2, TECH_COMBAT = 1)
|
||||
|
||||
var/times_used = 0 //Number of times it's been used.
|
||||
var/broken = FALSE //Is the flash burnt out?
|
||||
var/last_used = 0 //last world.time it was used.
|
||||
var/max_flashes = 10 // How many times the flash can be used before needing to self recharge.
|
||||
var/halloss_per_flash = 30
|
||||
var/break_mod = 3 // The percent to break increased by every use on the flash.
|
||||
///Number of times it's been used.
|
||||
var/times_used = 0
|
||||
//Is the flash burnt out?
|
||||
var/broken = FALSE
|
||||
///last world.time it was used.
|
||||
var/last_used = 0
|
||||
///How many times the flash can be used before needing to self recharge.
|
||||
var/max_flashes = 10
|
||||
///Halloss damage per flash.
|
||||
var/halloss_per_flash = 60
|
||||
/// The percent to break increased by every use on the flash.
|
||||
var/break_mod = 3
|
||||
|
||||
var/can_break = TRUE // Can the flash break?
|
||||
var/can_repair = FALSE // Can you repair the flash?
|
||||
var/repairing = FALSE // Are we repairing right now?
|
||||
/// If the flash can break or not
|
||||
var/can_break = TRUE
|
||||
/// If the flash can be repaired or not.
|
||||
var/can_repair = TRUE
|
||||
|
||||
var/safe_flashes = 2 // How many flashes are kept in 1% breakchance?
|
||||
|
||||
@@ -42,11 +49,7 @@
|
||||
|
||||
/obj/item/flash/attackby(var/obj/item/W, var/mob/user)
|
||||
if(W.has_tool_quality(TOOL_SCREWDRIVER) && broken)
|
||||
if(repairing)
|
||||
to_chat(user, span_notice("\The [src] is already being repaired!"))
|
||||
return
|
||||
user.visible_message(span_infoplain(span_bold("\The [user]") + " starts trying to repair \the [src]'s bulb."))
|
||||
repairing = TRUE
|
||||
if(do_after(user, (40 SECONDS + rand(0, 20 SECONDS)) * W.toolspeed, target = src) && can_repair)
|
||||
if(prob(30))
|
||||
user.visible_message(span_notice("\The [user] successfully repairs \the [src]!"))
|
||||
@@ -55,7 +58,6 @@
|
||||
playsound(src, W.usesound, 50, 1)
|
||||
else
|
||||
user.visible_message(span_infoplain(span_bold("\The [user]") + " fails to repair \the [src]."))
|
||||
repairing = FALSE
|
||||
else
|
||||
..()
|
||||
|
||||
@@ -150,13 +152,13 @@
|
||||
return TRUE
|
||||
|
||||
//attack_as_weapon
|
||||
/obj/item/flash/attack(mob/living/M, mob/living/user, var/target_zone)
|
||||
if(!user || !M) return //sanity
|
||||
/obj/item/flash/attack(mob/living/target, mob/living/user, var/target_zone)
|
||||
if(!user || !target) return //sanity
|
||||
|
||||
add_attack_logs(user,M,"Flashed (attempt) with [src]")
|
||||
add_attack_logs(user,target,"Flashed (attempt) with [src]")
|
||||
|
||||
user.setClickCooldown(user.get_attack_speed(src))
|
||||
user.do_attack_animation(M)
|
||||
user.do_attack_animation(target)
|
||||
|
||||
if(!clown_check(user)) return
|
||||
if(broken)
|
||||
@@ -169,77 +171,76 @@
|
||||
return
|
||||
|
||||
playsound(src, 'sound/weapons/flash.ogg', 100, 1)
|
||||
var/flashfail = 0
|
||||
|
||||
if(ishuman(M))
|
||||
var/mob/living/carbon/human/H = M
|
||||
if(H.nif && H.nif.flag_check(NIF_V_FLASHPROT,NIF_FLAGS_VISION))
|
||||
flashfail = 1
|
||||
H.nif.notify("High intensity light detected, and blocked!",TRUE)
|
||||
if(FLASHPROOF in H.mutations)
|
||||
flashfail = 1
|
||||
if(isrobot(user))
|
||||
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)
|
||||
QDEL_IN(animation, 5)
|
||||
|
||||
if(iscarbon(M) && !flashfail) //VOREStation Add - NIF
|
||||
var/mob/living/carbon/C = M
|
||||
if(C.stat != DEAD)
|
||||
var/safety = C.eyecheck()
|
||||
if(safety <= 0)
|
||||
var/flash_strength = 10 //Vorestation edit, making flashes behave the same as flash rounds
|
||||
if(ishuman(C))
|
||||
var/mob/living/carbon/human/H = C
|
||||
flash_strength *= H.species.flash_mod
|
||||
if(attempt_flash(target))
|
||||
flick("flash2", src)
|
||||
if(issilicon(target))
|
||||
user.visible_message(span_notice("[user] overloads [target]'s sensors with the flash!"))
|
||||
else
|
||||
user.visible_message(span_disarm("[user] blinds [target] with the flash!"))
|
||||
return
|
||||
//fail message
|
||||
user.visible_message(span_notice("[user] fails to blind [target] with the flash!"))
|
||||
return
|
||||
|
||||
if(flash_strength > 0)
|
||||
H.Confuse(flash_strength + 5)
|
||||
H.Blind(flash_strength)
|
||||
H.eye_blurry = max(H.eye_blurry, flash_strength + 5)
|
||||
H.flash_eyes()
|
||||
H.adjustHalLoss(halloss_per_flash * (flash_strength / 5)) // Should take four flashes to stun.
|
||||
H.apply_damage(flash_strength * H.species.flash_burn/5, BURN, BP_HEAD, 0)
|
||||
/// Sees if we can flash the target and if so, does the effects of it.
|
||||
/// Returns TRUE if the flash went through, FALSE otherwise.
|
||||
/obj/item/flash/proc/attempt_flash(mob/living/target)
|
||||
if(!istype(target))
|
||||
return FALSE
|
||||
if(target.stat == DEAD) //no point, they're already gone.
|
||||
return FALSE
|
||||
if(FLASHPROOF in target.mutations)
|
||||
return FALSE
|
||||
var/flash_strength = 5
|
||||
var/flash_burn = 0
|
||||
|
||||
else
|
||||
flashfail = 1
|
||||
//Flashes can only flash THREE things: Humans, Silicons, and Robots. NOTHING ELSE!!!
|
||||
if(ishuman(target))
|
||||
var/mob/living/carbon/human/human_target = target
|
||||
if(human_target.nif && human_target.nif.flag_check(NIF_V_FLASHPROT,NIF_FLAGS_VISION))
|
||||
human_target.nif.notify("High intensity light detected, and blocked!",TRUE)
|
||||
return FALSE
|
||||
|
||||
else if(issilicon(M))
|
||||
flashfail = 0
|
||||
var/mob/living/silicon/S = M
|
||||
if(isrobot(S))
|
||||
var/mob/living/silicon/robot/R = S
|
||||
var/safety = human_target.eyecheck()
|
||||
if(safety <= 0)
|
||||
flash_strength = flash_strength * human_target.species.flash_mod
|
||||
flash_burn = human_target.species.flash_burn
|
||||
else
|
||||
return FALSE
|
||||
|
||||
else if(issilicon(target))
|
||||
if(isrobot(target))
|
||||
var/mob/living/silicon/robot/R = target
|
||||
if(R.has_active_type(/obj/item/borg/combat/shield))
|
||||
var/obj/item/borg/combat/shield/shield = locate() in R
|
||||
if(shield)
|
||||
if(shield.active)
|
||||
shield.adjust_flash_count(R, 1)
|
||||
flashfail = 1
|
||||
return FALSE
|
||||
target.Weaken(rand(5,10))
|
||||
return TRUE
|
||||
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)
|
||||
QDEL_IN(animation, 5)
|
||||
|
||||
if(!flashfail)
|
||||
flick("flash2", src)
|
||||
if(!issilicon(M))
|
||||
|
||||
user.visible_message(span_disarm("[user] blinds [M] with the flash!"))
|
||||
else
|
||||
|
||||
user.visible_message(span_notice("[user] overloads [M]'s sensors with the flash!"))
|
||||
M.Weaken(rand(5,10))
|
||||
else
|
||||
|
||||
user.visible_message(span_notice("[user] fails to blind [M] with the flash!"))
|
||||
|
||||
return
|
||||
|
||||
return FALSE
|
||||
|
||||
//Now do all the actual effects.
|
||||
target.Confuse(flash_strength + 5)
|
||||
target.Blind(flash_strength)
|
||||
target.eye_blurry = max(target.eye_blurry, flash_strength + 5)
|
||||
target.flash_eyes()
|
||||
target.adjustHalLoss(halloss_per_flash * (flash_strength / 5)) // Should take two flashes to stun.
|
||||
if(flash_burn)
|
||||
target.apply_damage(flash_burn * (flash_strength/5), BURN, BP_HEAD, 0)
|
||||
return TRUE
|
||||
|
||||
|
||||
/obj/item/flash/attack_self(mob/living/carbon/user as mob, flag = 0, emp = 0)
|
||||
@@ -259,14 +260,13 @@
|
||||
playsound(src, 'sound/weapons/flash.ogg', 100, 1)
|
||||
flick("flash2", 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)
|
||||
QDEL_IN(animation, 5)
|
||||
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)
|
||||
QDEL_IN(animation, 5)
|
||||
|
||||
for(var/mob/living/carbon/C in oviewers(3, null))
|
||||
var/safety = C.eyecheck()
|
||||
@@ -287,10 +287,8 @@
|
||||
var/safety = C.eyecheck()
|
||||
if(safety <= 0)
|
||||
C.adjustHalLoss(halloss_per_flash)
|
||||
//C.Weaken(10)
|
||||
C.flash_eyes()
|
||||
for(var/mob/M in viewers(C, null))
|
||||
M.show_message(span_disarm("[C] is blinded by the flash!"))
|
||||
C.visible_message(span_disarm("[C] is blinded by the flash!"), span_danger("You're blinded by the flash!"), span_warning("You hear the sound of a flash!"))
|
||||
..()
|
||||
|
||||
/obj/item/flash/synthetic
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
/obj/item/flash
|
||||
can_break = FALSE // Can the flash break?
|
||||
Reference in New Issue
Block a user