/datum/random_map/noise/ore
descriptor = "ore distribution map"
var/deep_val = 0.8 // Threshold for deep metals, set in new as percentage of cell_range.
var/rare_val = 0.7 // Threshold for rare metal, set in new as percentage of cell_range.
var/chunk_size = 3 // Size each cell represents on map
/datum/random_map/noise/ore/New()
rare_val = cell_range * rare_val
deep_val = cell_range * deep_val
..()
/datum/random_map/noise/ore/check_map_sanity()
var/rare_count = 0
var/surface_count = 0
var/deep_count = 0
// Increment map sanity counters.
for(var/value in map)
if(value < rare_val)
surface_count++
else if(value < deep_val)
rare_count++
else
deep_count++
// Sanity check.
if(surface_count < MIN_SURFACE_COUNT)
admin_notice("Insufficient surface minerals. Rerolling...", R_DEBUG)
return 0
else if(rare_count < MIN_RARE_COUNT)
admin_notice("Insufficient rare minerals. Rerolling...", R_DEBUG)
return 0
else if(deep_count < MIN_DEEP_COUNT)
admin_notice("Insufficient deep minerals. Rerolling...", R_DEBUG)
return 0
else
return 1
/datum/random_map/noise/ore/apply_to_turf(var/x,var/y)
var/tx = ((origin_x-1)+x)*chunk_size
var/ty = ((origin_y-1)+y)*chunk_size
for(var/i=0,i