From 46eb5bb38a66a26b2d5d060fee1e32fadcc8579f Mon Sep 17 00:00:00 2001 From: zxaber <37497534+zxaber@users.noreply.github.com> Date: Tue, 9 Jan 2024 11:09:22 -0800 Subject: [PATCH] Fixes open-air mechs (Ripley, Paddy) not pushing projectile damage to the pilot (#80844) ## About The Pull Request Moves parent call for mech bullet_act() to after the enclosed and occupant check, so that the rest of the proc has a chance to send the damage to the pilot ## Why It's Good For The Game Bugfix. ## Changelog :cl: fix: Ripley MK-Is and Paddys now correctly make incoming projectiles hit the pilot again. /:cl: --- code/__DEFINES/mecha.dm | 2 +- code/_globalvars/bitfields.dm | 2 +- code/game/objects/items/tools/crowbar.dm | 2 +- code/modules/vehicles/mecha/_mecha.dm | 16 +++++++--------- code/modules/vehicles/mecha/combat/gygax.dm | 2 +- code/modules/vehicles/mecha/combat/honker.dm | 4 ++-- code/modules/vehicles/mecha/combat/marauder.dm | 4 ++-- code/modules/vehicles/mecha/combat/reticence.dm | 2 +- .../vehicles/mecha/combat/savannah_ivanov.dm | 2 +- code/modules/vehicles/mecha/mecha_actions.dm | 2 +- .../vehicles/mecha/mecha_control_console.dm | 4 ++-- code/modules/vehicles/mecha/mecha_defense.dm | 16 +++++++--------- code/modules/vehicles/mecha/mecha_ui.dm | 2 +- code/modules/vehicles/mecha/working/ripley.dm | 8 ++++---- 14 files changed, 32 insertions(+), 36 deletions(-) diff --git a/code/__DEFINES/mecha.dm b/code/__DEFINES/mecha.dm index 5a37f60aba6..0f900f72ee4 100644 --- a/code/__DEFINES/mecha.dm +++ b/code/__DEFINES/mecha.dm @@ -6,7 +6,7 @@ #define PANEL_OPEN (1<<0) #define ID_LOCK_ON (1<<1) -#define CANSTRAFE (1<<2) +#define CAN_STRAFE (1<<2) #define LIGHTS_ON (1<<3) #define SILICON_PILOT (1<<4) #define IS_ENCLOSED (1<<5) diff --git a/code/_globalvars/bitfields.dm b/code/_globalvars/bitfields.dm index 2c35baed1ec..89c0b4e1c4d 100644 --- a/code/_globalvars/bitfields.dm +++ b/code/_globalvars/bitfields.dm @@ -231,7 +231,7 @@ DEFINE_BITFIELD(internal_damage, list( DEFINE_BITFIELD(mecha_flags, list( "ID_LOCK_ON" = ID_LOCK_ON, - "CANSTRAFE" = CANSTRAFE, + "CAN_STRAFE" = CAN_STRAFE, "LIGHTS_ON" = LIGHTS_ON, "SILICON_PILOT" = SILICON_PILOT, "IS_ENCLOSED" = IS_ENCLOSED, diff --git a/code/game/objects/items/tools/crowbar.dm b/code/game/objects/items/tools/crowbar.dm index 9265dc7cb4e..bc4e0a94c16 100644 --- a/code/game/objects/items/tools/crowbar.dm +++ b/code/game/objects/items/tools/crowbar.dm @@ -235,7 +235,7 @@ var/mech_dir = mech.dir mech.balloon_alert(user, "prying open...") playsound(mech, 'sound/machines/airlock_alien_prying.ogg', 100, TRUE) - if(!use_tool(mech, user, mech.enclosed ? 5 SECONDS : 3 SECONDS, volume = 0, extra_checks = CALLBACK(src, PROC_REF(extra_checks), mech, mech_dir))) + if(!use_tool(mech, user, (mech.mecha_flags & IS_ENCLOSED) ? 5 SECONDS : 3 SECONDS, volume = 0, extra_checks = CALLBACK(src, PROC_REF(extra_checks), mech, mech_dir))) mech.balloon_alert(user, "interrupted!") return user.log_message("pried open [mech], located at [loc_name(mech)], which is currently occupied by [mech.occupants.Join(", ")].", LOG_ATTACK) diff --git a/code/modules/vehicles/mecha/_mecha.dm b/code/modules/vehicles/mecha/_mecha.dm index d971b82a856..dc7304a1388 100644 --- a/code/modules/vehicles/mecha/_mecha.dm +++ b/code/modules/vehicles/mecha/_mecha.dm @@ -54,7 +54,7 @@ /// Keeps track of the mech's servo motor var/obj/item/stock_parts/servo/servo ///Contains flags for the mecha - var/mecha_flags = CANSTRAFE | IS_ENCLOSED | HAS_LIGHTS | MMI_COMPATIBLE + var/mecha_flags = CAN_STRAFE | IS_ENCLOSED | HAS_LIGHTS | MMI_COMPATIBLE ///Spark effects are handled by this datum var/datum/effect_system/spark_spread/spark_system @@ -70,8 +70,6 @@ var/bumpsmash = FALSE ///////////ATMOS - ///Whether the pilot is hidden from the outside viewers and whether the cabin can be sealed to be airtight - var/enclosed = TRUE ///Whether the cabin exchanges gases with the environment var/cabin_sealed = FALSE ///Internal air mix datum @@ -397,7 +395,7 @@ /obj/vehicle/sealed/mecha/generate_actions() initialize_passenger_action_type(/datum/action/vehicle/sealed/mecha/mech_eject) - if(enclosed) + if(mecha_flags & IS_ENCLOSED) initialize_controller_action_type(/datum/action/vehicle/sealed/mecha/mech_toggle_cabin_seal, VEHICLE_CONTROL_SETTINGS) if(can_use_overclock) initialize_passenger_action_type(/datum/action/vehicle/sealed/mecha/mech_overclock) @@ -468,7 +466,7 @@ . += span_warning("It's missing a capacitor.") if(!scanmod) . += span_warning("It's missing a scanning module.") - if(enclosed) + if(mecha_flags & IS_ENCLOSED) return if(mecha_flags & SILICON_PILOT) . += span_notice("[src] appears to be piloting itself...") @@ -574,7 +572,7 @@ /obj/vehicle/sealed/mecha/proc/process_occupants(seconds_per_tick) for(var/mob/living/occupant as anything in occupants) - if(!enclosed && occupant?.incapacitated()) //no sides mean it's easy to just sorta fall out if you're incapacitated. + if(!(mecha_flags & IS_ENCLOSED) && occupant?.incapacitated()) //no sides mean it's easy to just sorta fall out if you're incapacitated. mob_exit(occupant, randomstep = TRUE) //bye bye continue if(cell && cell.maxcharge) @@ -725,12 +723,12 @@ ///////////////////////////////////// /obj/vehicle/sealed/mecha/remove_air(amount) - if(enclosed && cabin_sealed) + if((mecha_flags & IS_ENCLOSED) && cabin_sealed) return cabin_air.remove(amount) return ..() /obj/vehicle/sealed/mecha/return_air() - if(enclosed && cabin_sealed) + if((mecha_flags & IS_ENCLOSED) && cabin_sealed) return cabin_air return ..() @@ -749,7 +747,7 @@ ///makes cabin unsealed, dumping cabin air outside or airtight filling the cabin with external air mix /obj/vehicle/sealed/mecha/proc/set_cabin_seal(mob/user, cabin_sealed) - if(!enclosed) + if(!(mecha_flags & IS_ENCLOSED)) balloon_alert(user, "cabin can't be sealed!") log_message("Tried to seal cabin. This mech can't be airtight.", LOG_MECHA) return diff --git a/code/modules/vehicles/mecha/combat/gygax.dm b/code/modules/vehicles/mecha/combat/gygax.dm index 223ab66ca31..82fd77f2289 100644 --- a/code/modules/vehicles/mecha/combat/gygax.dm +++ b/code/modules/vehicles/mecha/combat/gygax.dm @@ -47,7 +47,7 @@ force = 30 accesses = list(ACCESS_SYNDICATE) wreckage = /obj/structure/mecha_wreckage/gygax/dark - mecha_flags = ID_LOCK_ON | CANSTRAFE | IS_ENCLOSED | HAS_LIGHTS | MMI_COMPATIBLE + mecha_flags = ID_LOCK_ON | CAN_STRAFE | IS_ENCLOSED | HAS_LIGHTS | MMI_COMPATIBLE max_equip_by_category = list( MECHA_L_ARM = 1, MECHA_R_ARM = 1, diff --git a/code/modules/vehicles/mecha/combat/honker.dm b/code/modules/vehicles/mecha/combat/honker.dm index dddcb7e8225..a7c9f018d28 100644 --- a/code/modules/vehicles/mecha/combat/honker.dm +++ b/code/modules/vehicles/mecha/combat/honker.dm @@ -13,7 +13,7 @@ exit_delay = 40 accesses = list(ACCESS_MECH_SCIENCE, ACCESS_THEATRE) wreckage = /obj/structure/mecha_wreckage/honker - mecha_flags = CANSTRAFE | IS_ENCLOSED | HAS_LIGHTS | MMI_COMPATIBLE + mecha_flags = CAN_STRAFE | IS_ENCLOSED | HAS_LIGHTS | MMI_COMPATIBLE mech_type = EXOSUIT_MODULE_HONK max_equip_by_category = list( MECHA_L_ARM = 1, @@ -47,7 +47,7 @@ max_temperature = 35000 accesses = list(ACCESS_SYNDICATE) wreckage = /obj/structure/mecha_wreckage/honker/dark - mecha_flags = ID_LOCK_ON | CANSTRAFE | IS_ENCLOSED | HAS_LIGHTS | MMI_COMPATIBLE + mecha_flags = ID_LOCK_ON | CAN_STRAFE | IS_ENCLOSED | HAS_LIGHTS | MMI_COMPATIBLE max_equip_by_category = list( MECHA_L_ARM = 1, MECHA_R_ARM = 1, diff --git a/code/modules/vehicles/mecha/combat/marauder.dm b/code/modules/vehicles/mecha/combat/marauder.dm index 2fe8da4bdc7..750223a85d7 100644 --- a/code/modules/vehicles/mecha/combat/marauder.dm +++ b/code/modules/vehicles/mecha/combat/marauder.dm @@ -12,7 +12,7 @@ resistance_flags = LAVA_PROOF | FIRE_PROOF | ACID_PROOF accesses = list(ACCESS_CENT_SPECOPS) wreckage = /obj/structure/mecha_wreckage/marauder - mecha_flags = CANSTRAFE | IS_ENCLOSED | HAS_LIGHTS | MMI_COMPATIBLE + mecha_flags = CAN_STRAFE | IS_ENCLOSED | HAS_LIGHTS | MMI_COMPATIBLE mech_type = EXOSUIT_MODULE_MARAUDER force = 45 max_equip_by_category = list( @@ -117,7 +117,7 @@ base_icon_state = "mauler" accesses = list(ACCESS_SYNDICATE) wreckage = /obj/structure/mecha_wreckage/mauler - mecha_flags = ID_LOCK_ON | CANSTRAFE | IS_ENCLOSED | HAS_LIGHTS | MMI_COMPATIBLE + mecha_flags = ID_LOCK_ON | CAN_STRAFE | IS_ENCLOSED | HAS_LIGHTS | MMI_COMPATIBLE max_equip_by_category = list( MECHA_L_ARM = 1, MECHA_R_ARM = 1, diff --git a/code/modules/vehicles/mecha/combat/reticence.dm b/code/modules/vehicles/mecha/combat/reticence.dm index bff5ecbd97b..ea8c72cae23 100644 --- a/code/modules/vehicles/mecha/combat/reticence.dm +++ b/code/modules/vehicles/mecha/combat/reticence.dm @@ -12,7 +12,7 @@ exit_delay = 40 wreckage = /obj/structure/mecha_wreckage/reticence accesses = list(ACCESS_MECH_SCIENCE, ACCESS_THEATRE) - mecha_flags = CANSTRAFE | IS_ENCLOSED | HAS_LIGHTS | QUIET_STEPS | QUIET_TURNS | MMI_COMPATIBLE + mecha_flags = CAN_STRAFE | IS_ENCLOSED | HAS_LIGHTS | QUIET_STEPS | QUIET_TURNS | MMI_COMPATIBLE mech_type = EXOSUIT_MODULE_RETICENCE max_equip_by_category = list( MECHA_L_ARM = 1, diff --git a/code/modules/vehicles/mecha/combat/savannah_ivanov.dm b/code/modules/vehicles/mecha/combat/savannah_ivanov.dm index c784219e3c3..237a0d971b0 100644 --- a/code/modules/vehicles/mecha/combat/savannah_ivanov.dm +++ b/code/modules/vehicles/mecha/combat/savannah_ivanov.dm @@ -19,7 +19,7 @@ base_icon_state = "savannah_ivanov" icon_state = "savannah_ivanov_0_0" //does not include mmi compatibility - mecha_flags = CANSTRAFE | IS_ENCLOSED | HAS_LIGHTS + mecha_flags = CAN_STRAFE | IS_ENCLOSED | HAS_LIGHTS mech_type = EXOSUIT_MODULE_SAVANNAH movedelay = 3 max_integrity = 450 //really tanky, like damn diff --git a/code/modules/vehicles/mecha/mecha_actions.dm b/code/modules/vehicles/mecha/mecha_actions.dm index 43301c19605..2b410bd60c7 100644 --- a/code/modules/vehicles/mecha/mecha_actions.dm +++ b/code/modules/vehicles/mecha/mecha_actions.dm @@ -101,7 +101,7 @@ toggle_strafe() /obj/vehicle/sealed/mecha/proc/toggle_strafe() - if(!(mecha_flags & CANSTRAFE)) + if(!(mecha_flags & CAN_STRAFE)) to_chat(occupants, "this mecha doesn't support strafing!") return diff --git a/code/modules/vehicles/mecha/mecha_control_console.dm b/code/modules/vehicles/mecha/mecha_control_console.dm index 3dd69d4ba93..635ec9425b1 100644 --- a/code/modules/vehicles/mecha/mecha_control_console.dm +++ b/code/modules/vehicles/mecha/mecha_control_console.dm @@ -29,7 +29,7 @@ name = M.name, integrity = round((M.get_integrity() / M.max_integrity) * 100), charge = M.cell ? round(M.cell.percent()) : null, - airtank = M.enclosed ? M.return_pressure() : null, + airtank = (M.mecha_flags & IS_ENCLOSED) ? M.return_pressure() : null, pilot = M.return_drivers(), location = get_area_name(M, TRUE), emp_recharging = MT.recharging, @@ -97,7 +97,7 @@ var/answer = {"Name: [chassis.name]
Integrity: [round((chassis.get_integrity()/chassis.max_integrity * 100), 0.01)]%
Cell Charge: [isnull(cell_charge) ? "Not Found":"[chassis.cell.percent()]%"]
- Cabin Pressure: [chassis.enclosed ? "[round(chassis.return_pressure(), 0.01)] kPa" : "Not Sealed"]
+ Cabin Pressure: [(chassis.mecha_flags & IS_ENCLOSED) ? "[round(chassis.return_pressure(), 0.01)] kPa" : "Not Sealed"]
Pilot: [english_list(chassis.return_drivers(), nothing_text = "None")]
Location: [get_area_name(chassis, TRUE) || "Unknown"]"} if(istype(chassis, /obj/vehicle/sealed/mecha/ripley)) diff --git a/code/modules/vehicles/mecha/mecha_defense.dm b/code/modules/vehicles/mecha/mecha_defense.dm index 746039e7552..e88ce2925ac 100644 --- a/code/modules/vehicles/mecha/mecha_defense.dm +++ b/code/modules/vehicles/mecha/mecha_defense.dm @@ -115,18 +115,15 @@ return ..() /obj/vehicle/sealed/mecha/bullet_act(obj/projectile/hitting_projectile, def_zone, piercing_hit) //wrapper - . = ..() - if(. != BULLET_ACT_HIT) - return . - //allows bullets to hit the pilot of open-canopy mechs - if(!enclosed \ + if(!(mecha_flags & IS_ENCLOSED) \ && LAZYLEN(occupants) \ && !(mecha_flags & SILICON_PILOT) \ && (def_zone == BODY_ZONE_HEAD || def_zone == BODY_ZONE_CHEST)) - for(var/mob/living/hitmob as anything in occupants) - hitmob.bullet_act(hitting_projectile, def_zone, piercing_hit) //If the sides are open, the occupant can be hit - return BULLET_ACT_HIT + var/mob/living/hitmob = pick(occupants) + return hitmob.bullet_act(hitting_projectile, def_zone, piercing_hit) //If the sides are open, the occupant can be hit + + . = ..() log_message("Hit by projectile. Type: [hitting_projectile]([hitting_projectile.damage_type]).", LOG_MECHA, color="red") // yes we *have* to run the armor calc proc here I love tg projectile code too @@ -138,6 +135,7 @@ armour_penetration = hitting_projectile.armour_penetration, ), def_zone) + /obj/vehicle/sealed/mecha/ex_act(severity, target) log_message("Affected by explosion of severity: [severity].", LOG_MECHA, color="red") return ..() @@ -199,7 +197,7 @@ /obj/vehicle/sealed/mecha/fire_act() //Check if we should ignite the pilot of an open-canopy mech . = ..() - if(enclosed || mecha_flags & SILICON_PILOT) + if(mecha_flags & IS_ENCLOSED || mecha_flags & SILICON_PILOT) return for(var/mob/living/cookedalive as anything in occupants) if(cookedalive.fire_stacks < 5) diff --git a/code/modules/vehicles/mecha/mecha_ui.dm b/code/modules/vehicles/mecha/mecha_ui.dm index 76d8b4613fa..826a746c849 100644 --- a/code/modules/vehicles/mecha/mecha_ui.dm +++ b/code/modules/vehicles/mecha/mecha_ui.dm @@ -97,7 +97,7 @@ data["capacitor_rating"] = capacitor?.rating data["weapons_safety"] = weapons_safety - data["enclosed"] = enclosed + data["enclosed"] = mecha_flags & IS_ENCLOSED data["cabin_sealed"] = cabin_sealed data["cabin_temp"] = round(cabin_air.temperature - T0C) data["cabin_pressure"] = round(cabin_air.return_pressure()) diff --git a/code/modules/vehicles/mecha/working/ripley.dm b/code/modules/vehicles/mecha/working/ripley.dm index 9bc6ea75751..711da429cca 100644 --- a/code/modules/vehicles/mecha/working/ripley.dm +++ b/code/modules/vehicles/mecha/working/ripley.dm @@ -17,11 +17,11 @@ MECHA_POWER = 1, MECHA_ARMOR = 1, ) + mecha_flags = CAN_STRAFE | HAS_LIGHTS | MMI_COMPATIBLE wreckage = /obj/structure/mecha_wreckage/ripley mech_type = EXOSUIT_MODULE_RIPLEY possible_int_damage = MECHA_INT_FIRE|MECHA_INT_CONTROL_LOST|MECHA_INT_SHORT_CIRCUIT accesses = list(ACCESS_MECH_ENGINE, ACCESS_MECH_SCIENCE, ACCESS_MECH_MINING) - enclosed = FALSE //Normal ripley has an open cockpit design enter_delay = 10 //can enter in a quarter of the time of other mechs exit_delay = 10 /// Custom Ripley step and turning sounds (from TGMC) @@ -75,10 +75,10 @@ movedelay = 4 max_temperature = 30000 max_integrity = 250 + mecha_flags = CAN_STRAFE | IS_ENCLOSED | HAS_LIGHTS | MMI_COMPATIBLE possible_int_damage = MECHA_INT_FIRE|MECHA_INT_TEMP_CONTROL|MECHA_CABIN_AIR_BREACH|MECHA_INT_CONTROL_LOST|MECHA_INT_SHORT_CIRCUIT armor_type = /datum/armor/mecha_ripley_mk2 wreckage = /obj/structure/mecha_wreckage/ripley/mk2 - enclosed = TRUE enter_delay = 40 silicon_icon_state = null @@ -186,7 +186,7 @@ /obj/vehicle/sealed/mecha/ripley/paddy/preset accesses = list(ACCESS_SECURITY) - mecha_flags = CANSTRAFE | IS_ENCLOSED | HAS_LIGHTS | MMI_COMPATIBLE | ID_LOCK_ON + mecha_flags = CAN_STRAFE | HAS_LIGHTS | MMI_COMPATIBLE | ID_LOCK_ON equip_by_category = list( MECHA_L_ARM = /obj/item/mecha_parts/mecha_equipment/weapon/energy/disabler, MECHA_R_ARM = /obj/item/mecha_parts/mecha_equipment/weapon/paddy_claw, @@ -206,7 +206,7 @@ lights_power = 7 wreckage = /obj/structure/mecha_wreckage/ripley/deathripley step_energy_drain = 0 - enclosed = TRUE + mecha_flags = CAN_STRAFE | IS_ENCLOSED | HAS_LIGHTS | MMI_COMPATIBLE enter_delay = 40 silicon_icon_state = null equip_by_category = list(