Skip to content

Commit

Permalink
emitter fix i guess
Browse files Browse the repository at this point in the history
  • Loading branch information
NinjaPikachuska committed Jan 17, 2025
1 parent 25954f0 commit 7513545
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 16 deletions.
14 changes: 11 additions & 3 deletions code/__HELPERS/vector.dm
Original file line number Diff line number Diff line change
Expand Up @@ -45,23 +45,31 @@ return_location()
/datum/plot_vector
var/turf/source
var/turf/target
var/cardinal_dir // in case we don't have a specific target
var/angle = 0 // direction of travel in degrees
var/loc_x = 0 // in pixels from the left edge of the map
var/loc_y = 0 // in pixels from the bottom edge of the map
var/loc_z = 0 // loc z is in world space coordinates (i.e. z level) - we don't care about measuring pixels for this
var/offset_x = 0 // distance to increment each step
var/offset_y = 0

/datum/plot_vector/proc/setup(turf/S, turf/T, xo = 0, yo = 0, angle_offset=0)
/datum/plot_vector/proc/setup(turf/S, turf/T, xo = 0, yo = 0, angle_offset=0, dir)
source = S
target = T
cardinal_dir = dir

if(!istype(source))
source = get_turf(source)
if(!istype(target))

if(!istype(source))
return

if(!target && cardinal_dir)
target = get_step(source, cardinal_dir)
else if(!istype(target))
target = get_turf(target)

if(!istype(source) || !istype(target))
if(!istype(target))
return

// convert coordinates to pixel space (default is 32px/turf, 8160px across for a size 255 map)
Expand Down
4 changes: 2 additions & 2 deletions code/game/turfs/turf.dm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/turf
icon = 'icons/turf/floors.dmi'

// base turf luminosity, works against byond native darkness
// most likely you shouldn't touch it
// currently direcly used only by starlight/environment lighting
Expand Down Expand Up @@ -150,7 +150,7 @@
var/atom/priority_target = mover.original

// Then check priority target if it on the tile
if(!isturf(priority_target) && priority_target.loc == T)
if(priority_target && !isturf(priority_target) && priority_target.loc == T)
if(isliving(priority_target))
if(!mover.check_miss(priority_target))
alive_obstacle = priority_target
Expand Down
9 changes: 0 additions & 9 deletions code/modules/power/singularity/emitter.dm
Original file line number Diff line number Diff line change
Expand Up @@ -160,15 +160,6 @@
s.start()
A.set_dir(src.dir)
A.starting = get_turf(src)
switch(dir)
if(NORTH)
A.original = locate(x, y+1, z)
if(EAST)
A.original = locate(x+1, y, z)
if(WEST)
A.original = locate(x-1, y, z)
else // Any other
A.original = locate(x, y-1, z)
A.process()


Expand Down
4 changes: 2 additions & 2 deletions code/modules/projectiles/projectile.dm
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
var/xo = null
var/current = null
var/obj/shot_from = null // the object which shot us
var/atom/original = null // the original target clicked
var/atom/original = null // the original target clicked, may not exist
var/turf/starting = null // the projectile's starting turf
var/list/permutated = list() // we've passed through these atoms, don't try to hit them again

Expand Down Expand Up @@ -255,7 +255,7 @@

// plot the initial trajectory
trajectory = new()
trajectory.setup(starting, original, pixel_x, pixel_y, angle_offset=offset)
trajectory.setup(starting, original, pixel_x, pixel_y, offset, dir)

// generate this now since all visual effects the projectile makes can use it
effect_transform = new()
Expand Down

0 comments on commit 7513545

Please sign in to comment.