diff --git a/code/game/machinery/modular_shield.dm b/code/game/machinery/modular_shield.dm index c11bebc5fe9..937a2a8fd9e 100644 --- a/code/game/machinery/modular_shield.dm +++ b/code/game/machinery/modular_shield.dm @@ -175,7 +175,7 @@ radius = initial(radius) active = TRUE initiating = TRUE - + var/color_shield = cached_color_filter || color if(radius >= 10) //the shield is large so we are going to use the midpoint formula and clamp it to the lowest full number in order to save processing power LAZYADD(inside_shield, circle_range_turfs(src, radius - 1))//in the future we might want to apply an effect to turfs inside the shield LAZYADD(list_of_turfs, get_perimeter(src, radius)) @@ -189,7 +189,8 @@ var/obj/structure/emergency_shield/modular/deploying_shield = new(target_tile) deploying_shield.shield_generator = src LAZYADD(deployed_shields, deploying_shield) - + if(color_shield) + deploying_shield.add_atom_colour(color_shield, FIXED_COLOUR_PRIORITY) addtimer(CALLBACK(src, PROC_REF(finish_field)), 2 SECONDS) calculate_regeneration() return @@ -200,6 +201,8 @@ var/obj/structure/emergency_shield/modular/deploying_shield = new(target_tile) deploying_shield.shield_generator = src LAZYADD(deployed_shields, deploying_shield) + if(color_shield) + deploying_shield.add_atom_colour(color_shield, FIXED_COLOUR_PRIORITY) addtimer(CALLBACK(src, PROC_REF(finish_field)), 2 SECONDS) calculate_regeneration() @@ -218,6 +221,8 @@ var/obj/structure/emergency_shield/modular/deploying_shield = new(target_tile) deploying_shield.shield_generator = src LAZYADD(deployed_shields, deploying_shield) + if(color_shield) + deploying_shield.add_atom_colour(color_shield, FIXED_COLOUR_PRIORITY) addtimer(CALLBACK(src, PROC_REF(finish_field)), 2 SECONDS) calculate_regeneration() @@ -231,6 +236,8 @@ var/obj/structure/emergency_shield/modular/deploying_shield = new(target_tile) deploying_shield.shield_generator = src LAZYADD(deployed_shields, deploying_shield) + if(color_shield) + deploying_shield.add_atom_colour(color_shield, FIXED_COLOUR_PRIORITY) addtimer(CALLBACK(src, PROC_REF(finish_field)), 2 SECONDS) calculate_regeneration() @@ -384,13 +391,18 @@ //Start of other machines ///The general code used for machines that want to connect to the network /obj/machinery/modular_shield/module - name = "modular shield debugger" //Filler name and sprite for testing desc = "This is filler for testing you shouldn't see this." icon = 'icons/obj/machines/mech_bay.dmi' icon_state = "recharge_port" density = TRUE + ///This var is what determines if boosters, such as charger or well, can connect to this module + var/allow_boosters = TRUE + + ///This var is what determines if we are a booster or a logistic module + var/is_booster = FALSE + ///The shield generator we are connected to if we find one or a node provides us one var/obj/machinery/modular_shield_generator/shield_generator @@ -403,7 +415,8 @@ /obj/machinery/modular_shield/module/Initialize(mapload) . = ..() - connected_turf = get_step(loc, dir) + connected_turf = get_step(src, dir) + try_connect() /obj/machinery/modular_shield/module/Destroy() @@ -412,6 +425,7 @@ shield_generator.calculate_boost() if(connected_node) LAZYREMOVE(connected_node.connected_through_us, (src)) + connected_node.update_icon_state() return ..() /obj/machinery/modular_shield/module/examine(mob/user) @@ -456,9 +470,11 @@ if(connected_node) LAZYREMOVE(connected_node.connected_through_us, (src)) + connected_node.update_icon_state() connected_node = null - connected_turf = get_step(loc, dir) + connected_turf = get_step(src, dir) + try_connect() return TRUE /obj/machinery/modular_shield/module/crowbar_act(mob/living/user, obj/item/tool) @@ -470,13 +486,14 @@ /obj/machinery/modular_shield/module/setDir(new_dir) . = ..() - connected_turf = get_step(loc, dir) + connected_turf = get_step(src, dir) ///checks for a valid machine in front of us and connects to it /obj/machinery/modular_shield/module/proc/try_connect(user) if(shield_generator || connected_node) balloon_alert(user, "already connected to something!") + update_icon_state() return shield_generator = (locate(/obj/machinery/modular_shield_generator) in connected_turf) @@ -493,7 +510,15 @@ if(connected_node) + //checks if the node allows boosters and if we are a booster + if(!connected_node.allow_boosters && is_booster) + connected_node = null + update_icon_state() + balloon_alert(user, "cant connect") + return + LAZYOR(connected_node.connected_through_us, (src)) + connected_node.update_icon_state() shield_generator = connected_node.shield_generator if(shield_generator) LAZYOR(shield_generator.connected_modules, (src)) @@ -501,14 +526,15 @@ update_icon_state() shield_generator.calculate_boost() return + update_icon_state() balloon_alert(user, "connected to node") return + update_icon_state() balloon_alert(user, "no connection!") /obj/machinery/modular_shield/module/node - name = "modular shield node" desc = "A waist high mess of humming pipes and wires that extend the modular shield network." icon = 'icons/obj/machines/modular_shield_generator.dmi' @@ -541,9 +567,11 @@ if(connected_node) LAZYREMOVE(connected_node.connected_through_us, (src)) + connected_node.update_icon_state() connected_node = null - connected_turf = get_step(loc, dir) + connected_turf = get_step(src, dir) + try_connect() return TRUE //after trying to connect to a machine infront of us, we will try to link anything connected to us to a generator @@ -588,12 +616,38 @@ connected.shield_generator = null connected.update_icon_state() -/obj/machinery/modular_shield/module/charger +/obj/machinery/modular_shield/module/node/cable + name = "modular shield cable" + desc = "An ankle high mess of cables packed as low as possible at the cost of lacking connection components necessary for anything other than nodes and the generator itself." + icon = 'icons/obj/machines/modular_shield_generator.dmi' + icon_state = "cable_node_closed_r_b_l" + active_power_usage = BASE_MACHINE_ACTIVE_CONSUMPTION * 0.1 + circuit = /obj/item/circuitboard/machine/modular_shield_cable + density = FALSE + allow_boosters = FALSE +/obj/machinery/modular_shield/module/node/cable/update_icon_state() + . = ..() + var/turf/right_turf = get_step(src, turn(dir, 270)) + var/obj/machinery/modular_shield/module/node/connected_right = (locate(/obj/machinery/modular_shield/module/node) in right_turf) + if(!(connected_right in connected_through_us)) + connected_right = null + var/turf/back_turf = get_step(src, turn(dir, 180)) + var/obj/machinery/modular_shield/module/node/connected_back = (locate(/obj/machinery/modular_shield/module/node) in back_turf) + if(!(connected_back in connected_through_us)) + connected_back = null + var/turf/left_turf = get_step(src, turn(dir, 90)) + var/obj/machinery/modular_shield/module/node/connected_left = (locate(/obj/machinery/modular_shield/module/node) in left_turf) + if(!(connected_left in connected_through_us)) + connected_left = null + icon_state = "cable_node_[panel_open ? "open" : "closed"]_[connected_right ? "r" : "nr"]_[connected_back ? "b" : "nb"]_[connected_left ? "l" : "nl"]" + +/obj/machinery/modular_shield/module/charger name = "modular shield charger" desc = "A machine that somehow fabricates hardlight using electrons." icon = 'icons/obj/machines/modular_shield_generator.dmi' icon_state = "charger_off_closed" + is_booster = TRUE circuit = /obj/item/circuitboard/machine/modular_shield_charger @@ -617,11 +671,11 @@ shield_generator.calculate_boost() /obj/machinery/modular_shield/module/relay - name = "modular shield relay" desc = "It helps the shield generator project farther out." icon = 'icons/obj/machines/modular_shield_generator.dmi' icon_state = "relay_off_closed" + is_booster = TRUE circuit = /obj/item/circuitboard/machine/modular_shield_relay @@ -645,11 +699,11 @@ shield_generator.calculate_boost() /obj/machinery/modular_shield/module/well - name = "modular shield well" desc = "A device used to hold more hardlight for the modular shield generator." icon = 'icons/obj/machines/modular_shield_generator.dmi' icon_state = "well_off_closed" + is_booster = TRUE circuit = /obj/item/circuitboard/machine/modular_shield_well diff --git a/code/game/objects/items/circuitboards/machines/machine_circuitboards.dm b/code/game/objects/items/circuitboards/machines/machine_circuitboards.dm index dacaeaccd00..02586eae323 100644 --- a/code/game/objects/items/circuitboards/machines/machine_circuitboards.dm +++ b/code/game/objects/items/circuitboards/machines/machine_circuitboards.dm @@ -193,6 +193,14 @@ /obj/item/stack/sheet/plasteel = 2, ) +/obj/item/circuitboard/machine/modular_shield_cable + name = "Modular Shield Cable" + greyscale_colors = CIRCUIT_COLOR_ENGINEERING + build_path = /obj/machinery/modular_shield/module/node/cable + req_components = list( + /obj/item/stack/sheet/plasteel = 1, + ) + /obj/item/circuitboard/machine/modular_shield_well name = "Modular Shield Well" greyscale_colors = CIRCUIT_COLOR_ENGINEERING diff --git a/code/modules/research/designs/machine_designs.dm b/code/modules/research/designs/machine_designs.dm index 6b5bb80b1f8..7f13dee950d 100644 --- a/code/modules/research/designs/machine_designs.dm +++ b/code/modules/research/designs/machine_designs.dm @@ -217,6 +217,16 @@ ) departmental_flags = DEPARTMENT_BITFLAG_ENGINEERING +/datum/design/board/modular_shield_cable + name = "Modular Shield Cable Board" + desc = "The circuit board for a modular shield cable." + id = "modular_shield_cable" + build_path = /obj/item/circuitboard/machine/modular_shield_cable + category = list( + RND_CATEGORY_MACHINE + RND_SUBCATEGORY_MACHINE_ENGINEERING + ) + departmental_flags = DEPARTMENT_BITFLAG_ENGINEERING + /datum/design/board/modular_shield_relay name = "Modular Shield Relay Board" desc = "The circuit board for a modular shield relay." diff --git a/code/modules/research/techweb/nodes/engi_nodes.dm b/code/modules/research/techweb/nodes/engi_nodes.dm index 638905edd9b..4679e6182cf 100644 --- a/code/modules/research/techweb/nodes/engi_nodes.dm +++ b/code/modules/research/techweb/nodes/engi_nodes.dm @@ -220,6 +220,7 @@ "holodisk", "modular_shield_generator", "modular_shield_node", + "modular_shield_cable", "modular_shield_relay", "modular_shield_charger", "modular_shield_well", diff --git a/icons/obj/machines/modular_shield_generator.dmi b/icons/obj/machines/modular_shield_generator.dmi index 1a6f3025eab..23abd0a99a2 100644 Binary files a/icons/obj/machines/modular_shield_generator.dmi and b/icons/obj/machines/modular_shield_generator.dmi differ