[MIRROR] fixes inconsistent lighting ci failure in icebox [MDB IGNORE] (#14166)

* fixes inconsistent lighting ci failure in icebox (#67430)

Fixes and adds test for get_pixel_turf returning null on tall objects on top of the map.

* fixes inconsistent lighting ci failure in icebox

Co-authored-by: Kylerace <kylerlumpkin1@gmail.com>
This commit is contained in:
SkyratBot
2022-06-07 21:11:27 +01:00
committed by GitHub
co-authored by Kylerace
parent ad0f73628f
commit f0ea5eec7b
3 changed files with 14 additions and 2 deletions
+2 -2
View File
@@ -229,8 +229,8 @@ Turf and target are separate in case you want to teleport some distance from a t
var/turf/atom_turf = get_turf(checked_atom) //use checked_atom's turfs, as it's coords are the same as checked_atom's AND checked_atom's coords are lost if it is inside another atom
if(!atom_turf)
return null
var/final_x = atom_turf.x + rough_x
var/final_y = atom_turf.y + rough_y
var/final_x = clamp(atom_turf.x + rough_x, 1, world.maxx)
var/final_y = clamp(atom_turf.y + rough_y, 1, world.maxy)
if(final_x || final_y)
return locate(final_x, final_y, atom_turf.z)
+1
View File
@@ -95,6 +95,7 @@
#include "emoting.dm"
#include "food_edibility_check.dm"
#include "gas_transfer.dm"
#include "get_turf_pixel.dm"
#include "greyscale_config.dm"
#include "heretic_knowledge.dm"
#include "heretic_rituals.dm"
+11
View File
@@ -0,0 +1,11 @@
///ensures that get_turf_pixel() returns turfs within the bounds of the map,
///even when called on a movable with its sprite out of bounds
/datum/unit_test/get_turf_pixel
/datum/unit_test/get_turf_pixel/Run()
//we need long larry to peek over the top edge of the earth
var/turf/north = locate(1, world.maxy, run_loc_floor_bottom_left.z)
//hes really long, so hes really good at peaking over the edge of the map
var/mob/living/simple_animal/hostile/megafauna/colossus/long_larry = allocate(/mob/living/simple_animal/hostile/megafauna/colossus, north)
TEST_ASSERT(istype(get_turf_pixel(long_larry), /turf), "get_turf_pixel() isnt clamping a mob whos sprite is above the bounds of the world inside of the map.")