diff --git a/code/game/mecha/equipment/mecha_equipment.dm b/code/game/mecha/equipment/mecha_equipment.dm index f3bad7909f3f..31d9fdb813ee 100644 --- a/code/game/mecha/equipment/mecha_equipment.dm +++ b/code/game/mecha/equipment/mecha_equipment.dm @@ -41,6 +41,16 @@ chassis = null return ..() +/obj/item/mecha_parts/mecha_equipment/try_attach_part(mob/user, obj/mecha/M) + if(can_attach(M)) + if(!user.temporarilyRemoveItemFromInventory(src)) + return FALSE + attach(M) + user.visible_message("[user] attaches [src] to [M].", "You attach [src] to [M].") + return TRUE + to_chat(user, "You are unable to attach [src] to [M]!") + return FALSE + /obj/item/mecha_parts/mecha_equipment/proc/critfail() log_message("Critical failure", LOG_MECHA, color="red") diff --git a/code/game/mecha/equipment/tools/weapon_bay.dm b/code/game/mecha/equipment/tools/weapon_bay.dm new file mode 100644 index 000000000000..1b3db529cc5a --- /dev/null +++ b/code/game/mecha/equipment/tools/weapon_bay.dm @@ -0,0 +1,14 @@ +/obj/item/mecha_parts/concealed_weapon_bay + name = "concealed weapon bay" + desc = "A compartment that allows a non-combat mecha to equip one weapon while hiding the weapon from plain sight." + icon = 'icons/mecha/mecha_equipment.dmi' + icon_state = "mecha_weapon_bay" + +/obj/item/mecha_parts/concealed_weapon_bay/try_attach_part(mob/user, obj/mecha/M) + if(istype(M, /obj/mecha/combat)) + to_chat(user, "[M] can already hold weapons!") + return + if(locate(/obj/item/mecha_parts/concealed_weapon_bay) in M.contents) + to_chat(user, "[M] already has a concealed weapon bay!") + return + ..() \ No newline at end of file diff --git a/code/game/mecha/equipment/weapons/weapons.dm b/code/game/mecha/equipment/weapons/weapons.dm index f579b5ff3336..37b0e29aac0c 100644 --- a/code/game/mecha/equipment/weapons/weapons.dm +++ b/code/game/mecha/equipment/weapons/weapons.dm @@ -10,11 +10,14 @@ var/firing_effect_type = /obj/effect/temp_visual/dir_setting/firing_effect //the visual effect appearing when the weapon is fired. var/kickback = TRUE //Will using this weapon in no grav push mecha back. -/obj/item/mecha_parts/mecha_equipment/weapon/can_attach(obj/mecha/combat/M) - if(..()) - if(istype(M)) - return 1 - return 0 +/obj/item/mecha_parts/mecha_equipment/weapon/can_attach(obj/mecha/M) + if(!..()) + return FALSE + if(istype(M, /obj/mecha/combat)) + return TRUE + if((locate(/obj/item/mecha_parts/concealed_weapon_bay) in M.contents) && !(locate(/obj/item/mecha_parts/mecha_equipment/weapon) in M.equipment)) + return TRUE + return FALSE /obj/item/mecha_parts/mecha_equipment/weapon/proc/get_shot_amount() return projectiles_per_shot diff --git a/code/game/mecha/mecha.dm b/code/game/mecha/mecha.dm index 3697bfc99b8f..9af2cd7a5f54 100644 --- a/code/game/mecha/mecha.dm +++ b/code/game/mecha/mecha.dm @@ -273,9 +273,12 @@ to_chat(user, "It's heavily damaged.") else to_chat(user, "It's falling apart.") - if(equipment && equipment.len) + var/hide_weapon = locate(/obj/item/mecha_parts/concealed_weapon_bay) in contents + var/hidden_weapon = hide_weapon ? (locate(/obj/item/mecha_parts/mecha_equipment/weapon) in equipment) : null + var/list/visible_equipment = equipment - hidden_weapon + if(visible_equipment.len) to_chat(user, "It's equipped with:") - for(var/obj/item/mecha_parts/mecha_equipment/ME in equipment) + for(var/obj/item/mecha_parts/mecha_equipment/ME in visible_equipment) to_chat(user, "[icon2html(ME, user)] \A [ME].") //processing internal damage, temperature, air regulation, alert updates, lights power use. diff --git a/code/game/mecha/mecha_control_console.dm b/code/game/mecha/mecha_control_console.dm index 39c5241619e5..e736630701cb 100644 --- a/code/game/mecha/mecha_control_console.dm +++ b/code/game/mecha/mecha_control_console.dm @@ -83,6 +83,12 @@ M.trackers -= src return ..() +/obj/item/mecha_parts/mecha_tracking/try_attach_part(mob/user, obj/mecha/M) + if(!..()) + return + M.trackers += src + M.diag_hud_set_mechtracking() + /obj/item/mecha_parts/mecha_tracking/proc/in_mecha() if(ismecha(loc)) return loc diff --git a/code/game/mecha/mecha_defense.dm b/code/game/mecha/mecha_defense.dm index 19882e8a38ef..80ac5f86b565 100644 --- a/code/game/mecha/mecha_defense.dm +++ b/code/game/mecha/mecha_defense.dm @@ -164,17 +164,6 @@ to_chat(user, "[src]-[W] interface initialization failed.") return - if(istype(W, /obj/item/mecha_parts/mecha_equipment)) - var/obj/item/mecha_parts/mecha_equipment/E = W - spawn() - if(E.can_attach(src)) - if(!user.temporarilyRemoveItemFromInventory(W)) - return - E.attach(src) - user.visible_message("[user] attaches [W] to [src].", "You attach [W] to [src].") - else - to_chat(user, "You were unable to attach [W] to [src]!") - return if(W.GetID()) if(add_req_access || maint_access) if(internals_access_allowed(user)) @@ -260,13 +249,9 @@ to_chat(user, "The [name] is at full integrity!") return 1 - else if(istype(W, /obj/item/mecha_parts/mecha_tracking)) - if(!user.transferItemToLoc(W, src)) - to_chat(user, "\the [W] is stuck to your hand, you cannot put it in \the [src]!") - return - trackers += W - user.visible_message("[user] attaches [W] to [src].", "You attach [W] to [src].") - diag_hud_set_mechtracking() + else if(istype(W, /obj/item/mecha_parts)) + var/obj/item/mecha_parts/P = W + P.try_attach_part(user, src) return else return ..() diff --git a/code/game/mecha/mecha_parts.dm b/code/game/mecha/mecha_parts.dm index 3f5e4bde662b..57ba26ce0b65 100644 --- a/code/game/mecha/mecha_parts.dm +++ b/code/game/mecha/mecha_parts.dm @@ -9,6 +9,16 @@ w_class = WEIGHT_CLASS_GIGANTIC flags_1 = CONDUCT_1 +/obj/item/mecha_parts/proc/try_attach_part(mob/user, obj/mecha/M) //For attaching parts to a finished mech + if(!user.transferItemToLoc(src, M)) + to_chat(user, "\The [src] is stuck to your hand, you cannot put it in \the [M]!") + return FALSE + user.visible_message("[user] attaches [src] to [M].", "You attach [src] to [M].") + return TRUE + +/obj/item/mecha_parts/part/try_attach_part(mob/user, obj/mecha/M) + return + /obj/item/mecha_parts/chassis name = "Mecha Chassis" icon_state = "backbone" diff --git a/code/modules/uplink/uplink_items.dm b/code/modules/uplink/uplink_items.dm index 19aa62cd10df..523377382b6e 100644 --- a/code/modules/uplink/uplink_items.dm +++ b/code/modules/uplink/uplink_items.dm @@ -1553,6 +1553,15 @@ GLOBAL_LIST_INIT(uplink_items, subtypesof(/datum/uplink_item)) cost = 20 restricted_roles = list("Clown") +/datum/uplink_item/role_restricted/concealed_weapon_bay + name = "Concealed Weapon Bay" + desc = "A modification for non-combat mechas that allows them to equip one piece of equipment designed for combat mechs. \ + It also hides the equipped weapon from plain sight. \ + Only one can fit on a mecha." + item = /obj/item/mecha_parts/concealed_weapon_bay + cost = 3 + restricted_roles = list("Roboticist", "Research Director") + // Pointless /datum/uplink_item/badass category = "(Pointless) Badassery" diff --git a/icons/mecha/mecha_equipment.dmi b/icons/mecha/mecha_equipment.dmi index 02c7984831c3..d66bd20af7e3 100644 Binary files a/icons/mecha/mecha_equipment.dmi and b/icons/mecha/mecha_equipment.dmi differ diff --git a/tgstation.dme b/tgstation.dme index 6c23cac5bb99..3708ac9fa8d4 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -691,6 +691,7 @@ #include "code\game\mecha\equipment\tools\medical_tools.dm" #include "code\game\mecha\equipment\tools\mining_tools.dm" #include "code\game\mecha\equipment\tools\other_tools.dm" +#include "code\game\mecha\equipment\tools\weapon_bay.dm" #include "code\game\mecha\equipment\tools\work_tools.dm" #include "code\game\mecha\equipment\weapons\weapons.dm" #include "code\game\mecha\medical\medical.dm"