Skip to content
Merged
8 changes: 6 additions & 2 deletions code/_helpers/type2type.dm
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
/*
* Holds procs designed to change one type of value, into another.
* Contains:
* text2list & list2text
* alist2list
* file2list
* angle2dir
* angle2text
* worldtime2text
*/

/proc/alist2list(alist/input)
. = list()
for(var/k,v in input)
.[k] = v

// Splits the text of a file at seperator and returns them in a list.
/proc/file2list(filename, seperator = "\n")
return splittext(safe_file2text(filename), seperator)
Expand Down
2 changes: 1 addition & 1 deletion code/game/base_turf.dm
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

// Returns the open turf of a Z-stack by finding the nearest non-open turf below.
/proc/get_open_turf_type(var/turf/T)
if(!HasBelow(T.z))
if(!istype(T) || !HasBelow(T.z))
return
var/turf/below = T
while ((below = GetBelow(below)))
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/alarm.dm
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@
TLV["temperature"] = list(T0C-26, T0C, T0C+40, T0C+66) // K

var/decl/environment_data/env_info = GET_DECL(environment_type)
for(var/g in decls_repository.get_decl_paths_of_subtype(/decl/material/gas))
for(var/g in get_filterable_material_types())
if(!env_info.important_gasses[g])
trace_gas += g
// not everything in these lists is a subtype of /decl/material/gas, so:
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/atmoalter/scrubber.dm
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
. = ..()
if(!scrubbing_gas)
scrubbing_gas = list()
for(var/g in decls_repository.get_decl_paths_of_subtype(/decl/material/gas))
for(var/g in get_filterable_material_types())
if(g != /decl/material/gas/oxygen && g != /decl/material/gas/nitrogen)
scrubbing_gas += g

Expand Down
6 changes: 6 additions & 0 deletions code/game/objects/effects/_effect.dm
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
/obj/effect
abstract_type = /obj/effect

/obj/effect/can_be_grabbed(var/mob/grabber, var/target_zone)
return FALSE

/obj/effect/try_make_grab(mob/living/user, defer_hand = FALSE)
return FALSE
4 changes: 3 additions & 1 deletion code/game/turfs/flooring/_flooring.dm
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ var/global/list/flooring_cache = list()
var/color = COLOR_WHITE
var/footstep_type = /decl/footsteps/plating
var/growth_value = 0
var/deconstruct_sound

var/neighbour_type

Expand Down Expand Up @@ -295,7 +296,8 @@ var/global/list/flooring_cache = list()
return TRUE
to_chat(user, SPAN_NOTICE("You remove the [get_surface_descriptor()] with \the [item]."))
floor.remove_flooring(floor.get_topmost_flooring(), place_product = TRUE)
playsound(floor, 'sound/items/Deconstruct.ogg', 80, 1)
if(deconstruct_sound)
playsound(floor, deconstruct_sound, 80, 1)
return TRUE

if(constructed)
Expand Down
1 change: 1 addition & 0 deletions code/game/turfs/flooring/flooring_reinforced.dm
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"broken4"
)
uid = "floor_reinf"
deconstruct_sound = 'sound/items/Deconstruct.ogg'

/decl/flooring/reinforced/circuit
name = "processing strata"
Expand Down
3 changes: 3 additions & 0 deletions code/game/turfs/flooring/flooring_tiled.dm
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
space_smooth = SMOOTH_ALL
constructed = TRUE
gender = NEUTER
deconstruct_sound = 'sound/items/Deconstruct.ogg'

