Merge pull request #10450 from Citadel-Station-13/kevinz000-patch-8

(is this really a good idea) hitscan emitters
This commit is contained in:
Ghom
2020-01-23 02:44:17 +01:00
committed by GitHub
6 changed files with 32 additions and 7 deletions
+1 -1
View File
@@ -30,7 +30,7 @@
var/locked = FALSE
var/allow_switch_interact = TRUE
var/projectile_type = /obj/item/projectile/beam/emitter
var/projectile_type = /obj/item/projectile/beam/emitter/hitscan
var/projectile_sound = 'sound/weapons/emitter.ogg'
var/datum/effect_system/spark_spread/sparks
+9 -3
View File
@@ -57,6 +57,8 @@
var/muzzle_type
var/impact_type
var/turf/last_angle_set_hitscan_store //last turf we stored a hitscan segment while changing angles. without this you'll have potentially hundreds of segments from a homing projectile or something.
//Fancy hitscan lighting effects!
var/hitscan_light_intensity = 1.5
var/hitscan_light_range = 0.75
@@ -410,12 +412,16 @@
START_PROCESSING(SSprojectiles, src)
pixel_move(1, FALSE) //move it now!
/obj/item/projectile/proc/setAngle(new_angle) //wrapper for overrides.
/obj/item/projectile/proc/setAngle(new_angle, hitscan_store_segment = TRUE) //wrapper for overrides.
Angle = new_angle
if(!nondirectional_sprite)
var/matrix/M = new
M.Turn(Angle)
transform = M
if(fired && hitscan && trajectory && isloc(loc) && (loc != last_angle_set_hitscan_store))
last_angle_set_hitscan_store = loc
var/datum/point/pcache = trajectory.copy_to()
store_hitscan_collision(pcache)
if(trajectory)
trajectory.set_angle(new_angle)
return TRUE
@@ -462,7 +468,7 @@
beam_segments[beam_index] = null //record start.
/obj/item/projectile/proc/process_hitscan()
var/safety = range * 3
var/safety = range * 10
record_hitscan_start(RETURN_POINT_VECTOR_INCREMENT(src, Angle, MUZZLE_EFFECT_PIXEL_INCREMENT, 1))
while(loc && !QDELETED(src))
if(paused)
@@ -647,7 +653,7 @@
/obj/item/projectile/proc/cleanup_beam_segments()
QDEL_LIST_ASSOC(beam_segments)
beam_segments = list()
qdel(beam_index)
QDEL_NULL(beam_index)
/obj/item/projectile/proc/finalize_hitscan_and_generate_tracers(impacting = TRUE)
if(trajectory && beam_index)
+8 -1
View File
@@ -118,7 +118,14 @@
light_color = LIGHT_COLOR_GREEN
/obj/item/projectile/beam/emitter/singularity_pull()
return //don't want the emitters to miss
return
/obj/item/projectile/beam/emitter/hitscan
hitscan = TRUE
muzzle_type = /obj/effect/projectile/muzzle/laser/emitter
tracer_type = /obj/effect/projectile/tracer/laser/emitter
impact_type = /obj/effect/projectile/impact/laser/emitter
impact_effect_type = null
/obj/item/projectile/beam/lasertag
name = "laser tag beam"