From d40f3d2c5fc6a3af3bdd7cce02361b5f4f1a9c7f Mon Sep 17 00:00:00 2001 From: MLGTASTICa Date: Thu, 19 Sep 2024 14:24:05 +0300 Subject: [PATCH 01/12] Update mecha.dm --- code/game/mecha/mecha.dm | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/code/game/mecha/mecha.dm b/code/game/mecha/mecha.dm index afcaf470d86..b4b5e756236 100644 --- a/code/game/mecha/mecha.dm +++ b/code/game/mecha/mecha.dm @@ -83,6 +83,17 @@ var/internal_damage_threshold = 50 //health percentage below which internal damage is possible var/internal_damage = 0 //contains bitflags + /// FRONT , left side , right side , behind + var/list/directional_mults = list(1,1,1,1) + /// List of internal components per direction , will cause increased mech damge incase of mech AP and block shots from hitting the driver + // internal list should be list[ref] = list(hitChance, hitMult, APthreshold) + var/list/directional_comps = list( + list(), + list(), + list(), + list() + ) + var/list/operation_req_access = list()//required access level for mecha operation var/list/internals_req_access = list()//REQUIRED ACCESS LEVEL TO OPEN CELL COMPARTMENT From 317bd6c67dfed98d6bcb9bb12f9aa95776f70159 Mon Sep 17 00:00:00 2001 From: MLGTASTICa Date: Sun, 22 Sep 2024 15:26:05 +0300 Subject: [PATCH 02/12] ze code --- code/game/mecha/mecha.dm | 4 +--- code/game/mecha/mecha_defense.dm | 39 ++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 3 deletions(-) diff --git a/code/game/mecha/mecha.dm b/code/game/mecha/mecha.dm index b4b5e756236..124b2a5757f 100644 --- a/code/game/mecha/mecha.dm +++ b/code/game/mecha/mecha.dm @@ -82,9 +82,7 @@ var/max_temperature = 25000 var/internal_damage_threshold = 50 //health percentage below which internal damage is possible var/internal_damage = 0 //contains bitflags - - /// FRONT , left side , right side , behind - var/list/directional_mults = list(1,1,1,1) + // FRONT, LEFT , RIGHT, BACK /// List of internal components per direction , will cause increased mech damge incase of mech AP and block shots from hitting the driver // internal list should be list[ref] = list(hitChance, hitMult, APthreshold) var/list/directional_comps = list( diff --git a/code/game/mecha/mecha_defense.dm b/code/game/mecha/mecha_defense.dm index c7f31906c0d..b94a1410016 100644 --- a/code/game/mecha/mecha_defense.dm +++ b/code/game/mecha/mecha_defense.dm @@ -6,7 +6,18 @@ return facing_modifiers[FRONT_ARMOUR] return facing_modifiers[SIDE_ARMOUR] //if its not a front hit or back hit then assume its from the side +/obj/mecha/proc/attack_dir_for_modules(relative_dir) + if(relative_dir > -45 && relative_dir < 45) + return 1 + else if(relative_dir < -45 && relative_dir > -135) + return 2 + else if(relative_dir > 45 && relative_dir < 135) + return 3 + else if(relative_dir > -135 && relative_dir < 135) + return 4 + /obj/mecha/take_damage(damage_amount, damage_type = BRUTE, damage_flag = 0, sound_effect = 1, attack_dir, armour_penetration = 0, atom/attacked_by) + . = ..() if(. && obj_integrity > 0) spark_system.start() @@ -46,6 +57,7 @@ if(attack_dir) var/facing_modifier = get_armour_facing(abs(dir2angle(dir) - dir2angle(attack_dir))) + booster_damage_modifier /= facing_modifier booster_deflection_modifier *= facing_modifier if(prob(deflect_chance * booster_deflection_modifier) && damage_flag != "bomb") @@ -109,6 +121,33 @@ /obj/mecha/bullet_act(obj/item/projectile/Proj) //wrapper mecha_log_message("Hit by projectile. Type: [Proj.name]([Proj.flag]).", color="red") + if(!(Proj.damage_type in list(BRUTE, BURN))) + return BULLET_ACT_BLOCK + var/attack_dir = get_Dir(Proj, src) + var/facing_modifier = get_armour_facing(abs(dir2angle(dir) - dir2angle(attack_dir))) + var/true_armor = armor["linebullet"] * facing_modifiers / 100 + if(true_armor > 50 && prob(true_armor)) + handle_projectile_attack_redirection(Proj, REDIRECT_METHOD_DEFLECT) + return BULLET_ACT_FORCE_PIERCE + var/true_damage = Proj.damage * (1 - true_armor) + if(true_damage < 1) + return BULLET_ACT_BLOCK + var/modules_index = attack_dir_for_modules(dir2angle(get_dir(Proj,src)) - dir2angle(dir)) + for(var/i=1 to length(directional_comps[modules_index])) + if(!prob(directional_comps[modules_index][1])) + continue + var/damage_mult = directional_comps[modules_index][2] + var/ap_threshold = directional_comps[modules_index][3] + if(damage_mult > 0) + take_damage(true_damage * damage_mult, Proj.damage_type, null, null, attack_dir, Proj.armour_penetration, Proj) + if(Proj.armour_penetration < ap_threshold) + return BULLET_ACT_BLOCK + else + Proj.armour_penetration -= ap_threshold + + if(prob(80) && occupant) + . = occupant.bullet_act(Proj, Proj.def_zone) + . = ..() /obj/mecha/ex_act(severity, target) From c0cf707ac9d088847ee1e9e77e541728f155380c Mon Sep 17 00:00:00 2001 From: MLGTASTICa Date: Sun, 22 Sep 2024 17:13:41 +0300 Subject: [PATCH 03/12] AAAAAAAAAAAAAAAA --- code/game/mecha/mecha.dm | 16 ++++++++++++---- code/game/mecha/mecha_defense.dm | 19 +++++++++++-------- 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/code/game/mecha/mecha.dm b/code/game/mecha/mecha.dm index 124b2a5757f..52304935cf3 100644 --- a/code/game/mecha/mecha.dm +++ b/code/game/mecha/mecha.dm @@ -86,10 +86,18 @@ /// List of internal components per direction , will cause increased mech damge incase of mech AP and block shots from hitting the driver // internal list should be list[ref] = list(hitChance, hitMult, APthreshold) var/list/directional_comps = list( - list(), - list(), - list(), - list() + list( + list(100,2, 30, 50) + ), + list( + list(30,2, 30, 50) + ), + list( + list(30,2, 30, 50) + ), + list( + list(5,2, 30, 50) + ) ) var/list/operation_req_access = list()//required access level for mecha operation diff --git a/code/game/mecha/mecha_defense.dm b/code/game/mecha/mecha_defense.dm index b94a1410016..606d2fe0d11 100644 --- a/code/game/mecha/mecha_defense.dm +++ b/code/game/mecha/mecha_defense.dm @@ -13,7 +13,7 @@ return 2 else if(relative_dir > 45 && relative_dir < 135) return 3 - else if(relative_dir > -135 && relative_dir < 135) + else if(relative_dir >= -180 && relative_dir <= 180) return 4 /obj/mecha/take_damage(damage_amount, damage_type = BRUTE, damage_flag = 0, sound_effect = 1, attack_dir, armour_penetration = 0, atom/attacked_by) @@ -123,23 +123,26 @@ mecha_log_message("Hit by projectile. Type: [Proj.name]([Proj.flag]).", color="red") if(!(Proj.damage_type in list(BRUTE, BURN))) return BULLET_ACT_BLOCK - var/attack_dir = get_Dir(Proj, src) + var/attack_dir = get_dir(src, Proj) var/facing_modifier = get_armour_facing(abs(dir2angle(dir) - dir2angle(attack_dir))) - var/true_armor = armor["linebullet"] * facing_modifiers / 100 + var/true_armor = min(0,armor["linebullet"] * facing_modifier - Proj.armour_penetration) + var/true_damage = Proj.damage * (1 - true_armor) if(true_armor > 50 && prob(true_armor)) - handle_projectile_attack_redirection(Proj, REDIRECT_METHOD_DEFLECT) + Proj.setAngle(SIMPLIFY_DEGREES(Proj.Angle + rand(40,150))) return BULLET_ACT_FORCE_PIERCE - var/true_damage = Proj.damage * (1 - true_armor) if(true_damage < 1) return BULLET_ACT_BLOCK - var/modules_index = attack_dir_for_modules(dir2angle(get_dir(Proj,src)) - dir2angle(dir)) + Proj.damage = true_damage + var/modules_index = attack_dir_for_modules(dir2angle(attack_dir) - dir2angle(dir)) for(var/i=1 to length(directional_comps[modules_index])) if(!prob(directional_comps[modules_index][1])) continue var/damage_mult = directional_comps[modules_index][2] var/ap_threshold = directional_comps[modules_index][3] - if(damage_mult > 0) - take_damage(true_damage * damage_mult, Proj.damage_type, null, null, attack_dir, Proj.armour_penetration, Proj) + var/armor_rating = directional_comps[modules_index][4] + damage_mult = min(0.15,(Proj.damage + Proj.armour_penetration) / (Proj.damage + armor_rating)) + directional_comps[modules_index][4] -= damage_mult * Proj.damage + take_damage(true_damage * damage_mult, Proj.damage_type, null, null, attack_dir, Proj.armour_penetration, Proj) if(Proj.armour_penetration < ap_threshold) return BULLET_ACT_BLOCK else From 08de149f3366c12bf1539d3e0869869ac543f572 Mon Sep 17 00:00:00 2001 From: MLGTASTICa Date: Tue, 24 Sep 2024 14:12:48 +0300 Subject: [PATCH 04/12] ,kk --- code/game/mecha/mecha.dm | 8 ++++---- code/game/mecha/mecha_defense.dm | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/code/game/mecha/mecha.dm b/code/game/mecha/mecha.dm index 52304935cf3..83f70c76f77 100644 --- a/code/game/mecha/mecha.dm +++ b/code/game/mecha/mecha.dm @@ -87,16 +87,16 @@ // internal list should be list[ref] = list(hitChance, hitMult, APthreshold) var/list/directional_comps = list( list( - list(100,2, 30, 50) + list(100,2, 30) ), list( - list(30,2, 30, 50) + list(30,2, 30) ), list( - list(30,2, 30, 50) + list(30,2, 30) ), list( - list(5,2, 30, 50) + list(5,2, 30) ) ) diff --git a/code/game/mecha/mecha_defense.dm b/code/game/mecha/mecha_defense.dm index 606d2fe0d11..3afd6b65916 100644 --- a/code/game/mecha/mecha_defense.dm +++ b/code/game/mecha/mecha_defense.dm @@ -125,9 +125,9 @@ return BULLET_ACT_BLOCK var/attack_dir = get_dir(src, Proj) var/facing_modifier = get_armour_facing(abs(dir2angle(dir) - dir2angle(attack_dir))) - var/true_armor = min(0,armor["linebullet"] * facing_modifier - Proj.armour_penetration) + var/true_armor = min(0,armor["linebullet"] * facing_modifier - Proj.armour_penetration - Proj.damage / 4) var/true_damage = Proj.damage * (1 - true_armor) - if(true_armor > 50 && prob(true_armor)) + if(prob(true_armor/2)) Proj.setAngle(SIMPLIFY_DEGREES(Proj.Angle + rand(40,150))) return BULLET_ACT_FORCE_PIERCE if(true_damage < 1) From d809d39a0262aceadf6f54e2a50dc5403a87c01e Mon Sep 17 00:00:00 2001 From: MLGTASTICa Date: Tue, 24 Sep 2024 14:21:02 +0300 Subject: [PATCH 05/12] fix runtime --- code/game/mecha/mecha_defense.dm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/code/game/mecha/mecha_defense.dm b/code/game/mecha/mecha_defense.dm index 3afd6b65916..4d4155c3183 100644 --- a/code/game/mecha/mecha_defense.dm +++ b/code/game/mecha/mecha_defense.dm @@ -125,7 +125,12 @@ return BULLET_ACT_BLOCK var/attack_dir = get_dir(src, Proj) var/facing_modifier = get_armour_facing(abs(dir2angle(dir) - dir2angle(attack_dir))) - var/true_armor = min(0,armor["linebullet"] * facing_modifier - Proj.armour_penetration - Proj.damage / 4) + var/true_armor = 0 + if(armor.linebullet) + true_armor = min(0,armor["linebullet"] * facing_modifier - Proj.armour_penetration - Proj.damage / 4) + else if(armor.bullet) + true_armor = min(0,armor["bullet"] * facing_modifier - Proj.armour_penetration - Proj.damage / 4) + var/true_damage = Proj.damage * (1 - true_armor) if(prob(true_armor/2)) Proj.setAngle(SIMPLIFY_DEGREES(Proj.Angle + rand(40,150))) From 89f6a38e918936d7e13e06945bcb442d6dd3f82d Mon Sep 17 00:00:00 2001 From: MLGTASTICa Date: Tue, 24 Sep 2024 14:54:14 +0300 Subject: [PATCH 06/12] hit people in exosuits --- code/game/mecha/mecha_defense.dm | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/code/game/mecha/mecha_defense.dm b/code/game/mecha/mecha_defense.dm index 4d4155c3183..ff27f41861e 100644 --- a/code/game/mecha/mecha_defense.dm +++ b/code/game/mecha/mecha_defense.dm @@ -153,10 +153,19 @@ else Proj.armour_penetration -= ap_threshold - if(prob(80) && occupant) - . = occupant.bullet_act(Proj, Proj.def_zone) + var/list/hittable_occupants = list() + if(occupant) + hittable_occupants[occupant] = 80 + for(var/obj/item/mecha_parts/mecha_equipment/seat/other_occupant in src) + if(other_occupant.patient && other_occupant.patient.stat != DEAD) + hittable_occupants[other_occupant.patient] = 70 + + var/mob/living/true_target = pickweight(hittable_occupants, 50) + if(true_target) + . = true_target.bullet_act(Proj, Proj.def_zone) + else + . = ..() - . = ..() /obj/mecha/ex_act(severity, target) severity-- // MORE DAMAGE From 5a7c85d925e264ecff55b53cb455d2573124dd63 Mon Sep 17 00:00:00 2001 From: MLGTASTICa Date: Tue, 24 Sep 2024 16:59:52 +0300 Subject: [PATCH 07/12] Update mecha_defense.dm --- code/game/mecha/mecha_defense.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/game/mecha/mecha_defense.dm b/code/game/mecha/mecha_defense.dm index ff27f41861e..dd7a98845c3 100644 --- a/code/game/mecha/mecha_defense.dm +++ b/code/game/mecha/mecha_defense.dm @@ -127,9 +127,9 @@ var/facing_modifier = get_armour_facing(abs(dir2angle(dir) - dir2angle(attack_dir))) var/true_armor = 0 if(armor.linebullet) - true_armor = min(0,armor["linebullet"] * facing_modifier - Proj.armour_penetration - Proj.damage / 4) + true_armor = min(0,armor.linebullet * facing_modifier - Proj.armour_penetration - Proj.damage / 4) else if(armor.bullet) - true_armor = min(0,armor["bullet"] * facing_modifier - Proj.armour_penetration - Proj.damage / 4) + true_armor = min(0,armor.bullet * facing_modifier - Proj.armour_penetration - Proj.damage / 4) var/true_damage = Proj.damage * (1 - true_armor) if(prob(true_armor/2)) From 4483a2a02d526271d0bd2d47fa675673567f3370 Mon Sep 17 00:00:00 2001 From: MLGTASTICa Date: Tue, 24 Sep 2024 20:26:01 +0300 Subject: [PATCH 08/12] Update mecha_defense.dm --- code/game/mecha/mecha_defense.dm | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/code/game/mecha/mecha_defense.dm b/code/game/mecha/mecha_defense.dm index dd7a98845c3..39bb6ed7ddc 100644 --- a/code/game/mecha/mecha_defense.dm +++ b/code/game/mecha/mecha_defense.dm @@ -125,13 +125,8 @@ return BULLET_ACT_BLOCK var/attack_dir = get_dir(src, Proj) var/facing_modifier = get_armour_facing(abs(dir2angle(dir) - dir2angle(attack_dir))) - var/true_armor = 0 - if(armor.linebullet) - true_armor = min(0,armor.linebullet * facing_modifier - Proj.armour_penetration - Proj.damage / 4) - else if(armor.bullet) - true_armor = min(0,armor.bullet * facing_modifier - Proj.armour_penetration - Proj.damage / 4) - - var/true_damage = Proj.damage * (1 - true_armor) + var/true_armor = round(armor.bullet - Proj.ap - Proj.damage/4, 0.01) + var/true_damage = round(Proj.damage * (1 - true_armor)) if(prob(true_armor/2)) Proj.setAngle(SIMPLIFY_DEGREES(Proj.Angle + rand(40,150))) return BULLET_ACT_FORCE_PIERCE From a49cd99e37e0e197499a714807551648c29fc206 Mon Sep 17 00:00:00 2001 From: MLGTASTICa Date: Wed, 25 Sep 2024 08:06:23 +0300 Subject: [PATCH 09/12] Update mecha_defense.dm --- code/game/mecha/mecha_defense.dm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/code/game/mecha/mecha_defense.dm b/code/game/mecha/mecha_defense.dm index 39bb6ed7ddc..1768d381a61 100644 --- a/code/game/mecha/mecha_defense.dm +++ b/code/game/mecha/mecha_defense.dm @@ -125,12 +125,14 @@ return BULLET_ACT_BLOCK var/attack_dir = get_dir(src, Proj) var/facing_modifier = get_armour_facing(abs(dir2angle(dir) - dir2angle(attack_dir))) - var/true_armor = round(armor.bullet - Proj.ap - Proj.damage/4, 0.01) + var/true_armor = clamp(round(armor.bullet*facing_modifier/100 - Proj.armour_penetration ,0.01), 0, 1) var/true_damage = round(Proj.damage * (1 - true_armor)) + var/minimum_damage_to_penetrate = round(armor.bullet/3*(1 -Proj.armour_penetration), 0.01) if(prob(true_armor/2)) Proj.setAngle(SIMPLIFY_DEGREES(Proj.Angle + rand(40,150))) return BULLET_ACT_FORCE_PIERCE - if(true_damage < 1) + if(true_damage < minimum_damage_to_penetrate) + . = ..() return BULLET_ACT_BLOCK Proj.damage = true_damage var/modules_index = attack_dir_for_modules(dir2angle(attack_dir) - dir2angle(dir)) From 1f0760a54c68e8474ddedf992c142f92b711f24b Mon Sep 17 00:00:00 2001 From: MLGTASTICa Date: Sat, 28 Sep 2024 18:53:41 +0300 Subject: [PATCH 10/12] Update mecha_defense.dm --- code/game/mecha/mecha_defense.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/game/mecha/mecha_defense.dm b/code/game/mecha/mecha_defense.dm index 1768d381a61..4285400eba8 100644 --- a/code/game/mecha/mecha_defense.dm +++ b/code/game/mecha/mecha_defense.dm @@ -127,7 +127,7 @@ var/facing_modifier = get_armour_facing(abs(dir2angle(dir) - dir2angle(attack_dir))) var/true_armor = clamp(round(armor.bullet*facing_modifier/100 - Proj.armour_penetration ,0.01), 0, 1) var/true_damage = round(Proj.damage * (1 - true_armor)) - var/minimum_damage_to_penetrate = round(armor.bullet/3*(1 -Proj.armour_penetration), 0.01) + var/minimum_damage_to_penetrate = round(armor.bullet/3*(1 - Proj.armour_penetration), 0.01) if(prob(true_armor/2)) Proj.setAngle(SIMPLIFY_DEGREES(Proj.Angle + rand(40,150))) return BULLET_ACT_FORCE_PIERCE From 25966511e893aa16cee59aadd404c34b1a3033cc Mon Sep 17 00:00:00 2001 From: MLGTASTICa <61350382+MLGTASTICa@users.noreply.github.com> Date: Sun, 6 Oct 2024 12:43:09 +0300 Subject: [PATCH 11/12] Update mecha_defense.dm --- code/game/mecha/mecha_defense.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/game/mecha/mecha_defense.dm b/code/game/mecha/mecha_defense.dm index 4285400eba8..5f1ade09635 100644 --- a/code/game/mecha/mecha_defense.dm +++ b/code/game/mecha/mecha_defense.dm @@ -131,10 +131,10 @@ if(prob(true_armor/2)) Proj.setAngle(SIMPLIFY_DEGREES(Proj.Angle + rand(40,150))) return BULLET_ACT_FORCE_PIERCE + Proj.damage = true_damage if(true_damage < minimum_damage_to_penetrate) - . = ..() + take_damage(true_damage, Proj.damage_type, null, null, attack_dir, Proj.armour_penetration, Proj) return BULLET_ACT_BLOCK - Proj.damage = true_damage var/modules_index = attack_dir_for_modules(dir2angle(attack_dir) - dir2angle(dir)) for(var/i=1 to length(directional_comps[modules_index])) if(!prob(directional_comps[modules_index][1])) From e6a8ff5b54a24843b0c67c698fce271818a4a209 Mon Sep 17 00:00:00 2001 From: MLGTASTICa <61350382+MLGTASTICa@users.noreply.github.com> Date: Tue, 8 Oct 2024 16:32:53 +0300 Subject: [PATCH 12/12] Update mecha_defense.dm --- code/game/mecha/mecha_defense.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/game/mecha/mecha_defense.dm b/code/game/mecha/mecha_defense.dm index 5f1ade09635..87e23b86907 100644 --- a/code/game/mecha/mecha_defense.dm +++ b/code/game/mecha/mecha_defense.dm @@ -132,8 +132,8 @@ Proj.setAngle(SIMPLIFY_DEGREES(Proj.Angle + rand(40,150))) return BULLET_ACT_FORCE_PIERCE Proj.damage = true_damage + take_damage(true_damage, Proj.damage_type, null, null, attack_dir, Proj.armour_penetration, Proj) if(true_damage < minimum_damage_to_penetrate) - take_damage(true_damage, Proj.damage_type, null, null, attack_dir, Proj.armour_penetration, Proj) return BULLET_ACT_BLOCK var/modules_index = attack_dir_for_modules(dir2angle(attack_dir) - dir2angle(dir)) for(var/i=1 to length(directional_comps[modules_index]))