Skip to content

Commit

Permalink
Merge branch 'PipenetRevamp' of https://github.com/Aranclanos/-tg-sta…
Browse files Browse the repository at this point in the history
…tion into Aranclanos-PipenetRevamp

Conflicts:
	_maps/map_files/tgstation.2.1.3.dmm
	code/ATMOSPHERICS/atmospherics.dm
	code/ATMOSPHERICS/components/portables_connector.dm
  • Loading branch information
Cheridan committed Nov 14, 2014
2 parents 37081d4 + 65918a1 commit 24456bc
Show file tree
Hide file tree
Showing 39 changed files with 812 additions and 1,685 deletions.
102 changes: 51 additions & 51 deletions _maps/map_files/tgstation.2.1.3.dmm

Large diffs are not rendered by default.

55 changes: 27 additions & 28 deletions code/ATMOSPHERICS/atmospherics.dm
Original file line number Diff line number Diff line change
Expand Up @@ -24,43 +24,30 @@ Pipelines + Other Objects -> Pipe network
var/global/list/iconsetids = list()
var/global/list/pipeimages = list()

/*
/obj/machinery/atmospherics/process()
//build_network()
*/

/obj/machinery/atmospherics/New()
..()
if(can_unwrench)
stored = new(src, make_from=src)

/obj/machinery/atmospherics/proc/network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference)
// Check to see if should be added to network. Add self if so and adjust variables appropriately.
// Note don't forget to have neighbors look as well!

return null

/obj/machinery/atmospherics/proc/build_network()
// Called to build a network from this node

return null
/obj/machinery/atmospherics/proc/returnPipenet()
return

/obj/machinery/atmospherics/proc/return_network(obj/machinery/atmospherics/reference)
// Returns pipe_network associated with connection to reference
// Notes: should create network if necessary
// Should never return null
/obj/machinery/atmospherics/proc/returnPipenetAir()
return

return null
/obj/machinery/atmospherics/proc/setPipenet()
return

/obj/machinery/atmospherics/proc/reassign_network(datum/pipe_network/old_network, datum/pipe_network/new_network)
// Used when two pipe_networks are combining
/obj/machinery/atmospherics/proc/replacePipenet()
return

/obj/machinery/atmospherics/proc/return_network_air(datum/network/reference)
// Return a list of gas_mixture(s) in the object
// associated with reference pipe_network for use in rebuilding the networks gases list
// Is permitted to return null
/obj/machinery/atmospherics/proc/build_network()
// Called to build a network from this node
return

/obj/machinery/atmospherics/proc/disconnect(obj/machinery/atmospherics/reference)
return

/obj/machinery/atmospherics/proc/icon_addintact(var/obj/machinery/atmospherics/node, var/connected)
var/image/img = getpipeimage('icons/obj/atmospherics/binary_devices.dmi', "pipe_intact", get_dir(src,node), node.pipe_color)
Expand All @@ -86,7 +73,7 @@ Pipelines + Other Objects -> Pipe network
var/datum/gas_mixture/int_air = return_air()
var/datum/gas_mixture/env_air = loc.return_air()
if ((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE)
user << "<span class='danger'>You cannot unwrench [src], it is too exerted due to internal pressure.</span>"
user << "<span class='danger'>You cannot unwrench this [src], it is too exerted due to internal pressure.</span>"
add_fingerprint(user)
return 1
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
Expand All @@ -113,8 +100,8 @@ Pipelines + Other Objects -> Pipe network
qdel(meter)
qdel(src)

/obj/machinery/atmospherics/proc/nullifyPipenetwork()
return
/obj/machinery/atmospherics/proc/nullifyPipenet(datum/pipeline/P)
P.other_atmosmch -= src

/obj/machinery/atmospherics/proc/getpipeimage(var/iconset, var/iconstate, var/direction, var/col=rgb(255,255,255))

Expand All @@ -137,6 +124,18 @@ Pipelines + Other Objects -> Pipe network

return img

/obj/machinery/atmospherics/proc/construction(D, P)
dir = D
initialize_directions = P
var/turf/T = loc
level = T.intact ? 2 : 1
initialize()
var/list/nodes = pipeline_expansion()
for(var/obj/machinery/atmospherics/A in nodes)
A.initialize()
A.addMember(src)
build_network()

/obj/machinery/atmospherics/singularity_pull(S, current_size)
if(current_size >= STAGE_FIVE)
Deconstruct()
131 changes: 59 additions & 72 deletions code/ATMOSPHERICS/components/binary_devices/binary_atmos_base.dm
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
var/obj/machinery/atmospherics/node1
var/obj/machinery/atmospherics/node2

var/datum/pipe_network/network1
var/datum/pipe_network/network2
var/datum/pipeline/parent1
var/datum/pipeline/parent2

var/showpipe = 0

Expand Down Expand Up @@ -60,33 +60,15 @@
..(intact)

// Housekeeping and pipe network stuff below
/obj/machinery/atmospherics/binary/network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference)
if(reference == node1)
network1 = new_network

else if(reference == node2)
network2 = new_network

if(new_network.normal_members.Find(src))
return 0

new_network.normal_members += src

return null

/obj/machinery/atmospherics/binary/Destroy()
loc = null

