mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 18:53:06 +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
|
throw_range = 10
|
||||||
origin_tech = list(TECH_MAGNET = 2, TECH_COMBAT = 1)
|
origin_tech = list(TECH_MAGNET = 2, TECH_COMBAT = 1)
|
||||||
|
|
||||||
var/times_used = 0 //Number of times it's been used.
|
///Number of times it's been used.
|
||||||
var/broken = FALSE //Is the flash burnt out?
|
var/times_used = 0
|
||||||
var/last_used = 0 //last world.time it was used.
|
//Is the flash burnt out?
|
||||||
var/max_flashes = 10 // How many times the flash can be used before needing to self recharge.
|
var/broken = FALSE
|
||||||
var/halloss_per_flash = 30
|
///last world.time it was used.
|
||||||
var/break_mod = 3 // The percent to break increased by every use on the flash.
|
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?
|
/// If the flash can break or not
|
||||||
var/can_repair = FALSE // Can you repair the flash?
|
var/can_break = TRUE
|
||||||
var/repairing = FALSE // Are we repairing right now?
|
/// If the flash can be repaired or not.
|
||||||
|
var/can_repair = TRUE
|
||||||
|
|
||||||
var/safe_flashes = 2 // How many flashes are kept in 1% breakchance?
|
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)
|
/obj/item/flash/attackby(var/obj/item/W, var/mob/user)
|
||||||
if(W.has_tool_quality(TOOL_SCREWDRIVER) && broken)
|
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."))
|
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(do_after(user, (40 SECONDS + rand(0, 20 SECONDS)) * W.toolspeed, target = src) && can_repair)
|
||||||
if(prob(30))
|
if(prob(30))
|
||||||
user.visible_message(span_notice("\The [user] successfully repairs \the [src]!"))
|
user.visible_message(span_notice("\The [user] successfully repairs \the [src]!"))
|
||||||
@@ -55,7 +58,6 @@
|
|||||||
playsound(src, W.usesound, 50, 1)
|
playsound(src, W.usesound, 50, 1)
|
||||||
else
|
else
|
||||||
user.visible_message(span_infoplain(span_bold("\The [user]") + " fails to repair \the [src]."))
|
user.visible_message(span_infoplain(span_bold("\The [user]") + " fails to repair \the [src]."))
|
||||||
repairing = FALSE
|
|
||||||
else
|
else
|
||||||
..()
|
..()
|
||||||
|
|
||||||
@@ -150,13 +152,13 @@
|
|||||||
return TRUE
|
return TRUE
|
||||||
|
|
||||||
//attack_as_weapon
|
//attack_as_weapon
|
||||||
/obj/item/flash/attack(mob/living/M, mob/living/user, var/target_zone)
|
/obj/item/flash/attack(mob/living/target, mob/living/user, var/target_zone)
|
||||||
if(!user || !M) return //sanity
|
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.setClickCooldown(user.get_attack_speed(src))
|
||||||
user.do_attack_animation(M)
|
user.do_attack_animation(target)
|
||||||
|
|
||||||
if(!clown_check(user)) return
|
if(!clown_check(user)) return
|
||||||
if(broken)
|
if(broken)
|
||||||
@@ -169,77 +171,76 @@
|
|||||||
return
|
return
|
||||||
|
|
||||||
playsound(src, 'sound/weapons/flash.ogg', 100, 1)
|
playsound(src, 'sound/weapons/flash.ogg', 100, 1)
|
||||||
var/flashfail = 0
|
|
||||||
|
|
||||||
if(ishuman(M))
|
if(isrobot(user))
|
||||||
var/mob/living/carbon/human/H = M
|
var/atom/movable/overlay/animation = new(user.loc)
|
||||||
if(H.nif && H.nif.flag_check(NIF_V_FLASHPROT,NIF_FLAGS_VISION))
|
animation.layer = user.layer + 1
|
||||||
flashfail = 1
|
animation.icon_state = "blank"
|
||||||
H.nif.notify("High intensity light detected, and blocked!",TRUE)
|
animation.icon = 'icons/mob/mob.dmi'
|
||||||
if(FLASHPROOF in H.mutations)
|
animation.master = user
|
||||||
flashfail = 1
|
flick("blspell", animation)
|
||||||
|
QDEL_IN(animation, 5)
|
||||||
|
|
||||||
if(iscarbon(M) && !flashfail) //VOREStation Add - NIF
|
if(attempt_flash(target))
|
||||||
var/mob/living/carbon/C = M
|
flick("flash2", src)
|
||||||
if(C.stat != DEAD)
|
if(issilicon(target))
|
||||||
var/safety = C.eyecheck()
|
user.visible_message(span_notice("[user] overloads [target]'s sensors with the flash!"))
|
||||||
if(safety <= 0)
|
else
|
||||||
var/flash_strength = 10 //Vorestation edit, making flashes behave the same as flash rounds
|
user.visible_message(span_disarm("[user] blinds [target] with the flash!"))
|
||||||
if(ishuman(C))
|
return
|
||||||
var/mob/living/carbon/human/H = C
|
//fail message
|
||||||
flash_strength *= H.species.flash_mod
|
user.visible_message(span_notice("[user] fails to blind [target] with the flash!"))
|
||||||
|
return
|
||||||
|
|
||||||
if(flash_strength > 0)
|
/// Sees if we can flash the target and if so, does the effects of it.
|
||||||
H.Confuse(flash_strength + 5)
|
/// Returns TRUE if the flash went through, FALSE otherwise.
|
||||||
H.Blind(flash_strength)
|
/obj/item/flash/proc/attempt_flash(mob/living/target)
|
||||||
H.eye_blurry = max(H.eye_blurry, flash_strength + 5)
|
if(!istype(target))
|
||||||
H.flash_eyes()
|
return FALSE
|
||||||
H.adjustHalLoss(halloss_per_flash * (flash_strength / 5)) // Should take four flashes to stun.
|
if(target.stat == DEAD) //no point, they're already gone.
|
||||||
H.apply_damage(flash_strength * H.species.flash_burn/5, BURN, BP_HEAD, 0)
|
return FALSE
|
||||||
|
if(FLASHPROOF in target.mutations)
|
||||||
|
return FALSE
|
||||||
|
var/flash_strength = 5
|
||||||
|
var/flash_burn = 0
|
||||||
|
|
||||||
else
|
//Flashes can only flash THREE things: Humans, Silicons, and Robots. NOTHING ELSE!!!
|
||||||
flashfail = 1
|
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))
|
var/safety = human_target.eyecheck()
|
||||||
flashfail = 0
|
if(safety <= 0)
|
||||||
var/mob/living/silicon/S = M
|
flash_strength = flash_strength * human_target.species.flash_mod
|
||||||
if(isrobot(S))
|
flash_burn = human_target.species.flash_burn
|
||||||
var/mob/living/silicon/robot/R = S
|
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))
|
if(R.has_active_type(/obj/item/borg/combat/shield))
|
||||||
var/obj/item/borg/combat/shield/shield = locate() in R
|
var/obj/item/borg/combat/shield/shield = locate() in R
|
||||||
if(shield)
|
if(shield)
|
||||||
if(shield.active)
|
if(shield.active)
|
||||||
shield.adjust_flash_count(R, 1)
|
shield.adjust_flash_count(R, 1)
|
||||||
flashfail = 1
|
return FALSE
|
||||||
|
target.Weaken(rand(5,10))
|
||||||
|
return TRUE
|
||||||
else
|
else
|
||||||
flashfail = 1
|
return FALSE
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
|
|
||||||
|
//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)
|
/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)
|
playsound(src, 'sound/weapons/flash.ogg', 100, 1)
|
||||||
flick("flash2", src)
|
flick("flash2", src)
|
||||||
if(user && isrobot(user))
|
if(user && isrobot(user))
|
||||||
spawn(0)
|
var/atom/movable/overlay/animation = new(user.loc)
|
||||||
var/atom/movable/overlay/animation = new(user.loc)
|
animation.layer = user.layer + 1
|
||||||
animation.layer = user.layer + 1
|
animation.icon_state = "blank"
|
||||||
animation.icon_state = "blank"
|
animation.icon = 'icons/mob/mob.dmi'
|
||||||
animation.icon = 'icons/mob/mob.dmi'
|
animation.master = user
|
||||||
animation.master = user
|
flick("blspell", animation)
|
||||||
flick("blspell", animation)
|
QDEL_IN(animation, 5)
|
||||||
QDEL_IN(animation, 5)
|
|
||||||
|
|
||||||
for(var/mob/living/carbon/C in oviewers(3, null))
|
for(var/mob/living/carbon/C in oviewers(3, null))
|
||||||
var/safety = C.eyecheck()
|
var/safety = C.eyecheck()
|
||||||
@@ -287,10 +287,8 @@
|
|||||||
var/safety = C.eyecheck()
|
var/safety = C.eyecheck()
|
||||||
if(safety <= 0)
|
if(safety <= 0)
|
||||||
C.adjustHalLoss(halloss_per_flash)
|
C.adjustHalLoss(halloss_per_flash)
|
||||||
//C.Weaken(10)
|
|
||||||
C.flash_eyes()
|
C.flash_eyes()
|
||||||
for(var/mob/M in viewers(C, null))
|
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!"))
|
||||||
M.show_message(span_disarm("[C] is blinded by the flash!"))
|
|
||||||
..()
|
..()
|
||||||
|
|
||||||
/obj/item/flash/synthetic
|
/obj/item/flash/synthetic
|
||||||
|
|||||||
@@ -1,2 +0,0 @@
|
|||||||
/obj/item/flash
|
|
||||||
can_break = FALSE // Can the flash break?
|
|
||||||
@@ -1592,7 +1592,6 @@
|
|||||||
#include "code\game\objects\items\devices\e_beacon.dm"
|
#include "code\game\objects\items\devices\e_beacon.dm"
|
||||||
#include "code\game\objects\items\devices\extrapolator.dm"
|
#include "code\game\objects\items\devices\extrapolator.dm"
|
||||||
#include "code\game\objects\items\devices\flash.dm"
|
#include "code\game\objects\items\devices\flash.dm"
|
||||||
#include "code\game\objects\items\devices\flash_vr.dm"
|
|
||||||
#include "code\game\objects\items\devices\flashlight.dm"
|
#include "code\game\objects\items\devices\flashlight.dm"
|
||||||
#include "code\game\objects\items\devices\floor_painter.dm"
|
#include "code\game\objects\items\devices\floor_painter.dm"
|
||||||
#include "code\game\objects\items\devices\geiger.dm"
|
#include "code\game\objects\items\devices\geiger.dm"
|
||||||
|
|||||||
Reference in New Issue
Block a user