From 9d074515b3366d5e14ebd6e09db6fa112efcc2d3 Mon Sep 17 00:00:00 2001 From: nemvar <47324920+nemvar@users.noreply.github.com> Date: Wed, 24 Jul 2019 05:25:04 +0200 Subject: [PATCH] The way silicon radios and cells get created is now more sane. (#45371) About The Pull Request See title. Fixes #45370 Why It's Good For The Game I don't think duplication of powercells and a bunch of duplicate code is really needed. This is more easily maintainable and just not shit in general. EDIT: oh forgot to mention that this causes syndiborgs to have 500 more max charge by default. If anyone is extremely triggered by this, I can change that. But since those things aren't finely tuned anyways, I don't think this is a big deal. Changelog cl code: Changed how sillycones get their cells and radios. /cl --- code/game/objects/items/robot/robot_parts.dm | 2 +- code/modules/mob/living/silicon/ai/ai.dm | 2 +- code/modules/mob/living/silicon/pai/pai.dm | 3 +-- code/modules/mob/living/silicon/robot/robot.dm | 18 ++++++++++++------ code/modules/mob/living/silicon/silicon.dm | 4 +++- 5 files changed, 18 insertions(+), 11 deletions(-) diff --git a/code/game/objects/items/robot/robot_parts.dm b/code/game/objects/items/robot/robot_parts.dm index 31f482b23ef..a734a08fa68 100644 --- a/code/game/objects/items/robot/robot_parts.dm +++ b/code/game/objects/items/robot/robot_parts.dm @@ -271,7 +271,7 @@ if(!user.temporarilyRemoveItemFromInventory(W)) return - var/mob/living/silicon/robot/O = new /mob/living/silicon/robot(get_turf(loc)) + var/mob/living/silicon/robot/O = new /mob/living/silicon/robot/nocell(get_turf(loc)) if(!O) return diff --git a/code/modules/mob/living/silicon/ai/ai.dm b/code/modules/mob/living/silicon/ai/ai.dm index ce503be9454..9db4d020f3e 100644 --- a/code/modules/mob/living/silicon/ai/ai.dm +++ b/code/modules/mob/living/silicon/ai/ai.dm @@ -29,6 +29,7 @@ sec_hud = DATA_HUD_SECURITY_BASIC d_hud = DATA_HUD_DIAGNOSTIC_ADVANCED mob_size = MOB_SIZE_LARGE + radio = /obj/item/radio/headset/silicon/ai var/battery = 200 //emergency power if the AI's APC is off var/list/network = list("ss13") var/obj/machinery/camera/current @@ -148,7 +149,6 @@ aiPDA.name = real_name + " (" + aiPDA.ownjob + ")" aiMulti = new(src) - radio = new /obj/item/radio/headset/silicon/ai(src) aicamera = new/obj/item/camera/siliconcam/ai_camera(src) deploy_action.Grant(src) diff --git a/code/modules/mob/living/silicon/pai/pai.dm b/code/modules/mob/living/silicon/pai/pai.dm index 395bdbacab8..772734acb52 100644 --- a/code/modules/mob/living/silicon/pai/pai.dm +++ b/code/modules/mob/living/silicon/pai/pai.dm @@ -13,6 +13,7 @@ maxHealth = 500 layer = BELOW_MOB_LAYER can_be_held = TRUE + radio = /obj/item/radio/headset/silicon/pai var/network = "ss13" var/obj/machinery/camera/current = null @@ -111,8 +112,6 @@ job = "Personal AI" signaler = new(src) hostscan = new /obj/item/healthanalyzer(src) - if(!radio) - radio = new /obj/item/radio/headset/silicon/pai(src) newscaster = new /obj/machinery/newscaster(src) if(!aicamera) aicamera = new /obj/item/camera/siliconcam/ai_camera(src) diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm index ca2e3506906..201705b5222 100644 --- a/code/modules/mob/living/silicon/robot/robot.dm +++ b/code/modules/mob/living/silicon/robot/robot.dm @@ -10,6 +10,8 @@ has_limbs = 1 hud_type = /datum/hud/robot + radio = /obj/item/radio/borg + var/custom_name = "" var/braintype = "Cyborg" var/obj/item/robot_suit/robot_suit = null //Used for deconstruction to remember what the borg was constructed out of.. @@ -40,7 +42,7 @@ var/mutable_appearance/eye_lights var/mob/living/silicon/ai/connected_ai = null - var/obj/item/stock_parts/cell/cell = null + var/obj/item/stock_parts/cell/cell = /obj/item/stock_parts/cell/high ///If this is a path, this gets created as an object in Initialize. var/opened = 0 var/emagged = FALSE @@ -111,15 +113,14 @@ ident = rand(1, 999) - if(!cell) - cell = new /obj/item/stock_parts/cell/high(src) + if(ispath(cell)) + cell = new cell(src) if(lawupdate) make_laws() if(!TryConnectToAI()) lawupdate = FALSE - radio = new /obj/item/radio/borg(src) if(!scrambledcodes && !builtInCamera) builtInCamera = new (src) builtInCamera.c_tag = real_name @@ -765,6 +766,10 @@ cell = null qdel(src) +///This is the subtype that gets created by robot suits. It's needed so that those kind of borgs don't have a useless cell in them +/mob/living/silicon/robot/nocell + cell = null + /mob/living/silicon/robot/modules var/set_module = /obj/item/robot_module @@ -816,11 +821,11 @@ Your cyborg LMG will slowly produce ammunition from your power supply, and your operative pinpointer will find and locate fellow nuclear operatives. \ Help the operatives secure the disk at all costs!" set_module = /obj/item/robot_module/syndicate + cell = /obj/item/stock_parts/cell/hyper + radio = /obj/item/radio/borg/syndicate /mob/living/silicon/robot/modules/syndicate/Initialize() . = ..() - cell = new /obj/item/stock_parts/cell/hyper(src, 25000) - radio = new /obj/item/radio/borg/syndicate(src) laws = new /datum/ai_laws/syndicate_override() addtimer(CALLBACK(src, .proc/show_playstyle), 5) @@ -1129,6 +1134,7 @@ /mob/living/silicon/robot/shell shell = TRUE + cell = null /mob/living/silicon/robot/MouseDrop_T(mob/living/M, mob/living/user) . = ..() diff --git a/code/modules/mob/living/silicon/silicon.dm b/code/modules/mob/living/silicon/silicon.dm index 45988dff5ab..c57d60924a9 100644 --- a/code/modules/mob/living/silicon/silicon.dm +++ b/code/modules/mob/living/silicon/silicon.dm @@ -24,7 +24,7 @@ var/obj/item/camera/siliconcam/aicamera = null //photography hud_possible = list(ANTAG_HUD, DIAG_STAT_HUD, DIAG_HUD, DIAG_TRACK_HUD) - var/obj/item/radio/borg/radio = null //All silicons make use of this, with (p)AI's creating headsets + var/obj/item/radio/borg/radio = null ///If this is a path, this gets created as an object in Initialize. var/list/alarm_types_show = list("Motion" = 0, "Fire" = 0, "Atmosphere" = 0, "Power" = 0, "Camera" = 0) var/list/alarm_types_clear = list("Motion" = 0, "Fire" = 0, "Atmosphere" = 0, "Power" = 0, "Camera" = 0) @@ -51,6 +51,8 @@ . = ..() GLOB.silicon_mobs += src faction += "silicon" + if(ispath(radio)) + radio = new radio(src) for(var/datum/atom_hud/data/diagnostic/diag_hud in GLOB.huds) diag_hud.add_to_hud(src) diag_hud_set_status()