if(node1)
node1.disconnect(src)
del(network1)
node1 = null
nullifyPipenet(parent1)
if(node2)
node2.disconnect(src)
del(network2)

node1 = null
node2 = null

node2 = null
nullifyPipenet(parent2)
..()

/obj/machinery/atmospherics/binary/initialize()
Expand All @@ -111,58 +93,63 @@
update_icon()

/obj/machinery/atmospherics/binary/build_network()
if(!network1 && node1)
network1 = new /datum/pipe_network()
network1.normal_members += src
network1.build_network(node1, src)

if(!network2 && node2)
network2 = new /datum/pipe_network()
network2.normal_members += src
network2.build_network(node2, src)

if(!parent1)
parent1 = new /datum/pipeline()
parent1.build_pipeline(src)

/obj/machinery/atmospherics/binary/return_network(obj/machinery/atmospherics/reference)
build_network()

if(reference==node1)
return network1

if(reference==node2)
return network2

return null

/obj/machinery/atmospherics/binary/reassign_network(datum/pipe_network/old_network, datum/pipe_network/new_network)
if(network1 == old_network)
network1 = new_network
if(network2 == old_network)
network2 = new_network

return 1

/obj/machinery/atmospherics/binary/return_network_air(datum/pipe_network/reference)
var/list/results = list()

if(network1 == reference)
results += air1
if(network2 == reference)
results += air2

return results
if(!parent2)
parent2 = new /datum/pipeline()
parent2.build_pipeline(src)

/obj/machinery/atmospherics/binary/disconnect(obj/machinery/atmospherics/reference)
if(reference==node1)
del(network1)
if(reference == node1)
if(istype(node1, /obj/machinery/atmospherics/pipe))
qdel(parent1)
node1 = null
else if(reference==node2)
del(network2)
else if(reference == node2)
if(istype(node2, /obj/machinery/atmospherics/pipe))
qdel(parent2)
node2 = null

update_icon()

return null

/obj/machinery/atmospherics/binary/nullifyPipenetwork()
network1 = null
network2 = null
/obj/machinery/atmospherics/binary/nullifyPipenet(datum/pipeline/P)
..()
if(P == parent1)
parent1.other_airs -= air1
parent1 = null
else if(P == parent2)
parent2.other_airs -= air2
parent2 = null

/obj/machinery/atmospherics/binary/returnPipenetAir(datum/pipeline/P)
if(P == parent1)
return air1
else if(P == parent2)
return air2

/obj/machinery/atmospherics/binary/pipeline_expansion(datum/pipeline/P)
if(P)
if(parent1 == P)
return list(node1)
else if(parent2 == P)
return list(node2)
else
return list(node1, node2)

/obj/machinery/atmospherics/binary/setPipenet(datum/pipeline/P, obj/machinery/atmospherics/A)
if(A == node1)
parent1 = P
else if(A == node2)
parent2 = P

/obj/machinery/atmospherics/binary/returnPipenet(obj/machinery/atmospherics/A)
if(A == node1)
return parent1
else if(A == node2)
return parent2

/obj/machinery/atmospherics/binary/replacePipenet(datum/pipeline/Old, datum/pipeline/New)
if(Old == parent1)
parent1 = New
else if(Old == parent2)
parent2 = New
6 changes: 2 additions & 4 deletions code/ATMOSPHERICS/components/binary_devices/circulator.dm
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,9 @@
//Actually transfer the gas
var/datum/gas_mixture/removed = air2.remove(transfer_moles)

if(network1)
network1.update = 1
parent1.update = 1

if(network2)
network2.update = 1
parent2.update = 1

return removed

Expand Down
6 changes: 2 additions & 4 deletions code/ATMOSPHERICS/components/binary_devices/dp_vent_pump.dm
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@
loc.assume_air(removed)
air_update_turf()

if(network1)
network1.update = 1
parent1.update = 1

else //external -> output
var/pressure_delta = 10000
Expand All @@ -94,8 +93,7 @@
air2.merge(removed)
air_update_turf()

if(network2)
network2.update = 1
parent2.update = 1

return 1

Expand Down
6 changes: 2 additions & 4 deletions code/ATMOSPHERICS/components/binary_devices/passive_gate.dm
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,9 @@ Passive gate is similar to the regular pump except:
var/datum/gas_mixture/removed = air1.remove(transfer_moles)
air2.merge(removed)

if(network1)
network1.update = 1
parent1.update = 1

if(network2)
network2.update = 1
parent2.update = 1


//Radio remote control
Expand Down
7 changes: 3 additions & 4 deletions code/ATMOSPHERICS/components/binary_devices/pump.dm
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,10 @@ Thus, the two variables affect pump operation are set in New():
var/datum/gas_mixture/removed = air1.remove(transfer_moles)
air2.merge(removed)

if(network1)
network1.update = 1
parent1.update = 1

if(network2)
network2.update = 1

parent2.update = 1

return 1

Expand Down
6 changes: 2 additions & 4 deletions code/ATMOSPHERICS/components/binary_devices/volume_pump.dm
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,9 @@ Thus, the two variables affect pump operation are set in New():

air2.merge(removed)

if(network1)
network1.update = 1
parent1.update = 1

if(network2)
network2.update = 1
parent2.update = 1

return 1

Expand Down
Loading

0 comments on commit 24456bc

Please sign in to comment.