/vg/ Multitool menu port!

With 100% better squashing.

I hope.
This commit is contained in:
PJB3005
2015-05-14 22:34:02 +02:00
parent d62b3d3d77
commit 257e77c400
33 changed files with 2626 additions and 163 deletions

View File

@@ -5,13 +5,15 @@
//node2 is output port
//node1 is input port
req_one_access_txt = "24;10"
name = "Dual Port Air Vent"
desc = "Has a valve and pump attached to it. There are two ports."
level = 1
connect_types = list(1,2,3) //connects to regular, supply and scrubbers pipes
connect_types = list(1,2,3) //connects to regular, supply and scrubbers pipes
var/on = 0
var/pump_direction = 1 //0 = siphoning, 1 = releasing
@@ -19,17 +21,49 @@
var/input_pressure_min = 0
var/output_pressure_max = 0
var/frequency = 0
var/id = null
var/frequency = 1439
var/id_tag = null
var/datum/radio_frequency/radio_connection
var/advcontrol = 0//does this device listen to the AAC
settagwhitelist = list("id_tag")
var/pressure_checks = 1
//1: Do not pass external_pressure_bound
//2: Do not pass input_pressure_min
//4: Do not pass output_pressure_max
/obj/machinery/atmospherics/binary/volume_pump/update_underlays()
if(..())
underlays.Cut()
var/turf/T = get_turf(src)
if(!istype(T))
return
add_underlay(T, node1, turn(dir, -180))
add_underlay(T, node2, dir)
/obj/machinery/atmospherics/binary/dp_vent_pump/multitool_menu(var/mob/user,var/obj/item/device/multitool/P)
return {"
<ul>
<li><b>Frequency:</b> <a href="?src=\ref[src];set_freq=-1">[format_frequency(frequency)] GHz</a> (<a href="?src=\ref[src];set_freq=[1439]">Reset</a>)</li>
<li><b>ID Tag:</b> <a href="?src=\ref[src];set_id=1">[id_tag]</a></li>
<li><b>AAC Acces:</b> <a href="?src=\ref[src];toggleadvcontrol=1">[advcontrol ? "Allowed" : "Blocked"]</a></li>
</ul>
"}
/obj/machinery/atmospherics/binary/dp_vent_pump/multitool_topic(var/mob/user, var/list/href_list, var/obj/O)
. = ..()
if(.)
return .
if("toggleadvcontrol" in href_list)
advcontrol = !advcontrol
return MT_UPDATE
/obj/machinery/atmospherics/binary/dp_vent_pump/New()
..()
if (!id_tag)
assign_uid()
id_tag = num2text(uid)
icon = null
/obj/machinery/atmospherics/binary/dp_vent_pump/high_volume
@@ -45,7 +79,7 @@
return
overlays.Cut()
var/vent_icon = "vent"
var/turf/T = get_turf(src)
@@ -54,7 +88,7 @@
if(T.intact && node1 && node2 && node1.level == 1 && node2.level == 1 && istype(node1, /obj/machinery/atmospherics/pipe) && istype(node2, /obj/machinery/atmospherics/pipe))
vent_icon += "h"
if(!powered())
vent_icon += "off"
else
@@ -150,7 +184,7 @@
signal.source = src
signal.data = list(
"tag" = id,
"tag" = id_tag,
"device" = "ADVP",
"power" = on,
"direction" = pump_direction?("release"):("siphon"),
@@ -170,7 +204,7 @@
set_frequency(frequency)
/obj/machinery/atmospherics/binary/dp_vent_pump/receive_signal(datum/signal/signal)
if(!signal.data["tag"] || (signal.data["tag"] != id) || (signal.data["sigtype"]!="command"))
if(!signal.data["tag"] || (signal.data["tag"] != id_tag) || (signal.data["sigtype"]!="command") || (signal.data["advcontrol"] && !advcontrol))
return 0
if(signal.data["power"])
on = text2num(signal.data["power"])
@@ -188,7 +222,7 @@
pressure_checks &= ~1
pump_direction = 0
if(signal.data["stabalize"])
if(signal.data["stabilize"])//the fact that this was "stabalize" shows how many fucks people give about these wonders, none
pressure_checks |= 1
pump_direction = 1
@@ -220,4 +254,54 @@
spawn(2)
broadcast_status()
update_icon()
update_icon()
/obj/machinery/atmospherics/binary/dp_vent_pump/attackby(var/obj/item/W as obj, var/mob/user as mob)
/*
if(istype(W, /obj/item/weapon/weldingtool))
var/obj/item/weapon/weldingtool/WT = W
if (WT.remove_fuel(0,user))
user << "\blue Now welding the vent."
if(do_after(user, 20))
if(!src || !WT.isOn()) return
playsound(get_turf(src), 'sound/items/Welder2.ogg', 50, 1)
if(!welded)
user.visible_message("[user] welds the vent shut.", "You weld the vent shut.", "You hear welding.")
welded = 1
update_icon()
else
user.visible_message("[user] unwelds the vent.", "You unweld the vent.", "You hear welding.")
welded = 0
update_icon()
else
user << "\blue The welding tool needs to be on to start this task."
else
user << "\blue You need more welding fuel to complete this task."
return 1*/
if(istype(W, /obj/item/device/multitool))
update_multitool_menu(user)
return 1
if (!istype(W, /obj/item/weapon/wrench))
return ..()
if (!(stat & NOPOWER) && on)
user << "\red You cannot unwrench this [src], turn it off first."
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(get_turf(src), '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)