Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions code/__DEFINES/layers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@
#define WEATHER_RENDER_TARGET "*WEATHER_OVERLAY_PLANE"

#define OPENSPACE_LAYER 17 //Openspace layer over all
#define OPENSPACE_PLANE -10 //Openspace plane below all turfs
#define OPENSPACE_BACKDROP_PLANE -9
#define OPENSPACE_PLANE -11 //Openspace plane below all turfs
#define OPENSPACE_BACKDROP_PLANE -10

#define FLOOR_PLANE -9
#define REFLECTION_PLANE -8

#define FLOOR_PLANE -8
#define WALL_PLANE -7
#define GAME_PLANE_LOWER -6
#define GAME_PLANE -5
Expand Down Expand Up @@ -116,6 +118,10 @@
#define PLANE_FOG_CUTTER 14
#define FOG_RENDER_TARGET "*FOG_RENDER_TARGET"

/// Displays reflections
#define REFLECTIVE_DISPLACEMENT_PLANE 120
#define REFLECTIVE_DISPLACEMENT_PLANE_RENDER_TARGET "*REFLECTIVE_DISPLACEMENT_RENDER_TARGET"

#define INDOOR_PLANE 15

#define SUNLIGHTING_PLANE 16
Expand Down
97 changes: 97 additions & 0 deletions code/__DEFINES/liquids.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
#define SSLIQUIDS_RUN_TYPE_TURFS 1
#define SSLIQUIDS_RUN_TYPE_GROUPS 2
#define SSLIQUIDS_RUN_TYPE_IMMUTABLES 3
#define SSLIQUIDS_RUN_TYPE_EVAPORATION 4
#define SSLIQUIDS_RUN_TYPE_FIRE 5
#define SSLIQUIDS_RUN_TYPE_OCEAN 6
#define SSLIQUIDS_RUN_TYPE_TEMPERATURE 7
#define SSLIQUIDS_RUN_TYPE_CACHED_EDGES 8

#define WATER_HEIGH_DIFFERENCE_SOUND_CHANCE 50
#define WATER_HEIGH_DIFFERENCE_DELTA_SPLASH 7 //Delta needed for the splash effect to be made in 1 go

#define REQUIRED_MEMBER_PROCESSES 10

#define REQUIRED_EVAPORATION_PROCESSES 20
#define EVAPORATION_CHANCE 50

#define REQUIRED_FIRE_PROCESSES 10
#define REQUIRED_FIRE_POWER_PER_UNIT 5
#define FIRE_BURN_PERCENT 10

#define REQUIRED_OCEAN_PROCESSES 5

#define PARTIAL_TRANSFER_AMOUNT 0.3

#define LIQUID_MUTUAL_SHARE 1
#define LIQUID_NOT_MUTUAL_SHARE 2

#define LIQUID_GIVER 1
#define LIQUID_TAKER 2

//Required amount of a reagent to be simulated on turf exposures from liquids (to prevent gaming the system with cheap dillutions)
#define LIQUID_REAGENT_THRESHOLD_TURF_EXPOSURE 5

//Threshold at which the difference of height makes us need to climb/blocks movement/allows to fall down
#define TURF_HEIGHT_BLOCK_THRESHOLD 20

#define LIQUID_HEIGHT_DIVISOR 15

#define ONE_LIQUIDS_HEIGHT LIQUID_HEIGHT_DIVISOR

#define LIQUID_ATTRITION_TO_STOP_ACTIVITY 2

//Perceived heat capacity for calculations with atmos sharing
#define REAGENT_HEAT_CAPACITY 5

#define LIQUID_STATE_PUDDLE 1
#define LIQUID_STATE_ANKLES 2
#define LIQUID_STATE_WAIST 3
#define LIQUID_STATE_SHOULDERS 4
#define LIQUID_STATE_FULLTILE 5
#define TOTAL_LIQUID_STATES 5
#define LYING_DOWN_SUBMERGEMENT_STATE_BONUS 2

#define LIQUID_STATE_FOR_HEAT_EXCHANGERS LIQUID_STATE_WAIST

#define LIQUID_ANKLES_LEVEL_HEIGHT 8
#define LIQUID_WAIST_LEVEL_HEIGHT 19
#define LIQUID_SHOULDERS_LEVEL_HEIGHT 29
#define LIQUID_FULLTILE_LEVEL_HEIGHT 39

#define LIQUID_FIRE_STATE_NONE 0
#define LIQUID_FIRE_STATE_SMALL 1
#define LIQUID_FIRE_STATE_MILD 2
#define LIQUID_FIRE_STATE_MEDIUM 3
#define LIQUID_FIRE_STATE_HUGE 4
#define LIQUID_FIRE_STATE_INFERNO 5

//Threshold at which we "choke" on the water, instead of holding our breath
#define OXYGEN_DAMAGE_CHOKING_THRESHOLD 15

#define IMMUTABLE_LIQUID_SHARE 1

#define LIQUID_RECURSIVE_LOOP_SAFETY 255

//Height at which we consider the tile "full" and dont drop liquids on it from the upper Z level
#define LIQUID_HEIGHT_CONSIDER_FULL_TILE 50

