[MIRROR] Makes emitters hitscan (#3047)

* Makes emitters hitscan (#56579)

* Makes emitters hitscan

* a

Co-authored-by: NotRanged <rangedvdk@gmail.com>
Co-authored-by: Gandalf2k15 <jzo123@hotmail.com>
This commit is contained in:
SkyratBot
2021-02-03 23:37:40 +01:00
committed by GitHub
parent 200fb23a54
commit b511bc53e6
10 changed files with 41 additions and 7 deletions
+11 -2
View File
@@ -95,6 +95,8 @@
//Hitscan
var/hitscan = FALSE //Whether this is hitscan. If it is, speed is basically ignored.
var/list/beam_segments //assoc list of datum/point or datum/point/vector, start = end. Used for hitscan effect generation.
/// Last turf an angle was changed in for hitscan projectiles.
var/turf/last_angle_set_hitscan_store
var/datum/point/beam_index
var/turf/hitscan_last //last turf touched during hitscanning.
var/tracer_type
@@ -690,7 +692,7 @@
START_PROCESSING(SSprojectiles, src)
pixel_move(1, FALSE) //move it now!
/obj/projectile/proc/setAngle(new_angle) //wrapper for overrides.
/obj/projectile/proc/setAngle(new_angle) //wrapper for overrides.
Angle = new_angle
if(!nondirectional_sprite)
var/matrix/M = new
@@ -698,6 +700,13 @@
transform = M
if(trajectory)
trajectory.set_angle(new_angle)
if(fired && hitscan && isloc(loc) && (loc != last_angle_set_hitscan_store))
last_angle_set_hitscan_store = loc
var/datum/point/pcache = new (src)
var/list/coordinates = trajectory.return_coordinates()
pcache.initialize_location(coordinates[1], coordinates[2], coordinates[3]) // Take the center of the hitscan collision tile, so it looks good on reflector boxes and the like
trajectory.initialize_location(coordinates[1], coordinates[2], coordinates[3]) // Sets the trajectory to it as well, to prevent a strange visual bug
store_hitscan_collision(pcache)
return TRUE
/obj/projectile/forceMove(atom/target)
@@ -744,7 +753,7 @@
beam_segments[beam_index] = null //record start.
/obj/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)
+17 -1
View File
@@ -134,7 +134,7 @@
/obj/projectile/beam/emitter
name = "emitter beam"
icon_state = "emitter" //ICON OVERRIDEN IN SKYRAT AESTHETICS - SEE MODULE
icon_state = "emitter"
damage = 30
impact_effect_type = /obj/effect/temp_visual/impact_effect/green_laser
light_color = LIGHT_COLOR_GREEN
@@ -144,6 +144,22 @@
/obj/projectile/beam/emitter/singularity_pull()
return //don't want the emitters to miss
/obj/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
hitscan_light_intensity = 3
hitscan_light_range = 0.75
hitscan_light_color_override = COLOR_LIME
muzzle_flash_intensity = 6
muzzle_flash_range = 2
muzzle_flash_color_override = COLOR_LIME
impact_light_intensity = 7
impact_light_range = 2.5
impact_light_color_override = COLOR_LIME
/obj/projectile/beam/lasertag
name = "laser tag beam"
icon_state = "omnilaser"