From f9445e027f2e5b2e2f4eb0fddb5ce4d2c39f3344 Mon Sep 17 00:00:00 2001 From: Fikou <23585223+Fikou@users.noreply.github.com> Date: Fri, 9 Dec 2022 21:58:58 +0100 Subject: [PATCH] makes beams better (plus small kinesis tweaks) (#71768) ## About The Pull Request kinesis now waits for its first inputs to be given before firing, it should no longer pull the item to the center of the screen the kinesis overlay now is emissive beam emissivity now works (emissive appearances no longer reset transform) beams now have a variable whether or not they should be emissive, because of stuff like vines or chains from the meat hook fixes https://github.com/tgstation/tgstation/issues/71640 ## Why It's Good For The Game neat visual stuff ## Changelog :cl: fix: fixes beam glow in the dark effects fix: kinesis now doesnt pull the item to the centre of the screen when first used fix: physical beams (like vines or meat hook chain) no longer glow in the dark /:cl: --- code/__DEFINES/lighting.dm | 2 +- code/datums/beam.dm | 19 +++++++++++++------ .../changeling/powers/mutations.dm | 2 +- .../simple_animal/hostile/venus_human_trap.dm | 2 +- code/modules/mod/modules/module_kinesis.dm | 18 +++++++++--------- .../mod/modules/modules_engineering.dm | 2 +- .../projectiles/guns/special/meat_hook.dm | 2 +- 7 files changed, 27 insertions(+), 20 deletions(-) diff --git a/code/__DEFINES/lighting.dm b/code/__DEFINES/lighting.dm index f43c2381c01..62734b909a0 100644 --- a/code/__DEFINES/lighting.dm +++ b/code/__DEFINES/lighting.dm @@ -81,7 +81,7 @@ GLOBAL_LIST_INIT(emissive_color, EMISSIVE_COLOR) /// A globaly cached version of [EM_BLOCK_COLOR] for quick access. GLOBAL_LIST_INIT(em_block_color, EM_BLOCK_COLOR) /// A set of appearance flags applied to all emissive and emissive blocker overlays. -#define EMISSIVE_APPEARANCE_FLAGS (KEEP_APART|KEEP_TOGETHER|RESET_COLOR|RESET_TRANSFORM) +#define EMISSIVE_APPEARANCE_FLAGS (KEEP_APART|KEEP_TOGETHER|RESET_COLOR) /// The color matrix used to mask out emissive blockers on the emissive plane. Alpha should default to zero, be solely dependent on the RGB value of [EMISSIVE_COLOR], and be independant of the RGB value of [EM_BLOCK_COLOR]. #define EM_MASK_MATRIX list(0,0,0,1/3, 0,0,0,1/3, 0,0,0,1/3, 0,0,0,0, 1,1,1,0) /// A globaly cached version of [EM_MASK_MATRIX] for quick access. diff --git a/code/datums/beam.dm b/code/datums/beam.dm index c1bd16ac90f..a2542afcdb4 100644 --- a/code/datums/beam.dm +++ b/code/datums/beam.dm @@ -30,6 +30,8 @@ var/obj/effect/ebeam/visuals ///The color of the beam we're drawing. var/beam_color + ///If we use an emissive appearance + var/emissive = TRUE /// If set will be used instead of origin's pixel_x in offset calculations var/override_origin_pixel_x = null /// If set will be used instead of origin's pixel_y in offset calculations @@ -39,7 +41,7 @@ /// If set will be used instead of targets's pixel_y in offset calculations var/override_target_pixel_y = null -/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, override_origin_pixel_x = null, override_origin_pixel_y = null, override_target_pixel_x = null, override_target_pixel_y = null) +/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, emissive = TRUE, override_origin_pixel_x = null, override_origin_pixel_y = null, override_target_pixel_x = null, override_target_pixel_y = null) src.origin = origin src.target = target src.icon = icon @@ -47,6 +49,7 @@ src.max_distance = max_distance src.beam_type = beam_type src.beam_color = beam_color + src.emissive = emissive src.override_origin_pixel_x = override_origin_pixel_x src.override_origin_pixel_y = override_origin_pixel_y src.override_target_pixel_x = override_target_pixel_x @@ -64,6 +67,7 @@ visuals.color = beam_color visuals.layer = ABOVE_ALL_MOB_LAYER visuals.vis_flags = VIS_INHERIT_PLANE + visuals.emissive = emissive visuals.update_appearance() Draw() RegisterSignal(origin, COMSIG_MOVABLE_MOVED, PROC_REF(redrawing)) @@ -163,6 +167,7 @@ /obj/effect/ebeam mouse_opacity = MOUSE_OPACITY_TRANSPARENT anchored = TRUE + var/emissive = TRUE var/datum/beam/owner /obj/effect/ebeam/Initialize(mapload, beam_owner) @@ -171,9 +176,11 @@ /obj/effect/ebeam/update_overlays() . = ..() - var/mutable_appearance/emmisive = emissive_appearance(icon, icon_state, src) - emmisive.transform = transform - . += emmisive + if(!emissive) + return + var/mutable_appearance/emissive_overlay = emissive_appearance(icon, icon_state, src) + emissive_overlay.transform = transform + . += emissive_overlay /obj/effect/ebeam/Destroy() owner = null @@ -196,8 +203,8 @@ * 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, beam_color = null, override_origin_pixel_x = null, override_origin_pixel_y = null, override_target_pixel_x = null, override_target_pixel_y = null) - var/datum/beam/newbeam = new(src,BeamTarget,icon,icon_state,time,maxdistance,beam_type, beam_color, override_origin_pixel_x, override_origin_pixel_y, override_target_pixel_x, override_target_pixel_y ) +/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, emissive = TRUE, override_origin_pixel_x = null, override_origin_pixel_y = null, override_target_pixel_x = null, override_target_pixel_y = null) + var/datum/beam/newbeam = new(src,BeamTarget,icon,icon_state,time,maxdistance,beam_type, beam_color, emissive, override_origin_pixel_x, override_origin_pixel_y, override_target_pixel_x, override_target_pixel_y ) INVOKE_ASYNC(newbeam, TYPE_PROC_REF(/datum/beam/, Start)) return newbeam diff --git a/code/modules/antagonists/changeling/powers/mutations.dm b/code/modules/antagonists/changeling/powers/mutations.dm index fcd70e4f6cd..bd5f6fe33fd 100644 --- a/code/modules/antagonists/changeling/powers/mutations.dm +++ b/code/modules/antagonists/changeling/powers/mutations.dm @@ -322,7 +322,7 @@ /obj/projectile/tentacle/fire(setAngle) if(firer) - chain = firer.Beam(src, icon_state = "tentacle") + chain = firer.Beam(src, icon_state = "tentacle", emissive = FALSE) ..() /obj/projectile/tentacle/proc/reset_throw(mob/living/carbon/human/H) diff --git a/code/modules/mob/living/simple_animal/hostile/venus_human_trap.dm b/code/modules/mob/living/simple_animal/hostile/venus_human_trap.dm index f3fdb34451c..961e2481e90 100644 --- a/code/modules/mob/living/simple_animal/hostile/venus_human_trap.dm +++ b/code/modules/mob/living/simple_animal/hostile/venus_human_trap.dm @@ -189,7 +189,7 @@ if(O.density) return - var/datum/beam/newVine = Beam(the_target, icon_state = "vine", maxdistance = vine_grab_distance, beam_type=/obj/effect/ebeam/vine) + var/datum/beam/newVine = Beam(the_target, icon_state = "vine", maxdistance = vine_grab_distance, beam_type=/obj/effect/ebeam/vine, emissive = FALSE) RegisterSignal(newVine, COMSIG_PARENT_QDELETING, PROC_REF(remove_vine), newVine) vines += newVine if(isliving(the_target)) diff --git a/code/modules/mod/modules/module_kinesis.dm b/code/modules/mod/modules/module_kinesis.dm index e98f313d480..de44f39ae20 100644 --- a/code/modules/mod/modules/module_kinesis.dm +++ b/code/modules/mod/modules/module_kinesis.dm @@ -66,8 +66,9 @@ var/mob/living/grabbed_mob = grabbed_atom grabbed_mob.Stun(mob_stun_time) playsound(grabbed_atom, 'sound/effects/contractorbatonhit.ogg', 75, TRUE) - kinesis_icon = mutable_appearance(icon='icons/effects/effects.dmi', icon_state="kinesis", layer=grabbed_atom.layer-0.1) + kinesis_icon = mutable_appearance(icon = 'icons/effects/effects.dmi', icon_state = "kinesis", layer = grabbed_atom.layer - 0.1) kinesis_icon.appearance_flags = RESET_ALPHA|RESET_COLOR|RESET_TRANSFORM + kinesis_icon.overlays += emissive_appearance(icon = 'icons/effects/effects.dmi', icon_state = "kinesis", offset_spokesman = grabbed_atom) grabbed_atom.add_overlay(kinesis_icon) kinesis_beam = mod.wearer.Beam(grabbed_atom, "kinesis") kinesis_catcher = mod.wearer.overlay_fullscreen("kinesis", /atom/movable/screen/fullscreen/kinesis, 0) @@ -93,13 +94,12 @@ balloon_alert(mod.wearer, "out of range!") clear_grab() return - kinesis_catcher.calculate_params() - if(!kinesis_catcher.given_turf) - clear_grab() - return drain_power(use_power_cost/10) + if(kinesis_catcher.mouse_params) + kinesis_catcher.calculate_params() + if(!kinesis_catcher.given_turf) + return mod.wearer.setDir(get_dir(mod.wearer, grabbed_atom)) - grabbed_atom.set_glide_size() if(grabbed_atom.loc == kinesis_catcher.given_turf) if(grabbed_atom.pixel_x == kinesis_catcher.given_x - world.icon_size/2 && grabbed_atom.pixel_y == kinesis_catcher.given_y - world.icon_size/2) return //spare us redrawing if we are standing still @@ -109,7 +109,7 @@ animate(grabbed_atom, 0.2 SECONDS, pixel_x = grabbed_atom.base_pixel_x + kinesis_catcher.given_x - world.icon_size/2, pixel_y = grabbed_atom.base_pixel_y + kinesis_catcher.given_y - world.icon_size/2) kinesis_beam.redrawing() var/turf/next_turf = get_step_towards(grabbed_atom, kinesis_catcher.given_turf) - if(grabbed_atom.Move(next_turf)) + if(grabbed_atom.Move(next_turf, get_dir(grabbed_atom, next_turf), 8)) if(isitem(grabbed_atom) && (mod.wearer in next_turf)) var/obj/item/grabbed_item = grabbed_atom clear_grab() @@ -265,8 +265,8 @@ /atom/movable/screen/fullscreen/kinesis/proc/calculate_params() var/list/modifiers = params2list(mouse_params) - var/icon_x = text2num(LAZYACCESS(modifiers, VIS_X)) || view_list[1]*world.icon_size/2 - var/icon_y = text2num(LAZYACCESS(modifiers, VIS_Y)) || view_list[2]*world.icon_size/2 + var/icon_x = text2num(LAZYACCESS(modifiers, VIS_X)) + var/icon_y = text2num(LAZYACCESS(modifiers, VIS_Y)) var/our_x = round(icon_x / world.icon_size) var/our_y = round(icon_y / world.icon_size) given_turf = locate(kinesis_user.x+our_x-round(view_list[1]/2),kinesis_user.y+our_y-round(view_list[2]/2),kinesis_user.z) diff --git a/code/modules/mod/modules/modules_engineering.dm b/code/modules/mod/modules/modules_engineering.dm index 05ac9296e73..4f122b93ecf 100644 --- a/code/modules/mod/modules/modules_engineering.dm +++ b/code/modules/mod/modules/modules_engineering.dm @@ -126,7 +126,7 @@ /obj/projectile/tether/fire(setAngle) if(firer) - line = firer.Beam(src, "line", 'icons/obj/clothing/modsuit/mod_modules.dmi') + line = firer.Beam(src, "line", 'icons/obj/clothing/modsuit/mod_modules.dmi', emissive = FALSE) ..() /obj/projectile/tether/on_hit(atom/target) diff --git a/code/modules/projectiles/guns/special/meat_hook.dm b/code/modules/projectiles/guns/special/meat_hook.dm index fd6b2756dae..5c398ee4438 100644 --- a/code/modules/projectiles/guns/special/meat_hook.dm +++ b/code/modules/projectiles/guns/special/meat_hook.dm @@ -45,7 +45,7 @@ /obj/projectile/hook/fire(setAngle) if(firer) - chain = firer.Beam(src, icon_state = "chain") + chain = firer.Beam(src, icon_state = "chain", emissive = FALSE) ..() //TODO: root the firer until the chain returns