Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Project sigma #10433

Draft
wants to merge 21 commits into
base: dev
Choose a base branch
from
Draft
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
17 changes: 17 additions & 0 deletions baystation12.dme
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
#include "code\__defines\languages.dm"
#include "code\__defines\lazy_value.dm"
#include "code\__defines\lighting.dm"
#include "code\__defines\liquids.dm"
#include "code\__defines\machinery.dm"
#include "code\__defines\mapping.dm"
#include "code\__defines\materials.dm"
Expand Down Expand Up @@ -175,6 +176,7 @@
#include "code\_helpers\time.dm"
#include "code\_helpers\turfs.dm"
#include "code\_helpers\type2type.dm"
#include "code\_helpers\type_processing.dm"
#include "code\_helpers\unsorted.dm"
#include "code\_helpers\vector.dm"
#include "code\_helpers\warnings.dm"
Expand Down Expand Up @@ -245,6 +247,7 @@
#include "code\controllers\subsystems\garbage.dm"
#include "code\controllers\subsystems\inactivity.dm"
#include "code\controllers\subsystems\lighting.dm"
#include "code\controllers\subsystems\liquids.dm"
#include "code\controllers\subsystems\machines.dm"
#include "code\controllers\subsystems\mapping.dm"
#include "code\controllers\subsystems\misc_late.dm"
Expand Down Expand Up @@ -1953,6 +1956,20 @@
#include "code\modules\lighting\lighting_source.dm"
#include "code\modules\lighting\lighting_turf.dm"
#include "code\modules\lighting\~lighting_undefs.dm"
#include "code\modules\liquids\drains.dm"
#include "code\modules\liquids\height_floors.dm"
#include "code\modules\liquids\tools.dm"
#include "code\modules\liquids\liquid_systems\liquid_effect.dm"
#include "code\modules\liquids\liquid_systems\liquid_groups.dm"
#include "code\modules\liquids\liquid_systems\liquid_height.dm"
#include "code\modules\liquids\liquid_systems\liquid_interaction.dm"
#include "code\modules\liquids\liquid_systems\liquid_plumbers.dm"
#include "code\modules\liquids\liquid_systems\liquid_pump.dm"
#include "code\modules\liquids\liquid_systems\liquid_status_effect.dm"
#include "code\modules\liquids\liquid_systems\liquid_turf.dm"
#include "code\modules\liquids\reagents\reagent_containers.dm"
#include "code\modules\liquids\reagents\chemistry\holder.dm"
#include "code\modules\liquids\reagents\chemistry\reagents.dm"
#include "code\modules\lobby_music\_licenses.dm"
#include "code\modules\lobby_music\_lobby_music.dm"
#include "code\modules\lobby_music\crocketts_theme.dm"
Expand Down
3 changes: 3 additions & 0 deletions code/__defines/ces/signals.dm
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@
#define SIGNAL_ELEMENT_ATTACH "element_attach"
/// Fires on the target datum when an element is attached to it (/datum/element).
#define SIGNAL_ELEMENT_DETACH "element_detach"

/// Fires on the afterattack when an element is designed to clean liquids
#define SIGNAL_CLEAN_LIQUIDS "clean_liquids"
3 changes: 3 additions & 0 deletions code/__defines/ces/signals_atom.dm
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
/// From base of atom/proc/Initialize(): sent any time a new atom is created in this atom
#define SIGNAL_ATOM_INITIALIZED_ON "atom_initialized_on"

/// Called on `/atom/movable/proc/handle_fall` (turf)
#define SIGNAL_ATOM_FALL "atom_fall"

/// Called on 'atom/Move' (/atom, old_turf, new_turf)
#define SIGNAL_Z_CHANGED "movable_z_changed"

