From d9135ece44e19a855fb974fa131e68d0c595baf7 Mon Sep 17 00:00:00 2001
From: Qwertytoforty <52090703+Qwertytoforty@users.noreply.github.com>
Date: Mon, 4 Oct 2021 17:26:13 -0400
Subject: [PATCH] Adds 90% of the stuff
---
.../gamemodes/malfunction/Malf_Modules.dm | 21 +++++++++++
code/modules/mob/living/silicon/ai/ai.dm | 3 ++
.../modules/mob/living/silicon/robot/robot.dm | 2 +
.../mob/living/silicon/robot/robot_modules.dm | 37 +++++++++++++++----
code/modules/projectiles/ammunition/energy.dm | 8 ++++
code/modules/projectiles/guns/energy/laser.dm | 21 +++++++++++
6 files changed, 85 insertions(+), 7 deletions(-)
diff --git a/code/game/gamemodes/malfunction/Malf_Modules.dm b/code/game/gamemodes/malfunction/Malf_Modules.dm
index 4f0552cbefa..4ee2d96c5bf 100644
--- a/code/game/gamemodes/malfunction/Malf_Modules.dm
+++ b/code/game/gamemodes/malfunction/Malf_Modules.dm
@@ -786,3 +786,24 @@
/datum/AI_Module/large/cameracrack/upgrade(mob/living/silicon/ai/AI)
if(AI.builtInCamera)
QDEL_NULL(AI.builtInCamera)
+
+/datum/AI_Module/large/cameracrack
+ module_name = "Engineering Cyborg Emitter Upgrade"
+ mod_pick_name = "emitter"
+ description = "Downloads firmwear that activates the built in emitter in all enginering cyborgs linked to you. Cyborgs built after this upgrade will have it."
+ cost = 50 // IDK look into this
+ one_purchase = TRUE
+ upgrade = TRUE
+ unlock_text = "Firmwear downloaded. Bugs removed. Built in emitters operating at 73% efficency."
+ unlock_sound = 'sound/items/rped.ogg'
+
+/datum/AI_Module/large/cameracrack/upgrade(mob/living/silicon/ai/AI)
+ AI.purchased_modules += /obj/item/robot_module/engineering
+ log_game("[key_name(usr)] purchased emitters for all engineering cyborgs.")
+ message_admins("[key_name_admin(usr)] purchased emitters for all engineering cyborgs!")
+ for(var/mob/living/silicon/robot/R in AI.connected_robots)
+ if(!istype(R.module, /obj/item/robot_module/engineering))
+ continue
+ R.module.malfhacked = TRUE
+ R.module.rebuild_modules()
+ to_chat(R, "New firmwear downloaded. Emitter is now online.")
diff --git a/code/modules/mob/living/silicon/ai/ai.dm b/code/modules/mob/living/silicon/ai/ai.dm
index 47c383e1a33..943f894b151 100644
--- a/code/modules/mob/living/silicon/ai/ai.dm
+++ b/code/modules/mob/living/silicon/ai/ai.dm
@@ -79,6 +79,9 @@ GLOBAL_LIST_INIT(ai_verbs_default, list(
var/obj/machinery/power/apc/malfhack = null
var/explosive = 0 //does the AI explode when it dies?
+ /// List of modules the AI has purchased malf upgrades for.
+ var/list/purchased_modules = list()
+
var/mob/living/silicon/ai/parent = null
var/camera_light_on = 0
var/list/obj/machinery/camera/lit_cameras = list()
diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm
index 8affd317c6a..60d13a88ce5 100644
--- a/code/modules/mob/living/silicon/robot/robot.dm
+++ b/code/modules/mob/living/silicon/robot/robot.dm
@@ -1264,6 +1264,8 @@ GLOBAL_LIST_INIT(robot_verbs_default, list(
connected_ai = AI
connected_ai.connected_robots |= src
notify_ai(1)
+ if(module)
+ module.rebuild_modules() //This way, if a borg gets linked to a malf AI that has upgrades, they get their upgrades.
sync()
/mob/living/silicon/robot/adjustOxyLoss(amount)
diff --git a/code/modules/mob/living/silicon/robot/robot_modules.dm b/code/modules/mob/living/silicon/robot/robot_modules.dm
index ab7c4ff9562..e35e67113f0 100644
--- a/code/modules/mob/living/silicon/robot/robot_modules.dm
+++ b/code/modules/mob/living/silicon/robot/robot_modules.dm
@@ -6,12 +6,17 @@
item_state = "electronic"
flags = CONDUCT
+ /// Has the AI hacked the borg module, allowing access to the malf AI exclusive item.
+ var/malfhacked = FALSE
+
/// A list of all currently usable and created modules the robot currently has access too.
var/list/modules = list()
/// A list of module-specific, non-emag modules the borg will gain when this module is chosen.
var/list/basic_modules = list()
/// A list of modules the robot gets when emagged.
var/list/emag_modules = list()
+ /// A list of modules that the robot gets when malf AI buys it.
+ var/list/malf_modules = list()
/// A list of modules that require special recharge handling. Examples include things like flashes, sprays and welding tools.
var/list/special_rechargables = list()
/// A list of all "energy stacks", i.e metal, glass, brute kits, splints, etc.
@@ -43,12 +48,17 @@
emag_modules += I
emag_modules -= i
+ for(var/i in malf_modules)
+ var/obj/item/I = new i(src)
+ malf_modules += I
+ malf_modules -= i
+
// Flashes need a special recharge, and since basically every module uses it, add it here.
// Even if the module doesn't use a flash, it wont cause any issues to have it in this list.
special_rechargables += /obj/item/flash/cyborg
// This is done so we can loop through this list later and call cyborg_recharge() on the items while the borg is recharging.
- var/all_modules = basic_modules | emag_modules
+ var/all_modules = basic_modules | emag_modules | malf_modules
for(var/path in special_rechargables)
var/obj/item/I = locate(path) in all_modules
if(I) // If it exists, add the object reference.
@@ -70,6 +80,7 @@
QDEL_LIST(modules)
QDEL_LIST(basic_modules)
QDEL_LIST(emag_modules)
+ QDEL_LIST(malf_modules)
QDEL_LIST(storages)
QDEL_LIST(special_rechargables)
return ..()
@@ -88,6 +99,7 @@
var/list/lists = list(
basic_modules,
emag_modules,
+ malf_modules,
storages,
special_rechargables
)
@@ -155,13 +167,19 @@
return I
/**
- * Builds the usable module list from the modules we have in `basic_modules` and `emag_modules`
+ * Builds the usable module list from the modules we have in `basic_modules`, `emag_modules` and `malf_modules`
*/
/obj/item/robot_module/proc/rebuild_modules()
var/mob/living/silicon/robot/R = loc
R.uneq_all()
modules = list()
+ if(!malfhacked)
+ if(R.connected_ai)
+ for(var/I in R.connected_ai.purchased_modules)
+ if(istype(src, I))
+ malfhacked = TRUE
+
// By this point these lists should only contain items. It's safe to use typeless loops here.
for(var/item in basic_modules)
add_module(item, FALSE)
@@ -170,6 +188,10 @@
for(var/item in emag_modules)
add_module(item, FALSE)
+ if(malfhacked)
+ for(var/item in malf_modules)
+ add_module(item, FALSE)
+
if(R.hud_used)
R.hud_used.update_robot_modules_display()
@@ -354,8 +376,9 @@
/obj/item/stack/sheet/glass/cyborg,
/obj/item/stack/sheet/rglass/cyborg
)
- emag_modules = list(/obj/item/borg/stun)
- special_rechargables = list(/obj/item/extinguisher, /obj/item/weldingtool/largetank/cyborg)
+ emag_modules = list(/obj/item/borg/stun, /obj/item/restraints/handcuffs/cable/zipties/cyborg)
+ malf_modules = list(/obj/item/gun/energy/emitter/cyborg)
+ special_rechargables = list(/obj/item/extinguisher, /obj/item/weldingtool/largetank/cyborg, /obj/item/gun/energy/emitter/cyborg)
/obj/item/robot_module/engineering/handle_death(mob/living/silicon/robot/R, gibbed)
var/obj/item/gripper/G = locate(/obj/item/gripper) in modules
@@ -400,7 +423,7 @@
/obj/item/holosign_creator,
/obj/item/extinguisher/mini
)
- emag_modules = list(/obj/item/reagent_containers/spray/cyborg_lube)
+ emag_modules = list(/obj/item/reagent_containers/spray/cyborg_lube, /obj/item/restraints/handcuffs/cable/zipties/cyborg)
special_rechargables = list(
/obj/item/lightreplacer,
/obj/item/reagent_containers/spray/cyborg_lube,
@@ -471,7 +494,7 @@
/obj/item/storage/bag/tray/cyborg,
/obj/item/reagent_containers/food/drinks/shaker
)
- emag_modules = list(/obj/item/reagent_containers/food/drinks/cans/beer/sleepy_beer)
+ emag_modules = list(/obj/item/reagent_containers/food/drinks/cans/beer/sleepy_beer, /obj/item/restraints/handcuffs/cable/zipties/cyborg)
special_rechargables = list(
/obj/item/reagent_containers/food/condiment/enzyme,
/obj/item/reagent_containers/food/drinks/cans/beer/sleepy_beer
@@ -530,7 +553,7 @@
/obj/item/gun/energy/kinetic_accelerator/cyborg,
/obj/item/gps/cyborg
)
- emag_modules = list(/obj/item/borg/stun, /obj/item/pickaxe/drill/cyborg/diamond)
+ emag_modules = list(/obj/item/borg/stun, /obj/item/pickaxe/drill/cyborg/diamond, /obj/item/restraints/handcuffs/cable/zipties/cyborg)
special_rechargables = list(/obj/item/extinguisher/mini, /obj/item/weldingtool/mini)
// Replace their normal drill with a diamond drill.
diff --git a/code/modules/projectiles/ammunition/energy.dm b/code/modules/projectiles/ammunition/energy.dm
index 18ed273ff23..d8802045ba9 100644
--- a/code/modules/projectiles/ammunition/energy.dm
+++ b/code/modules/projectiles/ammunition/energy.dm
@@ -271,6 +271,14 @@
delay = 50
select_name = "snipe"
+/obj/item/ammo_casing/energy/emitter
+ projectile_type = /obj/item/projectile/beam/emitter
+ muzzle_flash_color = LIGHT_COLOR_GREEN
+ fire_sound = 'sound/weapons/emitter.ogg'
+ e_cost = 500 // about 28 shots on an engineering borg from a borging machine, assuming some power is used for lights / movement. May need to change.
+ delay = 3 SECONDS // Lasers fire every second
+ select_name = "emitter"
+
/obj/item/ammo_casing/energy/bsg
projectile_type = /obj/item/projectile/energy/bsg
muzzle_flash_color = LIGHT_COLOR_DARKBLUE
diff --git a/code/modules/projectiles/guns/energy/laser.dm b/code/modules/projectiles/guns/energy/laser.dm
index b205dc44797..d6284adb0c0 100644
--- a/code/modules/projectiles/guns/energy/laser.dm
+++ b/code/modules/projectiles/guns/energy/laser.dm
@@ -141,6 +141,27 @@
name = "cyborg immolator cannon"
ammo_type = list(/obj/item/ammo_casing/energy/immolator/scatter/cyborg, /obj/item/ammo_casing/energy/immolator/strong/cyborg) // scatter is default, because it is more useful
+/obj/item/gun/energy/emitter
+ name = "mobile emitter"
+ desc = "An emitter someone removed from its base, and an attached to a power cell, to try to make a weapon."
+ icon_state = "lasercannon"
+ item_state = "laser"
+ w_class = WEIGHT_CLASS_BULKY
+ can_holster = FALSE
+ origin_tech = "combat=4;magnets=4;powerstorage=3"
+ ammo_type = list(/obj/item/ammo_casing/energy/emitter)
+ ammo_x_offset = 3
+
+/obj/item/gun/energy/emitter/cyborg
+ name = "mounted emitter"
+ desc = "An emitter mounted to your cyborg frame, draining charge from your cell."
+
+/obj/item/gun/energy/emitter/cyborg/newshot()
+ ..()
+ robocharge()
+
+/obj/item/gun/energy/emitter/cyborg/emp_act()
+ return
////////Laser Tag////////////////////