#define LIQUID_GROUP_DECAY_TIME 3

//Scaled with how much a person is submerged
#define SUBMERGEMENT_REAGENTS_TOUCH_AMOUNT 60

#define CHOKE_REAGENTS_INGEST_ON_FALL_AMOUNT 4

#define CHOKE_REAGENTS_INGEST_ON_BREATH_AMOUNT 2

#define SUBMERGEMENT_PERCENT(carbon, liquids) min(1,((carbon.mobility_flags & MOBILITY_STAND) ? liquids.liquid_group.group_overlay_state : liquids.liquid_group.group_overlay_state+LYING_DOWN_SUBMERGEMENT_STATE_BONUS)/TOTAL_LIQUID_STATES)

#define LIQUID_PROTECTION "liquid_protection"

GLOBAL_LIST_INIT(liquid_blacklist, list(
))

///from base of [/datum/reagents/proc/del_reagent]: (/datum/reagent)
#define COMSIG_REAGENTS_DEL_REAGENT "reagents_del_reagent"
#define COMSIG_REAGENTS_EXPOSE_TEMPERATURE "reagents_expose_temperature"
3 changes: 3 additions & 0 deletions code/__DEFINES/reflections.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#define SHINE_MATTE 0
#define SHINE_REFLECTIVE 1
#define SHINE_SHINY 2
7 changes: 7 additions & 0 deletions code/__HELPERS/filters.dm
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,10 @@
.["x"] = x
if(!isnull(y))
.["y"] = y