Expand Down
1 change: 1 addition & 0 deletions code/__defines/ces/signals_turf.dm
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/// Called on `/turf/proc/ChangeTurf` (/turf, old_density, density, old_opacity, opacity)
#define SIGNAL_TURF_CHANGED "turf_changed"
#define SIGNAL_TURF_LIQUIDS_CREATION "turf_liquids_creation"
6 changes: 6 additions & 0 deletions code/__defines/lighting.dm
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,9 @@
#define LIGHTMODE_ALARM "alarm"
#define LIGHTMODE_READY "ready"
#define LIGHTMODE_RADSTORM "radiation_storm"

///How many tiles standard fires glow.
#define LIGHT_RANGE_FIRE 3
#define LIGHT_FIRE_BLOSSOM 2.1
#define LIGHT_RANGE_FIRE_BLOSSOM_HARVESTED 2.7
#define LIGHT_POWER_FIRE_BLOSSOM_HARVESTED 1.5
83 changes: 83 additions & 0 deletions code/__defines/liquids.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
#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_EVAPORATION_PROCESSES 80
#define EVAPORATION_CHANCE 30

/// Portion (out of 1) of reagents that are lost during the transfer from a mop/towel to a container.
#define SQUEEZING_DISPERSAL_RATIO 0.75

#define REQUIRED_FIRE_PROCESSES 4
#define REQUIRED_FIRE_POWER_PER_UNIT 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 10

#define ONE_LIQUIDS_HEIGHT LIQUID_HEIGHT_DIVISOR

#define LIQUID_ATTRITION_TO_STOP_ACTIVITY 2

//Percieved 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 100 //Hundred loops at maximum for adjacency checking

//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 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 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.lying ? liquids.liquid_state+LYING_DOWN_SUBMERGEMENT_STATE_BONUS : liquids.liquid_state)/TOTAL_LIQUID_STATES)
2 changes: 1 addition & 1 deletion code/__defines/misc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
#define TEMPLATE_FLAG_ALLOW_DUPLICATES 1 // Lets multiple copies of the template to be spawned
#define TEMPLATE_FLAG_SPAWN_GUARANTEED 2 // Makes it ignore away site budget and just spawn (only for away sites)
#define TEMPLATE_FLAG_CLEAR_CONTENTS 4 // if it should destroy objects it spawns on top of
#define TEMPLATE_FLAG_NO_RUINS 8 // if it should forbid ruins from spawning on top of it
#define TEMPLATE_FLAG_TURF_FLAG_NORUINS 8 // if it should forbid ruins from spawning on top of it

#define CUSTOM_ITEM_OBJ 'icons/obj/custom_items_obj.dmi'
#define CUSTOM_ITEM_MOB null
Expand Down
1 change: 1 addition & 0 deletions code/_global_vars/mapping.dm
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
GLOBAL_LIST_EMPTY(ruin_landmarks)
GLOBAL_LIST_EMPTY(areas)
32 changes: 32 additions & 0 deletions code/_helpers/atmospherics.dm
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,35 @@
return

. += SPAN_WARNING("\The [target] has no gases!")

/turf/proc/get_atmos_adjacent_turfs()
var/list/atmos_adjacent_turfs = list()
var/canpass = CanZASPass(src)
for(var/direction in GLOB.cardinalz)
var/turf/current_turf
if(direction != UP && direction != DOWN)
current_turf = get_step(src, direction)
if(direction == UP)
current_turf = GetAbove(src)
current_turf = istype(current_turf, /turf/simulated/open) ? current_turf : null

if(direction == DOWN)
current_turf = istype(src, /turf/simulated/open) ? GetBelow(src) : null

if(!istype(current_turf, /turf/simulated)) // not interested in you brother
continue

if(canpass && CanZASPass(current_turf) && !(blocks_air || current_turf.blocks_air))
LAZYINITLIST(current_turf.atmos_adjacent_turfs)
LAZYINITLIST(atmos_adjacent_turfs)
atmos_adjacent_turfs[current_turf] = TRUE
current_turf.atmos_adjacent_turfs[src] = TRUE
else
LAZYREMOVE(atmos_adjacent_turfs, current_turf)
if (current_turf.atmos_adjacent_turfs)
LAZYREMOVE(current_turf.atmos_adjacent_turfs, src)
UNSETEMPTY(current_turf.atmos_adjacent_turfs)

