Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flare Rework: Dying Light #7582

Merged
merged 10 commits into from
Nov 22, 2024
6 changes: 3 additions & 3 deletions code/game/objects/effects/aliens.dm
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@
/// Factor of duration between acid progression
var/acid_delay = 1
/// How much fuel the acid drains from the flare every acid tick
var/flare_damage = 500
var/flare_damage = 600
var/barricade_damage = 40
var/in_weather = FALSE

Expand All @@ -311,15 +311,15 @@
name = "weak acid"
acid_delay = 2.5 //250% delay (40% speed)
barricade_damage = 20
flare_damage = 150
flare_damage = 180
icon_state = "acid_weak"

//Superacid
/obj/effect/xenomorph/acid/strong
name = "strong acid"
acid_delay = 0.4 //40% delay (250% speed)
barricade_damage = 100
flare_damage = 1875
flare_damage = 2250
icon_state = "acid_strong"

/obj/effect/xenomorph/acid/Initialize(mapload, atom/target)
Expand Down
53 changes: 48 additions & 5 deletions code/game/objects/items/devices/flashlight.dm
Original file line number Diff line number Diff line change
Expand Up @@ -302,14 +302,14 @@
desc = "A red USCM issued flare. There are instructions on the side, it reads 'pull cord, make light'."
w_class = SIZE_SMALL
light_power = 2
light_range = 5
light_range = 7
icon_state = "flare"
item_state = "flare"
actions = list() //just pull it manually, neckbeard.
raillight_compatible = 0
can_be_broken = FALSE
var/burnt_out = FALSE
var/fuel = 0
var/fuel = 16 MINUTES
var/fuel_rate = AMOUNT_PER_TIME(1 SECONDS, 1 SECONDS)
var/on_damage = 7
var/ammo_datum = /datum/ammo/flare
Expand All @@ -327,7 +327,6 @@

/obj/item/device/flashlight/flare/Initialize()
. = ..()
fuel = rand(9.5 MINUTES, 10.5 MINUTES)
set_light_color(flame_tint)

/obj/item/device/flashlight/flare/update_icon()
Expand Down Expand Up @@ -362,9 +361,28 @@

/obj/item/device/flashlight/flare/process(delta_time)
fuel -= fuel_rate * delta_time
flare_burn_down()
if(fuel <= 0 || !on)
burn_out()

/obj/item/device/flashlight/flare/proc/flare_burn_down() //Controls the way in which flares slowly die out. Needs to be overriden by children, or they will be forced to use this light behavior.
switch(fuel) //The code belows controls the timing on a flares burn out, and the corresponding reduction in effective range.
if(15.25 MINUTES to 16 MINUTES)
set_light_range(7)
if(14.5 MINUTES to 15.24 MINUTES)
set_light_range(6)
if(6.5 MINUTES to 14.49 MINUTES)
set_light_range(5)
if(5.0 MINUTES to 6.49 MINUTES)
set_light_range(4)
if(3.5 MINUTES to 4.99 MINUTES)
set_light_range(3)
if(2.0 MINUTES to 3.49 MINUTES)
set_light_range(2)
if(0 MINUTES to 1.99 MINUTES)
set_light_range(1)
set_light_power(0.5) // A power of 2 results in no light at all, while .5 results in a small light.

// Causes flares to stop with a rotation offset for visual purposes
/obj/item/device/flashlight/flare/animation_spin(speed = 5, loop_amount = -1, clockwise = TRUE, sections = 3, angular_offset = 0, pixel_fuzz = 0)
pixel_fuzz = 16
Expand Down Expand Up @@ -450,10 +468,14 @@
icon_state = "" //No sprite
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
show_flame = FALSE
light_range = 7

/obj/item/device/flashlight/flare/on/illumination/Initialize()
. = ..()
fuel = rand(4.5 MINUTES, 5.5 MINUTES) // Half the duration of a flare, but justified since it's invincible
fuel = rand(5.0 MINUTES, 6.0 MINUTES) // Approximately half the effective duration of a flare, but justified since it's invincible

/obj/item/device/flashlight/flare/on/illumination/flare_burn_down() // Empty proc to override parent.
return

/obj/item/device/flashlight/flare/on/illumination/update_icon()
return
Expand All @@ -472,12 +494,29 @@
anchored = TRUE//can't be picked up
ammo_datum = /datum/ammo/flare/starshell
show_flame = FALSE
light_range = 6

/obj/item/device/flashlight/flare/on/starshell_ash/Initialize(mapload, ...)
if(mapload)
return INITIALIZE_HINT_QDEL
. = ..()
fuel = rand(4.5 MINUTES, 5.5 MINUTES)
fuel = rand(6.0 MINUTES, 6.5 MINUTES)

/obj/item/device/flashlight/flare/on/starshell_ash/flare_burn_down() // Starshell's own burn_down curve, overrides parent flare.
switch(fuel)
if(6.0 MINUTES to 6.5 MINUTES)
set_light_range(6)
if(2.5 MINUTES to 5.99 MINUTES)
set_light_range(5)
if(2.0 MINUTES to 2.49 MINUTES)
set_light_range(4)
if(1.5 MINUTES to 1.99 MINUTES)
set_light_range(3)
if(1.0 MINUTES to 1.49 MINUTES)
set_light_range(2)
if(0 MINUTES to 0.99 MINUTES)
set_light_range(1)
set_light_power(0.5)

/obj/item/device/flashlight/flare/on/illumination/chemical
name = "chemical light"
Expand Down Expand Up @@ -529,6 +568,7 @@
item_state = "cas_flare"
layer = ABOVE_FLY_LAYER
ammo_datum = /datum/ammo/flare/signal
light_range = 5
var/faction = ""
var/datum/cas_signal/signal
var/activate_message = TRUE
Expand All @@ -539,6 +579,9 @@
. = ..()
fuel = rand(160 SECONDS, 200 SECONDS)

/obj/item/device/flashlight/flare/signal/flare_burn_down() // Empty proc to override parent.
return

/obj/item/device/flashlight/flare/signal/attack_self(mob/living/carbon/human/user)
if(!istype(user))
return
Expand Down
5 changes: 4 additions & 1 deletion code/modules/projectiles/guns/flare_gun.dm
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@
fired_flare.visible_message(SPAN_WARNING("\A [fired_flare] bursts into brilliant light in the sky!"))
fired_flare.invisibility = INVISIBILITY_MAXIMUM
fired_flare.mouse_opacity = FALSE
fired_flare.fuel = 3 MINUTES
fired_flare.light_range = 6
fired_flare.light_power = 3
playsound(user.loc, fire_sound, 50, 1)

var/obj/effect/flare_light/light_effect = new (fired_flare, fired_flare.light_range, fired_flare.light_power, fired_flare.light_color)
Expand All @@ -146,7 +149,7 @@
desc = "You are not supposed to see this. Please report it."
icon_state = "" //No sprite
invisibility = INVISIBILITY_MAXIMUM
light_system = STATIC_LIGHT
light_system = MOVABLE_LIGHT

/obj/effect/flare_light/Initialize(mapload, light_range, light_power, light_color)
. = ..()
Expand Down
Loading