mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-22 04:30:44 +01:00
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 🆑 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 /🆑
This commit is contained in:
@@ -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.
|
||||
|
||||
+13
-6
@@ -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
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user