mirror of
https://github.com/Citadel-Station-13/Citadel-Station-13-RP.git
synced 2025-12-11 13:01:05 +00:00
mining turfs
This commit is contained in:
@@ -17,7 +17,6 @@ GLOBAL_LIST_EMPTY(turf_edge_cache)
|
|||||||
var/list/flooring_cache = list()
|
var/list/flooring_cache = list()
|
||||||
|
|
||||||
/turf/simulated/floor/update_icon()
|
/turf/simulated/floor/update_icon()
|
||||||
. = ..()
|
|
||||||
cut_overlays()
|
cut_overlays()
|
||||||
|
|
||||||
if(flooring)
|
if(flooring)
|
||||||
@@ -91,6 +90,9 @@ var/list/flooring_cache = list()
|
|||||||
if(isopenturf(above) && !istype(src, /turf/simulated/floor/outdoors)) // This won't apply to outdoor turfs since its assumed they don't have a ceiling anyways.
|
if(isopenturf(above) && !istype(src, /turf/simulated/floor/outdoors)) // This won't apply to outdoor turfs since its assumed they don't have a ceiling anyways.
|
||||||
add_overlay(GLOB.no_ceiling_image)
|
add_overlay(GLOB.no_ceiling_image)
|
||||||
|
|
||||||
|
// ..() has to be last to prevent trampling managed overlays
|
||||||
|
return ..()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* welcome to the less modular but more sensical and efficient way to do icon edges
|
* welcome to the less modular but more sensical and efficient way to do icon edges
|
||||||
* instead of having every turf check, we only have turfs tha can spill onto others check, and apply their edges to other turfs
|
* instead of having every turf check, we only have turfs tha can spill onto others check, and apply their edges to other turfs
|
||||||
|
|||||||
@@ -32,11 +32,9 @@
|
|||||||
update_icon()
|
update_icon()
|
||||||
|
|
||||||
/turf/simulated/wall/update_overlays()
|
/turf/simulated/wall/update_overlays()
|
||||||
. = ..()
|
|
||||||
|
|
||||||
// materrialless walls don't use this system.
|
// materrialless walls don't use this system.
|
||||||
if(!material)
|
if(!material)
|
||||||
return
|
return ..()
|
||||||
|
|
||||||
cut_overlays()
|
cut_overlays()
|
||||||
|
|
||||||
@@ -48,7 +46,7 @@
|
|||||||
I = image('icons/turf/wall_masks.dmi', "[material.icon_base]fwall_open")
|
I = image('icons/turf/wall_masks.dmi', "[material.icon_base]fwall_open")
|
||||||
I.color = material.icon_colour
|
I.color = material.icon_colour
|
||||||
add_overlay(I)
|
add_overlay(I)
|
||||||
return
|
return ..()
|
||||||
|
|
||||||
// modern smoothiing when
|
// modern smoothiing when
|
||||||
// sigh
|
// sigh
|
||||||
@@ -98,3 +96,6 @@
|
|||||||
overlay = damage_overlays.len
|
overlay = damage_overlays.len
|
||||||
|
|
||||||
add_overlay(damage_overlays[overlay])
|
add_overlay(damage_overlays[overlay])
|
||||||
|
|
||||||
|
// ..() has to be last to prevent trampling managed overlays
|
||||||
|
return ..()
|
||||||
|
|||||||
@@ -94,8 +94,7 @@ VIRGO3B_TURF_CREATE(/turf/simulated/mineral/floor)
|
|||||||
MAT_LEAD = 1))
|
MAT_LEAD = 1))
|
||||||
if(mineral_name && (mineral_name in GLOB.ore_data))
|
if(mineral_name && (mineral_name in GLOB.ore_data))
|
||||||
mineral = GLOB.ore_data[mineral_name]
|
mineral = GLOB.ore_data[mineral_name]
|
||||||
if(flags & INITIALIZED)
|
UpdateMineral()
|
||||||
UpdateMineral()
|
|
||||||
|
|
||||||
turf/simulated/mineral/rich/make_ore(var/rare_ore)
|
turf/simulated/mineral/rich/make_ore(var/rare_ore)
|
||||||
if(mineral || ignore_mapgen)
|
if(mineral || ignore_mapgen)
|
||||||
@@ -127,8 +126,7 @@ turf/simulated/mineral/rich/make_ore(var/rare_ore)
|
|||||||
MAT_VERDANTIUM = 1))
|
MAT_VERDANTIUM = 1))
|
||||||
if(mineral_name && (mineral_name in GLOB.ore_data))
|
if(mineral_name && (mineral_name in GLOB.ore_data))
|
||||||
mineral = GLOB.ore_data[mineral_name]
|
mineral = GLOB.ore_data[mineral_name]
|
||||||
if(flags & INITIALIZED)
|
UpdateMineral()
|
||||||
UpdateMineral()
|
|
||||||
|
|
||||||
//Unsimulated
|
//Unsimulated
|
||||||
/turf/unsimulated/mineral/virgo3b
|
/turf/unsimulated/mineral/virgo3b
|
||||||
@@ -168,8 +166,7 @@ turf/simulated/mineral/rich/make_ore(var/rare_ore)
|
|||||||
MAT_VERDANTIUM = 1))
|
MAT_VERDANTIUM = 1))
|
||||||
if(mineral_name && (mineral_name in GLOB.ore_data))
|
if(mineral_name && (mineral_name in GLOB.ore_data))
|
||||||
mineral = GLOB.ore_data[mineral_name]
|
mineral = GLOB.ore_data[mineral_name]
|
||||||
if(flags & INITIALIZED)
|
UpdateMineral()
|
||||||
UpdateMineral()
|
|
||||||
|
|
||||||
// Some turfs to make floors look better in centcom tram station.
|
// Some turfs to make floors look better in centcom tram station.
|
||||||
|
|
||||||
|
|||||||
@@ -140,8 +140,7 @@ VIRGO2_TURF_CREATE(/turf/simulated/mineral)
|
|||||||
|
|
||||||
if(mineral_name && (mineral_name in GLOB.ore_data))
|
if(mineral_name && (mineral_name in GLOB.ore_data))
|
||||||
mineral = GLOB.ore_data[mineral_name]
|
mineral = GLOB.ore_data[mineral_name]
|
||||||
if(flags & INITIALIZED)
|
UpdateMineral()
|
||||||
UpdateMineral()
|
|
||||||
|
|
||||||
VIRGO2_TURF_CREATE(/turf/simulated/mineral/ignore_mapgen)
|
VIRGO2_TURF_CREATE(/turf/simulated/mineral/ignore_mapgen)
|
||||||
VIRGO2_TURF_CREATE(/turf/simulated/mineral/floor)
|
VIRGO2_TURF_CREATE(/turf/simulated/mineral/floor)
|
||||||
|
|||||||
@@ -1,6 +1,3 @@
|
|||||||
var/list/mining_overlay_cache = list()
|
|
||||||
|
|
||||||
|
|
||||||
/**********************Mineral deposits**************************/
|
/**********************Mineral deposits**************************/
|
||||||
/turf/unsimulated/mineral
|
/turf/unsimulated/mineral
|
||||||
name = "impassable rock"
|
name = "impassable rock"
|
||||||
@@ -12,6 +9,7 @@ var/list/mining_overlay_cache = list()
|
|||||||
name = "rock"
|
name = "rock"
|
||||||
icon = 'icons/turf/walls.dmi'
|
icon = 'icons/turf/walls.dmi'
|
||||||
icon_state = "rock"
|
icon_state = "rock"
|
||||||
|
smoothing_flags = SMOOTH_CUSTOM
|
||||||
var/rock_side_icon_state = "rock_side"
|
var/rock_side_icon_state = "rock_side"
|
||||||
var/sand_icon_state = "asteroid"
|
var/sand_icon_state = "asteroid"
|
||||||
var/rock_icon_state = "rock"
|
var/rock_icon_state = "rock"
|
||||||
@@ -84,35 +82,30 @@ turf/simulated/mineral/floor/light_corner
|
|||||||
/turf/simulated/mineral/proc/make_floor()
|
/turf/simulated/mineral/proc/make_floor()
|
||||||
if(!density && !opacity)
|
if(!density && !opacity)
|
||||||
return
|
return
|
||||||
density = 0
|
density = FALSE
|
||||||
opacity = 0
|
opacity = FALSE
|
||||||
recalc_atom_opacity()
|
recalc_atom_opacity()
|
||||||
reconsider_lights()
|
reconsider_lights()
|
||||||
blocks_air = 0
|
blocks_air = FALSE
|
||||||
can_build_into_floor = TRUE
|
can_build_into_floor = TRUE
|
||||||
SSplanets.addTurf(src)
|
SSplanets.addTurf(src)
|
||||||
|
SSair.mark_for_update(src)
|
||||||
update_general()
|
update_general()
|
||||||
|
QUEUE_SMOOTH_NEIGHBORS(src)
|
||||||
|
|
||||||
/turf/simulated/mineral/proc/make_wall()
|
/turf/simulated/mineral/proc/make_wall()
|
||||||
if(density && opacity)
|
if(density && opacity)
|
||||||
return
|
return
|
||||||
density = 1
|
density = TRUE
|
||||||
opacity = 1
|
opacity = TRUE
|
||||||
recalc_atom_opacity()
|
recalc_atom_opacity()
|
||||||
reconsider_lights()
|
reconsider_lights()
|
||||||
blocks_air = 1
|
blocks_air = TRUE
|
||||||
can_build_into_floor = FALSE
|
can_build_into_floor = FALSE
|
||||||
SSplanets.removeTurf(src)
|
SSplanets.removeTurf(src)
|
||||||
|
SSair.mark_for_update(src)
|
||||||
update_general()
|
update_general()
|
||||||
|
QUEUE_SMOOTH_NEIGHBORS(src)
|
||||||
/turf/simulated/mineral/proc/update_general()
|
|
||||||
if(!(flags & INITIALIZED))
|
|
||||||
update_icon(TRUE)
|
|
||||||
recalc_atom_opacity()
|
|
||||||
if(SSticker && SSticker.current_state == GAME_STATE_PLAYING)
|
|
||||||
reconsider_lights()
|
|
||||||
if(air_master)
|
|
||||||
air_master.mark_for_update(src)
|
|
||||||
|
|
||||||
/turf/simulated/mineral/Entered(atom/movable/M as mob|obj)
|
/turf/simulated/mineral/Entered(atom/movable/M as mob|obj)
|
||||||
..()
|
..()
|
||||||
@@ -123,25 +116,6 @@ turf/simulated/mineral/floor/light_corner
|
|||||||
O.autoload(R)
|
O.autoload(R)
|
||||||
return
|
return
|
||||||
|
|
||||||
/turf/simulated/mineral/proc/get_cached_border(var/cache_id, var/direction, var/icon_file, var/icon_state, var/offset = 32)
|
|
||||||
//Cache miss
|
|
||||||
if(!mining_overlay_cache["[cache_id]_[direction]"])
|
|
||||||
var/image/new_cached_image = image(icon_state, dir = direction, layer = ABOVE_TURF_LAYER)
|
|
||||||
switch(direction)
|
|
||||||
if(NORTH)
|
|
||||||
new_cached_image.pixel_y = offset
|
|
||||||
if(SOUTH)
|
|
||||||
new_cached_image.pixel_y = -offset
|
|
||||||
if(EAST)
|
|
||||||
new_cached_image.pixel_x = offset
|
|
||||||
if(WEST)
|
|
||||||
new_cached_image.pixel_x = -offset
|
|
||||||
mining_overlay_cache["[cache_id]_[direction]"] = new_cached_image
|
|
||||||
return new_cached_image
|
|
||||||
|
|
||||||
//Cache hit
|
|
||||||
return mining_overlay_cache["[cache_id]_[direction]"]
|
|
||||||
|
|
||||||
/turf/simulated/mineral/Initialize(mapload)
|
/turf/simulated/mineral/Initialize(mapload)
|
||||||
. = ..()
|
. = ..()
|
||||||
if(prob(20))
|
if(prob(20))
|
||||||
@@ -150,17 +124,28 @@ turf/simulated/mineral/floor/light_corner
|
|||||||
dir = pick(GLOB.alldirs)
|
dir = pick(GLOB.alldirs)
|
||||||
if(mineral)
|
if(mineral)
|
||||||
if(density)
|
if(density)
|
||||||
MineralSpread(mapload)
|
MineralSpread()
|
||||||
else
|
else
|
||||||
UpdateMineral(!mapload)
|
UpdateMineral() // this'll work because we're INITIALIZED
|
||||||
else
|
if(!mapload)
|
||||||
update_icon(!mapload)
|
QUEUE_SMOOTH_NEIGHBORS(src)
|
||||||
|
|
||||||
/turf/simulated/mineral/update_icon(var/update_neighbors)
|
/* custom smoothing code */
|
||||||
|
/turf/simulated/mineral/find_type_in_direction(direction)
|
||||||
|
var/turf/T = get_step(src, direction)
|
||||||
|
if(!T)
|
||||||
|
return NULLTURF_BORDER
|
||||||
|
return T.density? ADJ_FOUND : NO_ADJ_FOUND
|
||||||
|
|
||||||
|
/turf/simulated/mineral/custom_smooth(dirs)
|
||||||
|
smoothing_junction = dirs
|
||||||
|
update_icon()
|
||||||
|
|
||||||
|
/turf/simulated/mineral/update_icon()
|
||||||
cut_overlays()
|
cut_overlays()
|
||||||
|
|
||||||
//We are a wall (why does this system work like this??)
|
//We are a wall (why does this system work like this??)
|
||||||
|
// todo: refactor this shitheap because this is pants on fucking head awful
|
||||||
if(density)
|
if(density)
|
||||||
if(mineral)
|
if(mineral)
|
||||||
name = "[mineral.display_name] deposit"
|
name = "[mineral.display_name] deposit"
|
||||||
@@ -170,17 +155,25 @@ turf/simulated/mineral/floor/light_corner
|
|||||||
icon = 'icons/turf/walls.dmi'
|
icon = 'icons/turf/walls.dmi'
|
||||||
icon_state = rock_icon_state
|
icon_state = rock_icon_state
|
||||||
|
|
||||||
|
if(smoothing_junction & NORTH_JUNCTION)
|
||||||
|
add_overlay(get_cached_border(rock_side_icon_state, NORTH, icon, rock_side_icon_state))
|
||||||
|
if(smoothing_junction & SOUTH_JUNCTION)
|
||||||
|
add_overlay(get_cached_border(rock_side_icon_state, SOUTH, icon, rock_side_icon_state))
|
||||||
|
if(smoothing_junction & EAST_JUNCTION)
|
||||||
|
add_overlay(get_cached_border(rock_side_icon_state, EAST, icon, rock_side_icon_state))
|
||||||
|
if(smoothing_junction & WEST_JUNCTION)
|
||||||
|
add_overlay(get_cached_border(rock_side_icon_state, WEST, icon, rock_side_icon_state))
|
||||||
|
|
||||||
//Apply overlays if we should have borders
|
//Apply overlays if we should have borders
|
||||||
for(var/direction in GLOB.cardinal)
|
for(var/direction in GLOB.cardinal)
|
||||||
var/turf/T = get_step(src,direction)
|
var/turf/T = get_step(src,direction)
|
||||||
if(istype(T) && !T.density)
|
if(istype(T) && !T.density)
|
||||||
add_overlay(get_cached_border(rock_side_icon_state,direction,icon,rock_side_icon_state))
|
add_overlay(get_cached_border(rock_side_icon_state,direction,icon,rock_side_icon_state))
|
||||||
|
|
||||||
if(archaeo_overlay)
|
if(archaeo_overlay)
|
||||||
add_overlay(archaeo_overlay)
|
add_overlay(archaeo_overlay)
|
||||||
|
if(excav_overlay)
|
||||||
if(excav_overlay)
|
add_overlay(excav_overlay)
|
||||||
add_overlay(excav_overlay)
|
|
||||||
|
|
||||||
//We are a sand floor
|
//We are a sand floor
|
||||||
else
|
else
|
||||||
@@ -190,26 +183,35 @@ turf/simulated/mineral/floor/light_corner
|
|||||||
|
|
||||||
if(sand_dug)
|
if(sand_dug)
|
||||||
add_overlay("dug_overlay")
|
add_overlay("dug_overlay")
|
||||||
|
|
||||||
//Apply overlays if there's space
|
|
||||||
for(var/direction in GLOB.cardinal)
|
|
||||||
if(istype(get_step(src, direction), /turf/space) && !istype(get_step(src, direction), /turf/space/cracked_asteroid))
|
|
||||||
add_overlay(get_cached_border("asteroid_edge",direction,icon,"asteroid_edges", 0))
|
|
||||||
|
|
||||||
//Or any time
|
|
||||||
else
|
|
||||||
var/turf/T = get_step(src, direction)
|
|
||||||
if(istype(T) && T.density)
|
|
||||||
add_overlay(get_cached_border(rock_side_icon_state,direction,'icons/turf/walls.dmi',rock_side_icon_state))
|
|
||||||
|
|
||||||
if(overlay_detail)
|
if(overlay_detail)
|
||||||
add_overlay('icons/turf/flooring/decals.dmi',overlay_detail)
|
add_overlay('icons/turf/flooring/decals.dmi',overlay_detail)
|
||||||
|
|
||||||
if(update_neighbors)
|
// ..() has to be last to prevent trampling managed overlays
|
||||||
for(var/direction in GLOB.alldirs)
|
return ..()
|
||||||
if(istype(get_step(src, direction), /turf/simulated/mineral))
|
|
||||||
var/turf/simulated/mineral/M = get_step(src, direction)
|
GLOBAL_LIST_EMPTY(mining_overlay_cache)
|
||||||
M.update_icon()
|
|
||||||
|
/turf/simulated/mineral/proc/get_cached_border(cache_id, direction, icon_file, icon_state)
|
||||||
|
cache_id = "[cached_id]_[direction]"
|
||||||
|
//Cache miss
|
||||||
|
if(!GLOB.mining_overlay_cache[cache_id])
|
||||||
|
var/image/new_cached_image = image(icon_state, dir = turn(direction, 180), layer = ABOVE_TURF_LAYER)
|
||||||
|
switch(direction)
|
||||||
|
if(NORTH)
|
||||||
|
new_cached_image.pixel_y = 32
|
||||||
|
if(SOUTH)
|
||||||
|
new_cached_image.pixel_y = -32
|
||||||
|
if(EAST)
|
||||||
|
new_cached_image.pixel_x = 32
|
||||||
|
if(WEST)
|
||||||
|
new_cached_image.pixel_x = -32
|
||||||
|
GLOB.mining_overlay_cache[cache_id] = new_cached_image
|
||||||
|
return new_cached_image
|
||||||
|
|
||||||
|
//Cache hit
|
||||||
|
return GLOB.mining_overlay_cache[cache_id]
|
||||||
|
|
||||||
|
/* smoothing end */
|
||||||
|
|
||||||
/turf/simulated/mineral/ex_act(severity)
|
/turf/simulated/mineral/ex_act(severity)
|
||||||
|
|
||||||
@@ -272,21 +274,22 @@ turf/simulated/mineral/floor/light_corner
|
|||||||
if(istype(M.selected,/obj/item/mecha_parts/mecha_equipment/tool/drill))
|
if(istype(M.selected,/obj/item/mecha_parts/mecha_equipment/tool/drill))
|
||||||
M.selected.action(src)
|
M.selected.action(src)
|
||||||
|
|
||||||
/turf/simulated/mineral/proc/MineralSpread(mapload)
|
/turf/simulated/mineral/proc/MineralSpread()
|
||||||
UpdateMineral(!mapload)
|
UpdateMineral()
|
||||||
if(mineral && mineral.spread)
|
if(mineral && mineral.spread)
|
||||||
for(var/trydir in GLOB.cardinal)
|
for(var/trydir in GLOB.cardinal)
|
||||||
if(prob(mineral.spread_chance))
|
if(prob(mineral.spread_chance))
|
||||||
var/turf/simulated/mineral/target_turf = get_step(src, trydir)
|
var/turf/simulated/mineral/target_turf = get_step(src, trydir)
|
||||||
if(istype(target_turf) && target_turf.density && !target_turf.mineral)
|
if(istype(target_turf) && target_turf.density && !target_turf.mineral)
|
||||||
target_turf.mineral = mineral
|
target_turf.mineral = mineral
|
||||||
target_turf.MineralSpread(mapload)
|
target_turf.MineralSpread()
|
||||||
|
|
||||||
/turf/simulated/mineral/proc/UpdateMineral(update_neighbors)
|
/turf/simulated/mineral/proc/UpdateMineral(update_neighbors)
|
||||||
|
if(!(flags & INITIALIZED))
|
||||||
|
return // /Initialize() will handle us
|
||||||
clear_ore_effects()
|
clear_ore_effects()
|
||||||
if(mineral && density)
|
if(mineral && density)
|
||||||
new /obj/effect/mineral(src, mineral)
|
new /obj/effect/mineral(src, mineral)
|
||||||
update_icon(update_neighbors)
|
|
||||||
|
|
||||||
//Not even going to touch this pile of spaghetti
|
//Not even going to touch this pile of spaghetti
|
||||||
/turf/simulated/mineral/attackby(obj/item/W as obj, mob/user as mob)
|
/turf/simulated/mineral/attackby(obj/item/W as obj, mob/user as mob)
|
||||||
@@ -606,7 +609,7 @@ turf/simulated/mineral/floor/light_corner
|
|||||||
sand_dug = 1
|
sand_dug = 1
|
||||||
for(var/i=0;i<5;i++)
|
for(var/i=0;i<5;i++)
|
||||||
new/obj/item/ore/glass(src)
|
new/obj/item/ore/glass(src)
|
||||||
update_icon()
|
QUEUE_SMOOTH(src)
|
||||||
return
|
return
|
||||||
|
|
||||||
if (mineral && mineral.result_amount)
|
if (mineral && mineral.result_amount)
|
||||||
@@ -639,7 +642,6 @@ turf/simulated/mineral/floor/light_corner
|
|||||||
new /obj/structure/closet/crate/secure/loot(src)
|
new /obj/structure/closet/crate/secure/loot(src)
|
||||||
|
|
||||||
make_floor()
|
make_floor()
|
||||||
update_icon(1)
|
|
||||||
|
|
||||||
/turf/simulated/mineral/proc/excavate_find(var/is_clean = 0, var/datum/find/F)
|
/turf/simulated/mineral/proc/excavate_find(var/is_clean = 0, var/datum/find/F)
|
||||||
//with skill and luck, players can cleanly extract finds
|
//with skill and luck, players can cleanly extract finds
|
||||||
@@ -708,5 +710,4 @@ turf/simulated/mineral/floor/light_corner
|
|||||||
|
|
||||||
if(mineral_name && (mineral_name in GLOB.ore_data))
|
if(mineral_name && (mineral_name in GLOB.ore_data))
|
||||||
mineral = GLOB.ore_data[mineral_name]
|
mineral = GLOB.ore_data[mineral_name]
|
||||||
if(flags & INITIALIZED)
|
UpdateMineral()
|
||||||
UpdateMineral()
|
|
||||||
|
|||||||
@@ -65,8 +65,7 @@
|
|||||||
MAT_URANIUM = 5))
|
MAT_URANIUM = 5))
|
||||||
if(mineral_name && (mineral_name in GLOB.ore_data))
|
if(mineral_name && (mineral_name in GLOB.ore_data))
|
||||||
mineral = GLOB.ore_data[mineral_name]
|
mineral = GLOB.ore_data[mineral_name]
|
||||||
if(flags & INITIALIZED)
|
UpdateMineral()
|
||||||
UpdateMineral()
|
|
||||||
|
|
||||||
/turf/simulated/mineral/rich/make_ore(var/rare_ore)
|
/turf/simulated/mineral/rich/make_ore(var/rare_ore)
|
||||||
if(mineral || ignore_mapgen)
|
if(mineral || ignore_mapgen)
|
||||||
@@ -100,8 +99,7 @@
|
|||||||
MAT_VERDANTIUM = 1))
|
MAT_VERDANTIUM = 1))
|
||||||
if(mineral_name && (mineral_name in GLOB.ore_data))
|
if(mineral_name && (mineral_name in GLOB.ore_data))
|
||||||
mineral = GLOB.ore_data[mineral_name]
|
mineral = GLOB.ore_data[mineral_name]
|
||||||
if(flags & INITIALIZED)
|
UpdateMineral()
|
||||||
UpdateMineral()
|
|
||||||
|
|
||||||
//Unsimulated
|
//Unsimulated
|
||||||
/turf/unsimulated/wall/planetary/triumph
|
/turf/unsimulated/wall/planetary/triumph
|
||||||
|
|||||||
Reference in New Issue
Block a user