UNSETEMPTY(atmos_adjacent_turfs)
src.atmos_adjacent_turfs = atmos_adjacent_turfs
return atmos_adjacent_turfs
31 changes: 31 additions & 0 deletions code/_helpers/atom_movables.dm
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,34 @@
turfs -= get_turf(src)
if(length(turfs))
throw_at(pick(turfs), maxrange, speed, src)

///Returns a chosen path that is the closest to a list of matches
/proc/pick_closest_path(value, list/matches = get_fancy_list_of_atom_types())
if (value == FALSE) //nothing should be calling us with a number, so this is safe
value = input("Enter type to find (blank for all, cancel to cancel)", "Search for type") as null|text
if (isnull(value))
return
value = trim(value)

var/random = FALSE
if(findtext(value, "?"))
value = replacetext(value, "?", "")
random = TRUE

if(!isnull(value) && value != "")
matches = filter_fancy_list(matches, value)

if(matches.len == 0)
return

var/chosen
if(matches.len == 1)
chosen = matches[1]
else if(random)
chosen = pick(matches) || null
else
chosen = input("Select a type", "Pick Type", matches[1]) as null|anything in sort_list(matches)
if(!chosen)
return
chosen = matches[chosen]
return chosen
54 changes: 54 additions & 0 deletions code/_helpers/type_processing.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/proc/make_types_fancy(list/types)
if (ispath(types))
types = list(types)
. = list()
for(var/type in types)
var/typename = "[type]"
var/static/list/TYPES_SHORTCUTS = list(
/obj/effect/decal/cleanable = "CLEANABLE",
/obj/item/device/radio/headset = "HEADSET",
/obj/item/clothing/head/helmet/space = "SPESSHELMET",
/obj/item/reagent_containers/vessel/glass = "DRINK", //longest paths comes first
/obj/item/reagent_containers/food = "FOOD",
/obj/item/reagent_containers = "REAGENT_CONTAINERS",
/obj/machinery/atmospherics = "ATMOS_MECH",
/obj/machinery/portable_atmospherics = "PORT_ATMOS",
/obj/item/mecha_parts/mecha_equipment/weapon/ballistic/missile_rack = "MECHA_MISSILE_RACK",
/obj/item/mecha_parts/mecha_equipment = "MECHA_EQUIP",
/obj/item/organ = "ORGAN",
/obj/item = "ITEM",
/obj/machinery = "MACHINERY",
/obj/effect = "EFFECT",
/obj = "O",
/datum = "D",
/turf = "T",
/mob/living/carbon = "CARBON",
/mob/living/simple_animal = "SIMPLE",
/mob/living = "LIVING",
/mob = "M"
)
for (var/tn in TYPES_SHORTCUTS)
if(copytext(typename, 1, length("[tn]/") + 1) == "[tn]/" /*findtextEx(typename,"[tn]/",1,2)*/ )
typename = TYPES_SHORTCUTS[tn] + copytext(typename, length("[tn]/"))
break
.[typename] = type

/proc/get_fancy_list_of_atom_types()
var/static/list/pre_generated_list
if (!pre_generated_list) //init
pre_generated_list = make_types_fancy(typesof(/atom))
return pre_generated_list

/proc/filter_fancy_list(list/L, filter as text)
var/list/matches = new
var/end_len = -1
var/list/endcheck = splittext(filter, "!")
if(endcheck.len > 1)
filter = endcheck[1]
end_len = length_char(filter)

for(var/key in L)
var/value = L[key]
if(findtext("[key]", filter, -end_len) || findtext("[value]", filter, -end_len))
matches[key] = value
return matches
Loading
Loading