|
25 | 25 | ) |
26 | 26 |
|
27 | 27 | var/volume = 10000 //in liters |
28 | | - var/gas_type = 0 |
| 28 | + var/gas_type = null |
29 | 29 |
|
30 | 30 | /obj/machinery/atmospherics/components/unary/tank/Initialize(mapload) |
31 | 31 | . = ..() |
|
39 | 39 |
|
40 | 40 | /obj/machinery/atmospherics/components/unary/tank/attackby(obj/item/I, mob/user, params) |
41 | 41 | var/datum/gas_mixture/air_contents = airs[1] |
42 | | - default_deconstruction_screwdriver(user, icon_state, icon_state, I) |
43 | | - if(panel_open || air_contents.total_moles() < 1000) |
| 42 | + if(default_deconstruction_screwdriver(user, icon_state, icon_state, I)) |
| 43 | + change_pipe_connection(!anchored) |
| 44 | + return |
| 45 | + if(panel_open) |
44 | 46 | if(default_unfasten_wrench(user, I, 10)) |
45 | | - change_pipe_connection(!anchored) |
| 47 | + dump_gas() |
46 | 48 | return |
47 | 49 | else |
48 | 50 | to_chat(user, span_warning("[panel_open? "Too much gas inside, make sure it's below 1000 moles!" : "Open the panel first!"]")) |
49 | 51 | return |
50 | 52 | return ..() |
51 | 53 |
|
52 | 54 | /obj/machinery/atmospherics/components/unary/tank/attackby_secondary(obj/item/I, mob/user, params) |
53 | | - if(!anchored) |
| 55 | + if(panel_open) |
54 | 56 | if(default_change_direction_wrench(user, I)) |
55 | 57 | return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN |
56 | 58 | else |
57 | 59 | return SECONDARY_ATTACK_CALL_NORMAL |
58 | 60 |
|
| 61 | +/obj/machinery/atmospherics/components/unary/tank/proc/dump_gas() |
| 62 | + var/datum/gas_mixture/contents = airs[1] |
| 63 | + var/datum/pipeline/pipe = parents[1] |
| 64 | + for(var/gas_id in contents.get_gases()) |
| 65 | + var/gas_removed = contents.get_moles(gas_id) |
| 66 | + contents.adjust_moles(gas_id, -gas_removed) |
| 67 | + pipe.air.adjust_moles(gas_id, gas_removed) |
| 68 | + |
59 | 69 | /obj/machinery/atmospherics/components/unary/tank/default_change_direction_wrench(mob/user, obj/item/I) |
60 | 70 | if(!..()) |
61 | 71 | return FALSE |
|
0 commit comments