mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-24 12:37:26 +01:00
Flash refactor and rebalance (#25852)
* Flash refactor and rebalance * Maps * Update code/game/objects/items/devices/flash.dm Co-authored-by: Contrabang <91113370+Contrabang@users.noreply.github.com> Signed-off-by: DGamerL <108773801+DGamerL@users.noreply.github.com> * Update code/game/objects/items/devices/flash.dm Co-authored-by: Contrabang <91113370+Contrabang@users.noreply.github.com> Signed-off-by: DGamerL <108773801+DGamerL@users.noreply.github.com> * Contra review * Update code/game/objects/items/devices/flash.dm Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com> Signed-off-by: DGamerL <108773801+DGamerL@users.noreply.github.com> * Lewc Review --------- Signed-off-by: DGamerL <108773801+DGamerL@users.noreply.github.com> Co-authored-by: Contrabang <91113370+Contrabang@users.noreply.github.com> Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com>
This commit is contained in:
co-authored by
Contrabang
Luc
parent
dc85c54d65
commit
a21b962ee6
@@ -13,32 +13,40 @@
|
||||
materials = list(MAT_METAL = 300, MAT_GLASS = 300)
|
||||
origin_tech = "magnets=2;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/battery_panel = FALSE //whether the flash can be modified with a cell or not
|
||||
var/overcharged = FALSE //if overcharged the flash will set people on fire then immediately burn out (does so even if it doesn't blind them).
|
||||
var/can_overcharge = TRUE //set this to FALSE if you don't want your flash to be overcharge capable
|
||||
///This tracks the world.time until the flash can be used again
|
||||
var/cooldown
|
||||
///This is the duration of the cooldown
|
||||
var/cooldown_duration = 5 SECONDS
|
||||
var/use_sound = 'sound/weapons/flash.ogg'
|
||||
/// Is the flash burnt out?
|
||||
var/broken = FALSE
|
||||
/// Whether the flash can be modified with a cell or not
|
||||
var/battery_panel = FALSE
|
||||
/// If overcharged the flash will set people on fire then immediately burn out (does so even if it doesn't blind them).
|
||||
var/overcharged = FALSE
|
||||
/// Set this to FALSE if you don't want your flash to be overcharge capable
|
||||
var/can_overcharge = TRUE
|
||||
/// How many times have we used the flash recently
|
||||
var/times_used = 0
|
||||
/// What is the max amount we can use this flash before it burns out
|
||||
var/max_uses = 5
|
||||
/// A reference to the timer used to recharge. If we use it while it's on cooldown, we reset the cooling
|
||||
var/flash_timer
|
||||
/// How long do we have between flashes
|
||||
var/time_between_flashes = 5 SECONDS
|
||||
|
||||
/obj/item/flash/proc/clown_check(mob/user)
|
||||
if(user && HAS_TRAIT(user, TRAIT_CLUMSY) && prob(50))
|
||||
flash_carbon(user, user, 30 SECONDS, 0)
|
||||
return FALSE
|
||||
return TRUE
|
||||
var/use_sound = 'sound/weapons/flash.ogg'
|
||||
COOLDOWN_DECLARE(flash_cooldown)
|
||||
|
||||
/obj/item/flash/attackby(obj/item/I, mob/user, params)
|
||||
if(can_overcharge)
|
||||
if(battery_panel && !overcharged)
|
||||
if(istype(I, /obj/item/stock_parts/cell))
|
||||
to_chat(user, "<span class='notice'>You jam [I] into the battery compartment on [src].</span>")
|
||||
qdel(I)
|
||||
overcharged = TRUE
|
||||
add_overlay("overcharge")
|
||||
if(!can_overcharge || !istype(I, /obj/item/stock_parts/cell))
|
||||
return
|
||||
|
||||
if(battery_panel && !overcharged)
|
||||
to_chat(user, "<span class='notice'>You jam [I] into the battery compartment on [src].</span>")
|
||||
qdel(I)
|
||||
overcharged = TRUE
|
||||
update_icon(UPDATE_OVERLAYS)
|
||||
|
||||
/obj/item/flash/update_overlays()
|
||||
. = ..()
|
||||
if(overcharged)
|
||||
add_overlay("overcharge")
|
||||
|
||||
/obj/item/flash/screwdriver_act(mob/living/user, obj/item/I)
|
||||
if(!can_overcharge)
|
||||
@@ -51,54 +59,52 @@
|
||||
battery_panel = !battery_panel
|
||||
return TRUE
|
||||
|
||||
/obj/item/flash/random/New()
|
||||
..()
|
||||
if(prob(25))
|
||||
broken = TRUE
|
||||
icon_state = "[initial(icon_state)]burnt"
|
||||
|
||||
/obj/item/flash/proc/burn_out() //Made so you can override it if you want to have an invincible flash from R&D or something.
|
||||
broken = TRUE
|
||||
icon_state = "[initial(icon_state)]burnt"
|
||||
visible_message("<span class='notice'>[src] burns out!</span>")
|
||||
|
||||
|
||||
/obj/item/flash/proc/flash_recharge(mob/user)
|
||||
if(prob(times_used * 2)) //if you use it 5 times in a minute it has a 10% chance to break!
|
||||
burn_out()
|
||||
return FALSE
|
||||
|
||||
var/deciseconds_passed = world.time - last_used
|
||||
for(var/seconds = deciseconds_passed/10, seconds>=10, seconds-=10) //get 1 charge every 10 seconds
|
||||
times_used--
|
||||
|
||||
last_used = world.time
|
||||
times_used = max(0, times_used) //sanity
|
||||
|
||||
|
||||
/obj/item/flash/proc/try_use_flash(mob/user)
|
||||
if(broken)
|
||||
return FALSE
|
||||
|
||||
if(cooldown >= world.time && user)
|
||||
if(!COOLDOWN_FINISHED(src, flash_cooldown) && user)
|
||||
to_chat(user, "<span class='warning'>Your [name] is still too hot to use again!</span>")
|
||||
return FALSE
|
||||
cooldown = world.time + cooldown_duration
|
||||
flash_recharge(user)
|
||||
|
||||
playsound(loc, use_sound, 100, 1)
|
||||
. = TRUE
|
||||
COOLDOWN_START(src, flash_cooldown, time_between_flashes)
|
||||
if(!flash_timer)
|
||||
flash_timer = addtimer(CALLBACK(src, PROC_REF(flash_recharge)), 10 SECONDS, TIMER_STOPPABLE)
|
||||
else
|
||||
// The flash can't cool down if you overheat it again!
|
||||
deltimer(flash_timer)
|
||||
flash_timer = addtimer(CALLBACK(src, PROC_REF(flash_recharge)), 10 SECONDS, TIMER_STOPPABLE)
|
||||
|
||||
playsound(loc, use_sound, 100, TRUE)
|
||||
|
||||
flick("[initial(icon_state)]2", src)
|
||||
set_light(2, 1, COLOR_WHITE)
|
||||
addtimer(CALLBACK(src, TYPE_PROC_REF(/atom, set_light), 0), 2)
|
||||
times_used++
|
||||
addtimer(CALLBACK(src, TYPE_PROC_REF(/atom, set_light), 0), 2 DECISECONDS)
|
||||
|
||||
if(user && !clown_check(user))
|
||||
times_used++
|
||||
if(times_used == (max_uses - 1))
|
||||
to_chat(user, "<span class='warning'>[src] is getting dangerously hot! Don't use it for a few seconds or it will burn out!</span>")
|
||||
else if(times_used == max_uses)
|
||||
burn_out()
|
||||
|
||||
if(user && HAS_TRAIT(user, TRAIT_CLUMSY) && prob(50))
|
||||
flash_carbon(user, user, 30 SECONDS, 0)
|
||||
return FALSE
|
||||
|
||||
return TRUE
|
||||
/obj/item/flash/proc/flash_recharge(mob/user)
|
||||
times_used = max(0, times_used - 1)
|
||||
if(times_used)
|
||||
flash_timer = addtimer(CALLBACK(src, PROC_REF(flash_recharge)), 10 SECONDS, TIMER_STOPPABLE)
|
||||
else
|
||||
flash_timer = null
|
||||
|
||||
|
||||
/obj/item/flash/proc/flash_carbon(mob/living/carbon/M, mob/user = null, power = 10 SECONDS, targeted = 1)
|
||||
/obj/item/flash/proc/flash_carbon(mob/living/carbon/M, mob/user, power = 10 SECONDS, targeted = TRUE)
|
||||
if(user)
|
||||
add_attack_logs(user, M, "Flashed with [src]")
|
||||
if(targeted)
|
||||
@@ -151,7 +157,6 @@
|
||||
user.create_attack_log("[key_name(user)] EMPd a camera with a flash")
|
||||
add_attack_logs(user, C, "EMPd with [src]", ATKLOG_ALL)
|
||||
|
||||
|
||||
/obj/item/flash/attack_self(mob/living/carbon/user, flag = 0, emp = 0)
|
||||
if(!try_use_flash(user))
|
||||
return FALSE
|
||||
@@ -164,15 +169,13 @@
|
||||
user.create_attack_log("[key_name(user)] EMPd a camera with a flash")
|
||||
add_attack_logs(user, C, "EMPd with [src]", ATKLOG_ALL)
|
||||
|
||||
|
||||
/obj/item/flash/emp_act(severity)
|
||||
if(!try_use_flash())
|
||||
return FALSE
|
||||
for(var/mob/living/carbon/M in viewers(3, null))
|
||||
flash_carbon(M, null, 20 SECONDS, 0)
|
||||
burn_out()
|
||||
..()
|
||||
|
||||
return ..()
|
||||
|
||||
/obj/item/flash/proc/revolution_conversion(mob/M, mob/user)
|
||||
if(!ishuman(M) || !user.mind?.has_antag_datum(/datum/antagonist/rev/head))
|
||||
@@ -247,7 +250,7 @@
|
||||
if(charge_tick < 10)
|
||||
return FALSE
|
||||
charge_tick = 0
|
||||
flash_cur_charges = min(flash_cur_charges+1, flash_max_charges)
|
||||
flash_cur_charges = min(flash_cur_charges + 1, flash_max_charges)
|
||||
return TRUE
|
||||
|
||||
/obj/item/flash/cameraflash/try_use_flash(mob/user = null)
|
||||
@@ -261,15 +264,15 @@
|
||||
|
||||
/obj/item/flash/memorizer
|
||||
name = "memorizer"
|
||||
desc = "If you see this, you're not likely to remember it any time soon."
|
||||
desc = "If you see this, you're not likely to remember it any time soon." // Why doesn't this at least delete your notes smh
|
||||
icon_state = "memorizer"
|
||||
item_state = "nullrod"
|
||||
|
||||
/obj/item/flash/armimplant
|
||||
name = "photon projector"
|
||||
desc = "A high-powered photon projector implant normally used for lighting purposes, but also doubles as a flashbulb weapon. Self-repair protocols fix the flashbulb if it ever burns out."
|
||||
cooldown_duration = 2 SECONDS
|
||||
var/obj/item/organ/internal/cyberimp/arm/implant = null
|
||||
time_between_flashes = 2 SECONDS
|
||||
var/obj/item/organ/internal/cyberimp/arm/implant
|
||||
|
||||
/obj/item/flash/armimplant/burn_out()
|
||||
if(implant?.owner)
|
||||
@@ -280,5 +283,8 @@
|
||||
implant = null
|
||||
return ..()
|
||||
|
||||
/// just a regular flash now
|
||||
/obj/item/flash/synthetic
|
||||
/obj/item/flash/random/Initialize(mapload)
|
||||
. = ..()
|
||||
if(prob(25))
|
||||
broken = TRUE
|
||||
icon_state = "[initial(icon_state)]burnt"
|
||||
|
||||
Reference in New Issue
Block a user