Mechs now can be connected to atmos ports (#30551)
* Mechs now can be connected to atmos ports * Using internal_tank instead of dead code. * Apply Cyberboss's advises Corrected stupid typos * Broke connection if external powers move mech Remove forgotten comment * get_turf(src)
This commit is contained in:
committed by
CitadelStationBot
parent
8ee6fdb76a
commit
2812a72cca
@@ -451,6 +451,9 @@
|
||||
. = ..()
|
||||
if(.)
|
||||
events.fireEvent("onMove",get_turf(src))
|
||||
if (internal_tank.disconnect()) // Something moved us and broke connection
|
||||
occupant_message("<span class='warning'>Air port connection teared off!</span>")
|
||||
log_message("Lost connection to gas port.")
|
||||
|
||||
/obj/mecha/Process_Spacemove(var/movement_dir = 0)
|
||||
. = ..()
|
||||
@@ -474,7 +477,7 @@
|
||||
user.forceMove(get_turf(src))
|
||||
to_chat(user, "<span class='notice'>You climb out from [src].</span>")
|
||||
return 0
|
||||
if(connected_port)
|
||||
if(internal_tank.connected_port)
|
||||
if(world.time - last_message > 20)
|
||||
occupant_message("<span class='warning'>Unable to move while connected to the air system port!</span>")
|
||||
last_message = world.time
|
||||
@@ -763,40 +766,12 @@
|
||||
. = t_air.return_pressure()
|
||||
return
|
||||
|
||||
|
||||
/obj/mecha/proc/return_temperature()
|
||||
var/datum/gas_mixture/t_air = return_air()
|
||||
if(t_air)
|
||||
. = t_air.return_temperature()
|
||||
return
|
||||
|
||||
/obj/mecha/proc/connect(obj/machinery/atmospherics/components/unary/portables_connector/new_port)
|
||||
//Make sure not already connected to something else
|
||||
if(connected_port || !new_port || new_port.connected_device)
|
||||
return 0
|
||||
|
||||
//Make sure are close enough for a valid connection
|
||||
if(new_port.loc != loc)
|
||||
return 0
|
||||
|
||||
//Perform the connection
|
||||
connected_port = new_port
|
||||
connected_port.connected_device = src
|
||||
var/datum/pipeline/connected_port_parent = connected_port.PARENT1
|
||||
connected_port_parent.reconcile_air()
|
||||
|
||||
log_message("Connected to gas port.")
|
||||
return 1
|
||||
|
||||
/obj/mecha/proc/disconnect()
|
||||
if(!connected_port)
|
||||
return 0
|
||||
|
||||
connected_port.connected_device = null
|
||||
connected_port = null
|
||||
log_message("Disconnected from gas port.")
|
||||
return 1
|
||||
|
||||
/obj/mecha/portableConnectorReturnAir()
|
||||
return internal_tank.return_air()
|
||||
|
||||
|
||||
@@ -115,6 +115,7 @@
|
||||
<div class='links'>
|
||||
<a href='?src=\ref[src];toggle_id_upload=1'><span id='t_id_upload'>[add_req_access?"L":"Unl"]ock ID upload panel</span></a><br>
|
||||
<a href='?src=\ref[src];toggle_maint_access=1'><span id='t_maint_access'>[maint_access?"Forbid":"Permit"] maintenance protocols</span></a><br>
|
||||
<a href='?src=\ref[src];toggle_port_connection=1'><span id='t_port_connection'>[internal_tank.connected_port?"Disconnect from":"Connect to"] gas port</span></a><br>
|
||||
<a href='?src=\ref[src];dna_lock=1'>DNA-lock</a><br>
|
||||
<a href='?src=\ref[src];view_log=1'>View internal log</a><br>
|
||||
<a href='?src=\ref[src];change_name=1'>Change exosuit name</a><br>
|
||||
@@ -306,6 +307,24 @@
|
||||
maint_access = !maint_access
|
||||
send_byjax(src.occupant,"exosuit.browser","t_maint_access","[maint_access?"Forbid":"Permit"] maintenance protocols")
|
||||
|
||||
if (href_list["toggle_port_connection"])
|
||||
if(internal_tank.connected_port)
|
||||
if(internal_tank.disconnect())
|
||||
occupant_message("Disconnected from the air system port.")
|
||||
log_message("Disconnected from gas port.")
|
||||
else
|
||||
occupant_message("<span class='warning'>Unable to disconnect from the air system port!</span>")
|
||||
return
|
||||
else
|
||||
var/obj/machinery/atmospherics/components/unary/portables_connector/possible_port = locate() in loc
|
||||
if(internal_tank.connect(possible_port))
|
||||
occupant_message("Connected to the air system port.")
|
||||
log_message("Connected to gas port.")
|
||||
else
|
||||
occupant_message("<span class='warning'>Unable to connect with air system port!</span>")
|
||||
return
|
||||
send_byjax(occupant,"exosuit.browser","t_port_connection","[internal_tank.connected_port?"Disconnect from":"Connect to"] gas port")
|
||||
|
||||
if(href_list["dna_lock"])
|
||||
if(occupant && !iscarbon(occupant))
|
||||
to_chat(occupant, "<span class='danger'> You do not have any DNA!</span>")
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
return 0
|
||||
|
||||
//Make sure are close enough for a valid connection
|
||||
if(new_port.loc != loc)
|
||||
if(new_port.loc != get_turf(src))
|
||||
return 0
|
||||
|
||||
//Perform the connection
|
||||
|
||||
Reference in New Issue
Block a user