mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 02:09:41 +00:00
[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 <chompsation2@gmail.com> Co-authored-by: Selis <sirlionfur@hotmail.de>
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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,
|
||||
|
||||
200
code/modules/admin/verbs/modify_robot.dm
Normal file
200
code/modules/admin/verbs/modify_robot.dm
Normal file
@@ -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, "<span class='danger'>You added \"[add_item]\" to [target].</span>")
|
||||
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, "<span class='danger'>You removed \"[selected_module_module]\" from [target]</span>")
|
||||
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, "<span class='danger'>You added \"[selected_radio_channel]\" channel to [target].</span>")
|
||||
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, "<span class='danger'>You removed \"[selected_radio_channel]\" channel from [target].</span>")
|
||||
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, "<span class='danger'>You replaced \"[C]\" on [target] with \"[selected_cell]\".</span>")
|
||||
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, "<span class='danger'>You repplaced \"[C]\" on [target].</span>")
|
||||
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, "<span class='danger'>You removed \"[C]\" from [target]</span>")
|
||||
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, "<span class='danger'>You resetted [target]'s module selection.</span>")
|
||||
@@ -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()
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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)
|
||||
|
||||
..()
|
||||
|
||||
|
||||
@@ -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.")
|
||||
user.custom_emote(message = "connects \the [src] to [user == target ? "their" : "[target]'s"] charging port, expending it.")
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 40 KiB After Width: | Height: | Size: 40 KiB |
@@ -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
|
||||
*/
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user