From 36ee762c1a2c1d81e91a08a781b9e11a2033dce3 Mon Sep 17 00:00:00 2001 From: Aronai Sieyes Date: Mon, 23 Mar 2020 21:33:58 -0400 Subject: [PATCH] Mecha cloaking generator --- code/game/mecha/equipment/tools/cloak.dm | 70 ++++++++++++++++++++++++ code/modules/research/mechfab_designs.dm | 7 +++ vorestation.dme | 1 + 3 files changed, 78 insertions(+) create mode 100644 code/game/mecha/equipment/tools/cloak.dm diff --git a/code/game/mecha/equipment/tools/cloak.dm b/code/game/mecha/equipment/tools/cloak.dm new file mode 100644 index 0000000000..6f6ddd1c8f --- /dev/null +++ b/code/game/mecha/equipment/tools/cloak.dm @@ -0,0 +1,70 @@ +/obj/item/mecha_parts/mecha_equipment/cloak + name = "cloaking device" + desc = "Integrated cloaking system. High power usage, but does render you invisible to the naked eye. Doesn't prevent noise, however." + icon_state = "tesla" + origin_tech = list(TECH_MAGNET = 5, TECH_DATA = 5) + equip_cooldown = 2 SECONDS + energy_drain = 300 + range = 0 + + equip_type = EQUIP_SPECIAL + + var/datum/global_iterator/mecha_cloak/cloak_iterator + +/obj/item/mecha_parts/mecha_equipment/cloak/Initialize() + . = ..() + cloak_iterator = new /datum/global_iterator/mecha_cloak(list(src),0) + cloak_iterator.set_delay(equip_cooldown) + +/obj/item/mecha_parts/mecha_equipment/cloak/Destroy() + qdel_null(cloak_iterator) + return ..() + +/obj/item/mecha_parts/mecha_equipment/cloak/detach() + qdel_null(cloak_iterator) + if(!equip_ready) //We were running + stop_cloak() + return ..() + +/obj/item/mecha_parts/mecha_equipment/cloak/get_equip_info() + if(!chassis) + return + return "* [src.name] - [equip_ready ? "A" : "Dea"]ctivate" + +/obj/item/mecha_parts/mecha_equipment/cloak/Topic(href, href_list) + ..() + if(href_list["toggle_cloak"]) + if(equip_ready) + start_cloak() + else + stop_cloak() + return + +/obj/item/mecha_parts/mecha_equipment/cloak/proc/start_cloak() + if(chassis) + chassis.cloak() + log_message("Activated.") + cloak_iterator.start() + set_ready_state(0) + playsound(get_turf(src), 'sound/effects/EMPulse.ogg', 100, 1) + +/obj/item/mecha_parts/mecha_equipment/cloak/proc/stop_cloak() + if(chassis) + chassis.uncloak() + log_message("Deactivated.") + cloak_iterator.stop() + set_ready_state(1) + playsound(get_turf(src), 'sound/effects/EMPulse.ogg', 100, 1) + +// These things are so silly +/datum/global_iterator/mecha_cloak/process(var/obj/item/mecha_parts/mecha_equipment/cloak/cloak) + //Removed from chassis + if(!cloak.chassis) + stop() + cloak.stop_cloak() + return + //Ran out of power + if(!cloak.chassis.use_power(cloak.energy_drain)) + stop() + cloak.stop_cloak() + return diff --git a/code/modules/research/mechfab_designs.dm b/code/modules/research/mechfab_designs.dm index fce2ffd6e0..125de3db6c 100644 --- a/code/modules/research/mechfab_designs.dm +++ b/code/modules/research/mechfab_designs.dm @@ -538,6 +538,13 @@ req_tech = list(TECH_BLUESPACE = 10, TECH_MAGNET = 5) build_path = /obj/item/mecha_parts/mecha_equipment/teleporter +/datum/design/item/mecha/teleporter + name = "Cloaking Device" + desc = "A device that renders the exosuit invisible to the naked eye, though not to thermal detection. Uses large amounts of energy." + id = "mech_cloaking" + req_tech = list(TECH_BLUESPACE = 10, TECH_MAGNET = 5) + build_path = /obj/item/mecha_parts/mecha_equipment/cloak + /datum/design/item/mecha/rcd name = "RCD" desc = "An exosuit-mounted rapid construction device." diff --git a/vorestation.dme b/vorestation.dme index 442a19d35a..27222c2676 100644 --- a/vorestation.dme +++ b/vorestation.dme @@ -918,6 +918,7 @@ #include "code\game\mecha\equipment\tools\cable_layer.dm" #include "code\game\mecha\equipment\tools\catapult.dm" #include "code\game\mecha\equipment\tools\clamp.dm" +#include "code\game\mecha\equipment\tools\cloak.dm" #include "code\game\mecha\equipment\tools\drill.dm" #include "code\game\mecha\equipment\tools\energy_relay.dm" #include "code\game\mecha\equipment\tools\extinguisher.dm"