Files
Alexis 21b4095dfd [MDB IGNORE] [IDB IGNORE] Upstream Sync - 04/17/2026 (#5453)
Upstream 04/17/2026

fixes https://github.com/Bubberstation/Bubberstation/issues/5549

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: tgstation-ci[bot] <179393467+tgstation-ci[bot]@users.noreply.github.com>
Co-authored-by: ArcaneMusic <41715314+ArcaneMusic@users.noreply.github.com>
Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com>
Co-authored-by: Rhials <28870487+Rhials@users.noreply.github.com>
Co-authored-by: rageguy505 <54517726+rageguy505@users.noreply.github.com>
Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
Co-authored-by: John Willard <53777086+JohnFulpWillard@users.noreply.github.com>
Co-authored-by: Aliceee2ch <160794176+Aliceee2ch@users.noreply.github.com>
Co-authored-by: Time-Green <7501474+Time-Green@users.noreply.github.com>
Co-authored-by: Tsar-Salat <62388554+Tsar-Salat@users.noreply.github.com>
Co-authored-by: SmArtKar <44720187+SmArtKar@users.noreply.github.com>
Co-authored-by: Maxipat <108554989+Maxipat112@users.noreply.github.com>
Co-authored-by: SyncIt21 <110812394+SyncIt21@users.noreply.github.com>
Co-authored-by: deltanedas <39013340+deltanedas@users.noreply.github.com>
Co-authored-by: SimplyLogan <47579821+loganuk@users.noreply.github.com>
Co-authored-by: loganuk <fakeemail123@aol.com>
Co-authored-by: Leland Kemble <70413276+lelandkemble@users.noreply.github.com>
Co-authored-by: FalloutFalcon <86381784+FalloutFalcon@users.noreply.github.com>
Co-authored-by: Roxy <75404941+TealSeer@users.noreply.github.com>
Co-authored-by: Lucy <lucy@absolucy.moe>
Co-authored-by: siliconOpossum <138069572+siliconOpossum@users.noreply.github.com>
Co-authored-by: Isratosh <Isratosh@hotmail.com>
Co-authored-by: TheRyeGuyWhoWillNowDie <70169560+TheRyeGuyWhoWillNowDie@users.noreply.github.com>
Co-authored-by: Neocloudy <88008002+Neocloudy@users.noreply.github.com>
Co-authored-by: Alexander V. <volas@ya.ru>
Co-authored-by: ElGitificador <168473461+ElGitificador@users.noreply.github.com>
Co-authored-by: Twaticus <46540570+Twaticus@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Bloop <13398309+vinylspiders@users.noreply.github.com>
Co-authored-by: Cameron Lennox <killer65311@gmail.com>
Co-authored-by: Tim <timothymtorres@gmail.com>
Co-authored-by: Iamgoofball <iamgoofball@gmail.com>
Co-authored-by: Layzu666 <121319428+Layzu666@users.noreply.github.com>
Co-authored-by: Arturlang <24881678+Arturlang@users.noreply.github.com>
Co-authored-by: _0Steven <42909981+00-Steven@users.noreply.github.com>
Co-authored-by: mrmanlikesbt <99309552+mrmanlikesbt@users.noreply.github.com>
Co-authored-by: Ben10Omintrix <138636438+Ben10Omintrix@users.noreply.github.com>
Co-authored-by: John F. Kennedy <54908920+MacaroniCritter@users.noreply.github.com>
Co-authored-by: Cursor <102828457+theselfish@users.noreply.github.com>
Co-authored-by: Josh <josh.adam.powell@gmail.com>
Co-authored-by: Josh Powell <josh.powell@softwire.com>
Co-authored-by: Yobrocharlie <Charliemiller5617@gmail.com>
Co-authored-by: Hardly3D <66234359+Hardly3D@users.noreply.github.com>
Co-authored-by: shayoki <96078776+shayoki@users.noreply.github.com>
Co-authored-by: LT3 <83487515+lessthnthree@users.noreply.github.com>
2026-05-16 00:56:00 +02:00

59 lines
2.7 KiB
Plaintext

/// Derived properties aren't present on materials, and are instead just centralized holders for formulas
/datum/material_property/derived
abstract_type = /datum/material_property/derived
inherited = FALSE
/// Does this property apply to our material?
/datum/material_property/derived/proc/is_present(datum/material/material)
return TRUE
/// Calculate and fetch the value of the property on this material
/datum/material_property/derived/proc/get_value(datum/material/material)
return 0
#define INTEGRITY_MIN 0.1
// This results in iron being almost exactly 1
#define INTEGRITY_COEFF 1.57
/// Base atom integrity multiplier of items made from this material
/datum/material_property/derived/integrity
id = MATERIAL_INTEGRITY
/datum/material_property/derived/integrity/get_value(datum/material/material)
// Integrity is a combination of density, hardness and flexibility
var/density = material.get_property(MATERIAL_DENSITY)
var/hardness = material.get_property(MATERIAL_HARDNESS)
var/flexibility = material.get_property(MATERIAL_FLEXIBILITY)
// Its primarily hardness - the harder a material is, the more it is resistant to direct impacts
// But unless it has enough bend to it, it'll also fracture - which is why flexibility needs to be in a sweetspot, based on density
var/hardness_coeff = (2 + max(0, hardness - 4) * 2 - max(0, 2 - hardness)) / MATERIAL_PROPERTY_MAX
var/bend_coeff = 1 - abs(flexibility - sqrt(density)) * 0.1
// Check the math for yourself in https://www.desmos.com/calculator/ez2n34w772
return round(INTEGRITY_MIN + hardness_coeff * bend_coeff * INTEGRITY_COEFF, 0.01)
#undef INTEGRITY_MIN
#undef INTEGRITY_COEFF
/// How pretty a material is
/datum/material_property/derived/beauty
id = MATERIAL_BEAUTY
/datum/material_property/derived/beauty/is_present(datum/material/material)
return abs(material.get_property(MATERIAL_REFLECTIVITY)) > MATERIAL_PROPERTY_MAX / 2
/datum/material_property/derived/beauty/get_value(datum/material/material)
// Requires the material to be especially shiny or dull
var/reflectivity = material.get_property(MATERIAL_REFLECTIVITY)
return MATERIAL_PROPERTY_DIVERGENCE(reflectivity, 3, 6) * 0.05
/// Siemens coeff multiplier for our material
/datum/material_property/derived/insulation
id = MATERIAL_INSULATION
/datum/material_property/derived/insulation/get_value(datum/material/material)
// [0 ~ 1] is fully insulating, (1 ~ 6] maps to (0 ~ 1] and [6 ~ 10] maps to [1 ~ 2]
// 1.18 and 0.15 here are to allow 6 to map to 1 and 10 to map to 2 and are pulled out of my ass (system in the desmos below)
// See https://www.desmos.com/calculator/rdbv1x8oty
var/conductivity = material.get_property(MATERIAL_ELECTRICAL)
return round(max(0, conductivity - 1) ** 1.18 * 0.15, 0.01)