[MIRROR] Makes ore silo connecting work on multi-z [MDB IGNORE] (#14257)

* Makes ore silo connecting work on multi-z (#67640)

* makes ore silo connecting work on multi-z

* I merged the two checks for same z level when connecting an ore silo, and disconnecting it. This was because I didn't want to copy paste the code to use it twice, which was what now caused the problem of multi-z maps being unable to connect ore silos on the same level. At the time it was also intentional since it's easier to connect than to disconnect something, but I realize that this inconsistency isn't great or beneficial to anyone.

* Turns it into a helper instead

* Makes ore silo connecting work on multi-z

Co-authored-by: John Willard <53777086+JohnFulpWillard@users.noreply.github.com>
This commit is contained in:
SkyratBot
2022-06-12 02:34:45 +01:00
committed by GitHub
co-authored by John Willard
parent fa873f0eb5
commit 73d6dc9f6e
3 changed files with 23 additions and 6 deletions
+19
View File
@@ -0,0 +1,19 @@
/**
* - is_valid_z_level
*
* Checks if source_loc and checking_loc is both on the station, or on the same z level.
* This is because the station's several levels aren't considered the same z, so multi-z stations need this special case.
*
* Args:
* source_loc - turf of the source we're comparing.
* checking_loc - turf we are comparing to source_loc.
*
* returns TRUE if connection is valid, FALSE otherwise.
*/
/proc/is_valid_z_level(turf/source_loc, turf/checking_loc)
// if we're both on "station", regardless of multi-z, we'll pass by.
if(is_station_level(source_loc.z) && is_station_level(checking_loc.z))
return TRUE
if(source_loc.z == checking_loc.z)
return TRUE
return FALSE
+3 -6
View File
@@ -108,7 +108,7 @@ handles linking back and forth.
return COMPONENT_BLOCK_TOOL_ATTACK
var/turf/silo_turf = get_turf(M.buffer)
var/turf/user_loc = get_turf(user)
if(user_loc.z != silo_turf.z)
if(!is_valid_z_level(silo_turf, user_loc))
to_chat(user, span_warning("[parent] is too far away to get a connection signal!"))
return COMPONENT_BLOCK_TOOL_ATTACK
if (silo)
@@ -130,11 +130,8 @@ handles linking back and forth.
return
var/turf/silo_turf = get_turf(silo)
if(is_station_level(silo_turf.z) && is_station_level(new_turf.z)) // if we're both on "station", regardless of multi-z, we'll pass by.
return
if(silo_turf.z == new_turf.z)
return
disconnect_from(silo)
if(!is_valid_z_level(silo_turf, new_turf))
disconnect_from(silo)
/datum/component/remote_materials/proc/on_hold()
return silo?.holds["[get_area(parent)]/[category]"]
+1
View File
@@ -362,6 +362,7 @@
#include "code\__HELPERS\icons.dm"
#include "code\__HELPERS\jatum.dm"
#include "code\__HELPERS\level_traits.dm"
#include "code\__HELPERS\levels.dm"
#include "code\__HELPERS\lighting.dm"
#include "code\__HELPERS\maths.dm"
#include "code\__HELPERS\matrices.dm"