burned_states = list(
"burned0",
"burned1"
Expand Down Expand Up @@ -87,6 +89,7 @@
color = null
build_type = null
uid = "floor_tiled_new"
deconstruct_sound = 'sound/items/Deconstruct.ogg'

/decl/flooring/tiling/new_tile/cargo_one
icon_base = "cargo_one_full"
Expand Down
8 changes: 4 additions & 4 deletions code/game/turfs/floors/subtypes/floor_reinforced.dm
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/turf/floor/reinforced
name = "reinforced floor"
icon = 'icons/turf/flooring/tiles.dmi'
icon_state = "reinforced"
_flooring = /decl/flooring/reinforced
name = "reinforced floor"
icon = 'icons/turf/flooring/tiles.dmi'
icon_state = "reinforced"
_flooring = /decl/flooring/reinforced

/turf/floor/reinforced/airless
initial_gas = null
Expand Down
8 changes: 7 additions & 1 deletion code/game/turfs/turf_ramps.dm
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/turf/proc/handle_ramp_dug_below(turf/wall/natural/ramp)
if(simulated && !is_open())
ChangeTurf(get_base_turf(z))
ChangeTurf(get_open_turf_type(src))
return TRUE
return FALSE

/turf/floor/handle_ramp_dug_below(turf/wall/natural/ramp)
var/decl/flooring/floor = get_topmost_flooring()
return !floor.constructed && ..()
1 change: 1 addition & 0 deletions code/game/turfs/walls/wall_icon.dm
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@
other_connections = dirs_to_corner_states(other_dirs)

/turf/wall/proc/update_wall_icon()

var/material_icon_base = get_wall_icon()
var/base_color = get_base_color()

Expand Down
6 changes: 3 additions & 3 deletions code/game/turfs/walls/wall_natural_icon.dm
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
var/turf/floor_data = floor_type
new_icon = initial(floor_data.icon)
new_icon_state = initial(floor_data.icon_state)
new_color = initial(floor_data.color)
new_color = base_color

var/turf/wall/natural/neighbor = get_step(src, turn(ramp_slope_direction, -90))
var/has_left_neighbor = istype(neighbor) && neighbor.ramp_slope_direction == ramp_slope_direction
Expand All @@ -65,10 +65,10 @@
state = "ramp-blend-left"
else if(has_right_neighbor)
state = "ramp-blend-right"
var/image/I = image(material_icon_base, state, dir = ramp_slope_direction)
var/image/I = image(icon = material_icon_base, icon_state = state, dir = ramp_slope_direction)
add_overlay(I)
if(shine)
I = image(material_icon_base, "[state]-shine", dir = ramp_slope_direction)
I = image(icon = material_icon_base, icon_state = "[state]-shine", dir = ramp_slope_direction)
I.appearance_flags |= RESET_ALPHA
I.alpha = shine
add_overlay(I)
Expand Down
49 changes: 16 additions & 33 deletions code/game/turfs/walls/wall_natural_ramps.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,40 +4,23 @@
QDEL_NULL_LIST(engravings)

var/old_ao = permit_ao
if(ramp_slope_direction)

user?.visible_message(SPAN_NOTICE("\The [user] digs out \the [src], forming a ramp."))

drop_ore()
permit_ao = FALSE
blocks_air = FALSE
density = FALSE
opacity = FALSE

// Pretend to be a normal floor turf under the ramp.
var/turf/under = floor_type
icon = initial(under.icon)
icon_state = initial(under.icon_state)
color = initial(under.color)

decals = null
var/turf/ramp_above = GetAbove(src)
if(ramp_above)
ramp_above.handle_ramp_dug_below(src)
update_neighboring_ramps()

else

if(!ramp_slope_direction)
user?.visible_message(SPAN_NOTICE("\The [user] clears out \the [src]."))

permit_ao = initial(permit_ao)
blocks_air = initial(blocks_air)
density = initial(density)
color = initial(color)
refresh_opacity()

icon = 'icons/turf/walls/natural.dmi'
icon_state = "blank"
ChangeTurf(floor_type)
return

user?.visible_message(SPAN_NOTICE("\The [user] digs out \the [src], forming a ramp."))
drop_ore()
permit_ao = FALSE
blocks_air = FALSE
density = FALSE
opacity = FALSE
decals = null
var/turf/ramp_above = GetAbove(src)
if(ramp_above)
ramp_above.handle_ramp_dug_below(src)
update_neighboring_ramps()
update_icon()

if(!skip_icon_update)
for(var/turf/wall/natural/neighbor in RANGE_TURFS(src, 1))
Expand Down
5 changes: 2 additions & 3 deletions code/modules/admin/verbs/grief_fixers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,8 @@

/decl/atmos_grief_fix_step/reset_turfs/act()
var/list/unsorted_overlays = list()
var/list/all_gasses = decls_repository.get_decls_of_subtype(/decl/material/gas)
for(var/id in all_gasses)
var/decl/material/mat = all_gasses[id]
for(var/id,m in get_filterable_material_types())
var/decl/material/mat = m
unsorted_overlays |= mat.gas_tile_overlay

for(var/turf/T in world)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
id_tag = "[sequential_id("obj/machinery")]"
if(!scrubbing_gas)
scrubbing_gas = list()
for(var/g in decls_repository.get_decl_paths_of_subtype(/decl/material/gas))
for(var/g in get_filterable_material_types())
if(g != /decl/material/gas/oxygen && g != /decl/material/gas/nitrogen)
scrubbing_gas += g
. = ..()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@

/datum/fauna_generator/proc/generate_breathable_gases(var/datum/gas_mixture/atmosphere, var/list/breath_gases, var/list/toxic_gases)
//Set up gases for living things
var/list/all_gasses = decls_repository.get_decl_paths_of_subtype(/decl/material/gas)
var/list/all_gasses = get_filterable_material_types(as_list = TRUE)
if(!length(breath_gases))
var/list/goodgases = all_gasses.Copy()
var/gasnum = min(rand(1,3), goodgases.len)
Expand Down
17 changes: 17 additions & 0 deletions code/modules/materials/_materials.dm
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
var/global/alist/_filterable_mats_alist
var/global/list/_filterable_mats_list

/proc/get_filterable_material_types(as_list = FALSE)

if(isnull(_filterable_mats_alist))
_filterable_mats_alist = alist()
for(var/decl/material/mat in decls_repository.get_decls_of_subtype_unassociated(/decl/material))
if(!isnull(mat.boiling_point))
_filterable_mats_alist[mat.type] = mat

if(as_list)
if(isnull(_filterable_mats_list))
_filterable_mats_list = alist2list(_filterable_mats_alist)
return _filterable_mats_list
return _filterable_mats_alist

/*
MATERIAL DECLS
This data is used by various parts of the game for basic physical properties and behaviors
Expand Down
3 changes: 3 additions & 0 deletions code/modules/materials/definitions/liquids/_mat_liquid.dm
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
latent_heat = 2258
abstract_type = /decl/material/liquid
accelerant_value = FUEL_VALUE_SUPPRESSANT // Abstract way of dousing fires with fluid; realistically it should deprive them of oxidizer but heigh ho
// Assume if we're dealing with stacks, then it's solid (like ice)
sound_manipulate = 'sound/foley/rockscrape.ogg'
sound_dropped = 'sound/foley/rockscrape.ogg'

/decl/material/liquid/Initialize()
if(!gas_name)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
dug_drop_type = /obj/item/stack/material/ore/handful
default_solid_form = /obj/item/stack/material/lump/large
can_backfill_floor_type = /decl/flooring/snow
sound_manipulate = 'sound/foley/paperpickup2.ogg'
sound_dropped = 'sound/foley/paperpickup1.ogg'

/decl/material/solid/ice/snow/handle_stain_dry(obj/effect/decal/cleanable/blood/stain)
var/ambient_temperature = stain.get_ambient_temperature()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,8 @@
dug_drop_type = /obj/item/stack/material/ore/handful
default_solid_form = /obj/item/stack/material/ore/handful
can_backfill_floor_type = /decl/flooring/sand
sound_manipulate = 'sound/foley/paperpickup2.ogg'
sound_dropped = 'sound/foley/paperpickup1.ogg'

/decl/material/solid/clay
name = "clay"
Expand All @@ -261,6 +263,8 @@
can_backfill_floor_type = /decl/flooring/clay
gemstone_chance = 0.01
gemstone_types = list(/decl/material/solid/gemstone/sapphire = 1)
sound_manipulate = 'sound/foley/paperpickup2.ogg'
sound_dropped = 'sound/foley/paperpickup1.ogg'

/decl/material/solid/soil
name = "soil"
Expand All @@ -281,6 +285,8 @@
)
solution_name = "mud"
coated_adjective = "muddy"
sound_manipulate = 'sound/foley/paperpickup2.ogg'
sound_dropped = 'sound/foley/paperpickup1.ogg'

// todo: make mud either its own material or a mix of dirt and water
// or let dirt be in the liquid volumes list for mud?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
/decl/material/solid/stone/Initialize()
. = ..()
texture = image('icons/turf/wall_texture.dmi', "concrete")
texture.appearance_flags |= RESET_COLOR | RESET_ALPHA
texture.blend_mode = BLEND_MULTIPLY

/decl/material/solid/stone/get_wall_texture()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/datum/artifact_effect/gas/New()
..()
if(!spawned_gas)
spawned_gas = pick(decls_repository.get_decl_paths_of_subtype(/decl/material/gas))
spawned_gas = pick(get_filterable_material_types(as_list = TRUE))
operation_type = pick((XA_EFFECT_TOUCH), (XA_EFFECT_AURA))
origin_type = XA_EFFECT_SYNTH

Expand Down
2 changes: 1 addition & 1 deletion code/modules/xenoarcheaology/artifacts/triggers/gas.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

/datum/artifact_trigger/gas/New()
if(!gas_needed)
gas_needed = list(pick(decls_repository.get_decl_paths_of_subtype(/decl/material/gas)) = rand(1,10))
gas_needed = list(pick(get_filterable_material_types(as_list = TRUE)) = rand(1,10))
var/decl/material/gas/gas = GET_DECL(gas_needed[1])
name = "concentration of [gas.name]"

Expand Down
4 changes: 2 additions & 2 deletions code/modules/xenoarcheaology/finds/find_types/mundane.dm
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"It's like no [item_type] you've ever seen before.",
"It's a mystery how anyone is supposed to eat with this.",
"You wonder what the creator's mouth was shaped like.")

// Coin
/decl/archaeological_find/coin
item_type = "coin"
Expand Down Expand Up @@ -56,7 +56,7 @@
/decl/archaeological_find/tank/spawn_item(atom/loc)
var/obj/item/tank/new_item = ..()
new_item.air_contents.gas.Cut()
new_item.air_contents.adjust_gas(pick(decls_repository.get_decl_paths_of_subtype(/decl/material/gas)),15)
new_item.air_contents.adjust_gas(pick(get_filterable_material_types(as_list = TRUE)),15)
return new_item

/decl/archaeological_find/tank/generate_name()
Expand Down
10 changes: 5 additions & 5 deletions code/unit_tests/atmospherics_tests.dm
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

/datum/unit_test/atmos_machinery/proc/check_moles_conserved(var/case_name, var/list/before_gas_mixes, var/list/after_gas_mixes)
var/failed = FALSE
for(var/gasid in decls_repository.get_decl_paths_of_subtype(/decl/material/gas))
for(var/gasid in get_filterable_material_types())
var/before = 0
for(var/gasmix in before_gas_mixes)
var/datum/gas_mixture/G = before_gas_mixes[gasmix]
Expand Down Expand Up @@ -195,7 +195,7 @@
name = "ATMOS MACHINERY: scrub_gas() Conserves Moles"

/datum/unit_test/atmos_machinery/conserve_moles/scrub_gas/start_test()
var/list/filtering = decls_repository.get_decl_paths_of_subtype(/decl/material/gas)
var/list/filtering = get_filterable_material_types(as_list = TRUE)
for(var/case_name in test_cases)
var/gas_mix_data = test_cases[case_name]
var/list/before_gas_mixes = create_gas_mixes(gas_mix_data)
Expand All @@ -211,7 +211,7 @@
name = "ATMOS MACHINERY: filter_gas() Conserves Moles"

/datum/unit_test/atmos_machinery/conserve_moles/filter_gas/start_test()
var/list/filtering = decls_repository.get_decl_paths_of_subtype(/decl/material/gas)
var/list/filtering = get_filterable_material_types(as_list = TRUE)
for(var/case_name in test_cases)
var/gas_mix_data = test_cases[case_name]
var/list/before_gas_mixes = create_gas_mixes(gas_mix_data)
Expand All @@ -231,7 +231,7 @@
var/list/after_gas_mixes = create_gas_mixes(gas_mix_data)

var/list/filtering = list()
for(var/gasid in decls_repository.get_decl_paths_of_subtype(/decl/material/gas))
for(var/gasid in get_filterable_material_types())
filtering[gasid] = after_gas_mixes["sink"] //just filter everything to sink

filter_gas_multi(null, filtering, after_gas_mixes["source"], after_gas_mixes["sink"], null, INFINITY)
Expand All @@ -250,7 +250,7 @@
var/list/after_gas_mixes = create_gas_mixes(gas_mix_data)

var/list/mix_sources = list()
var/list/all_gasses = decls_repository.get_decl_paths_of_subtype(/decl/material/gas)
var/list/all_gasses = get_filterable_material_types(as_list = TRUE)
var/gas_count = length(all_gasses)
for(var/gasid in all_gasses)
var/datum/gas_mixture/mix_source = after_gas_mixes["sink"]
Expand Down
Loading
Loading