Merge pull request #3851 from Citadel-Station-13/upstream-merge-32399
[MIRROR] Multiple fixes in RPD and pipe construciton
This commit is contained in:
@@ -377,6 +377,19 @@ SUBSYSTEM_DEF(air)
|
||||
AM.build_network()
|
||||
CHECK_TICK
|
||||
|
||||
/datum/controller/subsystem/air/proc/get_pipe_cache(type, direction=NORTH)
|
||||
if(!pipe_construction_generation_cache[type])
|
||||
pipe_construction_generation_cache[type] = list()
|
||||
|
||||
if(!pipe_construction_generation_cache[type]["[direction]"])
|
||||
var/obj/machinery/atmospherics/cached = new type(null, FALSE, direction)
|
||||
pipe_construction_generation_cache[type]["[direction]"] = cached
|
||||
STOP_PROCESSING(SSmachines, cached)
|
||||
STOP_PROCESSING(SSfastprocess, cached)
|
||||
GLOB.machines -= cached
|
||||
|
||||
return pipe_construction_generation_cache[type]["[direction]"]
|
||||
|
||||
|
||||
#undef SSAIR_PIPENETS
|
||||
#undef SSAIR_ATMOSMACHINERY
|
||||
|
||||
@@ -69,7 +69,7 @@ Buildable meters
|
||||
return ..()
|
||||
|
||||
/obj/item/pipe/proc/setPipingLayer(new_layer = PIPING_LAYER_DEFAULT)
|
||||
var/obj/machinery/atmospherics/fakeA = get_pipe_cache(pipe_type)
|
||||
var/obj/machinery/atmospherics/fakeA = SSair.get_pipe_cache(pipe_type)
|
||||
|
||||
if(fakeA.pipe_flags & PIPING_ALL_LAYER)
|
||||
new_layer = PIPING_LAYER_DEFAULT
|
||||
@@ -80,7 +80,7 @@ Buildable meters
|
||||
layer = initial(layer) + ((piping_layer - PIPING_LAYER_DEFAULT) * PIPING_LAYER_LCHANGE)
|
||||
|
||||
/obj/item/pipe/proc/update()
|
||||
var/obj/machinery/atmospherics/A = get_pipe_cache(pipe_type)
|
||||
var/obj/machinery/atmospherics/A = SSair.get_pipe_cache(pipe_type)
|
||||
name = "[A.name] fitting"
|
||||
icon_state = A.pipe_state
|
||||
|
||||
@@ -147,19 +147,6 @@ Buildable meters
|
||||
/obj/item/pipe/attack_self(mob/user)
|
||||
return rotate()
|
||||
|
||||
/obj/item/pipe/proc/get_pipe_cache(type, direction)
|
||||
var/list/obj/machinery/atmospherics/check_cache = SSair.pipe_construction_generation_cache
|
||||
if(!islist(check_cache))
|
||||
check_cache = list()
|
||||
if(!check_cache[type])
|
||||
check_cache[type] = list()
|
||||
if(!check_cache[type]["[direction]"])
|
||||
var/obj/machinery/atmospherics/A = new type(null, FALSE, direction)
|
||||
A.name = "\[CACHE\] [A.name]"
|
||||
check_cache[type]["[direction]"] = A
|
||||
|
||||
return check_cache[type]["[direction]"]
|
||||
|
||||
/obj/item/pipe/attackby(obj/item/W, mob/user, params)
|
||||
if (!istype(W, /obj/item/wrench))
|
||||
return ..()
|
||||
@@ -169,7 +156,7 @@ Buildable meters
|
||||
|
||||
fixdir()
|
||||
|
||||
var/obj/machinery/atmospherics/fakeA = get_pipe_cache(pipe_type, dir)
|
||||
var/obj/machinery/atmospherics/fakeA = SSair.get_pipe_cache(pipe_type, dir)
|
||||
|
||||
for(var/obj/machinery/atmospherics/M in loc)
|
||||
if((M.pipe_flags & fakeA.pipe_flags & PIPING_ONE_PER_TURF)) //Only one dense/requires density object per tile, eg connectors/cryo/heater/coolers.
|
||||
|
||||
@@ -579,10 +579,18 @@ GLOBAL_LIST_INIT(RPD_recipes, list(
|
||||
playsound(get_turf(src), 'sound/machines/click.ogg', 50, 1)
|
||||
if(do_after(user, 2, target = A))
|
||||
activate()
|
||||
var/obj/item/pipe/P = new(get_turf(A), queued_p_type, queued_p_dir)
|
||||
|
||||
var/pipe_item_type = /obj/item/pipe
|
||||
var/obj/machinery/atmospherics/cached_pipe = SSair.get_pipe_cache(queued_p_type)
|
||||
if(istype(cached_pipe) && cached_pipe.construction_type)
|
||||
pipe_item_type = cached_pipe.construction_type
|
||||
|
||||
var/obj/item/pipe/P = new pipe_item_type(A, queued_p_type, queued_p_dir)
|
||||
|
||||
if(queued_p_flipped)
|
||||
var/obj/item/pipe/trinary/flippable/F = P
|
||||
F.flipped = queued_p_flipped
|
||||
|
||||
P.update()
|
||||
P.add_fingerprint(usr)
|
||||
if(!isnull(temp_piping_layer))
|
||||
|
||||
Reference in New Issue
Block a user