diff --git a/code/__DEFINES/materials/dynamics.dm b/code/__DEFINES/materials/dynamics.dm index ddaaa0563bd1..97da7fbe2391 100644 --- a/code/__DEFINES/materials/dynamics.dm +++ b/code/__DEFINES/materials/dynamics.dm @@ -4,7 +4,7 @@ //* Significance; This is how much material is in something /// used for shards -#define MATERIAL_SIGNIFICANCE_SHARD 2.5 +#define MATERIAL_SIGNIFICANCE_SHARD 3.5 /// baseline significance of material calculations done on material-side / default computations #define MATERIAL_SIGNIFICANCE_BASELINE 10 @@ -12,8 +12,12 @@ #define MATERIAL_SIGNIFICANCE_WEAPON_MEDIUM 10 #define MATERIAL_SIGNIFICANCE_WEAPON_HEAVY 12.5 +#define MATERIAL_SIGNIFICANCE_ARMOR_LIGHT 8.5 +#define MATERIAL_SIGNIFICANCE_ARMOR_MEDIUM 10 +#define MATERIAL_SIGNIFICANCE_ARMOR_HEAVY 12.5 + /// used for most doors -#define MATERIAL_SIGNIFICANCE_DOOR 15 +#define MATERIAL_SIGNIFICANCE_DOOR 20 /// significance used for normal wall layer #define MATERIAL_SIGNIFICANCE_WALL 20 /// significance used for reinforcing wall layer diff --git a/code/game/atoms/defense.dm b/code/game/atoms/defense.dm index 3ed53164a4cc..b0f1c8037122 100644 --- a/code/game/atoms/defense.dm +++ b/code/game/atoms/defense.dm @@ -436,7 +436,13 @@ */ /atom/proc/fetch_armor() RETURN_TYPE(/datum/armor) - return armor || (armor = fetch_armor_struct(armor_type)) + return armor || (armor = generate_armor()) + +/** + * get default armor datum + */ +/atom/proc/generate_armor() + return fetch_armor_struct(armor_type) /** * calculates the resulting damage from an attack, taking into account our armor and soak diff --git a/code/modules/materials/dynamics.dm b/code/modules/materials/dynamics.dm index 7e1351ae75c1..c3a022f2ef8a 100644 --- a/code/modules/materials/dynamics.dm +++ b/code/modules/materials/dynamics.dm @@ -13,8 +13,49 @@ * @return /datum/armor instance */ /datum/material/proc/create_armor(significance = MATERIAL_SIGNIFICANCE_BASELINE, mob_armor) - #warn params - #warn impl - this requires caching + var/cache_key = "[significance]_[!!mob_armor]" + if(!isnull(armor_cache[cache_key])) + return armor_cache[cache_key] + + //! Not even Desmos will save you now. !// + // absorbing kinetic energy + var/kinetic_damping = toughness * ((density ** 0.5) * (1 / 3)) + // stopping kinetic penetrators + var/kinetic_hardness = hardness * ((density ** 0.5) * (1 / 8) + 0.7) + // absorbing energy blasts + var/ablation_damping = + // spreading energy blasts from going through + var/ablation_diffusion = + // exotic 'energy' armor + var/exotic_absorption = + // bomb values : from kinetic damping and hardness + var/direct_bomb = + // direct values + // todo: integrate significance + var/direct_bio = relative_permeability > 1? -relative_permeability : relative_permeability + // todo: integrate significance + var/direct_acid = relative_reactivity > 1? -relative_reactivity : relative_reactivity + // todo: integrate significance + var/direct_fire = relative_reactivity > 1? -relative_reactivity : relative_reactivity + var/direct_rad = (density * (1 / 16))**2 * ((MATERIAL_SIGNIFICANCE_BASELINE + (significance - MATERIAL_SIGNIFICANCE_BASELINE)) * 0.1) + #warn FUCK + // we don't allow deflection for now + return (armor_cache = fetch_armor_struct(list( + ARMOR_MELEE = , + ARMOR_MELEE_TIER = , + ARMOR_MELEE_SOAK = , + ARMOR_BULLET = , + ARMOR_BULLET_TIER = , + ARMOR_BULLET_SOAK = , + ARMOR_LASER = , + ARMOR_LASER_TIER = , + ARMOR_LASER_SOAK = , + ARMOR_BOMB = direct_bomb, + ARMOR_BIO = direct_bio, + ARMOR_ACID = direct_acid, + ARMOR_FIRE = direct_fire, + ARMOR_RAD = direct_rad, + ))) /** * combines multiple material armors into one diff --git a/code/modules/materials/material.dm b/code/modules/materials/material.dm index d4e2d3b44d7f..542626d2c3ae 100644 --- a/code/modules/materials/material.dm +++ b/code/modules/materials/material.dm @@ -56,7 +56,7 @@ var/pass_stack_colors = FALSE //* Armor - /// caching of armor. text2num(significance) = armor datum instance + /// caching of armor. text2num(significance)_[mob_armor? 1 : 0] = armor datum instance var/tmp/list/armor_cache = list() //* Attacks @@ -107,6 +107,8 @@ /// * impacts radiation armor (major) /// * impacts bomb armor /// * impacts blunt / crush damage + /// * impacts sharp / blade damage (minor) + /// * impacts kinetic damage resistance (minor) var/density = 8 * 1 /// weight multiplier - allowing for materials that behave like a high-density material but are light /// * basically, low values = high density stats without the penalties from weight diff --git a/code/modules/projectiles/guns/projectile/rocket.dm b/code/modules/projectiles/guns/projectile/rocket.dm index f42300dd3a86..d4c5724ef69c 100644 --- a/code/modules/projectiles/guns/projectile/rocket.dm +++ b/code/modules/projectiles/guns/projectile/rocket.dm @@ -176,7 +176,7 @@ /obj/item/gun/ballistic/rocket/tyrmalin/attackby(var/obj/item/A as obj, mob/user as mob) . = ..() - if(istype(A, /obj/item/stack/material) && A.get_material_name() == MAT_PLASTEEL) + if(A.is_material_stack_of(/datum/material/plasteel)) var/obj/item/stack/material/M = A if(M.use(1)) var/obj/item/tyrmalin_rocket_assembly/R = new /obj/item/tyrmalin_rocket_assembly(get_turf(src)) diff --git a/code/modules/species/xenomorphs/alien_powers.dm b/code/modules/species/xenomorphs/alien_powers.dm index 6d15c0a63096..c913fe96d783 100644 --- a/code/modules/species/xenomorphs/alien_powers.dm +++ b/code/modules/species/xenomorphs/alien_powers.dm @@ -166,7 +166,7 @@ else if(istype(O, /turf/simulated/wall)) var/turf/simulated/wall/W = O - if(W.material.flags & MATERIAL_UNMELTABLE) + if(W.material_outer.material_flags & MATERIAL_FLAG_UNMELTABLE) cannot_melt = 1 else if(istype(O, /turf/simulated/floor)) /* var/turf/simulated/floor/F = O //Turfs are qdel'd to space (Even asteroid tiles), will need to be touched by someone smarter than myself. -Mech