Added transit tubes to the RPD (#5300)

This commit is contained in:
CitadelStationBot
2018-02-05 00:46:34 -06:00
committed by Poojawa
parent 004309eaed
commit 330a6ca0af
6 changed files with 88 additions and 23 deletions

View File

@@ -1,10 +1,11 @@
//Construction Categories
#define PIPE_STRAIGHT 0 //2 directions: N/S, E/W
#define PIPE_BENDABLE 1 //6 directions: N/S, E/W, N/E, N/W, S/E, S/W
#define PIPE_TRINARY 2 //4 directions: N/E/S, E/S/W, S/W/N, W/N/E
#define PIPE_TRIN_M 3 //8 directions: N->S+E, S->N+E, N->S+W, S->N+W, E->W+S, W->E+S, E->W+N, W->E+N
#define PIPE_UNARY 4 //4 directions: N, S, E, W
#define PIPE_ONEDIR 5 //1 direction: N/S/E/W
#define PIPE_STRAIGHT 0 //2 directions: N/S, E/W
#define PIPE_BENDABLE 1 //6 directions: N/S, E/W, N/E, N/W, S/E, S/W
#define PIPE_TRINARY 2 //4 directions: N/E/S, E/S/W, S/W/N, W/N/E
#define PIPE_TRIN_M 3 //8 directions: N->S+E, S->N+E, N->S+W, S->N+W, E->W+S, W->E+S, E->W+N, W->E+N
#define PIPE_UNARY 4 //4 directions: N, S, E, W
#define PIPE_ONEDIR 5 //1 direction: N/S/E/W
#define PIPE_UNARY_FLIPPABLE 6 //8 directions: N/S/E/W/N-flipped/S-flipped/E-flipped/W-flipped
//Disposal pipe relative connection directions
#define DISP_DIR_BASE 0

View File

@@ -8,9 +8,7 @@ RPD
#define ATMOS_MODE 0
#define METER_MODE 1
#define DISPOSALS_MODE 2
#define CATEGORY_ATMOS 0
#define CATEGORY_DISPOSALS 1
#define TRANSIT_MODE 3
GLOBAL_LIST_INIT(atmos_pipe_recipes, list(
@@ -56,6 +54,22 @@ GLOBAL_LIST_INIT(disposal_pipe_recipes, list(
)
))
GLOBAL_LIST_INIT(transit_tube_recipes, list(
"Transit Tubes" = list(
new /datum/pipe_info/transit("Straight Tube", /obj/structure/c_transit_tube, PIPE_STRAIGHT),
new /datum/pipe_info/transit("Straight Tube with Crossing", /obj/structure/c_transit_tube/crossing, PIPE_STRAIGHT),
new /datum/pipe_info/transit("Curved Tube", /obj/structure/c_transit_tube/curved, PIPE_UNARY_FLIPPABLE),
new /datum/pipe_info/transit("Diagonal Tube", /obj/structure/c_transit_tube/diagonal, PIPE_STRAIGHT),
new /datum/pipe_info/transit("Diagonal Tube with Crossing", /obj/structure/c_transit_tube/diagonal/crossing, PIPE_STRAIGHT),
new /datum/pipe_info/transit("Junction", /obj/structure/c_transit_tube/junction, PIPE_UNARY_FLIPPABLE),
),
"Station Equipment" = list(
new /datum/pipe_info/transit("Through Tube Station", /obj/structure/c_transit_tube/station, PIPE_STRAIGHT),
new /datum/pipe_info/transit("Terminus Tube Station", /obj/structure/c_transit_tube/station/reverse, PIPE_UNARY),
new /datum/pipe_info/transit("Transit Tube Pod", /obj/structure/c_transit_tube_pod, PIPE_ONEDIR),
)
))
/datum/pipe_info
var/name
@@ -95,13 +109,18 @@ GLOBAL_LIST_INIT(disposal_pipe_recipes, list(
dirs = list("[NORTH]" = "North", "[EAST]" = "East", "[SOUTH]" = "South", "[WEST]" = "West")
if(PIPE_ONEDIR)
dirs = list("[SOUTH]" = name)
if(PIPE_UNARY_FLIPPABLE)
dirs = list("[NORTH]" = "North", "[NORTHEAST]" = "North Flipped", "[EAST]" = "East", "[SOUTHEAST]" = "East Flipped",
"[SOUTH]" = "South", "[SOUTHWEST]" = "South Flipped", "[WEST]" = "West", "[NORTHWEST]" = "West Flipped")
var/list/rows = list()
var/list/row = list("previews" = list())
var/i = 0
for(var/dir in dirs)
var/flipped = (dirtype == PIPE_TRIN_M) && (text2num(dir) in GLOB.diagonals)
row["previews"] += list(list("selected" = (text2num(dir) == selected_dir), "dir" = dir2text(text2num(dir)), "dir_name" = dirs[dir], "icon_state" = icon_state, "flipped" = flipped))
var/numdir = text2num(dir)
var/flipped = ((dirtype == PIPE_TRIN_M) || (dirtype == PIPE_UNARY_FLIPPABLE)) && (numdir in GLOB.diagonals)
row["previews"] += list(list("selected" = (numdir == selected_dir), "dir" = dir2text(numdir), "dir_name" = dirs[dir], "icon_state" = icon_state, "flipped" = flipped))
if(i++ || dirtype == PIPE_ONEDIR)
rows += list(row)
row = list("previews" = list())
@@ -142,6 +161,13 @@ GLOBAL_LIST_INIT(disposal_pipe_recipes, list(
/datum/pipe_info/disposal/Params()
return "dmake=[id]&type=[dirtype]"
/datum/pipe_info/transit/New(label, obj/path, dt=PIPE_UNARY)
name = label
id = path
dirtype = dt
icon_state = initial(path.icon_state)
if(dt == PIPE_UNARY_FLIPPABLE)
icon_state = "[icon_state]_preview"
/obj/item/pipe_dispenser
name = "Rapid Piping Device (RPD)"
@@ -163,11 +189,12 @@ GLOBAL_LIST_INIT(disposal_pipe_recipes, list(
var/p_dir = NORTH
var/p_flipped = FALSE
var/paint_color="Grey"
var/screen = CATEGORY_ATMOS //Starts on the atmos tab.
var/screen = ATMOS_MODE //Starts on the atmos tab.
var/piping_layer = PIPING_LAYER_DEFAULT
var/datum/pipe_info/recipe
var/static/datum/pipe_info/first_atmos
var/static/datum/pipe_info/first_disposal
var/static/datum/pipe_info/first_transit
/obj/item/pipe_dispenser/New()
. = ..()
@@ -178,6 +205,9 @@ GLOBAL_LIST_INIT(disposal_pipe_recipes, list(
first_atmos = GLOB.atmos_pipe_recipes[GLOB.atmos_pipe_recipes[1]][1]
if(!first_disposal)
first_disposal = GLOB.disposal_pipe_recipes[GLOB.disposal_pipe_recipes[1]][1]
if(!first_transit)
first_transit = GLOB.transit_tube_recipes[GLOB.transit_tube_recipes[1]][1]
recipe = first_atmos
/obj/item/pipe_dispenser/Destroy()
@@ -215,10 +245,13 @@ GLOBAL_LIST_INIT(disposal_pipe_recipes, list(
)
var/list/recipes
if(screen == ATMOS_MODE)
recipes = GLOB.atmos_pipe_recipes
else if(screen == DISPOSALS_MODE)
recipes = GLOB.disposal_pipe_recipes
switch(screen)
if(ATMOS_MODE)
recipes = GLOB.atmos_pipe_recipes
if(DISPOSALS_MODE)
recipes = GLOB.disposal_pipe_recipes
if(TRANSIT_MODE)
recipes = GLOB.transit_tube_recipes
for(var/c in recipes)
var/list/cat = recipes[c]
var/list/r = list()
@@ -248,7 +281,13 @@ GLOBAL_LIST_INIT(disposal_pipe_recipes, list(
if(mode == screen)
mode = text2num(params["screen"])
screen = text2num(params["screen"])
recipe = screen == DISPOSALS_MODE ? first_disposal : first_atmos
switch(screen)
if(DISPOSALS_MODE)
recipe = first_disposal
if(ATMOS_MODE)
recipe = first_atmos
if(TRANSIT_MODE)
recipe = first_transit
p_dir = NORTH
playeffect = FALSE
if("piping_layer")
@@ -257,7 +296,7 @@ GLOBAL_LIST_INIT(disposal_pipe_recipes, list(
if("pipe_type")
var/static/list/recipes
if(!recipes)
recipes = GLOB.disposal_pipe_recipes + GLOB.atmos_pipe_recipes
recipes = GLOB.disposal_pipe_recipes + GLOB.atmos_pipe_recipes + GLOB.transit_tube_recipes
recipe = recipes[params["category"]][text2num(params["pipe_type"])]
p_dir = NORTH
if("setdir")
@@ -302,7 +341,7 @@ GLOBAL_LIST_INIT(disposal_pipe_recipes, list(
return
if(EATING_MODE) //Eating pipes
if(!(istype(A, /obj/item/pipe) || istype(A, /obj/item/pipe_meter) || istype(A, /obj/structure/disposalconstruct)))
if(!(istype(A, /obj/item/pipe) || istype(A, /obj/item/pipe_meter) || istype(A, /obj/structure/disposalconstruct) || istype(A, /obj/structure/c_transit_tube) || istype(A, /obj/structure/c_transit_tube_pod)))
return ..()
to_chat(user, "<span class='notice'>You start destroying a pipe...</span>")
playsound(get_turf(src), 'sound/machines/click.ogg', 50, 1)
@@ -365,6 +404,31 @@ GLOBAL_LIST_INIT(disposal_pipe_recipes, list(
C.update_icon()
return
if(TRANSIT_MODE) //Making transit tubes
if(!can_make_pipe)
return ..()
A = get_turf(A)
if(isclosedturf(A))
to_chat(user, "<span class='warning'>[src]'s error light flickers; there's something in the way!</span>")
return
to_chat(user, "<span class='notice'>You start building a transit tube...</span>")
playsound(get_turf(src), 'sound/machines/click.ogg', 50, 1)
if(do_after(user, 4, target = A))
activate()
if(queued_p_type == /obj/structure/c_transit_tube_pod)
var/obj/structure/c_transit_tube_pod/pod = new /obj/structure/c_transit_tube_pod(A)
pod.add_fingerprint(usr)
else
var/obj/structure/c_transit_tube/tube = new queued_p_type(A)
tube.dir = queued_p_dir
if(queued_p_flipped)
tube.dir = turn(queued_p_dir, 45)
tube.simple_rotate_flip()
tube.add_fingerprint(usr)
return
else
return ..()
@@ -377,5 +441,3 @@ GLOBAL_LIST_INIT(disposal_pipe_recipes, list(
#undef ATMOS_MODE
#undef METER_MODE
#undef DISPOSALS_MODE
#undef CATEGORY_ATMOS
#undef CATEGORY_DISPOSALS

View File

@@ -368,7 +368,7 @@ GLOBAL_LIST_EMPTY(asset_datums)
generic_icon_names = TRUE
/datum/asset/simple/icon_states/multiple_icons/pipes
icons = list('icons/obj/atmospherics/pipes/pipe_item.dmi', 'icons/obj/atmospherics/pipes/disposal.dmi')
icons = list('icons/obj/atmospherics/pipes/pipe_item.dmi', 'icons/obj/atmospherics/pipes/disposal.dmi', 'icons/obj/atmospherics/pipes/transit_tube.dmi')
prefix = "pipe"
/datum/asset/simple/icon_states/multiple_icons/pipes/New()

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 50 KiB

File diff suppressed because one or more lines are too long

View File

@@ -27,6 +27,8 @@
action='screen' params='{"screen": 0}'>Atmospherics</ui-button>
<ui-button icon='{{data.screen == 2 ? "check-square-o" : "square-o"}}' state='{{data.screen == 2 ? "selected" : null}}'
action='screen' params='{"screen": 2}'>Disposals</ui-button>
<ui-button icon='{{data.screen == 3 ? "check-square-o" : "square-o"}}' state='{{data.screen == 3 ? "selected" : null}}'
action='screen' params='{"screen": 3}'>Transit Tubes</ui-button>
</ui-section>
{{#if data.screen == 0}}
<ui-section label='Piping Layer'>