Ports hitscan from TG, adds it to *SELECT* things (#22754)

* this was just going to be a plasma cutter change but no had to make it look good, whats next, ai sat turrets (yes)

* ai turret

* Coca cola, don't forget the ice. Or the pulse

* almost done, pull master than map edit

* we ball

* ah, chasms.

* it's for the best. Fuck should not sleep checker though

* hitscan reflection limiting system

* Apply suggestions from code review

Co-authored-by: Henri215 <77684085+Henri215@users.noreply.github.com>

* c-c-c-changes

---------

Co-authored-by: Henri215 <77684085+Henri215@users.noreply.github.com>
Co-authored-by: S34N <12197162+S34NW@users.noreply.github.com>
This commit is contained in:
Qwertytoforty
2023-11-01 20:05:27 +00:00
committed by GitHub
co-authored by Henri215 S34N
parent 49c9d6f65a
commit 357c62b6d7
43 changed files with 1946 additions and 1610 deletions
@@ -0,0 +1,54 @@
//These are directional impact effects used by hitscan projectiles. Unlike current impact effect, they rotate to face the point the hitscan beam came from.
/obj/effect/projectile/impact
name = "beam impact"
icon = 'icons/obj/projectiles_impact.dmi'
/obj/effect/projectile/impact/laser
name = "laser impact"
icon_state = "impact_laser"
/obj/effect/projectile/impact/laser/blue
name = "laser impact"
icon_state = "impact_blue"
/obj/effect/projectile/impact/disabler
name = "disabler impact"
icon_state = "impact_omni"
/obj/effect/projectile/impact/xray
name = "\improper X-ray impact"
icon_state = "impact_xray"
/obj/effect/projectile/impact/pulse
name = "pulse impact"
icon_state = "impact_u_laser"
/obj/effect/projectile/impact/plasma_cutter
name = "plasma impact"
icon_state = "impact_plasmacutter"
/obj/effect/projectile/impact/stun
name = "stun impact"
icon_state = "impact_stun"
/obj/effect/projectile/impact/heavy_laser
name = "heavy laser impact"
icon_state = "impact_beam_heavy"
/obj/effect/projectile/impact/wormhole
icon_state = "wormhole_g"
/obj/effect/projectile/impact/laser/emitter
name = "emitter impact"
icon_state = "impact_emitter"
/obj/effect/projectile/impact/solar
name = "solar impact"
icon_state = "impact_solar"
/obj/effect/projectile/impact/sniper
icon_state = "sniper"
/obj/effect/projectile/impact/death
icon_state = "impact_hcult"
@@ -0,0 +1,48 @@
//These are directional muzzle effects used by hitscan projectiles. Unlike current muzzle effect, they rotate to face the point the hitscan beam came from.
/obj/effect/projectile/muzzle
name = "muzzle flash"
icon = 'icons/obj/projectiles_muzzle.dmi'
/obj/effect/projectile/muzzle/laser
icon_state = "muzzle_laser"
/obj/effect/projectile/muzzle/laser/blue
icon_state = "muzzle_blue"
/obj/effect/projectile/muzzle/disabler
icon_state = "muzzle_omni"
/obj/effect/projectile/muzzle/xray
icon_state = "muzzle_xray"
/obj/effect/projectile/muzzle/pulse
icon_state = "muzzle_u_laser"
/obj/effect/projectile/muzzle/plasma_cutter
icon_state = "muzzle_plasmacutter"
/obj/effect/projectile/muzzle/stun
icon_state = "muzzle_stun"
/obj/effect/projectile/muzzle/heavy_laser
icon_state = "muzzle_beam_heavy"
/obj/effect/projectile/muzzle/wormhole
icon_state = "wormhole_g"
/obj/effect/projectile/muzzle/laser/emitter
name = "emitter flash"
icon_state = "muzzle_emitter"
/obj/effect/projectile/muzzle/solar
icon_state = "muzzle_solar"
/obj/effect/projectile/muzzle/sniper
icon_state = "sniper"
/obj/effect/projectile/muzzle/bullet
icon_state = "muzzle_bullet"
/obj/effect/projectile/muzzle/death
icon_state = "muzzle_hcult"
@@ -0,0 +1,66 @@
//This is the parent of all projectile effects, impact muzzle and tracer.
/obj/effect/projectile
name = "pew"
icon = 'icons/obj/projectiles.dmi'
icon_state = "nothing"
layer = HITSCAN_LAYER
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
appearance_flags = LONG_GLIDE
/obj/effect/projectile/singularity_pull()
return
/obj/effect/projectile/singularity_act()
return
/obj/effect/projectile/proc/scale_to(nx,ny,override=TRUE)
var/matrix/M
if(!override)
M = transform
else
M = new
M.Scale(nx, ny)
transform = M
/obj/effect/projectile/proc/turn_to(angle,override=TRUE)
var/matrix/M
if(!override)
M = transform
else
M = new
M.Turn(angle)
transform = M
/obj/effect/projectile/New(angle_override, p_x, p_y, color_override, scaling = 1)
if(angle_override && p_x && p_y && color_override && scaling)
apply_vars(angle_override, p_x, p_y, color_override, scaling)
return ..()
/obj/effect/projectile/proc/apply_vars(angle_override, p_x = 0, p_y = 0, color_override, scaling = 1, new_loc, increment = 0)
var/mutable_appearance/look = new(src)
look.appearance_flags = RESET_COLOR | RESET_ALPHA
look.pixel_x = p_x
look.pixel_y = p_y
if(color_override)
look.color = color_override
look.appearance_flags = RESET_ALPHA
else
look.appearance_flags = RESET_COLOR | RESET_ALPHA
icon_state = null
add_overlay(look)
scale_to(1, scaling, FALSE)
turn_to(angle_override, FALSE)
if(!isnull(new_loc)) //If you want to null it just delete it...
forceMove(new_loc)
for(var/i in 1 to increment)
pixel_x += round((sin(angle_override) + 16 * sin(angle_override) * 2), 1)
pixel_y += round((cos(angle_override) + 16 * cos(angle_override) * 2), 1)
/obj/effect/projectile_lighting
var/owner
/obj/effect/projectile_lighting/Initialize(mapload, color, range, intensity, owner_key)
. = ..()
set_light(range, intensity, color)
owner = owner_key
@@ -0,0 +1,99 @@
//These are the visual tracers, the beams you see with hitscan effects. This is the proc that generates said tracer
/proc/generate_tracer_between_points(datum/position/starting, datum/position/ending, beam_type, color, qdel_in = 5, light_range = 2, light_color_override, light_intensity = 1, instance_key) //Do not pass z-crossing points as that will not be properly (and likely will never be properly until it's absolutely needed) supported!
if(isnull(starting))
return
if(isnull(ending))
return
if(isnull(beam_type))
return
var/datum/position/midpoint = point_midpoint_points(starting, ending)
var/performance_counter
for(var/obj/effect/projectile/tracer/counter in midpoint.return_turf())
performance_counter++
if(performance_counter >= 3)
return //Damage still happens, this should stop engineers with looping emitters doing shenanigins that makes the server cry
var/obj/effect/projectile/tracer/PB = new beam_type
if(isnull(light_color_override))
light_color_override = color
PB.apply_vars(angle_between_points(starting, ending), midpoint.return_px(), midpoint.return_py(), color, pixel_length_between_points(starting, ending) / world.icon_size, midpoint.return_turf(), 0)
. = PB
if(light_range > 0 && light_intensity > 0)
var/list/turf/line = get_line(starting.return_turf(), ending.return_turf())
tracing_line:
for(var/i in line)
var/turf/T = i
for(var/obj/effect/projectile_lighting/PL in T)
if(PL.owner == locateUID(instance_key))
continue tracing_line
QDEL_IN(new /obj/effect/projectile_lighting(T, light_color_override, light_range, light_intensity, instance_key), qdel_in > 0? qdel_in : 5)
line = null
if(qdel_in)
QDEL_IN(PB, qdel_in)
/obj/effect/projectile/tracer
name = "beam"
icon = 'icons/obj/projectiles_tracer.dmi'
/obj/effect/projectile/tracer/laser
name = "laser"
icon_state = "beam"
/obj/effect/projectile/tracer/laser/blue
icon_state = "beam_blue"
/obj/effect/projectile/tracer/disabler
name = "disabler"
icon_state = "beam_omni"
/obj/effect/projectile/tracer/xray
name = "\improper X-ray laser"
icon_state = "xray"
/obj/effect/projectile/tracer/pulse
name = "pulse laser"
icon_state = "u_laser"
/obj/effect/projectile/tracer/plasma_cutter
name = "plasma blast"
icon_state = "plasmacutter"
/obj/effect/projectile/tracer/stun
name = "stun beam"
icon_state = "stun"
/obj/effect/projectile/tracer/heavy_laser
name = "heavy laser"
icon_state = "beam_heavy"
/obj/effect/projectile/tracer/solar
name = "solar beam"
icon_state = "solar"
/obj/effect/projectile/tracer/solar/thin
icon_state = "solar_thin"
/obj/effect/projectile/tracer/solar/thinnest
icon_state = "solar_thinnest"
//BEAM RIFLE
/obj/effect/projectile/tracer/tracer/beam_rifle
icon_state = "tracer_beam"
/obj/effect/projectile/tracer/tracer/aiming
icon_state = "pixelbeam_greyscale"
plane = ABOVE_LIGHTING_PLANE
/obj/effect/projectile/tracer/wormhole
icon_state = "wormhole_g"
/obj/effect/projectile/tracer/laser/emitter
name = "emitter beam"
icon_state = "emitter"
/obj/effect/projectile/tracer/sniper
icon_state = "sniper"
/obj/effect/projectile/tracer/death
icon_state = "hcult"
@@ -89,7 +89,7 @@
if(user.get_active_hand() == src) // Make sure our user is still holding us
var/turf/target_turf = get_turf(target)
if(target_turf)
var/turflist = getline(user, target_turf)
var/turflist = get_line(user, target_turf)
add_attack_logs(user, target, "Flamethrowered at [target.x],[target.y],[target.z]")
flame_turf(turflist)