mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 18:53:06 +00:00
All credits to the author for this handy little script. I Committed the modified python script to tool directory. Although it needs to be in the root folder of your repo to work. To notice the improved compile times, in dreammaker go to Build > Preferences > and untick "automatically set file_dir for subfolders" If this commit inteferes with any large projects just revert it, do your thing, then rerun the script. Easy-peasy. git-svn-id: http://tgstation13.googlecode.com/svn/trunk@4488 316c924e-a436-60f5-8080-3fe189b3f50e
158 lines
3.6 KiB
Plaintext
158 lines
3.6 KiB
Plaintext
/obj/machinery/atmospherics/portables_connector
|
|
icon = 'icons/obj/atmospherics/portables_connector.dmi'
|
|
icon_state = "intact"
|
|
|
|
name = "Connector Port"
|
|
desc = "For connecting portables devices related to atmospherics control."
|
|
|
|
dir = SOUTH
|
|
initialize_directions = SOUTH
|
|
|
|
var/obj/machinery/portable_atmospherics/connected_device
|
|
|
|
var/obj/machinery/atmospherics/node
|
|
|
|
var/datum/pipe_network/network
|
|
|
|
var/on = 0
|
|
|
|
level = 0
|
|
|
|
|
|
New()
|
|
initialize_directions = dir
|
|
..()
|
|
|
|
update_icon()
|
|
if(node)
|
|
icon_state = "[level == 1 && istype(loc, /turf/simulated) ? "h" : "" ]intact"
|
|
dir = get_dir(src, node)
|
|
else
|
|
icon_state = "exposed"
|
|
|
|
return
|
|
|
|
hide(var/i) //to make the little pipe section invisible, the icon changes.
|
|
if(node)
|
|
icon_state = "[i == 1 && istype(loc, /turf/simulated) ? "h" : "" ]intact"
|
|
dir = get_dir(src, node)
|
|
else
|
|
icon_state = "exposed"
|
|
|
|
process()
|
|
..()
|
|
if(!on)
|
|
return
|
|
if(!connected_device)
|
|
on = 0
|
|
return
|
|
if(network)
|
|
network.update = 1
|
|
return 1
|
|
|
|
// Housekeeping and pipe network stuff below
|
|
network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference)
|
|
if(reference == node)
|
|
network = new_network
|
|
|
|
if(new_network.normal_members.Find(src))
|
|
return 0
|
|
|
|
new_network.normal_members += src
|
|
|
|
return null
|
|
|
|
Del()
|
|
loc = null
|
|
|
|
if(connected_device)
|
|
connected_device.disconnect()
|
|
|
|
if(node)
|
|
node.disconnect(src)
|
|
del(network)
|
|
|
|
node = null
|
|
|
|
..()
|
|
|
|
initialize()
|
|
if(node) return
|
|
|
|
var/node_connect = dir
|
|
|
|
for(var/obj/machinery/atmospherics/target in get_step(src,node_connect))
|
|
if(target.initialize_directions & get_dir(target,src))
|
|
node = target
|
|
break
|
|
|
|
update_icon()
|
|
|
|
build_network()
|
|
if(!network && node)
|
|
network = new /datum/pipe_network()
|
|
network.normal_members += src
|
|
network.build_network(node, src)
|
|
|
|
|
|
return_network(obj/machinery/atmospherics/reference)
|
|
build_network()
|
|
|
|
if(reference==node)
|
|
return network
|
|
|
|
if(reference==connected_device)
|
|
return network
|
|
|
|
return null
|
|
|
|
reassign_network(datum/pipe_network/old_network, datum/pipe_network/new_network)
|
|
if(network == old_network)
|
|
network = new_network
|
|
|
|
return 1
|
|
|
|
return_network_air(datum/pipe_network/reference)
|
|
var/list/results = list()
|
|
|
|
if(connected_device)
|
|
results += connected_device.air_contents
|
|
|
|
return results
|
|
|
|
disconnect(obj/machinery/atmospherics/reference)
|
|
if(reference==node)
|
|
del(network)
|
|
node = null
|
|
|
|
return null
|
|
|
|
|
|
attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
|
|
if (!istype(W, /obj/item/weapon/wrench))
|
|
return ..()
|
|
if (connected_device)
|
|
user << "\red You cannot unwrench this [src], dettach [connected_device] first."
|
|
return 1
|
|
if (locate(/obj/machinery/portable_atmospherics, src.loc))
|
|
return 1
|
|
var/turf/T = src.loc
|
|
if (level==1 && isturf(T) && T.intact)
|
|
user << "\red You must remove the plating first."
|
|
return 1
|
|
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 << "\red You cannot unwrench this [src], it too exerted due to internal pressure."
|
|
add_fingerprint(user)
|
|
return 1
|
|
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
|
|
user << "\blue You begin to unfasten \the [src]..."
|
|
if (do_after(user, 40))
|
|
user.visible_message( \
|
|
"[user] unfastens \the [src].", \
|
|
"\blue You have unfastened \the [src].", \
|
|
"You hear ratchet.")
|
|
new /obj/item/pipe(loc, make_from=src)
|
|
del(src)
|