Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bluespace pipe caps #36581

Merged
merged 21 commits into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 102 additions & 0 deletions code/ATMOSPHERICS/components/unary/cap.dm
Original file line number Diff line number Diff line change
Expand Up @@ -125,3 +125,105 @@
return // Coloring pipes.

return ..()

/obj/machinery/atmospherics/unary/cap/bluespace
name = "bluespace pipe endcap"
desc = "A bluespace-powered pipe endcap that can instantaneously transfer gases between two points. It will only transfer gases to other pipes with the same color, which can be changed with a multitool."
icon = 'icons/obj/pipes.dmi'
icon_state = "bscap"
level = LEVEL_ABOVE_FLOOR
can_be_coloured = 0
color = "#FFFFFF"
var/network_color = "#b4b4b4" // default grey color that all pipes have

var/color_r = 180
var/color_g = 180
var/color_b = 180

var/image/color_overlay

var/global/list/pipe_colors = list(
"custom", \
"grey" = rgb(180,180,180), \
"blue" = rgb(0,0,183), \
"cyan" = rgb(0,184,184), \
"green" = rgb(0,185,0), \
"pink" = rgb(255,102,204), \
"purple" = rgb(128,0,128), \
"red" = rgb(183,0,0), \
"orange" = rgb(183,121,0), \
"white" = rgb(255,255,255), \
)

/obj/machinery/atmospherics/unary/cap/bluespace/update_icon()
overlays = 0
alpha = invisibility ? 128 : 255
icon_state = "bscap"
update_moody_light('icons/lighting/moody_lights.dmi', "overlay_bscap")
color_overlay = image('icons/obj/pipes.dmi', icon_state = "bscap-overlay")
color_overlay.color = rgb(color_r,color_g,color_b)
overlays += color_overlay


var/global/list/obj/machinery/atmospherics/unary/cap/bluespace/bspipe_list = list()
var/global/list/obj/machinery/atmospherics/unary/cap/bluespace/bspipe_item_list = list()

/obj/machinery/atmospherics/unary/cap/bluespace/New()
..()
bspipe_list.Add(src)

/obj/machinery/atmospherics/unary/cap/bluespace/Destroy()
bspipe_list.Remove(src)
..()


/obj/machinery/atmospherics/unary/cap/bluespace/proc/merge_all()
var/datum/pipe_network/main_network
for(var/obj/machinery/atmospherics/unary/cap/bluespace/bscap in bspipe_list)
if(!bscap.network)
continue
if(src.network_color != bscap.network_color)
continue
if(src.z != bscap.z)
continue
if(!main_network)
main_network = bscap.network
continue
else
main_network.merge(bscap.network)

/obj/machinery/atmospherics/unary/cap/bluespace/build_network()
if(!network && node1)
network = new /datum/pipe_network
network.normal_members += src
network.build_network(node1, src)
merge_all()


/obj/machinery/atmospherics/unary/cap/bluespace/attackby(var/obj/item/O as obj, var/mob/user as mob)
if(istype(O,/obj/item/device/multitool))
var/list/choice_list = pipe_colors

var/choice = input(user,"Select a color to set [src] to.","[src]") in choice_list
if(!Adjacent(user))
return

var/new_color
if(choice == "custom")
new_color = input("Please select a color for the tile.", "[src]",rgb(color_r,color_g,color_b)) as color
if(new_color)
color_r = hex2num(copytext(new_color, 2, 4))
color_g = hex2num(copytext(new_color, 4, 6))
color_b = hex2num(copytext(new_color, 6, 8))
else
new_color = choice_list[choice]
color_r = hex2num(copytext(new_color, 2, 4))
color_g = hex2num(copytext(new_color, 4, 6))
color_b = hex2num(copytext(new_color, 6, 8))

update_icon()

network_color = new_color
qdel(network)
merge_all()
return ..()
19 changes: 17 additions & 2 deletions code/ATMOSPHERICS/pipe/construction.dm
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ Buildable meters
#define PIPE_Z_DOWN 36
#define PIPE_MPVALVE 37
#define PIPE_DPVALVE 38
#define PIPE_BSCAP 39

