From 45430008b17c54247d223f19c58c643cf8b725b3 Mon Sep 17 00:00:00 2001 From: CHOMPStation2 <58959929+CHOMPStation2@users.noreply.github.com> Date: Sun, 3 Dec 2023 05:23:07 -0700 Subject: [PATCH] [MIRROR] Admin add/remove borg modules, radio channels and components verb + rejuvenate fully restores borgs (#7322) Co-authored-by: Heroman3003 <31296024+Heroman3003@users.noreply.github.com> Co-authored-by: CHOMPStation2 Co-authored-by: Selis --- code/__defines/admin_vr.dm | 7 + code/modules/admin/admin_verb_lists_vr.dm | 1 + code/modules/admin/verbs/modify_robot.dm | 200 ++++++++++++++++++ .../modules/mob/living/silicon/robot/robot.dm | 42 +++- .../silicon/robot/robot_modules/station.dm | 2 + .../mob/living/silicon/robot/syndicate.dm | 4 +- code/modules/power/cells/power_cells.dm | 18 +- icons/mob/robot/crisis.dmi | Bin 41078 -> 41075 bytes .../code/modules/power/cells/power_cells.dm | 16 ++ vorestation.dme | 1 + 10 files changed, 284 insertions(+), 7 deletions(-) create mode 100644 code/modules/admin/verbs/modify_robot.dm diff --git a/code/__defines/admin_vr.dm b/code/__defines/admin_vr.dm index 5cc4ac2299..6dd0afc480 100644 --- a/code/__defines/admin_vr.dm +++ b/code/__defines/admin_vr.dm @@ -4,3 +4,10 @@ #define SMITE_AD_SPAM "Ad Spam" #define SMITE_AUTOSAVE "10 Second Autosave" #define SMITE_AUTOSAVE_WIDE "10 Second Autosave (AoE)" +#define MODIFIY_ROBOT_MODULE_ADD "Add a Module" +#define MODIFIY_ROBOT_MODULE_REMOVE "Remove a Module" +#define MODIFIY_ROBOT_RADIOC_ADD "Add a Radio Channel" +#define MODIFIY_ROBOT_RADIOC_REMOVE "Remove a Radio Channel" +#define MODIFIY_ROBOT_COMP_ADD "Replace a Component" +#define MODIFIY_ROBOT_COMP_REMOVE "Remove a Component" +#define MODIFIY_ROBOT_RESET_MODULE "Fully Resets a Robot Module" diff --git a/code/modules/admin/admin_verb_lists_vr.dm b/code/modules/admin/admin_verb_lists_vr.dm index 83ab12ca0e..45ccb056bf 100644 --- a/code/modules/admin/admin_verb_lists_vr.dm +++ b/code/modules/admin/admin_verb_lists_vr.dm @@ -77,6 +77,7 @@ var/list/admin_verbs_admin = list( /client/proc/check_ai_laws, //shows AI and borg laws, /client/proc/rename_silicon, //properly renames silicons, /client/proc/manage_silicon_laws, // Allows viewing and editing silicon laws. , + /client/proc/modify_robot, /client/proc/check_antagonists, /client/proc/admin_memo, //admin memo system. show/delete/write. +SERVER needed to delete admin memos of others, /client/proc/dsay, //talk in deadchat using our ckey/fakekey, diff --git a/code/modules/admin/verbs/modify_robot.dm b/code/modules/admin/verbs/modify_robot.dm new file mode 100644 index 0000000000..2562d891b3 --- /dev/null +++ b/code/modules/admin/verbs/modify_robot.dm @@ -0,0 +1,200 @@ +//Allows to add and remove modules from borgs +/client/proc/modify_robot(var/mob/living/silicon/robot/target in player_list) + set name = "Modify Robot Module" + set desc = "Allows to add or remove modules to/from robots." + set category = "Admin" + if(!check_rights(R_ADMIN)) + return + + if(!istype(target)) + return + + if(!target.module.modules) + return + + var/list/modification_options = list(MODIFIY_ROBOT_MODULE_ADD,MODIFIY_ROBOT_MODULE_REMOVE, MODIFIY_ROBOT_RADIOC_ADD, MODIFIY_ROBOT_RADIOC_REMOVE, MODIFIY_ROBOT_COMP_ADD, MODIFIY_ROBOT_COMP_REMOVE, MODIFIY_ROBOT_RESET_MODULE) + + var/modification_choice = tgui_input_list(usr, "Select if you want to add or remove a module to/from [target]","Choice", modification_options) + if(!modification_choice) + return + + log_and_message_admins("[key_name(src)] has used MODIFYROBOT ([modification_choice]) on [key_name(target)].") + feedback_add_details("admin_verb","MODIFYROBOT") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! + + switch(modification_choice) + if(MODIFIY_ROBOT_MODULE_ADD) + while(TRUE) + var/selected_module_module = tgui_input_list(usr, "Please select the module to pick modules from", "Module", robot_modules) + if(!selected_module_module || selected_module_module == "Cancel") + break + var/module_type = robot_modules[selected_module_module] + var/mob/living/silicon/robot/robot = new /mob/living/silicon/robot(null) + var/obj/item/weapon/robot_module/robot/robot_type = new module_type(robot) + robot.emag_items = 1 + if(!istype(robot_type, /obj/item/weapon/robot_module/robot/)) + robot.Destroy() + break + var/list/all_modules = robot.module.modules + all_modules += robot.module.emag + while(TRUE) + var/add_item = tgui_input_list(usr, "Please select the module to add", "Modules", all_modules) + if(!istype(add_item, /obj/item/)) + break + robot.module.emag.Remove(add_item) + robot.module.modules.Remove(add_item) + robot.module.contents.Remove(add_item) + target.module.modules.Add(add_item) + target.module.contents.Add(add_item) + to_chat(usr, "You added \"[add_item]\" to [target].") + if(istype(add_item, /obj/item/stack/)) + var/obj/item/stack/item_with_synth = add_item + for(var/synth in item_with_synth.synths) + var/found = target.module.synths.Find(synth) + if(!found) + robot.module.synths.Remove(synth) + target.module.synths.Add(synth) + else + item_with_synth.synths = list(target.module.synths[found]) + continue + if(istype(add_item, /obj/item/weapon/matter_decompiler/) || istype(add_item, /obj/item/device/dogborg/sleeper/compactor/decompiler/)) + var/obj/item/weapon/matter_decompiler/item_with_matter = add_item + if(item_with_matter.metal) + var/found = target.module.synths.Find(item_with_matter.metal) + if(!found) + robot.module.synths.Remove(item_with_matter.metal) + target.module.synths.Add(item_with_matter.metal) + else + item_with_matter.metal = target.module.synths[found] + if(item_with_matter.glass) + var/found = target.module.synths.Find(item_with_matter.glass) + if(!found) + robot.module.synths.Remove(item_with_matter.glass) + target.module.synths.Add(item_with_matter.glass) + else + item_with_matter.glass = target.module.synths[found] + if(item_with_matter.wood) + var/found = target.module.synths.Find(item_with_matter.wood) + if(!found) + robot.module.synths.Remove(item_with_matter.wood) + target.module.synths.Add(item_with_matter.wood) + else + item_with_matter.wood = target.module.synths[found] + if(item_with_matter.plastic) + var/found = target.module.synths.Find(item_with_matter.plastic) + if(!found) + robot.module.synths.Remove(item_with_matter.plastic) + target.module.synths.Add(item_with_matter.plastic) + else + item_with_matter.plastic = target.module.synths[found] + robot.Destroy() + if(MODIFIY_ROBOT_MODULE_REMOVE) + while(TRUE) + var/list/active_modules = target.module.modules + var/selected_module_module = tgui_input_list(usr, "Please select the module to remove", "Modules", active_modules) + if(!istype(selected_module_module, /obj/item/)) + break + to_chat(usr, "You removed \"[selected_module_module]\" from [target]") + target.module.emag.Remove(selected_module_module) + target.module.modules.Remove(selected_module_module) + target.module.contents.Remove(selected_module_module) + qdel(selected_module_module) + if(MODIFIY_ROBOT_RADIOC_ADD) + var/list/available_channels = radiochannels.Copy() + for(var/has_channel in target.radio.channels) + available_channels -= has_channel + while(TRUE) + var/selected_radio_channel = tgui_input_list(usr, "Please select the radio channel to add", "Channels", available_channels) + if(!selected_radio_channel || selected_radio_channel == "Cancel") + break + if(selected_radio_channel == "Special Ops") + target.radio.centComm = 1 + if(selected_radio_channel == "Raider") + qdel(target.radio.keyslot) + target.radio.keyslot = new /obj/item/device/encryptionkey/raider(target) + target.radio.syndie = 1 + if(selected_radio_channel == "Mercenary") + qdel(target.radio.keyslot) + target.radio.keyslot = new /obj/item/device/encryptionkey/syndicate(target) + target.radio.syndie = 1 + target.module.channels += list("[selected_radio_channel]" = 1) + target.radio.channels[selected_radio_channel] += target.module.channels[selected_radio_channel] + target.radio.secure_radio_connections[selected_radio_channel] += radio_controller.add_object(target.radio, radiochannels[selected_radio_channel], RADIO_CHAT) + available_channels -= selected_radio_channel + to_chat(usr, "You added \"[selected_radio_channel]\" channel to [target].") + if(MODIFIY_ROBOT_RADIOC_REMOVE) + while(TRUE) + var/selected_radio_channel = tgui_input_list(usr, "Please select the radio channel to remove", "Channels", target.radio.channels) + if(!selected_radio_channel || selected_radio_channel == "Cancel") + break + if(selected_radio_channel == "Special Ops") + target.radio.centComm = 0 + target.module.channels -= selected_radio_channel + if((selected_radio_channel == "Mercenary" || selected_radio_channel == "Raider") && !(target.module.channels["Raider"] || target.module.channels["Mercenary"])) + qdel(target.radio.keyslot) + target.radio.keyslot = null + target.radio.syndie = 0 + target.radio.channels = list() + for(var/n_chan in target.module.channels) + target.radio.channels[n_chan] -= target.module.channels[n_chan] + radio_controller.remove_object(target.radio, radiochannels[selected_radio_channel]) + target.radio.secure_radio_connections -= selected_radio_channel + to_chat(usr, "You removed \"[selected_radio_channel]\" channel from [target].") + if(MODIFIY_ROBOT_COMP_ADD) + while(TRUE) + var/selected_component = tgui_input_list(usr, "Please select the component to add or replace", "Component", target.components) + if(!selected_component || selected_component == "Cancel") + break + var/datum/robot_component/C = target.components[selected_component] + if(C.wrapped && selected_component != "power cell") + qdel(C.wrapped) + switch(selected_component) + if("actuator") + C.wrapped = new /obj/item/robot_parts/robot_component/actuator(target) + if("radio") + C.wrapped = new /obj/item/robot_parts/robot_component/radio(target) + if("power cell") + var/list/recommended_cells = list(/obj/item/weapon/cell/robot_station, /obj/item/weapon/cell/high, /obj/item/weapon/cell/super, /obj/item/weapon/cell/robot_syndi, /obj/item/weapon/cell/hyper, + /obj/item/weapon/cell/infinite, /obj/item/weapon/cell/potato, /obj/item/weapon/cell/slime) + var/list/cell_names = list() + for(var/cell_type in recommended_cells) + var/obj/item/weapon/cell/single_cell = cell_type + cell_names[capitalize(initial(single_cell.name))] = cell_type + var/selected_cell = tgui_input_list(usr, "What kind of cell do you want to install?", "Cells", cell_names) + if(!selected_cell || selected_cell == "Cancel") + continue + qdel(C.wrapped) + var/new_power_cell = cell_names[capitalize(selected_cell)] + target.cell = new new_power_cell(target) + C.wrapped = target.cell + to_chat(usr, "You replaced \"[C]\" on [target] with \"[selected_cell]\".") + if("diagnosis unit") + C.wrapped = new /obj/item/robot_parts/robot_component/diagnosis_unit(target) + if("camera") + C.wrapped = new /obj/item/robot_parts/robot_component/camera(target) + if("comms") + C.wrapped = new /obj/item/robot_parts/robot_component/binary_communication_device(target) + if("armour") + C.wrapped = new /obj/item/robot_parts/robot_component/armour(target) + C.install() + C.installed = 1 + if(selected_component != "power cell") + to_chat(usr, "You repplaced \"[C]\" on [target].") + if(MODIFIY_ROBOT_COMP_REMOVE) + while(TRUE) + var/selected_component = tgui_input_list(usr, "Please select the component to remove", "Component", target.components) + if(!selected_component || selected_component == "Cancel") + break + var/datum/robot_component/C = target.components[selected_component] + if(C.wrapped) + C.uninstall() + C.installed = 0 + qdel(C.wrapped) + C.wrapped = null + if(selected_component == "power cell") + target.cell = null + to_chat(usr, "You removed \"[C]\" from [target]") + if(MODIFIY_ROBOT_RESET_MODULE) + if(tgui_alert(usr, "Are you sure that you want to reset the entire module?","Confirm",list("Yes","No"))=="No") + return + target.module_reset() + to_chat(usr, "You resetted [target]'s module selection.") diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm index 054167cc75..89cc95c85f 100644 --- a/code/modules/mob/living/silicon/robot/robot.dm +++ b/code/modules/mob/living/silicon/robot/robot.dm @@ -151,9 +151,7 @@ C.wrapped = new C.external_type if(!cell) - cell = new /obj/item/weapon/cell(src) - cell.maxcharge = 7500 - cell.charge = 7500 + cell = new /obj/item/weapon/cell/robot_station(src) else if(ispath(cell)) cell = new cell(src) @@ -180,6 +178,44 @@ . = ..() update_icon() +/mob/living/silicon/robot/rejuvenate() + for (var/V in components) + var/datum/robot_component/C = components[V] + if(istype(C.wrapped, /obj/item/broken_device)) + qdel(C.wrapped) + C.wrapped = null + if(!C.wrapped) + switch(V) + if("actuator") + C.wrapped = new /obj/item/robot_parts/robot_component/actuator(src) + if("radio") + C.wrapped = new /obj/item/robot_parts/robot_component/radio(src) + if("power cell") + var/list/recommended_cells = list(/obj/item/weapon/cell/robot_station, /obj/item/weapon/cell/high, /obj/item/weapon/cell/super, /obj/item/weapon/cell/robot_syndi, /obj/item/weapon/cell/hyper, + /obj/item/weapon/cell/infinite, /obj/item/weapon/cell/potato, /obj/item/weapon/cell/slime) + var/list/cell_names = list() + for(var/cell_type in recommended_cells) + var/obj/item/weapon/cell/single_cell = cell_type + cell_names[capitalize(initial(single_cell.name))] = cell_type + var/selected_cell = tgui_input_list(usr, "What kind of cell do you want to install? Cancel installs a default robot cell.", "Cells", cell_names) + if(!selected_cell || selected_cell == "Cancel") + selected_cell = "A standard robot power cell" + var/new_power_cell = cell_names[capitalize(selected_cell)] + cell = new new_power_cell(src) + C.wrapped = cell + if("diagnosis unit") + C.wrapped = new /obj/item/robot_parts/robot_component/diagnosis_unit(src) + if("camera") + C.wrapped = new /obj/item/robot_parts/robot_component/camera(src) + if("comms") + C.wrapped = new /obj/item/robot_parts/robot_component/binary_communication_device(src) + if("armour") + C.wrapped = new /obj/item/robot_parts/robot_component/armour(src) + C.installed = 1 + C.install() + cell.charge = cell.maxcharge + ..() + /mob/living/silicon/robot/proc/init() aiCamera = new/obj/item/device/camera/siliconcam/robot_camera(src) laws = new /datum/ai_laws/nanotrasen() diff --git a/code/modules/mob/living/silicon/robot/robot_modules/station.dm b/code/modules/mob/living/silicon/robot/robot_modules/station.dm index 26465af10a..3311296c30 100644 --- a/code/modules/mob/living/silicon/robot/robot_modules/station.dm +++ b/code/modules/mob/living/silicon/robot/robot_modules/station.dm @@ -103,6 +103,8 @@ var/global/list/robot_modules = list( /obj/item/weapon/robot_module/Destroy() for(var/module in modules) qdel(module) + for(var/emg in emag) + qdel(emg) for(var/synth in synths) qdel(synth) modules.Cut() diff --git a/code/modules/mob/living/silicon/robot/syndicate.dm b/code/modules/mob/living/silicon/robot/syndicate.dm index 18d2b9ce80..286b2abf75 100644 --- a/code/modules/mob/living/silicon/robot/syndicate.dm +++ b/code/modules/mob/living/silicon/robot/syndicate.dm @@ -8,9 +8,7 @@ /mob/living/silicon/robot/syndicate/New() if(!cell) - cell = new /obj/item/weapon/cell(src) - cell.maxcharge = 25000 - cell.charge = 25000 + cell = new /obj/item/weapon/cell/robot_syndi(src) ..() diff --git a/code/modules/power/cells/power_cells.dm b/code/modules/power/cells/power_cells.dm index 54273ca747..8f8d01b1cc 100644 --- a/code/modules/power/cells/power_cells.dm +++ b/code/modules/power/cells/power_cells.dm @@ -35,6 +35,13 @@ maxcharge = 5000 matter = list(MAT_STEEL = 700, MAT_GLASS = 50) +/* + * Robot + */ +/obj/item/weapon/cell/robot_station + name = "A standard robot power cell" + maxcharge = 7500 + /* * High */ @@ -65,6 +72,15 @@ charge = 0 update_icon() +/* + * Syndicate + */ +/obj/item/weapon/cell/robot_syndi + name = "A syndicate robot power cell" + description_fluff = "Almost as good as a hyper." + icon_state = "super" //We don't want roboticists confuse it with a low standard cell + maxcharge = 25000 + /* * Hyper */ @@ -224,4 +240,4 @@ desc += " This one has already been used." cut_overlays() target.adjust_nutrition(amount) - user.custom_emote(message = "connects \the [src] to [user == target ? "their" : "[target]'s"] charging port, expending it.") \ No newline at end of file + user.custom_emote(message = "connects \the [src] to [user == target ? "their" : "[target]'s"] charging port, expending it.") diff --git a/icons/mob/robot/crisis.dmi b/icons/mob/robot/crisis.dmi index e4eb242001c7db6d85f04815b4b54ec54975979a..4f7ce6ed3400c7ee502ad7a31b2b3aa6457386a4 100644 GIT binary patch delta 276 zcmV+v0qg$uzykBY0+1vDdyyqI6OHrqvw(~kffh9^faE*p_8yu`k!>M6)i2gD2ROr% z35p7CEY5I@qMcz9>gRtzSD-4UK>Vou3a37J414ynPICcnt6exbgA3ShJV8+bf?aTt z$s9$CNywZeWZtbFs26PE|CXO^D@x+#qCuuTp7XY6N@9|b=I(Xu*%<*1mmr_fK9_b0 z^3_@2T0Wojt=|JV?*(@b%uZaqlPUonVX3*mA=JR5M)|$y5siPeR|<}j1!7_SHteW& z?=%lc{LTJqEw}z=hcJ5GJs%`Sk<=%Upj?+jSX^FqRLQe}y!8w1IaM4h$As`Mt;Po1 anBwJTffwr)`UAuJqD+!@G`+K{0n478CWe&& delta 279 zcmV+y0qFkozykKb0+1vDevu_L6Akn9vyhA!ffh9^faE*pau3aIk!>M6U0$qX4seDi z6BHHPSe)S)MLWYJT%P{{U4g2Y0`a5rE1de^G3?pPI?V;Rt#;w$3~I35c!Ht=1gmk8 z$s9!=laM({$h=!UP%qfR|1Uq=R+PleMT1OxJm+oCl*A+<&E4zRvoZo2EuBB@UxLAfr6u(-VJsFG&`d20*pIaM4h$AlQ%7+W;d dU}r&+DPC?Cc(GogKQS+-!1dklq_e02%bvrDhj;)0 diff --git a/modular_chomp/code/modules/power/cells/power_cells.dm b/modular_chomp/code/modules/power/cells/power_cells.dm index 765042421c..c7efccae26 100644 --- a/modular_chomp/code/modules/power/cells/power_cells.dm +++ b/modular_chomp/code/modules/power/cells/power_cells.dm @@ -13,6 +13,22 @@ ..() charge = 0 +/* + * Robot + */ +/obj/item/weapon/cell/robot_station + name = "A standard robot power cell" + maxcharge = 7500 + +/* + * Syndicate + */ +/obj/item/weapon/cell/robot_syndi + name = "A syndicate robot power cell" + description_fluff = "Almost as good as a hyper." + icon_state = "super" //We don't want roboticists confuse it with a low standard cell + maxcharge = 25000 + /* * Security Borg */ diff --git a/vorestation.dme b/vorestation.dme index ca8269f891..a5a9b59abf 100644 --- a/vorestation.dme +++ b/vorestation.dme @@ -1887,6 +1887,7 @@ #include "code\modules\admin\verbs\lightning_strike.dm" #include "code\modules\admin\verbs\map_template_loadverb.dm" #include "code\modules\admin\verbs\mapping.dm" +#include "code\modules\admin\verbs\modify_robot.dm" #include "code\modules\admin\verbs\panicbunker.dm" #include "code\modules\admin\verbs\playsound.dm" #include "code\modules\admin\verbs\possess.dm"