diff --git a/code/game/mecha/equipment/mecha_equipment.dm b/code/game/mecha/equipment/mecha_equipment.dm index 18ca35e6a39..de9c478a294 100644 --- a/code/game/mecha/equipment/mecha_equipment.dm +++ b/code/game/mecha/equipment/mecha_equipment.dm @@ -73,6 +73,13 @@ /obj/item/mecha_parts/mecha_equipment/proc/action(atom/target) return +/obj/item/mecha_parts/mecha_equipment/proc/on_unequip() + chassis.selected = null + return + +/obj/item/mecha_parts/mecha_equipment/proc/on_equip(atom/target) + return + /obj/item/mecha_parts/mecha_equipment/proc/start_cooldown() set_ready_state(0) chassis.use_power(energy_drain) diff --git a/code/game/mecha/equipment/tools/other_tools.dm b/code/game/mecha/equipment/tools/other_tools.dm index 321eaec8fcd..9bea878cbec 100644 --- a/code/game/mecha/equipment/tools/other_tools.dm +++ b/code/game/mecha/equipment/tools/other_tools.dm @@ -138,6 +138,26 @@ start_cooldown() return TRUE +/obj/item/mecha_parts/mecha_equipment/pulse_shield + name = "EPS-99 pulse shield generator" + desc = "A shield module that covers the exosuit in an energy barrier that absorbs damage. Requires energy to operate." + icon_state = "mecha_pulse_shield" + origin_tech = "materials=4;combat=4" + equip_cooldown = 10 + energy_drain = 50 + range = 0 + +/obj/item/mecha_parts/mecha_equipment/pulse_shield/on_equip() + chassis.update_icon(UPDATE_OVERLAYS) + +/obj/item/mecha_parts/mecha_equipment/pulse_shield/on_unequip() + . = ..() + chassis.update_icon(UPDATE_OVERLAYS) + +/obj/item/mecha_parts/mecha_equipment/pulse_shield/proc/attack_react(mob/user as mob) + if(action_checks(user)) + start_cooldown() + return TRUE ////////////////////////////////// REPAIR DROID ////////////////////////////////////////////////// @@ -286,6 +306,9 @@ STOP_PROCESSING(SSobj, src) set_ready_state(1) return + if(istype(chassis.selected, /obj/item/mecha_parts/mecha_equipment/pulse_shield)) + chassis.selected.on_unequip() // No shields while recharging + occupant_message("Shields disabled.") var/cur_charge = chassis.get_charge() if(isnull(cur_charge) || !chassis.cell) STOP_PROCESSING(SSobj, src) diff --git a/code/game/mecha/mecha.dm b/code/game/mecha/mecha.dm index 5415994362c..3a653315ffb 100644 --- a/code/game/mecha/mecha.dm +++ b/code/game/mecha/mecha.dm @@ -166,6 +166,9 @@ . = ..() underlays.Cut() underlays += emissive_appearance(emissive_appearance_icon, "[icon_state]_lightmask") + overlays.Cut() + if(istype(selected, /obj/item/mecha_parts/mecha_equipment/pulse_shield) && !leg_overload_mode && !istype(cell, /obj/item/stock_parts/cell/infinite) && occupant) + overlays += mutable_appearance('icons/effects/effects.dmi', "at_shield2", MOB_LAYER + 0.01, alpha = 120) //////////////////////// ////// Helpers ///////// @@ -527,6 +530,16 @@ return facing_modifiers[MECHA_SIDE_ARMOUR] //always return non-0 /obj/mecha/take_damage(damage_amount, damage_type = BRUTE, damage_flag = 0, sound_effect = 1, attack_dir) + for(var/obj/item/mecha_parts/mecha_equipment/pulse_shield/shield in equipment) + if(selected == shield && !leg_overload_mode && !istype(cell, /obj/item/stock_parts/cell/infinite) && occupant) + var/required_power = shield.energy_drain * damage_amount + if(cell && cell.use(required_power)) + log_message("Took [damage_amount] points of damage. Damage absorbed by [shield].") + damage_amount = 0 + spark_system.start() + else + occupant_message("Shield breached!") + shield.on_unequip() . = ..() if(. && obj_integrity > 0) spark_system.start() @@ -630,6 +643,9 @@ /obj/mecha/bullet_act(obj/item/projectile/Proj) //wrapper log_message("Hit by projectile. Type: [Proj.name]([Proj.flag]).") add_attack_logs(Proj.firer, OCCUPANT_LOGGING, "shot [Proj.name]([Proj.flag]) at mech [src]") + if(Proj.shield_buster && istype(selected, /obj/item/mecha_parts/mecha_equipment/pulse_shield)) + occupant_message("Shield breached!") + selected.on_unequip() ..() /obj/mecha/ex_act(severity, target) @@ -695,6 +711,9 @@ /obj/mecha/emp_act(severity) if(emp_proof) return + if(istype(selected, /obj/item/mecha_parts/mecha_equipment/pulse_shield)) + occupant_message("Shield breached!") + selected.on_unequip() if(get_charge()) use_power((cell.charge/3)/(severity*2)) take_damage(30 / severity, BURN, ENERGY, 1) @@ -768,6 +787,9 @@ W.forceMove(src) cell = W log_message("Powercell installed") + if(istype(selected, /obj/item/mecha_parts/mecha_equipment/pulse_shield) && istype(cell, /obj/item/stock_parts/cell/infinite)) + occupant_message("The immense power of the cell overloads the shields.") + selected.on_unequip() else to_chat(user, "There's already a powercell installed.") return diff --git a/code/game/mecha/mecha_actions.dm b/code/game/mecha/mecha_actions.dm index a6f22a90ff3..6f4cdbe1002 100644 --- a/code/game/mecha/mecha_actions.dm +++ b/code/game/mecha/mecha_actions.dm @@ -127,6 +127,8 @@ chassis.step_in = min(1, round(chassis.step_in / 2)) chassis.step_energy_drain = max(chassis.overload_step_energy_drain_min, chassis.step_energy_drain * chassis.leg_overload_coeff) chassis.occupant_message("You enable leg actuators overload.") + if(istype(chassis.selected, /obj/item/mecha_parts/mecha_equipment/pulse_shield)) + chassis.occupant_message("Your shields turn off as your actuators overload.") else chassis.leg_overload_mode = 0 // chassis.bumpsmash = 0 @@ -134,6 +136,7 @@ chassis.step_energy_drain = chassis.normal_step_energy_drain chassis.occupant_message("You disable leg actuators overload.") build_all_button_icons() + chassis.update_icon(UPDATE_OVERLAYS) /datum/action/innate/mecha/mech_toggle_thrusters name = "Toggle Thrusters" @@ -253,7 +256,10 @@ /datum/action/innate/mecha/select_module/Activate() if(!owner || !chassis || chassis.occupant != owner) return + if(chassis.selected) + chassis.selected.on_unequip() chassis.selected = equipment + chassis.selected.on_equip() chassis.occupant_message("You switch to [equipment.name].") chassis.visible_message("[chassis] raises [equipment.name]") send_byjax(chassis.occupant, "exosuit.browser", "eq_list", chassis.get_equipment_list()) diff --git a/code/game/mecha/mecha_topic.dm b/code/game/mecha/mecha_topic.dm index d489e84431e..94a2cecd492 100644 --- a/code/game/mecha/mecha_topic.dm +++ b/code/game/mecha/mecha_topic.dm @@ -257,7 +257,10 @@ if(usr != occupant) return var/obj/item/mecha_parts/mecha_equipment/equip = afilter.getObj("select_equip") if(equip && (equip in equipment)) + if(selected) + selected.on_unequip() selected = equip + selected.on_equip() occupant_message("You switch to [equip]") visible_message("[src] raises [equip]") send_byjax(occupant, "exosuit.browser", "eq_list", get_equipment_list()) diff --git a/code/modules/research/designs/mechfabricator_designs.dm b/code/modules/research/designs/mechfabricator_designs.dm index a3b06c5d4df..e9ffbbce250 100644 --- a/code/modules/research/designs/mechfabricator_designs.dm +++ b/code/modules/research/designs/mechfabricator_designs.dm @@ -947,6 +947,17 @@ construction_time = 10 SECONDS category = list("Exosuit Equipment") +/datum/design/mech_pulse_shield + name = "Exosuit Module (EPS-99 Pulse Shield Generator)" + desc = "Exosuit-mounted shield generator." + id = "mech_shield_gen" + build_type = MECHFAB + req_tech = list("bluespace" = 7, "combat" = 7, "engineering"=7) + build_path = /obj/item/mecha_parts/mecha_equipment/pulse_shield + materials = list(MAT_METAL = 20000, MAT_GOLD = 5000, MAT_BLUESPACE = 5000) + construction_time = 10 SECONDS + category = list("Exosuit Equipment") + /datum/design/mech_armor_plate name = "Exosuit Mining Armor Plate" desc = "This piece of metal can be attached to the mech itself, enhancing its protective characteristics. Unfortunately, only working class exosuits have notches for such armor." diff --git a/icons/mecha/mecha_equipment.dmi b/icons/mecha/mecha_equipment.dmi index 35757987ae5..93fb4404e58 100644 Binary files a/icons/mecha/mecha_equipment.dmi and b/icons/mecha/mecha_equipment.dmi differ