//Disposal piping numbers - do NOT hardcode these, use the defines
#define DISP_PIPE_STRAIGHT 0
Expand Down Expand Up @@ -177,6 +178,8 @@ var/list/bent_dirs = list(NORTH|SOUTH, WEST|EAST)
src.pipe_type = PIPE_INSUL_MANIFOLD4W
else
src.pipe_type = PIPE_MANIFOLD4W
else if(istype(make_from, /obj/machinery/atmospherics/unary/cap/bluespace))
src.pipe_type = PIPE_BSCAP
else if(istype(make_from, /obj/machinery/atmospherics/unary/cap/heat))
src.pipe_type = PIPE_HE_CAP
else if(istype(make_from, /obj/machinery/atmospherics/unary/cap))
Expand All @@ -202,11 +205,18 @@ var/list/bent_dirs = list(NORTH|SOUTH, WEST|EAST)
else
src.pipe_type = pipe_type
src.dir = dir
if(src.pipe_type == PIPE_BSCAP)
src.w_class = W_CLASS_LARGE
bspipe_item_list.Add(src)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably unnecessary since you already add it in New()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there are 2 lists: bspipe_list and bspipe_item_list, one tracks the caps in item form and the other in machinery form

//src.pipe_dir = get_pipe_dir()
update()
// src.pixel_x = rand(-5, 5)
// src.pixel_y = rand(-5, 5)

/obj/item/pipe/Destroy()
bspipe_item_list.Remove(src)
..()