/proc/motion_blur_filter(x, y)
. = list("type" = "motion_blur")
if(!isnull(x))
.["x"] = x
if(!isnull(y))
.["y"] = y
2 changes: 1 addition & 1 deletion code/__HELPERS/icons.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1439,7 +1439,7 @@ GLOBAL_LIST_INIT(freon_color_matrix, list("#2E5E69", "#60A2A8", "#A1AFB1", rgb(0
/proc/copy_appearance_filter_overlays(appearance_to_copy) as /mutable_appearance
RETURN_TYPE(/mutable_appearance)
var/mutable_appearance/copy = new(appearance_to_copy)
var/static/list/plane_whitelist = list(FLOAT_PLANE, GAME_PLANE, FLOOR_PLANE)
var/static/list/plane_whitelist = list(FLOAT_PLANE, GAME_PLANE, GAME_PLANE_FOV_HIDDEN, GAME_PLANE_UPPER, GAME_PLANE_LOWER, FLOOR_PLANE)

copy.overlays = recursively_filter_emissive_blockers(copy.overlays, plane_whitelist)
copy.underlays = recursively_filter_emissive_blockers(copy.underlays, plane_whitelist)
Expand Down
2 changes: 2 additions & 0 deletions code/__HELPERS/reagents.dm
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#define UNIT_FORM_STRING(amount) (amount == 1 ? "unit" : "units")

/proc/chem_recipes_do_conflict(datum/chemical_reaction/r1, datum/chemical_reaction/r2)
//do the non-list tests first, because they are cheaper
if(r1.required_container != r2.required_container)
Expand Down
10 changes: 10 additions & 0 deletions code/_onclick/hud/hud.dm
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,9 @@ GLOBAL_LIST_INIT(available_ui_styles, sortList(list(
// ensure observers get an accurate and up-to-date view
if (!viewmob)
plane_masters_update()
if(isliving(mymob))
var/mob/living/L = mymob
L.update_reflection()
for(var/M in mymob.observers)
show_hud(hud_version, M)
else if (viewmob.hud_used)
Expand All @@ -248,6 +251,13 @@ GLOBAL_LIST_INIT(available_ui_styles, sortList(list(
var/atom/movable/screen/plane_master/PM = plane_masters[thing]
PM.backdrop(mymob)
mymob.client.screen += PM
if(mymob?.client)
var/atom/movable/screen/plane_master/reflective/R = plane_masters["[REFLECTION_PLANE]"]
if(R && !R.get_filter("reflection"))
R.add_filter("reflection", 2, alpha_mask_filter(render_source = REFLECTIVE_DISPLACEMENT_PLANE_RENDER_TARGET))
var/atom/movable/screen/plane_master/reflective_cutter/RC = plane_masters["[REFLECTIVE_DISPLACEMENT_PLANE]"]
if(RC && !(RC in mymob.client.screen))
mymob.client.screen += RC

/datum/hud/human/show_hud(version = 0,mob/viewmob)
. = ..()
Expand Down
24 changes: 24 additions & 0 deletions code/_onclick/hud/plane_master.dm
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,30 @@
appearance_flags = PLANE_MASTER //should use client color
blend_mode = BLEND_OVERLAY

/atom/movable/screen/plane_master/reflective
name = "reflective plane master"
plane = REFLECTION_PLANE
appearance_flags = PLANE_MASTER
mouse_opacity = MOUSE_OPACITY_TRANSPARENT

/atom/movable/screen/plane_master/reflective/backdrop(mob/mymob)
if(!mymob || !mymob.client)
return
if(!get_filter("reflection"))
add_filter("reflection", 2, alpha_mask_filter(render_source = REFLECTIVE_DISPLACEMENT_PLANE_RENDER_TARGET))

/atom/movable/screen/plane_master/reflective/Initialize()
. = ..()
add_filter("motion_blur", 1, motion_blur_filter(y = 0.7))
add_filter("reflection", 2, alpha_mask_filter(render_source = REFLECTIVE_DISPLACEMENT_PLANE_RENDER_TARGET))

/atom/movable/screen/plane_master/reflective_cutter
name = "reflective cutting plane"
plane = REFLECTIVE_DISPLACEMENT_PLANE
render_target = REFLECTIVE_DISPLACEMENT_PLANE_RENDER_TARGET
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
appearance_flags = PLANE_MASTER

/atom/movable/screen/plane_master/game_world/backdrop(mob/mymob)
clear_filters()
if(istype(mymob) && mymob.client && mymob.client.prefs && mymob.client.prefs.ambientocclusion)
Expand Down
77 changes: 70 additions & 7 deletions code/controllers/subsystem/adjacent_air.dm
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,73 @@ SUBSYSTEM_DEF(adjacent_air)
/turf
//list of open turfs adjacent to us
var/list/atmos_adjacent_turfs
///the chance this turf has to spread, basically 3% by default
var/spread_chance = 0
///the chance this turf has to spread, basically 1% by default
var/spread_chance = 1
///means fires last at base 15 seconds
var/burn_power = 0
var/burn_power = 15
var/obj/effect/abstract/liquid_turf/liquids
var/liquid_height = 0
var/turf_height = 0
var/path_weight = 0
var/path_weight = 50

/turf/proc/reasses_liquids()
if(!liquids)
return
if(!liquids.liquid_group)
liquids.liquid_group = new(1, liquids)

/turf/proc/liquid_update_turf()
if(!liquids)
return
//Check atmos adjacency to cut off any disconnected groups
if(liquids.liquid_group)
var/assoc_atmos_turfs = list()
for(var/tur in atmos_adjacent_turfs)
assoc_atmos_turfs[tur] = TRUE
//Check any cardinals that may have a matching group
for(var/direction in GLOB.cardinals)
var/turf/T = get_step(src, direction)
if(!T.liquids)
return

/turf/proc/add_liquid_from_reagents(datum/reagents/giver, no_react = FALSE, chem_temp, amount)
var/list/compiled_list = list()
if(!giver.total_volume)
return
var/multiplier = amount ? amount / giver.total_volume : 1
for(var/datum/reagent/R as anything in giver.reagent_list)
if(!(R.type in GLOB.liquid_blacklist))
compiled_list[R.type] = R.volume * multiplier
if(!compiled_list.len) //No reagents to add, don't bother going further
return
var/had_liquids = !!liquids
if(!liquids)
liquids = new(src)
liquids.liquid_group.add_reagents(liquids, compiled_list, chem_temp)
if(had_liquids && liquids?.liquid_group?.reagents_per_turf > LIQUID_HEIGHT_DIVISOR)
liquids.liquid_group.process_cached_edges()

//More efficient than add_liquid for multiples
/turf/proc/add_liquid_list(reagent_list, no_react = FALSE, chem_temp)
if(liquids && !liquids.liquid_group)
qdel(liquids)
return

if(!liquids)
liquids = new(src)
liquids.liquid_group.add_reagents(liquids, reagent_list, chem_temp)
//Expose turf
liquids.liquid_group.expose_members_turf(liquids)

/turf/proc/add_liquid(reagent, amount, no_react = FALSE, chem_temp = 300)
if(reagent in GLOB.liquid_blacklist)
return
if(!liquids)
liquids = new(src)

liquids.liquid_group.add_reagent(liquids, reagent, amount, chem_temp)
//Expose turf
liquids.liquid_group.expose_members_turf(liquids)

/turf/open
var/obj/effect/hotspot/active_hotspot
Expand Down Expand Up @@ -101,11 +160,12 @@ SUBSYSTEM_DEF(adjacent_air)
// air with both of the related adjacent cardinal tiles
/turf/proc/GetAtmosAdjacentTurfs(alldir = 0)
var/adjacent_turfs
air_update_turf(TRUE) // since no atmos subsystem, we need to generate turf atmos adjacency manually
if(length(atmos_adjacent_turfs))
if(!atmos_adjacent_turfs)
ImmediateCalculateAdjacentTurfs()
if(atmos_adjacent_turfs)
adjacent_turfs = atmos_adjacent_turfs.Copy()
else
return null
adjacent_turfs = list()
if (!alldir)
return adjacent_turfs
var/turf/curloc = src
Expand All @@ -114,6 +174,9 @@ SUBSYSTEM_DEF(adjacent_air)
var/turf/S = get_step_multiz(curloc, direction)
if(!S)
continue
if(!S.atmos_adjacent_turfs)
S.ImmediateCalculateAdjacentTurfs()

for (var/checkDirection in GLOB.cardinals_multiz)
var/turf/checkTurf = get_step(S, checkDirection)
if(!S.atmos_adjacent_turfs || !S.atmos_adjacent_turfs[checkTurf])
Expand Down
Loading
Loading