mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-30 16:47:13 +01:00
Supermatter zaps now are colored based on the power (#66639)
Supermatter zaps will now start with a red color on low power, shifting towards blue for higher powers
This commit is contained in:
+19
-9
@@ -28,14 +28,17 @@
|
||||
var/beam_type = /obj/effect/ebeam
|
||||
///This is used as the visual_contents of beams, so you can apply one effect to this and the whole beam will look like that. never gets deleted on redrawing.
|
||||
var/obj/effect/ebeam/visuals
|
||||
///The color of the beam we're drawing.
|
||||
var/beam_color
|
||||
|
||||
/datum/beam/New(beam_origin,beam_target,beam_icon='icons/effects/beam.dmi',beam_icon_state="b_beam",time=INFINITY,maxdistance=INFINITY,btype = /obj/effect/ebeam)
|
||||
origin = beam_origin
|
||||
target = beam_target
|
||||
max_distance = maxdistance
|
||||
icon = beam_icon
|
||||
icon_state = beam_icon_state
|
||||
beam_type = btype
|
||||
/datum/beam/New(origin, target, icon = 'icons/effects/beam.dmi', icon_state = "b_beam", time = INFINITY, max_distance = INFINITY, beam_type = /obj/effect/ebeam, beam_color = null)
|
||||
src.origin = origin
|
||||
src.target = target
|
||||
src.icon = icon
|
||||
src.icon_state = icon_state
|
||||
src.max_distance = max_distance
|
||||
src.beam_type = beam_type
|
||||
src.beam_color = beam_color
|
||||
if(time < INFINITY)
|
||||
QDEL_IN(src, time)
|
||||
|
||||
@@ -46,6 +49,9 @@
|
||||
visuals = new beam_type()
|
||||
visuals.icon = icon
|
||||
visuals.icon_state = icon_state
|
||||
visuals.color = beam_color
|
||||
visuals.layer = ABOVE_ALL_MOB_LAYER
|
||||
visuals.update_appearance()
|
||||
Draw()
|
||||
RegisterSignal(origin, COMSIG_MOVABLE_MOVED, .proc/redrawing)
|
||||
RegisterSignal(target, COMSIG_MOVABLE_MOVED, .proc/redrawing)
|
||||
@@ -139,6 +145,10 @@
|
||||
anchored = TRUE
|
||||
var/datum/beam/owner
|
||||
|
||||
/obj/effect/ebeam/update_overlays()
|
||||
. = ..()
|
||||
. += emissive_appearance(icon, icon_state)
|
||||
|
||||
/obj/effect/ebeam/Destroy()
|
||||
owner = null
|
||||
return ..()
|
||||
@@ -160,7 +170,7 @@
|
||||
* maxdistance: how far the beam will go before stopping itself. Used mainly for two things: preventing lag if the beam may go in that direction and setting a range to abilities that use beams.
|
||||
* beam_type: The type of your custom beam. This is for adding other wacky stuff for your beam only. Most likely, you won't (and shouldn't) change it.
|
||||
*/
|
||||
/atom/proc/Beam(atom/BeamTarget,icon_state="b_beam",icon='icons/effects/beam.dmi',time=INFINITY,maxdistance=INFINITY,beam_type=/obj/effect/ebeam)
|
||||
var/datum/beam/newbeam = new(src,BeamTarget,icon,icon_state,time,maxdistance,beam_type)
|
||||
/atom/proc/Beam(atom/BeamTarget,icon_state="b_beam",icon='icons/effects/beam.dmi',time=INFINITY,maxdistance=INFINITY,beam_type=/obj/effect/ebeam, beam_color = null)
|
||||
var/datum/beam/newbeam = new(src,BeamTarget,icon,icon_state,time,maxdistance,beam_type, beam_color)
|
||||
INVOKE_ASYNC(newbeam, /datum/beam/.proc/Start)
|
||||
return newbeam
|
||||
|
||||
@@ -256,6 +256,8 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
|
||||
var/freonbonus = 0
|
||||
///Can the crystal trigger the station wide anomaly spawn?
|
||||
var/anomaly_event = TRUE
|
||||
///Hue shift of the zaps color based on the power of the crystal
|
||||
var/hue_angle_shift = 0
|
||||
///If an admin wants a sure cascade with the delamination just set this to true (don't be a badmin)
|
||||
var/admin_cascade = FALSE
|
||||
///Do we have a destabilizing crystal attached?
|
||||
@@ -523,7 +525,7 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
|
||||
if(VORTEX_ANOMALY)
|
||||
new /obj/effect/anomaly/bhole(local_turf, 20, FALSE)
|
||||
|
||||
/obj/machinery/proc/supermatter_zap(atom/zapstart = src, range = 5, zap_str = 4000, zap_flags = ZAP_SUPERMATTER_FLAGS, list/targets_hit = list(), zap_cutoff = 1500, power_level = 0, zap_icon = DEFAULT_ZAP_ICON_STATE)
|
||||
/obj/machinery/proc/supermatter_zap(atom/zapstart = src, range = 5, zap_str = 4000, zap_flags = ZAP_SUPERMATTER_FLAGS, list/targets_hit = list(), zap_cutoff = 1500, power_level = 0, zap_icon = DEFAULT_ZAP_ICON_STATE, color = null)
|
||||
if(QDELETED(zapstart))
|
||||
return
|
||||
. = zapstart.dir
|
||||
@@ -612,7 +614,7 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
|
||||
//Do the animation to zap to it from here
|
||||
if(!(zap_flags & ZAP_ALLOW_DUPLICATES))
|
||||
LAZYSET(targets_hit, target, TRUE)
|
||||
zapstart.Beam(target, icon_state=zap_icon, time = 0.5 SECONDS)
|
||||
zapstart.Beam(target, icon_state=zap_icon, time = 0.5 SECONDS, beam_color = color)
|
||||
var/zapdir = get_dir(zapstart, target)
|
||||
if(zapdir)
|
||||
. = zapdir
|
||||
@@ -661,7 +663,7 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
|
||||
var/child_targets_hit = targets_hit
|
||||
if(zap_count > 1)
|
||||
child_targets_hit = targets_hit.Copy() //Pass by ref begone
|
||||
supermatter_zap(target, new_range, zap_str, zap_flags, child_targets_hit, zap_cutoff, power_level, zap_icon)
|
||||
supermatter_zap(target, new_range, zap_str, zap_flags, child_targets_hit, zap_cutoff, power_level, zap_icon, color)
|
||||
|
||||
/obj/machinery/power/supermatter_crystal/engine
|
||||
is_main_engine = TRUE
|
||||
|
||||
@@ -279,13 +279,16 @@
|
||||
var/power_multiplier = max(0, (1 + (power_transmission_bonus / (10 - (gas_comp[/datum/gas/bz] * BZ_RADIOACTIVITY_MODIFIER)))) * freonbonus)// RadModBZ(500%)
|
||||
var/pressure_multiplier = max((1 / ((env.return_pressure() ** pressure_bonus_curve_angle) + 1) * pressure_bonus_derived_steepness) + pressure_bonus_derived_constant, 1)
|
||||
var/co2_power_increase = max(gas_comp[/datum/gas/carbon_dioxide] * 2, 1)
|
||||
hue_angle_shift = clamp(903 * log(10, (power + 8000)) - 3590, -50, 240)
|
||||
var/zap_color = color_matrix_rotate_hue(hue_angle_shift)
|
||||
supermatter_zap(
|
||||
zapstart = src,
|
||||
range = 3,
|
||||
zap_str = 2.5 * power * power_multiplier * pressure_multiplier * co2_power_increase,
|
||||
zap_flags = ZAP_SUPERMATTER_FLAGS,
|
||||
zap_cutoff = 300,
|
||||
power_level = power
|
||||
power_level = power,
|
||||
color = zap_color,
|
||||
)
|
||||
last_power_zap = world.time
|
||||
|
||||
|
||||
Reference in New Issue
Block a user