/obj/item/pipe/proc/setPipingLayer(new_layer = PIPING_LAYER_DEFAULT)
piping_layer = new_layer
if(pipe_type != PIPE_LAYER_MANIFOLD && pipe_type != PIPE_LAYER_ADAPTER)
Expand Down Expand Up @@ -255,7 +265,8 @@ var/global/list/pipeID2State = list(
"z_up",
"z_down",
"mpvalve",
"dpvalve"
"dpvalve",
"bscap"
)
var/global/list/nlist = list( \
"pipe", \
Expand Down Expand Up @@ -297,6 +308,7 @@ var/global/list/nlist = list( \
"down pipe", \
"manual conditional valve", \
"digital conditional valve", \
"bluespace pipe cap", \
)
/obj/item/pipe/proc/update()

Expand Down Expand Up @@ -383,7 +395,7 @@ var/list/manifold_pipes = list(PIPE_MANIFOLD4W, PIPE_INSUL_MANIFOLD4W, PIPE_HE_M
return flip|cw|acw
if(PIPE_GAS_FILTER, PIPE_GAS_MIXER,PIPE_MTVALVE,PIPE_DTVALVE,PIPE_MPVALVE,PIPE_DPVALVE)
return dir|flip|cw
if(PIPE_CAP, PIPE_HE_CAP, PIPE_Z_UP, PIPE_Z_DOWN)
if(PIPE_CAP, PIPE_HE_CAP, PIPE_BSCAP, PIPE_Z_UP, PIPE_Z_DOWN)
return dir
return 0

Expand Down Expand Up @@ -509,6 +521,9 @@ var/list/manifold_pipes = list(PIPE_MANIFOLD4W, PIPE_INSUL_MANIFOLD4W, PIPE_HE_M

if(PIPE_HE_CAP)
P=new /obj/machinery/atmospherics/unary/cap/heat(src.loc)

if(PIPE_BSCAP)
P=new /obj/machinery/atmospherics/unary/cap/bluespace(src.loc)

if(PIPE_PASSIVE_GATE) //passive gate
P=new /obj/machinery/atmospherics/binary/passive_gate(src.loc)
Expand Down
36 changes: 25 additions & 11 deletions code/ATMOSPHERICS/pipe/pipe_dispenser.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
density = 1
anchored = 1
var/wait = 0
machine_flags = WRENCHMOVE | FIXED2WORK

machine_flags = SCREWTOGGLE | CROWDESTROY | WRENCHMOVE | FIXED2WORK
var/layer_to_make = PIPING_LAYER_DEFAULT
var/bspipe_limit = 20
var/show_bscaps = FALSE

/********************************************************************
** Adding Stock Parts to VV so preconstructed shit has its candy **
Expand All @@ -27,6 +28,14 @@
)

RefreshParts()

/obj/machinery/pipedispenser/RefreshParts()
var/manipulator_count = 0
for(var/obj/item/weapon/stock_parts/manipulator/M in component_parts)
manipulator_count += M.rating
show_bscaps = FALSE
if(manipulator_count >= 6)
show_bscaps = TRUE

/obj/machinery/pipedispenser/attack_hand(user as mob)
if(..())
Expand Down Expand Up @@ -76,7 +85,10 @@
<li><a href='?src=\ref[src];make=[PIPE_GAS_MIXER];dir=9'>Gas Mixer \[M]</a></li>
<li><a href='?src=\ref[src];make=[PIPE_THERMAL_PLATE];dir=1'>Thermal Plate</a></li>
<li><a href='?src=\ref[src];make=[PIPE_INJECTOR];dir=1'>Injector</a></li>
<li><a href='?src=\ref[src];make=[PIPE_DP_VENT];dir=1'>Dual-Port Vent</a></li>
<li><a href='?src=\ref[src];make=[PIPE_DP_VENT];dir=1'>Dual-Port Vent</a></li>"}
if(show_bscaps)
dat += "<li><a href='?src=\ref[src];make=[PIPE_BSCAP];dir=1'>Bluespace Pipe Cap</a> ([20-(bspipe_list.len+bspipe_item_list.len)] caps available)</li>"
dat+= {"
</ul>
<b>Heat exchange:</b>
<ul>
Expand Down Expand Up @@ -109,20 +121,22 @@
if(!anchored)
usr << browse(null, "window=pipedispenser")
return 1

usr.set_machine(src)
src.add_fingerprint(usr)
if(href_list["make"])
if(!wait)
var/p_type = text2num(href_list["make"])
var/p_dir = text2num(href_list["dir"])
var/obj/item/pipe/P = new /obj/item/pipe(get_turf(src), pipe_type = p_type, dir = p_dir)
P.setPipingLayer(layer_to_make)
P.update()
P.add_fingerprint(usr)
wait = 1
spawn(10)
wait = 0
if(!(p_type == PIPE_BSCAP && bspipe_item_list.len+bspipe_list.len >= bspipe_limit))
var/obj/item/pipe/P = new /obj/item/pipe(get_turf(src), pipe_type = p_type, dir = p_dir)
P.setPipingLayer(layer_to_make)
P.update()
P.add_fingerprint(usr)
wait = 1
spawn(10)
wait = 0
if(p_type == PIPE_BSCAP)
interact(usr)
if(href_list["makemeter"])
if(!wait)
new /obj/item/pipe_meter(/*usr.loc*/ src.loc)
Expand Down
18 changes: 17 additions & 1 deletion code/game/machinery/computer/atmos_control.dm
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#define ACA_SCREEN_DETAILSVIEW 1
#define ACA_SCREEN_ADMINPANEL 2
#define ACA_SCREEN_BSCAPVIEW 3

var/global/list/atmos_controllers = list()
/obj/item/weapon/circuitboard/atmoscontrol
Expand Down Expand Up @@ -213,7 +214,8 @@ var/global/list/atmos_controllers = list()
data["admin_access"] = TRUE
else
data["admin_access"] = FALSE
screen = ACA_SCREEN_DETAILSVIEW //this dumb hack stops unauthorized cards from seeing shit they shouldn't
if(screen == ACA_SCREEN_ADMINPANEL)
screen = ACA_SCREEN_DETAILSVIEW //this dumb hack stops unauthorized cards from seeing shit they shouldn't

data["aca_screen"] = screen //aca_screen so we don't conflict with air alarms, which already use screen

Expand All @@ -226,6 +228,18 @@ var/global/list/atmos_controllers = list()
datum_data["short_name"] = gas_datum.short_name || gas_datum.name
gas_datums += list(datum_data)
data["gas_datums"]=gas_datums

if(bspipe_list.len>0)
data["bspipe_exist"] = TRUE
var/list/bspipes=list()
for(var/obj/machinery/atmospherics/unary/cap/bluespace/bscap in bspipe_list)
var/list/pipe_data = list()
pipe_data["name"] = bscap.name
pipe_data["x"] = bscap.x - WORLD_X_OFFSET[bscap.z]
pipe_data["y"] = bscap.y - WORLD_Y_OFFSET[bscap.z]
pipe_data["z"] = bscap.z
bspipes += list(pipe_data)
data["bspipes"]=bspipes

ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
if(!ui)
Expand All @@ -250,6 +264,7 @@ var/global/list/atmos_controllers = list()
return 1

if(href_list["login"])
screen = ACA_SCREEN_DETAILSVIEW
if(log_in_id || emagged)
return 1
var/mob/M = usr
Expand Down Expand Up @@ -605,3 +620,4 @@ var/global/list/atmos_controllers = list()

#undef ACA_SCREEN_DETAILSVIEW
#undef ACA_SCREEN_ADMINPANEL
#undef ACA_SCREEN_BSCAPVIEW
10 changes: 10 additions & 0 deletions code/modules/multiz/ventcrawl.dm
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,16 @@
user.forceMove(target_move.loc) //handles entering and so on
user.visible_message("You hear something squeeze through the ducts.", "You climb out the ventilation system.")
else if(target_move.can_crawl_through())
if(istype(target_move,/obj/machinery/atmospherics/unary/cap/bluespace)) //if the target is a bluespace pipe cap, teleport to the next cap in bspipe_list
var/obj/machinery/atmospherics/unary/cap/bluespace/bscap = target_move
var/list_len = bspipe_list.len
var/starting_index = bspipe_list.Find(bscap)
if(bscap.network)
for(var/i=0 to list_len-2)
var/pointer = ((i + starting_index) % list_len)+1
if(bscap.network == bspipe_list[pointer].network)
target_move = bspipe_list[pointer]
break
if(target_move.return_network(target_move) != return_network(src))
user.remove_ventcrawl()
user.add_ventcrawl(target_move)
Expand Down
Binary file modified icons/lighting/moody_lights.dmi
Binary file not shown.
Binary file modified icons/obj/pipe-item.dmi
Binary file not shown.
Binary file modified icons/obj/pipes.dmi
Binary file not shown.
24 changes: 24 additions & 0 deletions nano/templates/atmos_control.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ Used In File(s): /code/game/machinery/alarm.dm
<div class="line">
{{:helper.link('Show Tracker Map', 'pin-s', {'reset': 1, 'showMap' : 1})}}
{{:helper.link('Show Detail List', 'script', {'set_screen': 1})}}
{{if data.bspipe_exist}}
{{:helper.link('Show Bluespace Caps List', 'script', {'set_screen': 3})}}
{{/if}}
</div>

<div class="line">
Expand Down Expand Up @@ -125,6 +128,9 @@ Used In File(s): /code/game/machinery/alarm.dm
{{else data.aca_screen == "1"}}
<div class="line">
{{:helper.link('Show Tracker Map', 'pin-s', {'reset': 1, 'showMap' : 1})}}
{{if data.bspipe_exist}}
{{:helper.link('Show Bluespace Caps List', 'script', {'set_screen': 3})}}
{{/if}}
{{if data.admin_access}}
{{:helper.link('Show Presets Panel', 'gear', {'set_screen': 2})}}
{{:helper.link("Mass Set Mode",'alert',{'set_mass_mode': 1},null,"floatRight")}}
Expand Down Expand Up @@ -424,5 +430,23 @@ Used In File(s): /code/game/machinery/alarm.dm
{{/if}}
<!-- End air_alarm.tmpl copypaste -->
{{/if}}
{{else data.aca_screen == "3"}}
<div class="line">
{{:helper.link('Show Tracker Map', 'pin-s', {'reset': 1, 'showMap' : 1})}}
{{:helper.link('Show Detail List', 'script', {'set_screen': 1})}}
{{if data.admin_access}}
{{:helper.link('Show Presets Panel', 'gear', {'set_screen': 2})}}
{{:helper.link("Mass Set Mode",'alert',{'set_mass_mode': 1},null,"floatRight")}}
{{/if}}
</div>
<h3>Bluespace Pipes Locations</h3>
<div class="statusDisplay">
{{for data.bspipes}}
<div class="line">
{{:helper.string("<div class='statusValue good'>{0}</div>",value.name)}}
{{:helper.string("<div class='floatRight'>X: {0}, Y: {1}, Z: {2}</div>",value.x,value.y,value.z)}}
</div>
{{/for}}
</div>
{{/if}}
{{/if}}
3 changes: 3 additions & 0 deletions nano/templates/atmos_control_map_header.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ Used In File(s): \code\workinprogress\mini\atmos_control.dm
Logged in as: <b>{{:data.login_name}}</b> {{:helper.link('Log out', 'locked', {'logout': 1, 'showMap': 0}, (data.emagged) ? 'disabled' : null)}}
</div>
{{:helper.link('Show Detail List', 'script', {'showMap' : 0, 'set_screen': 1})}}
{{if data.bspipe_exist}}
{{:helper.link('Show Bluespace Caps List', 'script', {'showMap' : 0, 'set_screen': 3})}}
{{/if}}
{{if data.admin_access}}
{{:helper.link('Show Presets Panel', 'gear', {'showMap': 0, 'set_screen': 2})}}
{{/if}}
Expand Down
Loading