Basalt turfs (#3985)

changes:

Adds three new turf types: lava (separate from the existing lava which is bound to the flooring system), basalt (a child of asteroid turfs), and chasm open spaces.
canSmoothWith lists on asteroid turfs are now in the form of a shared global list for performance reasons.
'Ash' turfs have been repathed to /turf/simulated/asteroid/ash. Base asteroid turf type should not be used directly anymore; maps have been updated to new path.
Airless openspace, chasms, and airless chasms now have map-time debug icons.
No player-visible changes, just prepwork for future things and performance tweaks.

Sprites from TG.
This commit is contained in:
Lohikar
2017-12-24 22:30:36 +02:00
committed by Erki
parent 6feaf1a218
commit 3b19323055
21 changed files with 357 additions and 236 deletions
+77
View File
@@ -0,0 +1,77 @@
// These are pricey, but damn do they look nice.
/turf/simulated/lava
icon = 'icons/turf/smooth/lava.dmi'
icon_state = "smooth"
gender = PLURAL
smooth = SMOOTH_TRUE | SMOOTH_BORDER
light_color = LIGHT_COLOR_LAVA
light_range = 2
name = "lava"
desc = "Toasty."
canSmoothWith = list(
/turf/simulated/lava,
/turf/simulated/mineral
)
// Custom behavior here - we want smoothed turfs to show basalt underneath, not lava.
/turf/simulated/lava/get_smooth_underlay_icon(mutable_appearance/underlay_appearance, turf/asking_turf, adjacency_dir)
underlay_appearance.icon = 'icons/turf/basalt.dmi'
underlay_appearance.icon_state = "basalt"
if (prob(20))
underlay_appearance.icon_state += "[rand(0,12)]"
return TRUE
// Special asteroid variant that goes with lava better.
/turf/simulated/floor/asteroid/basalt
name = "basalt"
icon = 'icons/turf/basalt.dmi'
icon_state = "basalt"
desc = "Dark volcanic rock."
base_name = "basalt"
base_desc = "Dark volcanic rock."
base_icon = 'icons/turf/basalt.dmi'
base_icon_state = "basalt"
light_color = LIGHT_COLOR_LAVA
smooth = SMOOTH_FALSE
canSmoothWith = null
footstep_sound = "concretestep"
/turf/simulated/floor/asteroid/basalt/get_smooth_underlay_icon(mutable_appearance/underlay_appearance, turf/asking_turf, adjacency_dir)
underlay_appearance.icon = icon
underlay_appearance.icon_state = "basalt"
if (prob(20))
underlay_appearance.icon_state += "[rand(0,12)]"
return TRUE
/turf/simulated/floor/asteroid/basalt/Initialize(mapload)
if (prob(20))
var/variant = rand(0,12)
icon_state = "basalt[variant]"
switch (variant)
if (1, 2, 3) // fair bit of lava visible, less weak light
light_power = 0.75
light_range = 2
if (5, 9) // Not much lava visible, weak light
light_power = 0.5
light_range = 2
. = ..()
/turf/simulated/floor/asteroid/ash
name = "ash"
icon = 'icons/turf/map_placeholders.dmi'
icon_state = "ash"
desc = "A fine grey ash. Looks pretty tightly packed."
smooth = SMOOTH_MORE | SMOOTH_BORDER | SMOOTH_NO_CLEAR_ICON
gender = PLURAL
base_icon = 'icons/turf/smooth/ash.dmi'
base_icon_state = "ash"
footstep_sound = "sandstep"
/turf/simulated/floor/asteroid/ash/rocky
name = "rocky ash"
icon_state = "rockyash"
base_icon_state = "rockyash"
base_icon = 'icons/turf/smooth/rocky_ash.dmi'
desc = "A fine grey ash. Seems to contain medium-sized rocks."
footstep_sound = "gravelstep"
+43 -46
View File
@@ -7,6 +7,14 @@
density = 1
gender = PLURAL
// This is a global list so we can share the same list with all mineral turfs; it's the same for all of them anyways.
var/list/mineral_can_smooth_with = list(
/turf/simulated/mineral,
/turf/simulated/wall,
/turf/unsimulated/wall,
/turf/simulated/shuttle
)
/turf/simulated/mineral //wall piece
name = "rock"
icon = 'icons/turf/map_placeholders.dmi'
@@ -15,14 +23,10 @@
gender = PLURAL
var/icon/actual_icon = 'icons/turf/smooth/rock_wall.dmi'
layer = 2.01
// canSmoothWith is set in Initialize().
smooth = SMOOTH_MORE | SMOOTH_BORDER | SMOOTH_NO_CLEAR_ICON
smoothing_hints = SMOOTHHINT_CUT_ON_ALL_F | SMOOTHHINT_ONLY_MATCH_TURF | SMOOTHHINT_TARGETS_NOT_UNIQUE
canSmoothWith = list(
/turf/simulated/mineral,
/turf/simulated/wall,
/turf/unsimulated/wall,
/turf/simulated/shuttle
)
oxygen = 0
nitrogen = 0
@@ -43,6 +47,8 @@
var/obj/item/weapon/last_find
var/datum/artifact_find/artifact_find
var/obj/effect/mineral/my_mineral
has_resources = 1
// Copypaste parent call for performance.
@@ -50,7 +56,8 @@
if (initialized)
crash_with("Warning: [src]([type]) initialized multiple times!")
icon = actual_icon
if (icon != actual_icon)
icon = actual_icon
initialized = TRUE
@@ -64,10 +71,14 @@
has_opaque_atom = TRUE
if (smooth)
canSmoothWith = mineral_can_smooth_with
pixel_x = -4
pixel_y = -4
queue_smooth(src)
if (!mapload)
queue_smooth_neighbors(src)
return INITIALIZE_HINT_NORMAL
/turf/simulated/mineral/examine(mob/user)
@@ -316,8 +327,8 @@
return attack_hand(user)
/turf/simulated/mineral/proc/clear_ore_effects()
for(var/obj/effect/mineral/M in contents)
qdel(M)
if (my_mineral)
qdel(my_mineral)
/turf/simulated/mineral/proc/DropMineral()
if(!mineral)
@@ -360,21 +371,12 @@
//Add some rubble, you did just clear out a big chunk of rock.
var/turf/simulated/floor/asteroid/N = ChangeTurf(mined_turf)
// Kill and update the space overlays around us.
for(var/direction in cardinal)
var/turf/simulated/open/O = get_step(src, direction)
if(istype(O))
O.update()
ChangeTurf(mined_turf)
if(rand(1,500) == 1)
visible_message("<span class='notice'>An old dusty crate was buried within!</span>")
new /obj/structure/closet/crate/secure/loot(src)
if(istype(N))
N.overlay_detail = rand(0,9)
/turf/simulated/mineral/proc/excavate_find(var/prob_clean = 0, var/datum/find/F)
//with skill and luck, players can cleanly extract finds
//otherwise, they come out inside a chunk of rock
@@ -496,13 +498,6 @@
/**********************Asteroid**************************/
/turf/simulated/floor/asteroid/rocky
name = "rocky ash"
icon_state = "rockyash"
base_icon_state = "rockyash"
base_icon = 'icons/turf/smooth/rocky_ash.dmi'
desc = "A fine grey ash. Seems to contain medium-sized rocks."
// Setting icon/icon_state initially will use these values when the turf is built on/replaced.
// This means you can put grass on the asteroid etc.
/turf/simulated/floor/asteroid
@@ -513,12 +508,6 @@
smooth = SMOOTH_MORE | SMOOTH_BORDER | SMOOTH_NO_CLEAR_ICON
smoothing_hints = SMOOTHHINT_CUT_ON_ALL_F | SMOOTHHINT_ONLY_MATCH_TURF | SMOOTHHINT_TARGETS_NOT_UNIQUE
gender = PLURAL
canSmoothWith = list(
/turf/simulated/floor/asteroid,
/turf/simulated/mineral,
/turf/simulated/wall,
/turf/simulated/shuttle
)
base_icon = 'icons/turf/smooth/ash.dmi'
base_icon_state = "ash"
@@ -527,20 +516,30 @@
nitrogen = 0
temperature = TCMB
var/dug = 0 //Increments by 1 everytime it's dug. 11 is the last integer that should ever be here.
var/overlay_detail
var/digging
has_resources = 1
footstep_sound = "gravelstep"
roof_type = null
// Same as the other, this is a global so we don't have a lot of pointless lists floating around.
// Basalt is explicitly omitted so ash will spill onto basalt turfs.
var/list/asteroid_floor_smooth = list(
/turf/simulated/floor/asteroid/ash,
/turf/simulated/mineral,
/turf/simulated/wall,
/turf/simulated/shuttle
)
// Copypaste parent for performance.
/turf/simulated/floor/asteroid/Initialize(mapload)
if(initialized)
crash_with("Warning: [src]([type]) initialized multiple times!")
initialized = TRUE
icon = base_icon
if (icon != base_icon) // Setting icon is an appearance change, so avoid it if we can.
icon = base_icon
base_desc = desc
base_name = name
@@ -551,17 +550,21 @@
else
luminosity = 1
if(prob(20))
overlay_detail = rand(0,9)
if (mapload && permit_ao)
queue_ao()
if (smooth)
canSmoothWith = asteroid_floor_smooth
pixel_x = -4
pixel_y = -4
queue_smooth(src)
if (!mapload)
queue_smooth_neighbors(src)
if (light_range && light_power)
update_light()
return INITIALIZE_HINT_NORMAL
/turf/simulated/floor/asteroid/ex_act(severity)
@@ -618,20 +621,14 @@
user << "<span class='warning'>The plating is going to need some support.</span>"
return
var/list/usable_tools = list(
var/static/list/usable_tools = typecacheof(list(
/obj/item/weapon/shovel,
/obj/item/weapon/pickaxe/diamonddrill,
/obj/item/weapon/pickaxe/drill,
/obj/item/weapon/pickaxe/borgdrill
)
))
var/valid_tool
for(var/valid_type in usable_tools)
if(istype(W,valid_type))
valid_tool = 1
break
if(valid_tool)
if(is_type_in_typecache(W, usable_tools))
var/turf/T = user.loc
if (!(istype(T)))
return
+19 -2
View File
@@ -13,8 +13,25 @@
name = "[M.display_name] deposit"
ore_key = M.name
icon_state = "rock_[ore_key]"
var/turf/T = get_turf(src)
var/turf/simulated/mineral/T = get_turf(src)
layer = T.layer+0.1
if (!istype(T))
crash_with("Invalid loc for mineral overlay: [T ? T.type : "NULL"].")
qdel(src)
return
if (T.my_mineral)
crash_with("Mineral overlay created on turf that already had one.")
qdel(T.my_mineral)
T.my_mineral = src
/obj/effect/mineral/Destroy()
var/turf/simulated/mineral/T = loc
if (istype(T))
T.my_mineral = null
return ..()
/obj/effect/mineral/proc/get_scan_overlay()
if(!scanner_image)
@@ -29,4 +46,4 @@
return
/obj/effect/mineral/singuloCanEat()
return FALSE
return FALSE